Browse Source

fix: 不用basicMaterial

xzw 1 year ago
parent
commit
e6aa742eff
2 changed files with 433 additions and 43 deletions
  1. 432 42
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map

+ 432 - 42
public/lib/potree/potree.js

@@ -73865,7 +73865,7 @@ void main()
 
 
 
-	Utils.loadSkybox = function(path, oldSky ) {
+	Utils.loadSkybox = function(path, oldSky, callback ) {
 	    let  camera, scene, parent , cameraOrtho;
 	    if(!oldSky){
 	        parent = new Object3D("skybox_root");
@@ -73918,7 +73918,8 @@ void main()
 	        texture.flipY = false; 
 	        texture.magFilter = LinearFilter;
 	        texture.minFilter = LinearFilter;
-	        scene.children[0].material.uniforms.tDiffuse.value = texture;  
+	        scene.children[0].material.uniforms.tDiffuse.value = texture; 
+	        callback && callback();
 	        viewer.dispatchEvent('content_changed');
 	    },null,(e)=>{//error
 	        console.error('loadSkybox失败',path); 
@@ -77023,11 +77024,11 @@ void main()
 	                loadDone(object);
 	            };
 	            
-	             
+	              
 	            let info = { 
 	                fileType: prop.type, 
 	                id: prop.id,
-	                unlit:true,
+	                //unlit:true,
 	                url : prop.url,
 	                name : prop.title,
 	                /* transform : { 
@@ -77074,7 +77075,43 @@ void main()
 	                
 	            },callback,onprogress);
 	        
+	        }else if(prop.type == 'shp'){ 
+	            viewer.loadModel({  
+	                fileType: 'shp', 
+	                id: prop.id,
+	                name : prop.title, 
+	                url:prop.url,
+	                
+	            },callback,onprogress);
+	  
+	          
+	            //shpModel.position.set(-330000, 900000,10)//尽量移动到原点。原位置在江门那
+	            
+	             
+	         
+	           
+	            
+	 
+	        
+	        }else if(prop.type == '3dgs'){ 
+	        
+	            let callback = (object)=>{ 
+	                object.isModel = true; 
+	                
+	                loadDone(object);
+	            }; 
+	            viewer.loadModel({  
+	                fileType: '3dgs', 
+	                id: prop.id,
+	                name : prop.title, 
+	                url:prop.url,
+	                
+	            },callback,onprogress);
+	        
+	            
+	             
 	            
+	             
 	        }else {  
 	            
 	             //else if(prop.type == 'las' || prop.type == 'ply' || prop.type == 'laz' ) 
@@ -77702,7 +77739,10 @@ void main()
 	    pickFrontPointRatio:config$1.pickFrontPointRatio, //默认pick点云时选中靠近镜头的点的偏向
 	    dragPolyBeyondPoint: browser.urlHasValue('dragPolyBeyondPoint'),  //ctrlPolygon是否可以拖拽到没点云的地方
 	    panoZoomByPointer: false,//全景图是否定点缩放
-	    areaAtNotPlane: false
+	    areaAtNotPlane: false,
+	    
+	    
+	    fastTran: isTest
 	};
 
 
@@ -81699,7 +81739,7 @@ void main()
             uniform float modelAlpha;
             uniform float opacity;
             uniform float progress;
-            uniform int blackout;
+            uniform int tranType;
             uniform vec3 pano0Position;
             uniform vec3 pano1Position;
             uniform float maxDistance;
@@ -81787,16 +81827,18 @@ void main()
             {
                 vec3 vWorldPosition0N = normalize(vWorldPosition0);
                 vec3 vWorldPosition1N = normalize(vWorldPosition1);
-               
+                float progress_ = progress;
                 
                 vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);
                 #if defined(usePanoMap0)
                     //即progress < 1.0   通常是1
                     colorFromPano0=textureCube(pano0Map,vWorldPosition0N.xyz);
+                #else 
+                    progress_ = 1.0;
                 #endif
                 vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1N.xyz);
  
-                gl_FragColor = mix(colorFromPano0,colorFromPano1,progress);
+                gl_FragColor = mix(colorFromPano0,colorFromPano1,progress_);
               
               
                 
@@ -81819,7 +81861,7 @@ void main()
                     vec2 depth1 = getDepth(vWorldPosition1N, depthMap1, cameraHeight1, ceilHeight1, eyePos);
                     
                     
-                    gl_FragDepthEXT = mix(depth0.y,depth1.y,progress); 
+                    gl_FragDepthEXT = mix(depth0.y,depth1.y,progress_); 
                     gl_FragDepthEXT = clamp(gl_FragDepthEXT, 0.0, 1.0);    //防止部分手机出现黑块。ios 16  。 因为我给的超远值超出范围
                     
 
@@ -81888,7 +81930,7 @@ void main()
 	                return progress
 	            },
 	            set: e => {
-	                if (e < 1) {
+	                if (e < 1 && !Potree.settings.fastTran ) {
 	                    if (!('usePanoMap0' in this.defines)) {
 	                        this.defines.usePanoMap0 = '';
 	                        this.needsUpdate = true;
@@ -81985,6 +82027,268 @@ void main()
 	    } */
 	}
 
+	class FastTranPass {
+	    
+	    constructor(renderer){
+	       
+	        
+	        this.renderer = renderer;
+	        
+	        this.coverRenderTarget = new WebGLRenderTarget( 100, 100, { 
+	            minFilter: LinearFilter, magFilter: LinearFilter,
+	            format: RGBAFormat 
+	        });
+	        
+	        this.coverTex = this.coverRenderTarget.texture; 
+	        
+	        this.enabled = false;
+	        
+	        
+	        /* this.oldClearColor = new THREE.Color();
+	        this.oldClearAlpha = 1;
+
+	        this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
+	        this.scene = new THREE.Scene(); */
+
+
+	        this.material = this.getMaskMaterial();
+	         /* var copyShader = THREE.CopyShader;
+	        this.materialCopy = new THREE.ShaderMaterial( {
+	            uniforms: this.copyUniforms,
+	            vertexShader: copyShader.vertexShader,
+	            fragmentShader: copyShader.fragmentShader,
+	            blending: THREE.NoBlending,
+	            depthTest: false,
+	            depthWrite: false,
+	            transparent: true
+	        } );
+
+
+	        this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), this.material);
+	        this.quad.frustumCulled = false; // Avoid getting clipped
+	        this.scene.add( this.quad ); 
+	        
+	        
+	        this.renderToScreen = true*/
+	    }
+	    
+	    setSize( width, height ) {
+	        
+	        this.coverRenderTarget.setSize( width, height );
+	        
+	    } 
+	    
+	    
+	    start(){
+	        this.enabled = true;
+	        
+	        
+	        
+	        let {x,y} = viewer.mainViewport.resolution2;
+	        this.setSize(x,y);
+	        
+	        //draw coverTex
+	        let oldTarget = this.renderer.getRenderTarget();
+	        
+	        
+	        //let oldClearColor = this.renderer.getClearColor()
+	        
+	        
+	        
+	        this.renderer.setRenderTarget(this.coverRenderTarget);
+	        //this.renderer.setClearColor( 0x000000, 0)
+	        let oldLayer = viewer.mainViewport.camera.layers.mask; 
+	        Potree.Utils.setCameraLayers(viewer.mainViewport.camera, ['skybox']);
+	        this.renderer.render( viewer.scene.scene, viewer.mainViewport.camera );
+	        
+	        //this.renderer.setClearColor( 0x000000, 0)
+	        this.renderer.setRenderTarget(oldTarget); 
+	        viewer.mainViewport.camera.layers.mask = oldLayer;
+	        
+	        
+	        this.material.uniforms.progress.value = 1;
+	        console.log('start111');
+	        
+	    } 
+	    
+	    
+	    
+	    render( scene, camera, viewports, renderer, writeBuffer, readBuffer  ) {
+	        /* var oldAutoClear = renderer.autoClear; 
+	        renderer.autoClear = false;
+	         */
+	        
+	        let {x,y} = viewer.mainViewport.resolution2;
+	        var uniforms = this.material.uniforms;
+	        //uniforms.bgTex.value = readBuffer.texture; //更新
+	        uniforms.coverTex.value = this.coverTex; 
+	        
+	        uniforms.progress.value = viewer.images360.cube.material.uniforms.progress.value; 
+	        uniforms.screenRatio.value = x / y; // 使波纹为圆形
+	        uniforms.screenRatio.value *= uniforms.screenRatio.value;
+	        
+	        Potree.Utils.screenPass.render(viewer.renderer, viewer.images360.fastTranMaskPass.material);
+	        
+	        //renderer.autoClear = oldAutoClear;
+	        
+	        
+	    }
+	    
+	    stop(){
+	        this.enabled = false;
+	        console.log('stop111');
+	    }
+	    
+	    getMaskMaterial(){
+	        return new ShaderMaterial( {
+
+	            uniforms: {
+	                coverTex: {
+	                    type: "t",
+	                    value: null
+	                }, 
+	                progress:{
+	                    type: "f",
+	                    value: 0
+	                },
+	                screenRatio:{
+	                    type: "f",
+	                    value: 1
+	                }
+	            },
+
+	            vertexShader: ` 
+                varying vec2 vUv;
+                 
+                void main() 
+                {
+                    vUv = uv;
+                    
+                    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+                } 
+               
+            `,
+	            fragmentShader: ` 
+                uniform sampler2D coverTex; 
+                uniform float progress; 
+                uniform float screenRatio;
+                varying vec2 vUv;
+               
+                void main() {
+                    
+                    const float maxRadius = 0.708;      // sqrt(0.5^2+0.5^2)
+                    const float minRadius = 0.0 ;
+                     
+                    float radius = screenRatio>1.0 ? sqrt((vUv.x - 0.5)*(vUv.x - 0.5) + (vUv.y - 0.5)*(vUv.y - 0.5)/screenRatio) : sqrt((vUv.x - 0.5)*(vUv.x - 0.5)*screenRatio+ (vUv.y - 0.5)*(vUv.y - 0.5));
+                    float diff = 0.292;    //1.0-maxRadius;
+                    float radiusIn = maxRadius * progress + minRadius * (1.0-progress);
+                    float radiusOut = radiusIn + diff;
+                    if(radius < radiusIn) {
+                        
+                        discard;
+                        
+                    }else if(radius>radiusOut){
+                        gl_FragColor = texture2D(coverTex, vUv)  ;
+                        //gl_FragColor = vec4(1.0,1.0,0.0,1.0);//
+                        
+                    }else{
+                        
+                        /* vec4 color1 = texture2D(bgTex, vUv);
+                        vec4 color2 = texture2D(coverTex, vUv);
+                        float rotio = smoothstep(radiusIn ,radiusOut,radius);
+                       
+                        gl_FragColor = mix(color1, color2, rotio); */
+                        
+                        float rotio = smoothstep(radiusIn ,radiusOut, radius);
+                        
+                        vec4 color2 = texture2D(coverTex, vUv);
+                        color2.a = rotio;
+                        
+                        
+                    }
+                }
+             `
+
+	        } );
+	        
+	    }
+	    
+	    /* getMaskMaterial(){
+	        return new THREE.ShaderMaterial( {
+
+	            uniforms: {
+	                coverTex: {
+	                    type: "t",
+	                    value: null
+	                },
+	                bgTex: {
+	                    type: "t",
+	                    value: null
+	                },
+	                progress:{
+	                    type: "f",
+	                    value: 0
+	                },
+	                screenRatio:{
+	                    type: "f",
+	                    value: 1
+	                }
+	            },
+
+	            vertexShader: ` 
+	                varying vec2 vUv;
+	                 
+	                void main() 
+	                {
+	                    vUv = uv;
+	                    
+	                    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+	                } 
+	               
+	            `,
+	            fragmentShader: ` 
+	                uniform sampler2D coverTex;
+	                uniform sampler2D bgTex;
+	                uniform float progress; 
+	                uniform float screenRatio;
+	                varying vec2 vUv;
+	               
+	                void main() {
+	                    
+	                    const float maxRadius = 0.708;      // sqrt(0.5^2+0.5^2)
+	                    const float minRadius = 0.0 ;
+	                     
+	                    float radius = screenRatio>1.0 ? sqrt((vUv.x - 0.5)*(vUv.x - 0.5) + (vUv.y - 0.5)*(vUv.y - 0.5)/screenRatio) : sqrt((vUv.x - 0.5)*(vUv.x - 0.5)*screenRatio+ (vUv.y - 0.5)*(vUv.y - 0.5));
+	                    float diff = 0.292;    //1.0-maxRadius;
+	                    float radiusIn = maxRadius * progress + minRadius * (1.0-progress);
+	                    float radiusOut = radiusIn + diff;
+	                    if(radius < radiusIn) {
+	                        
+	                        gl_FragColor = texture2D(bgTex, vUv);
+	                        //gl_FragColor = vec4(0.0,0.0,1.0,1.0);//
+	                        
+	                    }else if(radius>radiusOut){
+	                        gl_FragColor = texture2D(coverTex, vUv)  ;
+	                        //gl_FragColor = vec4(1.0,1.0,0.0,1.0);//
+	                        
+	                    }else{
+	                        
+	                        vec4 color1 = texture2D(bgTex, vUv);
+	                        vec4 color2 = texture2D(coverTex, vUv);
+	                        float rotio = smoothstep(radiusIn ,radiusOut,radius);
+	                       
+	                        gl_FragColor = mix(color1, color2, rotio);
+	                    }
+	                }
+	             `
+
+	        } );
+	        
+	    } */
+
+	    
+	}
+
 	let GLCubeFaces$1 = Potree.defines.GLCubeFaces;
 
 	var TileUtils = {};
@@ -86501,7 +86805,8 @@ void main()
 	}
 
 	let {PanoSizeClass: PanoSizeClass$3,Vectors: Vectors$1,GLCubeFaces: GLCubeFaces$3, PanoramaEvents: PanoramaEvents$1} = Potree.defines;
-	 
+
+	    
 
 	 
 	var rot90$1 = new Quaternion().setFromAxisAngle(new Vector3(0,0,1),  Math.PI/2 ); //使用的是刚好适合全景图的,给cube贴图需要转90°
@@ -86550,7 +86855,7 @@ void main()
 	        this.node.name = 'ImagesNode';
 	         
 	        this.cubePanos = [];
-	        
+	        this.fastTranMaskPass = new FastTranPass(viewer.renderer);
 	        
 	        {
 	            this.cube = new Mesh(new BoxBufferGeometry(1,1,1,1),new ModelTextureMaterial());
@@ -87176,7 +87481,7 @@ void main()
 	            }
 	           
 	            this.dispatchEvent({type:'flyToPanoDone', makeIt, disturb});
-	             
+	            this.fastTranMaskPass.stop(); 
 	            toPano.deferred && toPano.deferred.resolve(makeIt);  //测量线截图时发现,resolve需要写在flying=false 后才行。
 	        };
 	        
