Explorar el Código

fix: glb rotation

xzw hace 1 año
padre
commit
e590071155

+ 2 - 1
public/lib/potree/potree.js

@@ -92462,11 +92462,12 @@
 	  model.is4dkkModel = true;
 	  model.is4dkkModel = true;
 	  model.panos = [];
 	  model.panos = [];
 	  //模拟点云,需要rotX(90)+平移一段才能和四维看看的bound一样
 	  //模拟点云,需要rotX(90)+平移一段才能和四维看看的bound一样
-	  var rot1M = new THREE.Matrix4().makeRotationX(Math.PI / 2);
+	  var rot1M = new THREE.Matrix4();
 	  var pos1 = new THREE.Vector3();
 	  var pos1 = new THREE.Vector3();
 	  if (model.fileType == '3dTiles') {
 	  if (model.fileType == '3dTiles') {
 	    pos1.fromArray(model.runtime.getTileset().tileset.root.boundingVolume.box.slice(0, 3)); //必须要平移一段才能重合 
 	    pos1.fromArray(model.runtime.getTileset().tileset.root.boundingVolume.box.slice(0, 3)); //必须要平移一段才能重合 
 	    pos1.copy(Potree.math.convertVector.ZupToYup(pos1));
 	    pos1.copy(Potree.math.convertVector.ZupToYup(pos1));
+	    rot1M.makeRotationX(Math.PI / 2);
 	  }
 	  }
 	  var pos1M = new THREE.Matrix4().setPosition(pos1);
 	  var pos1M = new THREE.Matrix4().setPosition(pos1);
 	  model.posRot1MatrixInvert = new THREE.Matrix4().multiplyMatrices(pos1M, rot1M).invert();
 	  model.posRot1MatrixInvert = new THREE.Matrix4().multiplyMatrices(pos1M, rot1M).invert();

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1 - 1
public/lib/potree/potree.js.map


+ 85 - 25
public/test-case/model-list.json

