Prechádzať zdrojové kódy

Merge branch 'v1.2.0-ga' of http://192.168.0.115:3000/bill/fuse-code into v1.2.0-ga

bill 4 mesiacov pred
rodič
commit
b5e7be8496

+ 170 - 64
public/lib/potree/potree.js

@@ -8562,7 +8562,8 @@
 	WebGLRenderer.prototype.paramThreeToGL = function (e) {
 	  var t,
 	    i = this.extensions,
-	    r = this.getContext(); //context;
+	    r = this.getContext();
+	  //context;
 	  if (e === RepeatWrapping) return r.REPEAT;
 	  if (e === ClampToEdgeWrapping) return r.CLAMP_TO_EDGE;
 	  if (e === MirroredRepeatWrapping) return r.MIRRORED_REPEAT;
@@ -8633,15 +8634,16 @@
 	    listeners[type] = [];
 	  }
 	  /* if(type == 'flyingDone'){
-	      console.log('addEventListener flyingDone')
-	  } */
+	          console.log('addEventListener flyingDone')
+	      } */
 	  if (!listeners[type].some(e => e.listener == listener)) {
 	    listeners[type].push({
 	      listener,
 	      importance,
 	      once
 	    });
-	    listeners[type] = listeners[type].sort((e, a) => a.importance - e.importance); //add
+	    listeners[type] = listeners[type].sort((e, a) => a.importance - e.importance);
+	    //add
 	  }
 	};
 	EventDispatcher.prototype.hasEventListener = function (type, listener) {
@@ -8655,9 +8657,9 @@
 	  var listenerArray = listeners[type];
 	  if (listenerArray !== undefined) {
 	    /* const index = listenerArray.indexOf( listener );
-	    		if ( index !== - 1 ) {
-	    			listenerArray.splice( index, 1 );
-	    		} */
+	    if ( index !== - 1 ) {
+	    listenerArray.splice( index, 1 );
+	    } */
 
 	    var item = listenerArray.find(e => e.listener == listener);
 	    item && listenerArray.splice(listenerArray.indexOf(item), 1);
@@ -8694,7 +8696,8 @@
 	      if (once) {
 	        this.removeEventListener(event.type, listener);
 	      }
-	      var result = listener.call(this, event); //add stopContinue
+	      var result = listener.call(this, event);
+	      //add stopContinue
 
 	      if (result && result.stopContinue) {
 	        break;
@@ -8733,7 +8736,8 @@
 	  return euler;
 	};
 	Object3D.prototype.traverse = function (callback, lastResult) {
-	  var result = callback(this, lastResult); //lastResult一般用于收集祖先的visible
+	  var result = callback(this, lastResult);
+	  //lastResult一般用于收集祖先的visible
 	  if (result && result.stopContinue) {
 	    //xzw add
 	    return;
@@ -8752,7 +8756,8 @@
 	  updateMatrixWorld(force) {
 	    //重写,只为了将root当做parent
 
-	    this.scale.set(1 / this.root.scale.x, 1 / this.root.scale.y, 1 / this.root.scale.z); //中和模型缩放。无论模型缩放如何都不能改tag大小
+	    this.scale.set(1 / this.root.scale.x, 1 / this.root.scale.y, 1 / this.root.scale.z);
+	    //中和模型缩放。无论模型缩放如何都不能改tag大小
 
 	    this.updateMatrix();
 	    this.matrixWorld.multiplyMatrices(this.root.matrixWorld, this.matrix);
@@ -8812,7 +8817,8 @@
 	  return a.distance - b.distance;
 	}
 	function intersectObject(object, raycaster, intersects, recursive, ignoreUnvisible) {
-	  if (ignoreUnvisible && !object.visible) return; //add
+	  if (ignoreUnvisible && !object.visible) return;
+	  //add
 
 	  if (object.layers.test(raycaster.layers)) {
 	    object.raycast(raycaster, intersects);
@@ -8875,29 +8881,50 @@
 	};
 	Curve.prototype.getPointAt = function (u, optionalTarget) {
 	  var t = this.getUtoTmapping(u);
-	  this.UtoTMapArr && this.UtoTMapArr.push(t); //add
+	  this.UtoTMapArr && this.UtoTMapArr.push(t);
+	  //add
 	  return this.getPoint(t, optionalTarget);
 	};
-	var _inverseMatrix$3 = /*@__PURE__*/new Matrix4();
-	var _ray$3 = /*@__PURE__*/new Ray();
-	var _sphere$6 = /*@__PURE__*/new Sphere();
-	var _sphereHitAt = /*@__PURE__*/new Vector3();
-	var _vA$1$1 = /*@__PURE__*/new Vector3();
-	var _vB$1$1 = /*@__PURE__*/new Vector3();
-	var _vC$1$1 = /*@__PURE__*/new Vector3();
-	var _tempA$1 = /*@__PURE__*/new Vector3();
-	var _morphA$1 = /*@__PURE__*/new Vector3();
-	var _intersectionPoint$1 = /*@__PURE__*/new Vector3();
-	var _intersectionPointWorld$1 = /*@__PURE__*/new Vector3();
-	var _basePosition$1 = /*@__PURE__*/new Vector3();
-	var _skinIndex$1 = /*@__PURE__*/new Vector4();
-	var _skinWeight$1 = /*@__PURE__*/new Vector4();
-	var _vector3 = /*@__PURE__*/new Vector3();
-	var _matrix4 = /*@__PURE__*/new Matrix4();
-	var _vertex = /*@__PURE__*/new Vector3();
-	var _sphere$5 = /*@__PURE__*/new Sphere();
-	var _inverseMatrix$2$1 = /*@__PURE__*/new Matrix4();
-	var _ray$2$1 = /*@__PURE__*/new Ray();
+	var _inverseMatrix$3 = /*@__PURE__*/
+	new Matrix4();
+	var _ray$3 = /*@__PURE__*/
+	new Ray();
+	var _sphere$6 = /*@__PURE__*/
+	new Sphere();
+	var _sphereHitAt = /*@__PURE__*/
+	new Vector3();
+	var _vA$1$1 = /*@__PURE__*/
+	new Vector3();
+	var _vB$1$1 = /*@__PURE__*/
+	new Vector3();
+	var _vC$1$1 = /*@__PURE__*/
+	new Vector3();
+	var _tempA$1 = /*@__PURE__*/
+	new Vector3();
+	var _morphA$1 = /*@__PURE__*/
+	new Vector3();
+	var _intersectionPoint$1 = /*@__PURE__*/
+	new Vector3();
+	var _intersectionPointWorld$1 = /*@__PURE__*/
+	new Vector3();
+	var _basePosition$1 = /*@__PURE__*/
+	new Vector3();
+	var _skinIndex$1 = /*@__PURE__*/
+	new Vector4();
+	var _skinWeight$1 = /*@__PURE__*/
+	new Vector4();
+	var _vector3 = /*@__PURE__*/
+	new Vector3();
+	var _matrix4 = /*@__PURE__*/
+	new Matrix4();
+	var _vertex = /*@__PURE__*/
+	new Vector3();
+	var _sphere$5 = /*@__PURE__*/
+	new Sphere();
+	var _inverseMatrix$2$1 = /*@__PURE__*/
+	new Matrix4();
+	var _ray$2$1 = /*@__PURE__*/
+	new Ray();
 	SkinnedMesh.prototype.computeBoundingSphere = function () {
 	  var geometry = this.geometry;
 	  if (!this.boundingSphere) {
@@ -9020,7 +9047,8 @@
 	          var c = index.getX(j + 2);
 	          intersection = checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c);
 	          if (intersection) {
-	            intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics
+	            intersection.faceIndex = Math.floor(j / 3);
+	            // triangle number in indexed buffer semantics
 	            intersection.face.materialIndex = group.materialIndex;
 	            intersects.push(intersection);
 	          }
@@ -9035,7 +9063,8 @@
 	        var _c = index.getX(_i + 2);
 	        intersection = checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, _a, _b, _c);
 	        if (intersection) {
-	          intersection.faceIndex = Math.floor(_i / 3); // triangle number in indexed buffer semantics
+	          intersection.faceIndex = Math.floor(_i / 3);
+	          // triangle number in indexed buffer semantics
 	          intersects.push(intersection);
 	        }
 	      }
@@ -9055,7 +9084,8 @@
 	          var _c2 = _j + 2;
 	          intersection = checkGeometryIntersection(this, _groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, _a2, _b2, _c2);
 	          if (intersection) {
-	            intersection.faceIndex = Math.floor(_j / 3); // triangle number in non-indexed buffer semantics
+	            intersection.faceIndex = Math.floor(_j / 3);
+	            // triangle number in non-indexed buffer semantics
 	            intersection.face.materialIndex = _group.materialIndex;
 	            intersects.push(intersection);
 	          }
@@ -9070,16 +9100,20 @@
 	        var _c3 = _i3 + 2;
 	        intersection = checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, _a3, _b3, _c3);
 	        if (intersection) {
-	          intersection.faceIndex = Math.floor(_i3 / 3); // triangle number in non-indexed buffer semantics
+	          intersection.faceIndex = Math.floor(_i3 / 3);
+	          // triangle number in non-indexed buffer semantics
 	          intersects.push(intersection);
 	        }
 	      }
 	    }
 	  }
 	};
