xzw 2 лет назад
Родитель
Сommit
a93afc6801
3 измененных файлов с 19 добавлено и 11 удалено
  1. 15 7
      src/ExtendPointCloudOctree.js
  2. 1 1
      src/custom/settings.js
  3. 3 3
      src/custom/viewer/ViewerNew.js

+ 15 - 7
src/ExtendPointCloudOctree.js

@@ -96,12 +96,15 @@ export class ExtendPointCloudOctree extends PointCloudOctree{
         
         
         if( this.nodeMaxLevel==0 )return true
-        if(camera.type == "OrthographicCamera"){
-            if(!Potree.Utils.isInsideFrustum(this.pcoGeometry.tightBoundingBox, camera)){
+        if(camera.type == "OrthographicCamera" || this.testMaxNodeCount < 50){
+            if(!Potree.Utils.isInsideFrustum(this.bound, camera)){
                 return true 
             }    
         }else if( !viewer.atDatasets.includes(this))return true //否则老远就count++
+          
+         
         
+         
         let levels = this.visibleNodes.map(e=>e.getLevel())
         let actMaxLevel = Math.max.apply(null, levels) //实际加载到的最高的node level
         if(actMaxLevel <  this.maxLevel)return true// 还没加载到能加载到的最高。  但在细节设置较低时,排除作用微弱。
@@ -125,7 +128,14 @@ export class ExtendPointCloudOctree extends PointCloudOctree{
         this.testMaxNodeCount ++
         viewer.testMaxNodeCount ++
         
-        //console.log('this.testMaxNodeCount', this.testMaxNodeCount)
+        //console.log('testMaxNodeCount', this.dataset_id,  this.testMaxNodeCount, 'nodeMaxLevel', this.nodeMaxLevel )
+        
+        
+        if( this.testMaxNodeCount == Potree.config.testNodeCount1 ){//差不多等当前所在数据集nodeMaxLevel加载出来
+            this.changePointSize()  //重新更新一下大小。因之前用的是nodeMaxLevelPredict (防止刚开始因nodeMaxLevel没涨完,导致过大的点云突然出现
+        }
+
+        
         
         if(this.testMaxNodeCount > 100){
             console.log('testMaxNodeLevel次数超出,强制结束:',this.dataset_id,  this.nodeMaxLevel,  this.nodeMaxLevelPredict.min) 
@@ -136,9 +146,7 @@ export class ExtendPointCloudOctree extends PointCloudOctree{
         
         this.testMaxNodeCount2 ++; // 已经> this.nodeMaxLevelPredict.min 后,开始计数。因为min可能低于真实nodeMaxLevel所以要再试几次
         
-        /* if(this.name == 'SS-t-CWmVgzP4XU'){
-            console.log('SS-t-CWmVgzP4XU count++')
-        } */
+        
         
         if(this.testMaxNodeCount2 < 50)  return  true //再试几次 ( 主要是细节调得低时需要多测几次才加载到
         this.testMaxNodeLevelDone = true
@@ -547,7 +555,7 @@ export class ExtendPointCloudOctree extends PointCloudOctree{
             num_ = Math.pow(num_, 1.05) * 6 
              
             
-            nodeMaxLevel = this.testMaxNodeCount > Potree.config.testNodeCount1 ? this.nodeMaxLevel : this.nodeMaxLevelPredict.max //防止刚开始因nodeMaxLevel没涨完,导致过大的点云突然出现
+            nodeMaxLevel = this.testMaxNodeCount >= Potree.config.testNodeCount1 ? this.nodeMaxLevel : this.nodeMaxLevelPredict.max //防止刚开始因nodeMaxLevel没涨完,导致过大的点云突然出现
             
             if(sizeFitToLevel || Potree.settings.sizeFitToLevel){//按照点云质量来调整的版本:    近似将pointSizeType换成ADAPTIVE
                 let str = this.temp.pointSize+':'+this.maxLevel+':'+ nodeMaxLevel

+ 1 - 1
src/custom/settings.js

@@ -285,7 +285,7 @@ const config = {//配置参数   不可修改
     clickMaxDragDis:5,
     clickMaxPressTime:500, //ms
     doubleClickTime:300,//双击间隔时间
-    testNodeCount1: browser.isMobile() ? 8 : 6,  //testMaxNode次数达到这个数字时,changePointSize才使用nodeMaxLevel。 (调试时比较卡,在线上实际只需要3)
+    testNodeCount1: browser.isMobile() ? 6 : 4,  //testMaxNode次数达到这个数字时,changePointSize才使用nodeMaxLevel。 (调试时比较卡,在线上实际只需要3)
      
     background: '#232323',
     mapBG:/* '#232323',   */  '#F5F5F5',   //地图的clearColor

+ 3 - 3
src/custom/viewer/ViewerNew.js

@@ -1271,9 +1271,9 @@ export class Viewer extends ViewerBase{
                         success = false; 
                     }
                 })
-                if(oldCount<=Potree.config.testNodeCount1  && this.testMaxNodeCount>Potree.config.testNodeCount1 ){//差不多等当前所在数据集nodeMaxLevel加载出来
+                /* if(oldCount<=Potree.config.testNodeCount1  && this.testMaxNodeCount>Potree.config.testNodeCount1 ){//差不多等当前所在数据集nodeMaxLevel加载出来
                     viewer.scene.pointclouds.forEach(e=>{e.changePointSize()}) //重新更新一下大小。因之前用的是nodeMaxLevelPredict (防止刚开始因nodeMaxLevel没涨完,导致过大的点云突然出现
-                } 
+                } */ 
                 if(!success)return true //没有全部加载完,继续循环      
                 else {
                     this.removeEventListener('camera_changed',test)
@@ -3774,7 +3774,7 @@ export class Viewer extends ViewerBase{
             
             if(this.mapViewer/* .attachedToViewer */){ 
                 //console.log('mapFocusOn: '+target.toArray())
-                const minBound = new THREE.Vector2(4,4)//针对垂直线,在地图上只有一个点
+                const minBound = new THREE.Vector2(1,1)//针对垂直线,在地图上只有一个点
                 //原始的bound
                 let boundOri = new THREE.Box3() 
                 object.points.forEach(e=>{