@@ -4,9 +4,9 @@
   "data": [
   "data": [
         {
         {
             "caseId": null,
             "caseId": null,
-            "fusionNumId": 1094,
+            "fusionNumId": 1997,
             "fusionId": 221,
             "fusionId": 221,
-            "modelId": 1311,
+            "modelId": 1252,
             "hide": 0,
             "hide": 0,
             "transform": {
             "transform": {
                 "scale": [
                 "scale": [
@@ -15,12 +15,12 @@
                     100.0
                     100.0
                 ],
                 ],
                 "position": {
                 "position": {
-                    "x": 0.0,
-                    "y": 0.0,
-                    "z": 2.0
+                    "x": -147.32228,
+                    "y": -48.50493,
+                    "z": 0.0
                 },
                 },
                 "rotation": {
                 "rotation": {
-                    "x": 1.570796326794896,
+                    "x": 0.0,
                     "y": 0.0,
                     "y": 0.0,
                     "z": 0.0
                     "z": 0.0
                 }
                 }
@@ -29,34 +29,94 @@
             "bottom": 0.0,
             "bottom": 0.0,
             "token": null,
             "token": null,
             "sceneData": {
             "sceneData": {
-                "modelId": 1311,
+                "modelId": 1252,
                 "modelTitle": null,
                 "modelTitle": null,
-                "modelDateType": "b3dm",
+                "modelDateType": "obj",
                 "modelSize": null,
                 "modelSize": null,
-                "type": 6,
+                "type": 2,
                 "modelObjUrl": null,
                 "modelObjUrl": null,
-                "modelGlbUrl": "[\"https://4dkk.4dage.com/scene_view_data/SG-t-Wm2b883yI4z/images/3dtiles/tileset.json\"]",
+                "modelGlbUrl": null,
                 "userName": null,
                 "userName": null,
-                "modelType": "b3dm",
-                "num": "SG-t-Wm2b883yI4z",
+                "modelType": "pointcloud",
+                "num": "SS-t-Rv7vsJ0R219",
                 "tbStatus": 0,
                 "tbStatus": 0,
                 "createStatus": 1,
                 "createStatus": 1,
-                "createTime": "2024-02-26 16:06:11",
-                "updateTime": "2024-07-24 11:09:03",
-                "deptId": "DEP000011456505791239610368",
-                "deptName": "广州市消防救援支队",
+                "createTime": "2024-03-27 14:52:33",
+                "updateTime": "2024-07-17 14:18:53",
+                "deptId": "DEP000011759420653032312832",
+                "deptName": "数据统计总队",
                 "fileNewName": null,
                 "fileNewName": null,
-                "id": 3006111,
-                "buildObjStatus": 0,
-                "name": "项目0226.16.05",
+                "id": 3796,
+                "buildObjStatus": 1,
+                "name": "场景2",
                 "payStatus": 1,
                 "payStatus": 1,
-                "sceneName": "项目0226.16.05",
-                "snCode": "BPVT00019",
+                "sceneName": null,
+                "snCode": "A0IA7R137",
+                "status": 2,
+                "thumb": "https://laser-oss.4dkankan.com/static/img_default/pc.jpg",
+                "title": "场景2",
+                "viewCount": 50,
+                "isLaser": true,
+                "phone": "18819272201",
+                "bind": true,
+                "location": 4
+            }
+        },
+        {
+            "caseId": null,
+            "fusionNumId": 1098,
+            "fusionId": 221,
+            "modelId": 1307,
+            "hide": 0,
+            "transform": {
+                "scale": [
+                    100.0,
+                    100.0,
+                    100.0
+                ],
+                "position": {
+                    "x": 0.16552170253057596,
+                    "y": -11.152602403,
+                    "z": 0.10249640482
+                },
+                "rotation": {
+                    "x": 0.0,
+                    "y": 0.0,
+                    "z": 0.0
+                }
+            },
+            "opacity": 100.0,
+            "bottom": 0.0,
+            "token": null,
+            "sceneData": {
+                "modelId": 1307,
+                "modelTitle": "las",
+                "modelDateType": "las",
+                "modelSize": "5.11MB",
+                "type": 3,
+                "modelObjUrl": null,
+                "modelGlbUrl": "[\"https://4dkk.4dage.com/fusion/xj/model/modelId_1307/webcloud\"]",
+                "userName": "88888888888",
+                "modelType": "las",
+                "num": null,
+                "tbStatus": 0,
+                "createStatus": 1,
+                "createTime": "2024-07-19 10:52:32",
+                "updateTime": "2024-07-19 10:52:35",
+                "deptId": "0",
+                "deptName": "超管组织",
+                "fileNewName": "https://4dkk.4dage.com/fusion/xj/model/modelId_1307/3af7984d9c1d4cb99998b14a54346008.zip",
+                "id": null,
+                "buildObjStatus": null,
+                "name": null,
+                "payStatus": null,
+                "sceneName": null,
+                "snCode": null,
                 "status": 2,
                 "status": 2,
-                "thumb": "https://4dkk.4dage.com/scene_view_data/SG-t-Wm2b883yI4z/images/floor_0.png?t=1708934771617",
-                "title": "项目0226.16.05",
-                "viewCount": 3,
-                "isLaser": false,
+                "thumb": null,
+                "title": null,
+                "viewCount": null,
+                "isLaser": null,
                 "phone": null,
                 "phone": null,
                 "bind": true,
                 "bind": true,
                 "location": null
                 "location": null

+ 20 - 18
src/sdk/cover/index.js

@@ -5,7 +5,7 @@ import axios from 'axios' //{ axios } from '@/api'
 
 
 /* 
 /* 
 
 
-https://xj-mix3d.4dkankan.com/fire/#/home  新疆消防救援总队火灾现场勘验重建平台
+新版的融合 支持全景漫游
 
 
  */
  */
 
 
@@ -599,13 +599,9 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
         },
         },
         
         
         
         
-        //scaleRange: { min, max }, opacityRange: { min, max }, bottomRange: { min, max } })
-        
+    
         addModel(props){ 
         addModel(props){ 
-            /* requestLoadCount || (props.url = Potree.resourcePath+'/models/Block1.glb')
-            requestLoadCount++ */ 
-            //console.log(props.isDynamicAdded, props.mode)
-        
+              
             let bus = mitt()  
             let bus = mitt()  
             //console.log('addModel',props)
             //console.log('addModel',props)
             props.isFirstLoad = isLocal ? props.bottom == void 0 : (props.isDynamicAdded || props.mode == 'single')  // 在编辑时用户添加的 或 展示单个模型 (props.mode='single'模型展示页, props.mode='many'融合页)
             props.isFirstLoad = isLocal ? props.bottom == void 0 : (props.isDynamicAdded || props.mode == 'single')  // 在编辑时用户添加的 或 展示单个模型 (props.mode='single'模型展示页, props.mode='many'融合页)
@@ -617,7 +613,12 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
                     props.rotation = new THREE.Euler().setFromVector3(props.rotation)
                     props.rotation = new THREE.Euler().setFromVector3(props.rotation)
                 }
                 }
             }
             }
-
+            let getDefaultRotation = ()=>{
+                //0看看,1看见,2深时,3用户上传三维模型,4深时mesh,5深光点云,6深光mesh
+                if(props.fromType == 1 || props.fromType == 6 || props.fromType == 4 && props.type != 'glb'    ){//来自4dkk的3dtiles初始需要转90度
+                    return new THREE.Euler(Math.PI/2, 0,0)
+                }else return new THREE.Euler(0,0,0)
+            } 
 
 
 
 
             if(!props.isFirstLoad){ 
             if(!props.isFirstLoad){ 
@@ -638,10 +639,7 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
             }else{
             }else{
                 readyToAddModel = true 
                 readyToAddModel = true 
                 
                 
-                //0看看,1看见,2深时,3用户上传三维模型,4深时mesh,5深光点云,6深光mesh
-                if(props.fromType == 1 || props.fromType == 4 || props.fromType == 6 ){//来自4dkk的3dtiles初始需要转90度
-                    props.rotation = new THREE.Euler(Math.PI/2, 0,0)
-                }
+                props.rotation = getDefaultRotation()
             }
             }
              
              
             
             
@@ -730,7 +728,7 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
                     },1) 
                     },1) 
                 } 
                 } 
                 if(props.fromType == 6 || props.fromType == 4 || props.fromType == 0 || props.fromType == 1){ 
                 if(props.fromType == 6 || props.fromType == 4 || props.fromType == 0 || props.fromType == 1){ 
-                    load4dkkPanos(props.url, model,()=>{
+                    Potree.load4dkkPanos(props.raw.num, model,()=>{
                         bus.emit('loadDone')
                         bus.emit('loadDone')
                     })
                     })
                 }else{
                 }else{
@@ -770,10 +768,14 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
             let scaleMeasure
             let scaleMeasure
             let result = {  
             let result = {  
                 bus,
                 bus,
+                getDefaultRotation,
                 changeShow(show){ 
                 changeShow(show){ 
                     props.show = show  //for autoLoads show model
                     props.show = show  //for autoLoads show model
                     if(model){  
                     if(model){  
-                        Potree.Utils.updateVisible(model, 'changeShow', show) 
+                        Potree.Utils.updateVisible(model, 'changeShow', show)  
+                        if(model.panos){
+                            model.panos.forEach(e=>e.setEnable(show))
+                        }
                         viewer.dispatchEvent('content_changed')
                         viewer.dispatchEvent('content_changed')
                     } 
                     } 
                 },
                 },
@@ -980,7 +982,7 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
                             Potree.Utils.updateVisible(viewer.objs, 'showPanos', false)
                             Potree.Utils.updateVisible(viewer.objs, 'showPanos', false)
                         },{once:true}) */
                         },{once:true}) */
                         let changeVisi = (object)=>{
                         let changeVisi = (object)=>{
-                            Potree.Utils.updateVisible(viewer.objs, 'showPanos', object == model)
+                            Potree.Utils.updateVisible(object, 'showPanos', object == model)
                         }
                         }
                         viewer.objs.children.forEach(changeVisi)
                         viewer.objs.children.forEach(changeVisi)
                         
                         
