xzw 2 years ago
parent
commit
c866225535
2 changed files with 33 additions and 30 deletions
  1. 32 29
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map

+ 32 - 29
public/lib/potree/potree.js

@@ -79320,8 +79320,7 @@ void main()
 	            let prop = Object.assign({
 	            let prop = Object.assign({
 	                lineWidth: o.lineWidth || 1,
 	                lineWidth: o.lineWidth || 1,
 	                //windows无效。 似乎mac/ios上粗细有效 ? 
 	                //windows无效。 似乎mac/ios上粗细有效 ? 
-	                color: o.color || defaultColor, 
-	                //depthTest : false, 
+	                color: o.color || defaultColor   
 	            },o);
 	            },o);
 	            if(o.deshed ){
 	            if(o.deshed ){
 	                prop.dashSize = o.dashSize || 0.1,
 	                prop.dashSize = o.dashSize || 0.1,
@@ -89189,6 +89188,10 @@ void main()
 	        });
 	        });
 	        
 	        
 	        this.computeCount = 0;
 	        this.computeCount = 0;
+	        this.maxLoading = 3; 
+	        this.loadFailCount = 0;
+	        this.loadingInProgress = 0;
+	        
 	    }
 	    }
 	    
 	    
 	    get zoomLevel(){
 	    get zoomLevel(){
@@ -89240,7 +89243,7 @@ void main()
 	    setEnable(enable){//add
 	    setEnable(enable){//add
 	        if(!this.disabled == enable)return
 	        if(!this.disabled == enable)return
 	        if(enable){
 	        if(enable){
-	            console.log('setEnable',true);
+	            //console.log('setEnable',true)
 	        }
 	        }
 	        this.disabled = !enable;
 	        this.disabled = !enable;
 	     
 	     
@@ -89293,9 +89296,9 @@ void main()
 	        let lonlat = viewer.transform.lonlatToLocal.inverse(viewport.camera.position.clone()); 
 	        let lonlat = viewer.transform.lonlatToLocal.inverse(viewport.camera.position.clone()); 
 	        let cos = Math.cos(MathUtils.degToRad(lonlat.y)); //越小就在纬度上越高,tile表现越小
 	        let cos = Math.cos(MathUtils.degToRad(lonlat.y)); //越小就在纬度上越高,tile表现越小
 	        //为什么lonlat.y会超出90?
 	        //为什么lonlat.y会超出90?
-	        if(lonlat.y>90){
-	            console.log('lonlat.y>90',lonlat.y);
-	        } 
+	        /* if(lonlat.y>90){
+	            console.log('lonlat.y>90',lonlat.y)
+	        }  */
 	        
 	        
 	        cos = MathUtils.clamp(cos, 0,1);
 	        cos = MathUtils.clamp(cos, 0,1);
 	        let lonShift =  Math.abs(viewer.mapViewer.camera.position.x / this.mapSizeM * 16  );  //越大就在经度离中心越远,tile表现越大  。  
 	        let lonShift =  Math.abs(viewer.mapViewer.camera.position.x / this.mapSizeM * 16  );  //越大就在经度离中心越远,tile表现越大  。  
@@ -89392,11 +89395,12 @@ void main()
 
 
 
 
 
 
-	let maxLoading = 3; 
-	let loadFailCount = 0;
+
 	const waitQueue = []; //等待加载的
 	const waitQueue = []; //等待加载的
 	const loadDone = (tile, success)=>{
 	const loadDone = (tile, success)=>{
 	    tile.map.mapLayer.loadingInProgress--;
 	    tile.map.mapLayer.loadingInProgress--;
+	    tile.map.loadingInProgress--;
+	    
 	    tile.loading = false;
 	    tile.loading = false;
 	     
 	     
 	    let next = waitQueue[0];
 	    let next = waitQueue[0];
@@ -89410,14 +89414,14 @@ void main()
 	    tile.mesh && (tile.mesh.material.needsUpdate = true);
 	    tile.mesh && (tile.mesh.material.needsUpdate = true);
 	    
 	    
 	};
 	};
-	let lastTile; 
+	 
 	function addLoadTile(tile){
 	function addLoadTile(tile){
 	    
 	    
-	    if(tile.map.mapLayer.loadingInProgress < maxLoading){
+	    if(tile.map.loadingInProgress < tile.map.maxLoading){
 	        if(!tile.mesh)return;  //有时候会遇到这种情况, 为什么没有被cancelLoad呢?
 	        if(!tile.mesh)return;  //有时候会遇到这种情况, 为什么没有被cancelLoad呢?
 
 
-	        
-	        tile.map.mapLayer.loadingInProgress ++; 
+	        tile.map.mapLayer.loadingInProgress++; 
+	        tile.map.loadingInProgress ++; 
 	        //tile.texURL && tile.texURL.includes('testdata') && console.log('addLoadTile',   tile.texURL.split('map_tiles/')[1] )
 	        //tile.texURL && tile.texURL.includes('testdata') && console.log('addLoadTile',   tile.texURL.split('map_tiles/')[1] )
 	         
 	         
 	        tile.loading = true;
 	        tile.loading = true;
@@ -89433,10 +89437,10 @@ void main()
 	                tile.map.mapLayer.needUpdate = true; //表示还要继续update(以removeChildren)
 	                tile.map.mapLayer.needUpdate = true; //表示还要继续update(以removeChildren)
 	                
 	                
 	                if(tile.map instanceof TiledMapOpenStreetMap){
 	                if(tile.map instanceof TiledMapOpenStreetMap){
-	                    maxLoading = browser.isMobile() ? 5 : 10; 
+	                    tile.map.maxLoading = browser.isMobile() ? 5 : 10; 
 	                } 
 	                } 
 	            }else {
 	            }else {
-	                tile.texURL && tile.texURL.includes('testdata') && console.log('loadDone and dispose',   tile.texURL.split('map_tiles/')[1] );
+	                //tile.texURL && tile.texURL.includes('testdata') && console.log('loadDone and dispose',   tile.texURL.split('map_tiles/')[1] )
 	                tex.dispose();   
 	                tex.dispose();   
 	            } 
 	            } 
 	            loadDone(tile, true);
 	            loadDone(tile, true);
@@ -89448,10 +89452,10 @@ void main()
 	                tile.map.mapLayer.viewer.mapChanged = true; 
 	                tile.map.mapLayer.viewer.mapChanged = true; 
 	            } 
 	            } 
 	            loadDone(tile, false);
 	            loadDone(tile, false);
-	            loadFailCount ++ ;
+	            tile.map.loadFailCount ++ ;
 	            
 	            
-	            if(tile.map instanceof TiledMapOpenStreetMap && Potree.settings.mapCompany == 'google' && loadFailCount > 3){//极有可能没有vpn为了防止影响到其他资源加载,减少加载的个数
-	                maxLoading = 2;
+	            if(tile.map instanceof TiledMapOpenStreetMap && Potree.settings.mapCompany == 'google' && tile.map.loadFailCount > 3){//极有可能没有vpn为了防止影响到其他资源加载,减少加载的个数
+	                tile.map.maxLoading = 2;
 	            }
 	            }
 	            
 	            
 	        }));  
 	        }));  