@@ -87259,16 +87564,6 @@ void main()
 	        }  
 	                   
 	        
-	        if(config.transition.showSkybox || config.transition.pointUsePanoTex){
-	             this.setProjectedPanos({
-	                progress:0,
-	                ifSkybox: this.cube.visible,
-	                ifPointcloud : config.transition.pointUsePanoTex,
-	                easeInOutRatio : pointcloudVisi ? 0.3 : 0,
-	                pano0:this.currentPano,
-	                pano1:pano
-	            });  
-	        }
 	        
 	        const endPosition = pano.position.clone(); 
 	        let T = Potree.config.transitionsTime;
@@ -87281,7 +87576,26 @@ void main()
 	        
 	        let maxDis = 7;
 	        let duration = toPano.duration == void 0 ? Math.min(dis, maxDis) * T.flytimeDistanceMultiplier + T.flyMinTime : toPano.duration; 
+	        
+	        
 	         
+	        if(config.transition.showSkybox || config.transition.pointUsePanoTex){
+	            
+	             if(Potree.settings.fastTran ){
+	                this.fastTranMaskPass.start(); //截图当前画面
+	                viewer.scene.view.position.copy(endPosition);
+	             }
+	            
+	            
+	             this.setProjectedPanos({
+	                progress: 0,
+	                ifSkybox: this.cube.visible,
+	                ifPointcloud : config.transition.pointUsePanoTex,
+	                easeInOutRatio : pointcloudVisi ? 0.3 : 0,
+	                pano0:this.currentPano,
+	                pano1:pano
+	            });  
+	        }
 	        
 	        
 	        if(toPano.useBound){
@@ -87359,6 +87673,9 @@ void main()
 	            this.dispatchEvent({type:'flyToPano', toPano});
 	            
 	             
+	            
+	             
+	             
 	            viewer.scene.view.setView({position:endPosition, target, quaternion:toPano.quaternion , duration:toPano.duration,  
 	                onUpdate:(progress_, delta)=>{
 	                    
@@ -104854,10 +105171,17 @@ void main()
 	                    }else {
 	                        viewer.renderer.render(viewer.scene.scene, camera);
 	                    }
-	                    if(Potree.settings.displayMode == 'showPanos' )return
+	                    
 	                }else {
 	                    viewer.renderer.render(viewer.scene.scene, camera);
 	                }     
+	                if(Potree.settings.displayMode == 'showPanos' ){
+	                    if(Potree.settings.fastTran && viewer.images360.fastTranMaskPass.enabled){
+	                        viewer.images360.fastTranMaskPass.render();
+	                    } 
+	                    return
+	                }
+	                 
 	                 
 	            }
 	            
@@ -121046,7 +121370,7 @@ ENDSEC
 	                    
 	                }));
 	                viewer.scene.scene.add(this.groundPlane);
