xzw 4 月之前
父節點
當前提交
2f353b240b
共有 3 個文件被更改,包括 76 次插入20 次删除
  1. 67 15
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 8 4
      src/sdk/cover/index.js

+ 67 - 15
public/lib/potree/potree.js

@@ -20459,9 +20459,11 @@
 	    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 	    super();
 	    var map = new Texture();
-	    map.generateMipmaps = true;
-	    map.minFilter = LinearMipmapLinearFilter;
-	    map.magFilter = NearestFilter; //放大后可以很清晰
+	    /* map.generateMipmaps = true
+	    map.minFilter = THREE.LinearMipmapLinearFilter  */ //这个比LinearFilter平滑所以模糊点
+	    map.minFilter = LinearFilter; //缩小效果都不好,sizeInfo尽量放大些(但要跟看到的差不多宽),用框选工具测出像素宽度大于map.image.width即可
+	    map.magFilter = NearestFilter; //试过 当可见宽度稍大于和贴图宽度时,放大后可以很清晰。可见宽度太大有锯齿。
+	    //width2d一般设置为200
 
 	    this.sprite = new Sprite$2(Object.assign({
 	      root: this
@@ -24791,7 +24793,9 @@
 	                model.rotation.y = parseFloat(prop.raw.orientation);
 	              }
 	              if (prop.is4dkkModel) {
-	                console.warn('遇到is4dkkModel的且有经纬度的mesh,但不是3dtiles! 位置估计不准', model);
+	                console.warn('遇到is4dkkModel的且有经纬度的mesh,但不是3dtiles!看看位置准不准', model);
+	                //4dkk应该是可以对的上的。但如果是3dtiles非4dkk的,目前没办法对准,cesium是可以
+
 	                //看见的场景说是市场不会带rtk的。所以我们这边标品也没存rtk的坐标信息。和产品聊了,不处理。意思就是,只有激光场景开启了rtk的rtkLocation才有值
 	                /* if(model.panos?.length){//只能通过漫游点经纬度来校准 
 	                    //但这时候panos还没加载。。。。
@@ -34264,7 +34268,19 @@
 	        //this.flying = false
 	        this.cancelFlyToPano(toPano);
 	        this.updateClosestPano(this.closestPano, false); //飞行结束后取消点击漫游点时得到的closestPano
-	      } else {}
+	      } else {
+	        if (toPano.retryUntilArrive) {
+	          //一直试直到可以飞成功
+	          var retry = e => {
+	            //重飞
+	            if (e.makeIt) {
+	              this.removeEventListener('flyToPanoDone', retry);
+	              this.flyToPano(toPano);
+	            }
+	          };
+	          this.addEventListener('flyToPanoDone', retry);
+	        }
+	      }
 	      this.dispatchEvent({
 	        type: 'flyToPanoDone',
 	        makeIt,
@@ -34274,24 +34290,24 @@
 	      toPano.deferred && toPano.deferred.resolve(makeIt); //测量线截图时发现,resolve需要写在flying=false 后才行。
 	    };
 	    if (!toPano.pano.enabled) return done(false, true);
-	    //Potree.Log('hope flyToPano: '+toPano.pano.id, toPano.pano.position.toArray() )
-
+	    Potree.Log('hope flyToPano: ' + toPano.pano.id /* , toPano.pano.position.toArray()  */);
 	    if (!toPano.canCancelLast && this.latestToPano && this.latestToPano != toPano && (
 	    //还在飞
 	    this.latestToPano.pano != this.currentPano || !this.isAtPano())) {
 	      //如果旧的toPano只在pano旋转镜头,就直接取消旧的,继续执行 
+	      console.log('还在飞', this.latestToPano.pano.id);
 	      return done(false);
 	    }
 	    if (this.currentPano == toPano.pano && this.isAtPano() && !toPano.target && !toPano.quaternion) {
 	      //已在该pano
+	      console.log('已在该pano', this.currentPano.id);
 	      this.dispatchEvent({
 	        type: 'flyToPano',
 	        toPano
 	      });
 	      return done(true);
 	    }
-	    //Potree.Log('flyToPano: '+toPano.pano.id, toPano.pano.position.toArray()  /* this.latestToPano && this.latestToPano.pano.id */ )
-
+	    Potree.Log('flyToPano: ' + toPano.pano.id /*, toPano.pano.position.toArray()  this.latestToPano && this.latestToPano.pano.id */);
 	    var target = toPano.target;
 	    var config = Potree.config.displayMode[Potree.settings.displayMode];
 	    var pano = toPano.pano;
@@ -61509,7 +61525,9 @@
 	    //注:onMesh时在非平地上拖拽,热点旋转会一直变 
 	    this.position.copy(info.position);
 	    this.normal.copy(info.normal);
+	    var root = this.root;
 	    this.root = info.root;
+	    root != this.root && this.updateMatrixWorld(); //防止拖动到另一个scale不同的模型上时sprite会缩放闪烁
 	    this.setNorQua();
 	    this.updatePose();
 	    this.dispatchEvent('posChanged');
@@ -79476,12 +79494,13 @@
 	    var currentPlay;
 	    var emitIndex = function emitIndex() {
 	      var indexInAni = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+	      //更新当前飞到的index
 	      var ani = sections[currentPlay];
 	      var currentIndex = 0;
 	      if (ani instanceof CameraAnimation$1) {
 	        currentIndex = ani.originIndexStart + indexInAni;
 	      } else {
-	        currentIndex = Math.max(0, data.points.indexOf(ani) - 1);
+	        currentIndex = Math.max(0, data.points.indexOf(ani) /* - 1 */); //因为是开始飞,还没飞到所以-1
 	      }
 	      event_.dispatchEvent({
 	        type: 'updateCurrentIndex',
@@ -79497,9 +79516,9 @@
 	          if (index == sections.length) {
 	            return event_.dispatchEvent('playDone');
 	          }
+	          console.log('playNext', index);
 	          var ani = sections[index];
 	          currentPlay = index;
-	          emitIndex();
 	          if (ani instanceof CameraAnimation$1) {
 	            Potree.settings.displayMode = 'showPointCloud';
 	            ani.addEventListener('playDone', () => {
@@ -79528,17 +79547,20 @@
 	              quaternion,
 	              duration,
 	              callback: () => {
+	                emitIndex();
 	                var next = () => {
 	                  var stayTime = (!sections[index - 1] || sections[index - 1] instanceof CameraAnimation$1) && sections[index + 1] && sections[index + 1] instanceof CameraAnimation$1 ? 1000 : 300; //前后都是点云模式的话停留久一点。最好在页面上能设置
-	                  console.log('stayTime', stayTime);
+	                  //console.log('stayTime',stayTime)
 	                  setTimeout(() => {
 	                    currentPlay != void 0 && playNext(index + 1);
 	                  }, stayTime); //稍作停留,不然点云-全景-点云的话根本看不到全景
 	                };
 	                if ( /* ani.displayMode == 'showPanos' &&  */Potree.settings.displayMode != 'showPanos') {
 	                  //刚加载完就飞走吗?
+
 	                  Potree.settings.displayMode = 'showPanos';
 	                  viewer.images360.addEventListener('endChangeMode', () => {
+	                    console.log(2);
 	                    next();
 	                  }, {
 	                    once: true
@@ -79547,11 +79569,13 @@
 	                  next();
 	                }
 	                //
-	              }
+	              },
+	              retryUntilArrive: true
 	            });
 	          }
 	        };
 	        playNext(0);
+	        emitIndex(); //0
 	      },
 	      stop() {
 	        var ani = sections[currentPlay];
@@ -82687,6 +82711,28 @@
 	    for (var [model, keys] of this.clipKeys) {
 	      if (_loop(keys)) continue;
 	    }
+	    viewer.objs.children.forEach(obj => {
+	      var _obj$actions;
+	      if (!((_obj$actions = obj.actions) !== null && _obj$actions !== void 0 && _obj$actions.length)) return;
+	      var clipState = obj.actions.map(action => {
+	        var played = action._mixer._isActiveAction(action);
+	        var paused = action.paused;
+	        var time = action.time;
+	        var weight = action.weight;
+	        return {
+	          played,
+	          paused,
+	          time,
+	          weight
+	        };
+	      });
+	      clipState = JSON.stringify(clipState);
+	      if (obj.clipState != clipState) {
+	        //动作是否改变
+	        obj.traverse(e => e.isSkinnedMesh && (e.boundingSphere = null)); //动画会导致bound改变,清空,raycast时重新计算bound,否则hover不到模型
+	      }
+	      obj.clipState = clipState;
+	    });
 	    {
 	      if (this.camFollowObject && !viewer.scene.monitors.some(e => e.isWatching)) {
 	        //in front of model 
@@ -84920,7 +84966,8 @@
 	        //if(distance < minRadius) minRadius = distance * 0.5 //融合页面当focus一个很小的物体时,需要将minRadius也调小
 	        this.minRadius = Math.min(standartMinRadius, distance * 0.5);
 	        this.maxRadius = Math.max(this.maxRadius, distance);
-	        console.log('focusOnObject radius ', viewer.mainViewport.view.radius);
+
+	        //console.log('focusOnObject radius ',  viewer.mainViewport.view.radius) 
 	      }
 	    });
 	  }
@@ -84994,7 +85041,7 @@
 	    var _viewer$inputHandler$2, _viewer$inputHandler$3;
 	    if (type == 'startPan') {
 	      var _viewer$inputHandler$;
-	      //以drag的point为target, 使drag跟手
+	      //以drag的point为target, 使drag跟手.     (如果scroll地面的时候也能改radius就好了,但是在朝模型scroll时容易误触地板导致radius突然增大)
 	      var I = (_viewer$inputHandler$ = viewer.inputHandler.intersect) === null || _viewer$inputHandler$ === void 0 ? void 0 : _viewer$inputHandler$.location;
 	      if (!I) {
 	        var {
@@ -92509,6 +92556,9 @@
 	          //获取在scale为1时,表现出的大小
 	          boundingBox.union(boundingBox_.clone().applyMatrix4(child.matrixWorld)); //但感觉如果最外层object大小不为1,要还原下scale再乘
 
+	          if (child instanceof SkinnedMesh) {
+	            child.boundingBox = null; //delete 动画会导致bound改变, raycast干脆不用boundingBox了,否则之后要实时重计算 
+	          }
 	          var changeMat = oldMat => {
 	            var mat = oldMat;
 	            if (fileInfo_.unlit && !(oldMat instanceof MeshBasicMaterial) /* || object.fileType == 'glb' */) {
@@ -92691,6 +92741,8 @@
 	          model.mixer = mixer;
 	        }
 	        model.gltf = gltf;
+	        //model.traverse(e=>e.frustumCulled = false)  为什么有的动画模型离近了会消失,173ver的不会
+
 	        loadDone(model);
 	      }, onProgress, onError);
 	    } else if (fileInfo.fileType == 'ply') {

文件差異過大導致無法顯示
+ 1 - 1
public/lib/potree/potree.js.map


+ 8 - 4
src/sdk/cover/index.js

@@ -841,7 +841,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
         
         changeMapTile(urls){
             //'http:/a.xxx.com/{x}/{y}/{z}.png'
-            console.log('changeMapTile',urls) 
+            console.log('changeMapTile', urls ) 
             
             mapProps = urls.map(e=>{
                 return {
@@ -878,7 +878,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
 
         enterSceneGuide(pathArr) {//导览  (不需要修改参数)
             let editor = viewer.modules.CamAniEditor
-            console.log('pathArr', pathArr)
+            //console.log('pathArr', pathArr)
 
           
 
@@ -907,11 +907,13 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
 
             //播放完成
             ani.event_.addEventListener('playDone', () => {
-                bus.emit('playComplete')
+                console.log('playComplete' )
+                bus.emit('playComplete') 
                 viewer.images360.panos.forEach(e=>e.marker && Potree.Utils.updateVisible(e, 'playAni', true))
             })
             //切换点
             ani.event_.addEventListener('updateCurrentIndex', e => {
+                console.log('updateCurrentIndex',e.currentIndex + 1)
                 bus.emit('changePoint', e.currentIndex + 1)
             })
 
@@ -1185,7 +1187,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     }
                 },
                 changeSelect(state) {
-                    console.error('changeSelect', model?.name, state)
+                    //console.error('changeSelect', model?.name, state)
                     if (model) {  
                         let focus = !(viewer.images360.currentPano?.pointcloud == model && viewer.images360.isAtPano()) //viewer.images360.latestRequestMode != 'showPanos' //防止因走到漫游点后我发送panoModelChange后执行这个又飞了
                         MergeEditor.selectModel(model, state, focus, true)
@@ -2432,6 +2434,8 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 return deferred.promise()
                  
             }
+        }else{
+            buildMapFromProp()
         }
         updateMap()