@@ -89470,12 +89474,9 @@ void main()
 	    
 	    
 	    if(!tile.loading){ 
 	    if(!tile.loading){ 
 	        let index = waitQueue.indexOf(tile);
 	        let index = waitQueue.indexOf(tile);
-	        index > -1 && waitQueue.splice(index,1); 
-	        //if(index == -1) console.error('cancelLoad index == -1', tile.id)
-	            
-	        index > -1 && tile.texURL && tile.texURL.includes('testdata') && console.log('cancelLoad',   tile.texURL.split('map_tiles/')[1]/* ,  (log && waitQueue.indexOf(tile)>-1) ? log:'' ,  tile.loading */ );
-	 
-	        
+	        index > -1 && waitQueue.splice(index,1);   
+	        //index > -1 && tile.texURL && tile.texURL.includes('testdata') && console.log('cancelLoad',   tile.texURL.split('map_tiles/')[1]/* ,  (log && waitQueue.indexOf(tile)>-1) ? log:'' ,  tile.loading */ )
+	  
 	    } 
 	    } 
 	}
 	}
 
 
@@ -98058,13 +98059,15 @@ void main()
 	        };
 	        };
 	        
 	        
 	        if(!toPano.pano.enabled)return done(false,true);
 	        if(!toPano.pano.enabled)return done(false,true);
