|
@@ -120967,9 +120967,9 @@ ENDSEC
|
|
|
},
|
|
|
|
|
|
|
|
|
- setGroundPlaneImg(src,scale){//设置地面图
|
|
|
+ setGroundPlaneImg(src,scale,angle){//设置地面图
|
|
|
|
|
|
- this.goundScale = scale;
|
|
|
+ this.goundScale = scale || 1, this.goundAngle = angle || 0;
|
|
|
let oldSrc = this.curGroundImgSrc;
|
|
|
this.curGroundImgSrc = src;
|
|
|
const ratio = 0.04;
|
|
@@ -120981,14 +120981,15 @@ ENDSEC
|
|
|
let {width, height} = this.groundPlane.material.map.image;
|
|
|
this.groundPlane.scale.set(width*s, height*s);
|
|
|
viewer.dispatchEvent('content_changed');
|
|
|
-
|
|
|
+ this.groundPlane.rotation.z = MathUtils.degToRad(this.goundAngle);
|
|
|
return
|
|
|
}
|
|
|
|
|
|
let map = texLoader$a.load(src,(tex)=>{
|
|
|
if(this.curGroundImgSrc == src){
|
|
|
const s = ratio * this.goundScale;
|
|
|
- this.groundPlane.scale.set(tex.image.width*s, tex.image.height*s);
|
|
|
+ this.groundPlane.scale.set(tex.image.width*s, tex.image.height*s);
|
|
|
+ this.groundPlane.rotation.z = MathUtils.degToRad(this.goundAngle);
|
|
|
viewer.dispatchEvent('content_changed');
|
|
|
}
|
|
|
});
|
|
@@ -135673,9 +135674,14 @@ ENDSEC
|
|
|
function getGpuMemoryUsage(win = window){//总的
|
|
|
let c = 0;
|
|
|
viewer.objs.children.filter(e=>{
|
|
|
- if(e.fileType == '3dTiles'){
|
|
|
- let tileset3D = e.runtime.getTileset();
|
|
|
- c += tileset3D.gpuMemoryUsageInBytes;
|
|
|
+ if(e.fileType == '3dTiles'){
|
|
|
+ e.traverse(child=>{
|
|
|
+ if(child.runtime){
|
|
|
+ let tileset3D = child.runtime.getTileset();
|
|
|
+ c += tileset3D.gpuMemoryUsageInBytes;
|
|
|
+ return {stopContinue:true}
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -163864,11 +163870,17 @@ ENDSEC
|
|
|
this.update(deltaTime, timestamp);
|
|
|
this.magnifier.render();
|
|
|
this.render();
|
|
|
-
|
|
|
+
|
|
|
|
|
|
this.objs.children.forEach(e=>{
|
|
|
if(e.fileType == '3dTiles'){
|
|
|
- e.runtime.update(deltaTime, this.renderer, this.mainViewport.camera);
|
|
|
+ e.traverse(child=>{
|
|
|
+ if(child.runtime){
|
|
|
+ child.runtime.update(deltaTime, this.renderer, this.mainViewport.camera);
|
|
|
+ return {stopContinue:true}
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -164176,55 +164188,75 @@ ENDSEC
|
|
|
|
|
|
|
|
|
if(fileInfo_.fileType == '3dTiles'){
|
|
|
- let tileset = object.runtime.getTileset();
|
|
|
-
|
|
|
- //TileHeader: tileset.root
|
|
|
- //参见另一个工程 TileRenderer.js preprocessNode //这个坐标位置几万…… let data = boundingVolume.halfAxes //但这个似乎是premultiply( transform );过后的,可能需还原下
|
|
|
+ let isGroup = !object.runtime;
|
|
|
+ let children = object.runtime ? [object] : object.children;
|
|
|
|
|
|
- let json = tileset.tileset;
|
|
|
- let box = json.root.boundingVolume.box;
|
|
|
-
|
|
|
- if(box){
|
|
|
- let center = new Vector3(box[0],box[1],box[2]);
|
|
|
- let boundSize = new Vector3( );
|
|
|
-
|
|
|
- // get the extents of the bounds in each axis
|
|
|
- let vecX = new Vector3( box[ 3 ], box[ 4 ], box[ 5 ] );
|
|
|
- let vecY = new Vector3( box[ 6 ], box[ 7 ], box[ 8 ] );
|
|
|
- let vecZ = new Vector3( box[ 9 ], box[ 10 ], box[ 11 ] );
|
|
|
-
|
|
|
- const scaleX = vecX.length();
|
|
|
- const scaleY = vecY.length();
|
|
|
- const scaleZ = vecZ.length();
|
|
|
- /* boundingBox.expandByPoint(center);
|
|
|
- boundingBox.expandByVector(new THREE.Vector3(scaleX,scaleY,scaleZ)) */
|
|
|
-
|
|
|
+
|
|
|
+ children.forEach(object =>{
|
|
|
+ let boundingBox_ = new Box3();
|
|
|
+
|
|
|
|
|
|
- boundingBox.min.set( - scaleX, - scaleY, - scaleZ );
|
|
|
- boundingBox.max.set( scaleX, scaleY, scaleZ );
|
|
|
+ let tileset = object.runtime.getTileset();
|
|
|
+
|
|
|
+ //TileHeader: tileset.root
|
|
|
+ //参见另一个工程 TileRenderer.js preprocessNode //这个坐标位置几万…… let data = boundingVolume.halfAxes //但这个似乎是premultiply( transform );过后的,可能需还原下
|
|
|
|
|
|
- }else if(json.root.boundingVolume.sphere){
|
|
|
- let sphereData = json.root.boundingVolume.sphere;
|
|
|
- let center = new Vector3(...sphereData);
|
|
|
- let radius = sphereData[3] / 2;
|
|
|
- /* let sphere = new THREE.Sphere(center, radius)
|
|
|
- let box = sphere.getBoundingBox()
|
|
|
- boundingBox.copy(box) */
|
|
|
+ let json = tileset.tileset;
|
|
|
+ let box = json.root.boundingVolume.box;
|
|
|
|
|
|
- boundingBox.min.set( - radius, - radius, - radius );
|
|
|
- boundingBox.max.set( radius, radius, radius );
|
|
|
+ if(box){
|
|
|
+ let center = new Vector3(box[0],box[1],box[2]);
|
|
|
+ let boundSize = new Vector3( );
|
|
|
+
|
|
|
+ // get the extents of the bounds in each axis
|
|
|
+ let vecX = new Vector3( box[ 3 ], box[ 4 ], box[ 5 ] );
|
|
|
+ let vecY = new Vector3( box[ 6 ], box[ 7 ], box[ 8 ] );
|
|
|
+ let vecZ = new Vector3( box[ 9 ], box[ 10 ], box[ 11 ] );
|
|
|
+
|
|
|
+ const scaleX = vecX.length();
|
|
|
+ const scaleY = vecY.length();
|
|
|
+ const scaleZ = vecZ.length();
|
|
|
+
|
|
|
+ boundingBox_.min.set( - scaleX, - scaleY, - scaleZ );
|
|
|
+ boundingBox_.max.set( scaleX, scaleY, scaleZ );
|
|
|
+
|
|
|
+ if(isGroup){//如果是多个拼成的,每个都保留原先在parent中的offset。 如果是外层,作为独立个体,不用理会位置信息,直接放中央。
|
|
|
+ object.position.copy(center);
|
|
|
+ object.position.z *= -1;
|
|
|
+ boundingBox_.translate(object.position); //由于是内层,其位移会改变整体的boundingbox
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if(json.root.boundingVolume.sphere){
|
|
|
+ let sphereData = json.root.boundingVolume.sphere;
|
|
|
+ let center = new Vector3(...sphereData);
|
|
|
+ let radius = sphereData[3] / 2;
|
|
|
+ /* let sphere = new THREE.Sphere(center, radius)
|
|
|
+ let box = sphere.getBoundingBox()
|
|
|
+ boundingBox.copy(box) */
|
|
|
+
|
|
|
+ boundingBox_.min.set( - radius, - radius, - radius );
|
|
|
+ boundingBox_.max.set( radius, radius, radius );
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }else {
|
|
|
+ return console.error('json boundingVolume 缺少信息')
|
|
|
+ }
|
|
|
|
|
|
+ //中心点居然没用。可能是漏用了什么信息,也许这和LVBADUI_qp是散的有关。
|
|
|
+ console.log('3d tiles json',json);
|
|
|
|
|
|
+ json.root.refine = 'ADD';
|
|
|
+ json.refine = 'ADD';
|
|
|
+
|
|
|
|
|
|
- }else {
|
|
|
- return console.error('json boundingVolume 缺少信息')
|
|
|
- }
|
|
|
+ boundingBox.union(boundingBox_);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- //中心点居然没用。可能是漏用了什么信息,也许这和LVBADUI_qp是散的有关。
|
|
|
- console.log('3d tiles json',json);
|
|
|
|
|
|
- json.root.refine = 'ADD';
|
|
|
- json.refine = 'ADD';
|
|
|
}else {
|
|
|
Potree.Utils.setObjectLayers(object, Potree.settings.showObjectsOnMap ? 'bothMapAndScene' : 'model');
|
|
|
|
|
@@ -164392,7 +164424,7 @@ ENDSEC
|
|
|
maximumScreenSpaceError: fileInfo.maximumScreenSpaceError || 80, //越小越清晰。 如果本身tiles很密很小这个值就不能很大。
|
|
|
//maxDepth: 100,
|
|
|
maximumMemoryUsage: 200, //缓存大小。单位M(但实际结果是 2.5*maximumMemoryUsage + 750 。超过2G会崩, 所以应该小于540) 若太小,密集的tile反复加载很卡. (任务管理器刷新网页后若内存不掉就要结束进程否则虚高)
|
|
|
- //debug:true, //show box
|
|
|
+ debug:false, //show box
|
|
|
parent: this.scene.scene,
|
|
|
is4dkk: fileInfo.is4dkk,//是否是4dkk中的模型. 通常maximumScreenSpaceError需要10
|
|
|
updateTime: fileInfo.updateTime, //加后缀防止缓存
|
|
@@ -164411,7 +164443,7 @@ ENDSEC
|
|
|
}
|
|
|
});
|
|
|
tileset.addEventListener('tileLoaded',(e)=>{ //每一个tile加载完要更改透明度
|
|
|
- let opacity = result.model.opacity;
|
|
|
+ let opacity = result.model.parent == this.objs ? result.model.opacity : result.model.parent.opacity;//最多两层
|
|
|
MergeEditor.changeOpacity(e.tileContent,opacity);
|
|
|
//set Layers ?
|
|
|
});
|