xzw 9 месяцев назад
Родитель
Сommit
711444b0db

+ 7 - 0
libs/three.js/3dtiles/three-loader-3dtiles.esm.js

@@ -18324,6 +18324,13 @@ tile.depth最低为1 , root是0
 
 
 
+============
+
+3dtiles在四维看看和激光里摆放不同,这里的需要位移一段距离才能和四维看看一样,也就是和无transform后的点云一样。
+见load4dkkPanos函数
+且四维看看场景里所有坐标导入这里都要转换下,用posRot1MatrixInvert等矩阵。
+
+
  */
 
  

+ 16 - 0
src/custom/modules/mergeModel/MergeEditor.js

@@ -1318,4 +1318,20 @@ viewer.modules.PanoEditor.linkChange(window.pano1, window.pano2, 'remove') //断
 
 国产系统8192贴图直接出错,4096的贴图过多也出错。texImage: Driver ran out of memory during upload.
 
+
+
+======和4dkk的对应=========
+4dkk模型无论是否是3dtiles都能和点云的坐标对应。
+如3dtiles的导入后能和其panos对应,见load4dkkPanos。要和点云对应的话搜prop.raw.orientation
+而4dkk非3dtile的模型导入融合后模型一致bound不变。
+
+关键:4dkk和laser的panos坐标一致(laser的originPosition)  
+===========================
+
+
+
+
+
+
+
 */ 

+ 24 - 14
src/custom/objects/Monitor.js

@@ -33,7 +33,7 @@ let cameraModel
 
 //接收4dkk的监控 暂不支持修改   可以直接加到模型上,注意所附模型旋转90度后角度才对。
 export default class Monitor extends THREE.Object3D{
-    constructor(data){
+    constructor(data, model){
         super()
          
         warnHls()
@@ -44,12 +44,12 @@ export default class Monitor extends THREE.Object3D{
         /* for(let i in data){
             this[i] = data[i]
         }  */
-        this.sid = data.sid 
-        this.fov = data.fov 
-        this.cylinderNear = data.near || 0.03
-        this.cylinderFar = data.far || 3
         
+        this.fov = data.data.fov 
+        this.cylinderNear = data.data.near || 0.03
+        this.cylinderFar = data.data.far || 3
         
+        model.add(this)
         
         
         this.video = videoPlayer.getVideo(data.video,this)
@@ -145,27 +145,37 @@ export default class Monitor extends THREE.Object3D{
         
         
         {
-            this.posOri = data.posOri || new THREE.Vector3()
-            this.posOffset = data.posOffset || new THREE.Vector3()
+            
+            let offset = new THREE.Vector3  
+            if(model.fileType == '3dTiles'){    
+                offset.fromArray(model.runtime.getTileset().tileset.root.boundingVolume.box.slice(0,3))//必须要平移一段才能重合 
+                //offset.copy(Potree.math.convertVector.ZupToYup(offset))
+            }
+            
+             
+            this.posOri = new THREE.Vector3(parseFloat(data.data['posOri-x']), parseFloat(data.data['posOri-y']), parseFloat(data.data['posOri-z'])),
+            this.posOffset = new THREE.Vector3(parseFloat(data.data['posOffset-x']), parseFloat(data.data['posOffset-y']), parseFloat(data.data['posOffset-z'])),
+            
             // data.position && this.position.copy(data.position)
-            this.position.copy(this.posOri).add(this.posOffset)
+            this.position.copy(this.posOri).add(this.posOffset).sub(offset)
 
-        
+ 
             // target的优先级大于rotation
             if (data.target) {
-                this.target = data.target
+                this.target = data.data.target
+                this.target.sub(offset)
                 this.lookAt(data.target)
             } else {
-                data.rotation && this.quaternion.setFromEuler(data.rotation)
+                data.data.rotation && this.quaternion.setFromEuler(data.data.rotation)
                 this.target = new THREE.Vector3(0, 0, -1).applyQuaternion(this.quaternion).add(this.position)
             }
             
             
             
             this.roll = 0
-            data.pitch && (this.pitch = data.pitch)
-            data.yaw && (this.yaw = data.yaw)
-            data.roll && this.setRoll(this.data.roll)
+            data.data.pitch && (this.pitch = data.data.pitch)
+            data.data.yaw && (this.yaw = data.data.yaw)
+            data.data.roll && this.setRoll(this.data.data.roll)
         }
         
         

+ 1 - 1
src/custom/start.js

@@ -907,7 +907,7 @@ export function mergeEditStart(dom, mapDom){
                             model.position.fromArray(model.runtime.getTileset().tileset.root.boundingVolume.box.slice(0,3))//必须要平移一段才能重合 
                             model.position.copy(Potree.math.convertVector.ZupToYup(model.position))
                              
-                            //原点旋转  类似Alignment.setMatrix 和点云一样处理 
+                            //原点旋转  类似Alignment.setMatrix 和点云一样处理 
                             if(prop.raw.orientation){
                                 model.updateMatrixWorld()//此时和点云没有旋转平移时一样。
                                 let rotMatrix = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0,0,1),  parseFloat(prop.raw.orientation)   )  

+ 1 - 2
src/custom/viewer/ViewerNew.js

@@ -6478,8 +6478,7 @@ export class Viewer extends ViewerBase{
             "pitch": -1,
             "videoType": 1
         }
-        let monitor = new Monitor(data)
-        model.add(monitor)
+        let monitor = new Monitor(data, model) 
         this.scene.monitors.push(monitor)
         this.dispatchEvent('content_changed')
     }