-	        //Potree.Log('hope flyToPano: '+toPano.pano.id )
+	        //Potree.Log('hope flyToPano: '+toPano.pano.id, toPano.pano.position.toArray() )
 	        
 	        
 	        
 	        
 	        if(this.latestToPano && this.latestToPano != toPano && this.latestToPano.pano != this.currentPano){//还在飞//如果旧的toPano只是旋转镜头,就直接取消旧的
 	        if(this.latestToPano && this.latestToPano != toPano && this.latestToPano.pano != this.currentPano){//还在飞//如果旧的toPano只是旋转镜头,就直接取消旧的
 	            return done(false) 
 	            return done(false) 
 	        }
 	        }
-	        //Potree.Log('flyToPano: '+toPano.pano.id,  this.latestToPano && this.latestToPano.pano.id )
+	         
+	        //Potree.Log('flyToPano: '+toPano.pano.id, toPano.pano.position.toArray()  /* this.latestToPano && this.latestToPano.pano.id */ )
+	          
 	        if(this.currentPano == toPano.pano && this.isAtPano() && !toPano.target && !toPano.quaternion  ){
 	        if(this.currentPano == toPano.pano && this.isAtPano() && !toPano.target && !toPano.quaternion  ){
 	            this.dispatchEvent({type:'flyToPano', toPano});
 	            this.dispatchEvent({type:'flyToPano', toPano});
 	            return done(true);
 	            return done(true);
@@ -119708,7 +119711,7 @@ ENDSEC
 	            } */
 	            } */
 	            
 	            
 	            {//连接时的辅助线
 	            {//连接时的辅助线
-	                this.linkGuideLine = LineDraw.createLine([], {color:'#aaa', deshed:true, dashSize:0.1,gapSize:0.1,});
+	                this.linkGuideLine = LineDraw.createLine([], {color:'#ddd', deshed:true, dashSize:0.1,gapSize:0.05, depthTest:false});
 	                this.linkGuideLine.visible = false;
 	                this.linkGuideLine.visible = false;
 	                this.linkGuideLine.name = 'linkGuideLine';
 	                this.linkGuideLine.name = 'linkGuideLine';
 	                viewer.scene.scene.add(this.linkGuideLine);
 	                viewer.scene.scene.add(this.linkGuideLine);
@@ -119721,7 +119724,7 @@ ENDSEC
 	                    if(this.activeViewName == 'top' ){
 	                    if(this.activeViewName == 'top' ){
 	                        endPos = e.intersect.orthoIntersect.clone().setZ(this.selectedPano.position.z);
 	                        endPos = e.intersect.orthoIntersect.clone().setZ(this.selectedPano.position.z);
 	                    }else if(this.activeViewName == 'mainView' ){
 	                    }else if(this.activeViewName == 'mainView' ){
-	                        if(!e.intersect.point)return
+	                        if(!e.intersect || !e.intersect.point)return
 	                        endPos = e.intersect.point.position;
 	                        endPos = e.intersect.point.position;
 	                    }
 	                    }
 	                    
 	                    
@@ -120625,7 +120628,7 @@ ENDSEC
 	            }
 	            }
 	             
 	             
 	            
 	            
-	            {//自动切换楼层
+	            if(this.currentFloor != 'all'){//如果原本不是展示全部楼层的话,自动切换楼层
 	               
 	               
 	                let atFloor = SiteModel$1.entities.find(e=>e.buildType == 'floor' && e.panos.includes(pano));
 	                let atFloor = SiteModel$1.entities.find(e=>e.buildType == 'floor' && e.panos.includes(pano));
 	                if(!atFloor){
 	                if(!atFloor){
@@ -155048,7 +155051,7 @@ ENDSEC
 	                options: {
 	                options: {
 	                    //dracoDecoderPath: '../utils/loaders/DRACOLoader/draco',
 	                    //dracoDecoderPath: '../utils/loaders/DRACOLoader/draco',
 	                    //basisTranscoderPath: '../utils/loaders/KTX2Loader/basis',
 	                    //basisTranscoderPath: '../utils/loaders/KTX2Loader/basis',
-	                    maximumScreenSpaceError: 50,
+	                    maximumScreenSpaceError: 30,  //如果本身tiles很密很小这个值就不能很大。
 	                    maxDepth: 100, 
 	                    maxDepth: 100, 
 	                    maximumMemoryUsage: 700, //缓存大小。 若太小,密集的tile反复加载很卡
 	                    maximumMemoryUsage: 700, //缓存大小。 若太小,密集的tile反复加载很卡
 	                    //debug:true,
 	                    //debug:true,

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