xzw 2 gadi atpakaļ
vecāks
revīzija
0cf1cf82d6

+ 18 - 22
src/custom/modules/panos/Images360.js

@@ -122,10 +122,7 @@ export class Images360 extends THREE.EventDispatcher{
         
         
         this.depthSampler = new DepthImageSampler(); 
-        this.addEventListener('loadedDepthImg',(e)=>{
-            e.loaded && this.updateDepthTex(e.pano)
-        })
-        
+ 
         
         
  
@@ -299,6 +296,7 @@ export class Images360 extends THREE.EventDispatcher{
                                 if(this.panos.length == 0)return
                                 //this.modeChanging = true //主要是因为到全景图不会立刻成功
                                 let wait = (e)=>{
+                                    console.log('flyToPanoDone')
                                     this.removeEventListener('flyToPanoDone',wait) 
                                     setTimeout(()=>{
                                         if(this.latestRequestMode == mode ){
@@ -331,21 +329,19 @@ export class Images360 extends THREE.EventDispatcher{
                         
                             
                         if(config2.showSkybox || config2.pointUsePanoTex){ 
-                            let wait = (e)=> {
-                                if(e.pano && e.pano != this.currentPano)return//loadedDepthImg
+                            let wait = ( )=> { 
+                                console.log('waitdone')
+                                //if(e.pano && e.pano != this.currentPano)return  //loadedDepthImg
                                 setTimeout( ()=>{
                                     if(this.latestRequestMode == mode ){
                                         Potree.settings.displayMode = mode 
                                     }
-                                },1)
-                                this.removeEventListener('loadedDepthImg', wait)
+                                },1) 
                             }
-                            if(!this.currentPano.depthTex && this.currentPano.pointcloud.hasDepthTex){
-                                this.addEventListener('loadedDepthImg', wait)           
-                                return this.currentPano.loadDepthImg()
-                            } 
+                            
                             //this.updateDepthTex()  
                             if(this.checkAndWaitForPanoLoad(this.currentPano,  this.basePanoSize, wait)){
+                                console.log('等待贴图加载2', this.currentPano.id)
                                 return
                             }  
                         } 
@@ -636,7 +632,7 @@ export class Images360 extends THREE.EventDispatcher{
 
 	cancelFlyToPano(toPano){//取消当前已有的飞行准备,前提是相机还未移动 
         if(viewer.mainViewport.view.isFlying() || toPano && this.latestToPano != toPano)return
-        //Potree.Log('cancelFlyToPano', this.latestToPano && this.latestToPano.pano.id)
+         Potree.Log('cancelFlyToPano', this.latestToPano && this.latestToPano.pano.id)
         this.nextPano = null 
         this.latestToPano = null 
     }
@@ -665,7 +661,7 @@ export class Images360 extends THREE.EventDispatcher{
         }
         
         if(!toPano.pano.enabled)return done(false,true);
-        //Potree.Log('hope flyToPano: '+toPano.pano.id )
+         Potree.Log('hope flyToPano: '+toPano.pano.id )
         
         
         if(this.latestToPano && this.latestToPano != toPano && this.latestToPano.pano != this.currentPano){//还在飞//如果旧的toPano只是旋转镜头,就直接取消旧的
@@ -694,17 +690,18 @@ export class Images360 extends THREE.EventDispatcher{
         {//不飞的话是否不要执行这段?
             
             let wait = (e)=> {
-                if(e.pano && this.latestToPano && e.pano != this.latestToPano.pano)return//loadedDepthImg
-                if(this.latestToPano != toPano)return /* Potree.Log('已经取消') *///如果取消了
+                console.log('wait done', pano.id)
+                if(/* e.pano &&  */this.latestToPano && pano != this.latestToPano.pano)return//loadedDepthImg
+                if(this.latestToPano != toPano)return   Potree.Log('已经取消', pano.id)  //如果取消了
                 setTimeout(()=>{ 
                     if(this.latestToPano != toPano)return
                     this.flyToPano(toPano) 
                 },1)
-                this.removeEventListener('loadedDepthImg', wait)
+                 
             }
             if(!pano.depthTex && pano.pointcloud.hasDepthTex){ //点云模式也要加载depthTex,因获取neighbour需要用到
-                //console.log('等待加载depthtex')
-                this.addEventListener('loadedDepthImg', wait)           
+                 console.log('等待加载depthtex', pano.id)
+                pano.addEventListener('loadedDepthImg', wait, {once:true})           
                 return pano.loadDepthImg()
             }
             
@@ -714,10 +711,9 @@ export class Images360 extends THREE.EventDispatcher{
                     toPano.useBound = true
                 }
                 
-                /* let wait2 = (e)=>{
-                    setTimeout(wait.bind(this,e),400 ) 
-                } */
+              
                 if(this.checkAndWaitForPanoLoad(pano, toPano.basePanoSize || this.basePanoSize,  wait )){
+                    console.log('等待贴图加载',pano.id)
                     return
                 }  
             } 

+ 3 - 2
src/custom/modules/panos/Panorama.js

@@ -255,13 +255,14 @@ class Panorama extends THREE.EventDispatcher{
         //console.log('开始下载depthImg', this.id)
         let texture = texLoader.load( src, ()=>{
             this.depthTex = texture
-            this.images360.dispatchEvent({type:'loadedDepthImg', pano:this, loaded:true})
+            this.dispatchEvent({type:'loadedDepthImg',  loaded:true})
             this.depthTexLoading = false
+            this.images360.updateDepthTex(this)
             //viewer.dispatchEvent('content_changed') 
         },null,(e)=>{//error
             console.error('loadDepthImg失败, 数据集sceneCode'+ this.pointcloud.sceneCode,  this.id )
             this.pointcloud.hasDepthTex = false
-            this.images360.dispatchEvent({type:'loadedDepthImg', pano:this, })
+            this.dispatchEvent({type:'loadedDepthImg' })
         });
         texture.wrapS = THREE.RepeatWrapping;
         texture.flipY = false 

+ 1 - 1
src/custom/potree.shim.js

@@ -1385,7 +1385,7 @@ Potree.updateVisibility = function(pointclouds, camera, areaSize){
 				  
                 
                 let addPow = viewer.mainViewport.view.isFlying() ? 0 : 0.5  //0-0.5,正常原本是0. 数字越大近处加载越快。但会造成远处加载慢甚至因pointBudge限制不加载。  isFlying:漫游时需要尽量加载一下远处的点云
-                addPow *= window.devicePixelRatio    //devicePixelRatio高的手机需要优先加载最近的高级点云,减少远处的中高级点云。
+                //addPow *= window.devicePixelRatio    //devicePixelRatio高的手机需要优先加载最近的高级点云,减少远处的中高级点云。
 				let distance = Math.pow(dd,0.5+addPow)//Math.sqrt(dd); //提高距离权重,为了提高近处加载速度。   某些场景近处加载慢优化明显,如SS-t-cqCAL6rJ5i 
 				
 				//let attenuateDis = 10;//add

+ 1 - 1
src/viewer/EDLRendererNew.js

@@ -197,7 +197,7 @@ export class EDLRenderer{//Eye-Dome Lighting 眼罩照明
         
         let target = params.target || null
         
-		const resolution = rtEDL ? new THREE.Vector2(rtEDL.width,rtEDL.height) : params.viewport ? params.viewport.resolution : this.viewer.renderer.getSize(new THREE.Vector2());//突然发现mobile用resolution2点云会放大
+		const resolution = rtEDL ? new THREE.Vector2(rtEDL.width,rtEDL.height) : params.viewport ? params.viewport.resolution2 : this.viewer.renderer.getSize(new THREE.Vector2());