-	                this.groundPlane.position.z = -1;
+	                this.groundPlane.position.z = 0.1;
 	            }else {
 	                this.groundPlane.material.map = map;
 	            }
@@ -134493,8 +134817,10 @@ ENDSEC
 				}
 
 				materialType = this._invokeOne( function ( ext ) {
-	                return BasicMaterial//kmuExtension.getMaterialType(); //xzw 改
-					//return ext.getMaterialType && ext.getMaterialType( materialIndex );
+	                //return BasicMaterial //2024.7放弃使用这个,因为纯色的看上去连成一片
+	                
+	                //kmuExtension.getMaterialType(); //xzw 改
+					return ext.getMaterialType && ext.getMaterialType( materialIndex );
 
 				} );
 
@@ -159500,10 +159826,12 @@ ENDSEC
 	                this.fxaaPass.renderToScreen = true;
 	                
 					this.composer.addPass( this.fxaaPass );  */
-	                //抗锯齿截图 效果时而好时而不好,文字比较模糊
+	                //抗锯齿截图 效果时而好时而不好,文字比较模糊 
+	                //这两个暂时不能一起用。目前刚好不需要一起用
 	                
+	                /* this.images360.fastTranMaskPass = new FastTranPass( this.renderer )
+	                this.composer.addPass(this.images360.fastTranMaskPass)//add */
 	                
