|
@@ -135673,9 +135673,14 @@ ENDSEC
|
|
function getGpuMemoryUsage(win = window){//总的
|
|
function getGpuMemoryUsage(win = window){//总的
|
|
let c = 0;
|
|
let c = 0;
|
|
viewer.objs.children.filter(e=>{
|
|
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 +163869,17 @@ ENDSEC
|
|
this.update(deltaTime, timestamp);
|
|
this.update(deltaTime, timestamp);
|
|
this.magnifier.render();
|
|
this.magnifier.render();
|
|
this.render();
|
|
this.render();
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
this.objs.children.forEach(e=>{
|
|
this.objs.children.forEach(e=>{
|
|
if(e.fileType == '3dTiles'){
|
|
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 +164187,71 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
if(fileInfo_.fileType == '3dTiles'){
|
|
if(fileInfo_.fileType == '3dTiles'){
|
|
- let tileset = object.runtime.getTileset();
|
|
|
|
-
|
|
|
|
- //TileHeader: tileset.root
|
|
|
|
- //参见另一个工程 TileRenderer.js preprocessNode //这个坐标位置几万…… let data = boundingVolume.halfAxes //但这个似乎是premultiply( transform );过后的,可能需还原下
|
|
|
|
|
|
+ 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.expandByPoint(center);
|
|
|
|
+ boundingBox.expandByVector(new THREE.Vector3(scaleX,scaleY,scaleZ)) */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ boundingBox_.min.set( - scaleX, - scaleY, - scaleZ );
|
|
|
|
+ boundingBox_.max.set( scaleX, scaleY, scaleZ );
|
|
|
|
+
|
|
|
|
+ }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 {
|
|
}else {
|
|
Potree.Utils.setObjectLayers(object, Potree.settings.showObjectsOnMap ? 'bothMapAndScene' : 'model');
|
|
Potree.Utils.setObjectLayers(object, Potree.settings.showObjectsOnMap ? 'bothMapAndScene' : 'model');
|
|
|
|
|
|
@@ -164411,7 +164438,7 @@ ENDSEC
|
|
}
|
|
}
|
|
});
|
|
});
|
|
tileset.addEventListener('tileLoaded',(e)=>{ //每一个tile加载完要更改透明度
|
|
tileset.addEventListener('tileLoaded',(e)=>{ //每一个tile加载完要更改透明度
|
|
- let opacity = result.model.opacity;
|
|
|
|
|
|
+ let opacity = result.model.parent ? result.model.parent.opacity : result.model.opacity; //最多两层
|
|
MergeEditor.changeOpacity(e.tileContent,opacity);
|
|
MergeEditor.changeOpacity(e.tileContent,opacity);
|
|
//set Layers ?
|
|
//set Layers ?
|
|
});
|
|
});
|