Browse Source

fix: 多楼层多个glb数组

xzw 10 months ago
parent
commit
464548e2d6
3 changed files with 12 additions and 8 deletions
  1. 9 5
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 2 2
      src/sdk/cover/index.js

+ 9 - 5
public/lib/potree/potree.js

@@ -26898,7 +26898,7 @@
 	    this.marker.position.copy(this.floorPosition);
 	    this.marker.lookAt(position); //融合页面marker可能跟随模型倾斜
 
-	    var upVec = new Vector3().subVectors(position, floorPosition).normalize().multiplyScalar(0.04);
+	    var upVec = new Vector3().subVectors(position, floorPosition).normalize().multiplyScalar(0.04 * this.pointcloud.scale.x);
 	    this.marker.position.add(upVec); //this.marker.position.z+=0.04//会被点云遮住
 
 	    if (this.label) {
@@ -30090,6 +30090,8 @@
 	    var uv = math.getUVfromDir(dirInPano); //转化为uv
 
 	    var distance = this.getDepth(uv.x, uv.y, useNeighIfZero);
+	    distance *= currentPano.pointcloud.scale.x;
+
 	    //viewer.addTimeMark(markName,'end')
 
 	    if (!distance) {
@@ -30723,7 +30725,7 @@
 	  findNearestPano(pos) {
 	    var panos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.panos;
 	    pos = pos ? new Vector3().copy(pos) : this.position;
-	    var result = Common.sortByScore(panos, [Images360.filters.isEnabled()], [e => -e.position.distanceTo(pos)]);
+	    var result = Common.sortByScore(panos, [Images360.filters.isEnabled()], [e => -e.position.distanceTo(pos) / e.pointcloud.scale.x]);
 	    var pano = result[0] && result[0].item;
 	    return pano;
 	  }
@@ -31499,7 +31501,7 @@
 	  bump(direction) {
 	    //撞墙弹回效果
 	    if (!this.bumping && !this.latestToPano) {
-	      var distance = Potree.settings.displayMode == 'showPanos' ? 0.15 : 0.12; //感觉点云模式比全景模式更明显,所以降低
+	      var distance = (Potree.settings.displayMode == 'showPanos' ? 0.15 : 0.12) * this.currentPano.pointcloud.scale.x; //感觉点云模式比全景模式更明显,所以降低
 	      var currentPos = this.position.clone();
 	      var endPosition = new Vector3().addVectors(this.position, direction.clone().multiplyScalar(distance));
 	      var duration = 150;
@@ -31624,9 +31626,10 @@
 	        return 0;
 	      }
 	    };
+	    var scaleFactor = Math.pow(this.currentPano.pointcloud.scale.x, 2);
 	    var disSquareMap = new Map();
 	    this.panos.forEach(pano => {
-	      var dis2 = pano.position.distanceToSquared(this.position); //距离目标点
+	      var dis2 = pano.position.distanceToSquared(this.position) / scaleFactor; //距离目标点
 	      disSquareMap.set(pano, dis2);
 	    });
 	    var changeTexCount = 0,
@@ -36074,6 +36077,7 @@
 	  // 设置点大小
 	  changePointSize(num, sizeFitToLevel) {
 	    var size, nodeMaxLevel;
+	    console.error('changePointSize', num);
 	    var dontRender = viewer.dealBeforeRender;
 	    if (this.material.pointSizeType != PointSizeType.ATTENUATED) {
 	      num && (size = num / Potree.config.material.realPointSize / 1.3);
@@ -36085,7 +36089,7 @@
 	        this.temp.pointSize = num_;
 	      }
 	      num_ = num_ / (Potree.config.material.realPointSize / Potree.config.material.pointSize); //兼容 
-
+	      num_ *= this.scale.x; //for mergeEditor   
 	      //num_ = Math.pow(num_, 1.05) * 5 
 
 	      nodeMaxLevel = this.testMaxNodeCount >= Potree.config.testNodeCount1 ? this.nodeMaxLevel : Math.max(this.nodeMaxLevel, this.nodeMaxLevelPredict.max); //防止刚开始因nodeMaxLevel没涨完,导致过大的点云突然出现

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


+ 2 - 2
src/sdk/cover/index.js

@@ -347,7 +347,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
             pos = pos ? new THREE.Vector3().copy(pos) : viewer.images360.position
 
             let pano = viewer.images360.findNearestPano(pos)
-            if (pano && pano.position.distanceTo(pos) < Potree.config.panoFieldRadius) {
+            if (pano && pano.position.distanceTo(pos) < Potree.config.panoFieldRadius * pano.pointcloud.scale.x) {
                 return {model:pano.pointcloud.result_}
             }
             //poschange后会调用这个,如果返回false会变为点云模式,且不会自动变回原先的模式
@@ -896,7 +896,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes }) => {
                         //MergeEditor.history.beforeChange(model)//但不知道什么时候结束拖拽
 
                         model.scale.set(s, s, s)
-                        model.isPointcloud && model.changePointSize(Potree.config.material.realPointSize * s)
+                        model.isPointcloud && model.changePointSize(/* Potree.config.material.realPointSize * s */)
 
                         model.dispatchEvent("scale_changed")