@@ -996,7 +998,7 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
                     let panoPos = viewer.images360.position.clone()
                     let panoPos = viewer.images360.position.clone()
                     //Potree.Utils.updateVisible(viewer.objs, 'showPanos', true)
                     //Potree.Utils.updateVisible(viewer.objs, 'showPanos', true)
                     let changeVisi = (object)=>{
                     let changeVisi = (object)=>{
-                        Potree.Utils.updateVisible(viewer.objs, 'showPanos', true)
+                        Potree.Utils.updateVisible(object, 'showPanos', true)
                     }
                     }
                     viewer.objs.children.forEach(changeVisi)
                     viewer.objs.children.forEach(changeVisi)
                     viewer.images360.panos.forEach(pano=>{
                     viewer.images360.panos.forEach(pano=>{
@@ -1220,7 +1222,7 @@ export const enter = ({dom, mapDom, isLocal, lonlat, scenes }) => {
     return sdk 
     return sdk 
 }
 }
 
 
-function load4dkkPanos(url, model, done){
+/* function load4dkkPanos(url, model, done){
     let sceneCode 
     let sceneCode 
     if(url.includes('4dkk.4dage.com/scene_view_data/')){
     if(url.includes('4dkk.4dage.com/scene_view_data/')){
         sceneCode = url.split('https://4dkk.4dage.com/scene_view_data/')[1].split('/images/')[0]
         sceneCode = url.split('https://4dkk.4dage.com/scene_view_data/')[1].split('/images/')[0]
@@ -1233,7 +1235,7 @@ function load4dkkPanos(url, model, done){
     
     
     
     
     Potree.load4dkkPanos(sceneCode, model, done)
     Potree.load4dkkPanos(sceneCode, model, done)
-} 
+}  */
 /* 
 /* 
 
 
     暂定不同场景间的漫游点不能互通。虽然它们可能是摆放正确的,如果是组成一整个场景的话还是要打通……
     暂定不同场景间的漫游点不能互通。虽然它们可能是摆放正确的,如果是组成一整个场景的话还是要打通……