-	                //这两个暂时不能一起用。目前刚好不需要一起用
 	                
 	            }
 	            
@@ -159639,7 +159967,8 @@ ENDSEC
 	                mtlLoader : new MTLLoader( manager ),
 	                glbLoader : new GLTFLoader(undefined, this.renderer, Potree.settings.libsUrl ),
 	                plyLoader : new PLYLoader( manager ),
-	                dxfLoader : new DxfLoader() 
+	                dxfLoader : new DxfLoader(),
+	                shapeLoader: new Potree.ShapefileLoader()
 	            }; 
 	            //add test
 	            /* const environment = new RoomEnvironment();
@@ -160682,10 +161011,11 @@ ENDSEC
 
 			if(bg === "skybox"){
 	            if(!src)src = Potree.resourcePath+'/textures/skybox/xingkong.jpg';
-				this.skybox = Utils.loadSkybox(src, this.skybox);
-			} 
-
-			this.background = bg;
+				this.skybox = Utils.loadSkybox(src, this.skybox, ()=>{
+	                this.background = bg;
+	            });
+			}else {  this.background = bg;
+	        }
 	        this.backgroundOpacity = 1;//add
 			this.dispatchEvent({'type': 'background_changed', 'viewer': this});
 		}
@@ -162366,7 +162696,7 @@ ENDSEC
 	                
 	            } 
 	                 
-	             if(Potree.settings.notAdditiveBlending){ // 融合页面才用到
+	            if(Potree.settings.notAdditiveBlending){ // 融合页面才用到
 	                params.renderBeforeCloud = false;
 	                this.renderOverlay1(params); 
 	                this.renderOverlay2(params);  
@@ -162622,7 +162952,9 @@ ENDSEC
 	            viewports = viewports.filter(v=>v.active); 
 	            if(viewports.length > 0){   
 	                params.viewports = viewports;  
-	                if(this.outlinePass.selectedObjects.length && this.outlinePass.edgeStrength > 0 && !params.screenshot){  
+	                if(this.outlinePass.selectedObjects.length && this.outlinePass.edgeStrength > 0 && !params.screenshot 
+	                   // || this.images360.fastTranMaskPass.enabled
+	                ){  
 	                    let scenes = this.inputHandler.interactiveScenes.concat(this.scene.scene).concat(viewer.scene.scenePointCloud); 
 	                    this.composer.render(scenes, null, this.viewports, this.renderDefault.bind(this));  
 	                }else {  
@@ -164331,11 +164663,10 @@ ENDSEC
 	                    //console.log(child.name, 'roughness',child.material.roughness,'metalness',child.material.metalness)
 	                       
 
-	                     //暂时用这种材质:
-	                    if(fileInfo_.unlit && (!(child.material instanceof MeshBasicMaterial) || object.fileType == 'glb')){
+	                     
+	                    if(fileInfo_.unlit && (!(child.material instanceof BasicMaterial) /* || object.fileType == 'glb' */)){ //注释掉是因为已经写入到loader文件里了
 	                        //let material = new THREE.MeshBasicMaterial({map:child.material.map})
-	                        let material = new BasicMaterial({map : child.material.map});  //很奇怪glb的图会使原本的MeshBasicMaterial 会偏暗,所以自己重新写
-	                        
+	                        let material = new BasicMaterial({map : child.material.map, opacity:child.material.opacity, color:child.material.color});  //很奇怪glb的图会使原本的MeshBasicMaterial 会偏暗,所以自己重新写
 	                        //child.material.dispose()
 	                        child.material = material; 
 	                    } 