-	var _v40 = /*@__PURE__*/new Vector4();
-	var _v41 = /*@__PURE__*/new Vector4();
-	var _v42 = /*@__PURE__*/new Vector4();
+	var _v40 = /*@__PURE__*/
+	new Vector4();
+	var _v41 = /*@__PURE__*/
+	new Vector4();
+	var _v42 = /*@__PURE__*/
+	new Vector4();
 	function checkGeometryIntersection(object, material, raycaster, ray, uv, uv1, normal, a, b, c) {
 	  object.getVertexPosition(a, _vA$1$1);
 	  object.getVertexPosition(b, _vB$1$1);
@@ -9131,8 +9165,10 @@
 	    object: object
 	  };
 	}
-	var _v1$6$1 = /*@__PURE__*/new Vector3();
-	var _v2$3$1 = /*@__PURE__*/new Vector3();
+	var _v1$6$1 = /*@__PURE__*/
+	new Vector3();
+	var _v2$3$1 = /*@__PURE__*/
+	new Vector3();
 	Sphere.prototype.expandByPoint = function (point) {
 	  if (this.isEmpty()) {
 	    this.center.copy(point);
@@ -9180,6 +9216,69 @@
 	  }
 	  return this;
 	};
+	Color.prototype.getHSV = function () {
+	  //or hsb   色相、饱和度、明度(不同于hsl的亮度,只有色相是和hsl一样)代码源于deepseek 
+	  var r = this.r,
+	    g = this.g,
+	    b = this.b;
+	  var max = Math.max(r, g, b);
+	  var min = Math.min(r, g, b);
+	  var h,
+	    s,
+	    v = max;
+	  var d = max - min;
+	  s = max === 0 ? 0 : d / max;
+	  if (max === min) {
+	    h = 0;
+	    // 无色
+	  } else {
+	    switch (max) {
+	      case r:
+	        h = (g - b) / d + (g < b ? 6 : 0);
+	        break;
+	      case g:
+	        h = (b - r) / d + 2;
+	        break;
+	      case b:
+	        h = (r - g) / d + 4;
+	        break;
+	    }
+	    h /= 6;
+	  }
+	  return {
+	    h: h * 360,
+	    s: s * 100,
+	    v: v * 100
+	  };
+	};
+	Color.prototype.setHSV = function (h, s, v) {
+	  h = h % 360;
+	  s /= 100;
+	  v /= 100;
+	  var c = v * s;
+	  var x = c * (1 - Math.abs(h / 60 % 2 - 1));
+	  var m = v - c;
+	  var r, g, b;
+	  if (0 <= h && h < 60) {
+	    [r, g, b] = [c, x, 0];
+	  } else if (60 <= h && h < 120) {
+	    [r, g, b] = [x, c, 0];
+	  } else if (120 <= h && h < 180) {
+	    [r, g, b] = [0, c, x];
+	  } else if (180 <= h && h < 240) {
+	    [r, g, b] = [0, x, c];
+	  } else if (240 <= h && h < 300) {
+	    [r, g, b] = [x, 0, c];
+	  } else if (300 <= h && h < 360) {
+	    [r, g, b] = [c, 0, x];
+	  }
+	  return this.setRGB(r + m, g + m, b + m);
+	};
+	var oldSet = Color.prototype.set;
+	Color.prototype.set = function () {
+	  if (arguments.length >= 3) return this.setRGB.apply(this, arguments);
+	  return oldSet.apply(this, arguments);
+	};
 
 	var MathLight = {};
 	MathLight.RADIANS_PER_DEGREE = Math.PI / 180;