@@ -164343,9 +164674,10 @@ ENDSEC
 	                        child.material = new MeshStandardMaterial();
 	                    } 
 	                    if(child.material instanceof MeshStandardMaterial){
-	                        child.material.roughness = 0.7;
-	                        child.material.metalness = 0.5; 
+	                        /* child.material.roughness = 0.7
+	                        child.material.metalness = 0.5  */
 	                    }
+	                    //纯色的还是不能用BasicMaterial
 	                } 
 	            } );
 	        }
@@ -164523,8 +164855,66 @@ ENDSEC
 	            loaders.dxfLoader.load(fileInfo.url,(object)=>{
 	                loadDone(object);
 	            },fileInfo); 
+	        }else if(fileInfo.fileType == 'shp'){
+	             
+	            loaders.shapeLoader.transform = viewer.transform.lonlatToLocal;
+	             
+	            const shp = await loaders.shapeLoader.load(fileInfo.url);
+	            const shpModel = shp.node;
+	            
+	            loadDone(shpModel);
+	            
+	        }else if(fileInfo.fileType == '3dgs'){
+	            
+	            const gsViewer = new Potree.GaussianSplats3D.Viewer({ 
+	                rootElement: this.renderArea,
+	                threeScene: this.scene.scene,
+	                renderer: this.renderer,
+	                camera:  this.mainViewport.camera,
+	                useBuiltInControls: false,
+	                //dropInMode: true,
+	                // sharedMemoryForWorkers:false  //否则 报错 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': SharedArrayBuffer transfer requires self.crossOriginIsolated. 
+
+	            });
+	            //let path = Potree.resourcePath+'/models/gaussian/bonsai.ksplat';
+	             
+	            
+	            gsViewer.addSplatScene(fileInfo.url, {
+	                  'streamView': true
+	                })
+	                .then(() => {
+	                    gsViewer.start(); 
+	                    /* gsViewer.splatMesh.rotation.x = -2.365929590263301
+	                    gsViewer.splatMesh.position.z = 5 */
+	                    gsViewer.splatMesh.updateMatrix();
+	                    gsViewer.splatMesh.updateMatrixWorld();
+	                    gsViewer.splatMesh.visible = false;
+	                    //viewer.mainViewport.view.setView({position: new THREE.Vector3(-4.980,  -5.3879,  5.4503095), quaternion:new THREE.Quaternion(0.5750,-0.2809,-0.3372,0.6903)})
+	                
+	                    gsViewer.splatMesh.onSplatTreeReadyCallback = ()=>{ 
+	                        let {sceneMax,sceneMin} = gsViewer.splatMesh.splatTree.subTrees[0];
+	                        gsViewer.splatMesh.boundingBox.min.copy(sceneMin);
+	                        gsViewer.splatMesh.boundingBox.max.copy(sceneMax);
+	                        loadDone(gsViewer.splatMesh);
+	                    }; 
+	                });
+	            
+	        
+	            //window.gsViewer = gsViewer
+	          
+	            viewer.addEventListener('render.begin2',(e)=>{
+	                if(e.name == 'scene'){ //gsViewer.selfDrivenUpdate()
+	                    gsViewer.update();
+	                
+	                    if(gsViewer.initialized && gsViewer.splatRenderReady){
+	                        gsViewer.splatMesh.visible = true;
+	                    } 
+	                }
+	            });
+	        
 	        }
 	        
+	        
 	         
 	    }
 	    

File diff suppressed because it is too large
+ 1 - 1
public/lib/potree/potree.js.map