@@ -20355,8 +20454,9 @@
 	    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 	    super();
 	    var map = new Texture();
-	    map.minFilter = LinearFilter; //清晰一些?
-	    map.magFilter = LinearFilter;
+	    map.minFilter = LinearMipmapNearestFilter;
+	    map.magFilter = NearestFilter; //放大后可以很清晰
+
 	    this.sprite = new Sprite$2(Object.assign({
 	      root: this
 	    }, options, {
@@ -20531,16 +20631,17 @@
 	      var actualBoundingBoxDescent = infos[i].fontBoundingBoxDescent == void 0 ? this.fontsize * r * 0.2 : infos[i].fontBoundingBoxDescent;
 	      y += actualBoundingBoxDescent + textBorderThick + lineSpace;
 	    }
-	    var texture = new Texture(canvas);
-	    texture.minFilter = LinearFilter;
-	    texture.magFilter = LinearFilter;
-	    texture.needsUpdate = true;
-	    //this.material.needsUpdate = true; 
 
-	    if (this.sprite.material.map) {
-	      this.sprite.material.map.dispose();
+	    /* let texture = new THREE.Texture(canvas); 
+	    texture.needsUpdate = true; */
+	    this.sprite.material.map.image = canvas;
+	    this.sprite.material.map.needsUpdate = true;
+
+	    /* if(this.sprite.material.map){
+	        this.sprite.material.map.dispose()
 	    }
-	    this.sprite.material.map = texture;
+	    this.sprite.material.map = texture; */
+
 	    var oldScale = this.sprite.scale.clone();
 	    this.sprite.scale.set(spriteWidth * 0.01 / r, spriteHeight * 0.01 / r, 1.0);
 	    if (!oldScale.equals(this.sprite.scale)) {
@@ -49902,11 +50003,14 @@
 	    if (this.color == color) return;
 	    this.color = color;
 	    var c = new Color().set(this.color);
+	    var hsb = new Color().set(this.color).getHSV();
+	    var textColor = new Color().setHSV(hsb.h, hsb.s, 100); //make bright full
+
 	    this.titleLabel.setTextColor({
-	      r: c.r * 255,
-	      g: c.g * 255,
-	      b: c.b * 255,
-	      a: 0.5
+	      r: textColor.r * 255,
+	      g: textColor.g * 255,
+	      b: textColor.b * 255,
+	      a: 0.95
 	    });
 	    this.updateSelectStyle(); //apply color
 
@@ -50329,20 +50433,20 @@
 	    viewer.mapViewer && viewer.mapViewer.dispatchEvent('content_changed');
 	  }
 	  updateSelectStyle() {
-	    var c = new Color().set(this.color).getHSL({
-	      h: 0,
-	      s: 0,
-	      l: 0
-	    });
+	    //let c = new THREE.Color().set(this.color).getHSL({ h: 0, s: 0, l: 0 })
+	    var hsv = new Color().set(this.color).getHSV();
 	    var color, arrowColor;
 	    if (this.selectStates.click) {
 	      color = '#00C8AF';
 	      arrowColor = '#ffffff';
 	    } else if (this.selectStates.hover) {
-	      color = new Color().setHSL(c.h, c.s, c.l - 0.1);
-	      arrowColor = new Color().setHSL(c.h, c.s, c.l >= 0.4 ? c.l - 0.3 : c.l + 0.3);
+	      /* color = new THREE.Color().setHSL(c.h, c.s, c.l - 0.1 )   
+	      arrowColor = new THREE.Color().setHSL(c.h, c.s, c.l >= 0.4 ? c.l - 0.3 : c.l + 0.3 )  */
+	      color = new Color().setHSV(hsv.h, hsv.s, hsv.v - 10);
+	      arrowColor = new Color().setHSV(hsv.h, hsv.s, hsv.v >= 40 ? hsv.v - 30 : hsv.v + 30);
 	    } else {
-	      arrowColor = new Color().setHSL(c.h, c.s, c.l >= 0.4 ? c.l - 0.3 : c.l + 0.3);
+	      //arrowColor = new THREE.Color().setHSL(c.h, c.s, c.l >= 0.4 ? c.l - 0.3 : c.l + 0.3 )  
+	      arrowColor = new Color().setHSV(hsv.h, hsv.s, hsv.v >= 40 ? hsv.v - 30 : hsv.v + 30);
 	      color = this.color;
 	    }
 	    if (this.arrows) {
@@ -50628,6 +50732,7 @@
 
 	 */
 
+	var sid$1 = 0;
 	class History extends EventDispatcher {
 	  constructor(o) {
 	    super();
@@ -50637,6 +50742,7 @@
 	    this.getData = o.getData; //获取数据的方法
 
 	    this.dataBefore;
+	    this.sid = sid$1++;
 	    (o.viewer || viewer).inputHandler.addEventListener('keydown', e => {
 	      if (e.keyCode == 90 && e.event.ctrlKey) {
 	        //Z
@@ -50657,7 +50763,7 @@
 	      unExist || this.redoList.push(last);
 	      unExist && this.undo(); //找不到就回退下一个。
 	      this.dispatchEvent('undo');
-	      //console.log('undo',last)
+	      console.log(this.sid, 'undo', this.undoList.length);
 	    }
 	  }
 	  redo() {

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
public/lib/potree/potree.js.map


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

@@ -242,7 +242,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
      
     viewer.images360.addEventListener('endChangeMode',(e)=>{
         sceneBus.emit('modeChange', {mode: e.mode == 'showPanos' ? 'pano' : 'fuse',  model : e.mode == 'showPanos' && viewer.images360.currentPano.pointcloud.result_} )
-         
+         console.log('emit Changemode', e.mode )
         Potree.Utils.updateVisible(MergeEditor.transformControls, 'showPanos', e.mode == 'showPointCloud')
         Potree.Utils.updateVisible(MergeEditor.boxHelper, 'showPanos', e.mode == 'showPointCloud')
          
@@ -656,7 +656,9 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
             
             if(Potree.settings.displayMode == 'showPanos'){
                 let model = viewer.images360.currentPano.pointcloud
-                if(!isFlyToTag || model.dataset_id == modelId){ //保存编辑热点时的视角,如果在全景模式,只有点位在所加模型上时才保存
+                if(isFlyToTag && model.dataset_id != modelId){ //保存编辑热点时的视角,如果在全景模式,只有点位在所加模型上时才保存
+                    pose.noViewSaved = true //不保存视角
+                }else{
                     pose.panoId = viewer.images360.currentPano.originID 
                     pose.posInModel = Potree.Utils.datasetPosTransform({ toDataset: true, position: camera.position.clone(), object:model })
                     pose.rotInModel = Potree.Utils.datasetRotTransform({ toDataset: true, quaternion: camera.quaternion.clone(), getQuaternion: true, pointcloud:model }).toArray() //拿第一个数据集
@@ -670,7 +672,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 pose.maxDis = 15, pose.isFlyToTag = true,  pose.modelId = modelId //补一下
             }
             
-            console.log('getPose', pose)
+            
             return pose
         },
         
@@ -734,9 +736,8 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     if(r){
                         requestShowPano = true
                     }else{
-                        if(o.panoId != void 0 || o.modelId != void 0 && o.target != void 0){ 
-                            return fly()    //使用保存的视角
-                             
+                        if(!o.noViewSaved){ 
+                            return fly()    //使用保存的视角 
                         }
                         Potree.settings.displayMode = 'showPointCloud'  
                     }
@@ -1265,8 +1266,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     } else {
                         MergeEditor.transformControls.detach()
                         MergeEditor.transformControls2.detach()
-                    }
-                    MergeEditor.history.clear()
+                    } 
                 },
 
                 enterAlignment() {//开始校准
@@ -1464,7 +1464,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                     }
                     
                     let modelFuns = sdk.addModel(prop)
-                    
+                   
                     
                     let visibleRange 
                     let updateVisiByRange = ()=>{//可见范围
@@ -2195,7 +2195,7 @@ export const enter = ({ dom, mapDom, isLocal, lonlat, scenes, laserRoot, laserOS
                 
                 getImageCenter(){  //热点在模型的本地坐标 
                     if(!tag.parent)return new THREE.Vector3
-                    return  tag.onMesh ? tag.position : new THREE.Vector3().addVectors(tag.position, tag.titleLabel.parent.position)
+                    return  tag.onMesh ? tag.position : tag.titleLabel.parent.getWorldPosition().applyMatrix4(tag.root.matrixWorld.clone().invert())      /* new THREE.Vector3().addVectors(tag.position, tag.titleLabel.parent.position)还要乘以scale */
                      
                 },