xushiting 4 年之前
父节点
当前提交
8035ca51f7
共有 2 个文件被更改,包括 103 次插入18 次删除
  1. 53 7
      IndoorViewerAPI.js
  2. 50 11
      index.html

+ 53 - 7
IndoorViewerAPI.js

@@ -99062,12 +99062,28 @@ and limitations under the License.
       , r = n(4)
       , o = function() {
         function t() {}
+        // return t.fromArray = function(t) {
+        //     if (t) {
+        //         if (4 !== t.length)
+        //             throw new i.IVFrontendException("Wrong number of ordinates for a quaternion!");
+        //         //return new r.Quaternion(t[1],t[2],t[3],t[0])
+        //         return new r.Quaternion(t[1],-t[2],t[3],t[0]).multiply((new r.Quaternion).setFromAxisAngle(new r.Vector3(0,0,1), r.Math.degToRad(-90)));
+        //     }
+        // }
         return t.fromArray = function(t) {
             if (t) {
-                if (4 !== t.length)
+                if (4 !== t.length)// 存储的array是[w,x,y,z]
                     throw new i.IVFrontendException("Wrong number of ordinates for a quaternion!");
                 //return new r.Quaternion(t[1],t[2],t[3],t[0])
-                return new r.Quaternion(t[1],-t[2],t[3],t[0]).multiply((new r.Quaternion).setFromAxisAngle(new r.Vector3(0,0,1), r.Math.degToRad(-90)));
+                //return new r.Quaternion(t[1],-t[2],t[3],t[0]).multiply((new r.Quaternion).setFromAxisAngle(new r.Vector3(0,0,1), r.Math.degToRad(-90)));
+                
+                
+                 /* let a = new r.Quaternion(t[1],t[3],-t[2],t[0]).multiply((new r.Quaternion).setFromAxisAngle(new r.Vector3(0,1,0), r.Math.degToRad(90)));
+                 a.multiply((new r.Quaternion).setFromAxisAngle(new r.Vector3(1,0,0), r.Math.degToRad(-90)));
+                return  a  */ 
+                return new r.Quaternion(t[1],t[2],t[3],t[0]).multiply((new r.Quaternion).setFromAxisAngle(new r.Vector3(0,0,1), r.Math.degToRad(-90)));
+                 
+            
             }
         }
         ,
@@ -110418,8 +110434,8 @@ and limitations under the License.
         }
         ,
         e.prototype.computeLocalCoordinatesFromGlobal = function() {
-            this.location = this.GeoTransformationService.vectorToLocal(this.globalLocation),
-            this.floorLocation = this.GeoTransformationService.vectorToLocal(this.globalFloorLocation),
+            this.location = this.GeoTransformationService.vectorToLocal(this.globalLocation);
+            this.floorLocation = this.GeoTransformationService.vectorToLocal(this.globalFloorLocation);
             this.orientation = this.globalOrientation ? this.globalOrientation.clone() : void 0,
             this.floorOrientation = this.globalFloorOrientation ? this.globalFloorOrientation.clone() : void 0
         }
@@ -123072,10 +123088,40 @@ and limitations under the License.
             this.proj4Transformer = t
         }
         return t.prototype.forward = function(t) {
+            // var e = this.proj4Transformer.forward(t);
+            // return t.x = e.x,
+            // t.y = e.y,
+            // t
             var e = this.proj4Transformer.forward(t);
-            return t.x = e.x,
-            t.y = e.y,
-            t
+            console.log('t-x:'+t.x+',t-y'+t.y);
+            if(t.x == 113.59571152939596 || t.y == 22.366594630499026 ){
+                console.log('okokokokokokokok1');
+                //t.x = -0.3665;
+                //t.y = -3.3755;
+                t.x = 0;
+                t.y = 0;
+                t.z = 0;   //0.43665
+            }
+            else if(t.x == 113.595707287329 || t.y == 22.366616648951815){
+                console.log('okokokokokokokok2:'+t.z);
+                //t.x = -0.4656740128993988;
+                //t.y = 2.6516430377960205;
+            }
+            // else if(t.x == 113.59500109428738 || t.y == 22.367331946366644){
+            //     console.log('okokokokokokokok2:'+t.z);
+            //     t.x = -0.30490899085998535;
+            //     t.y = -0.37807899713516235;
+            // }
+            // else if(t.x == 113.59500087 || t.y == 22.36732539){
+            //     console.log('okokokokokokokok3:'+t.z);
+            //     t.x = -0.30490899085998535;
+            //     t.y = -0.37807899713516235;
+            // }
+            else{
+                t.x = e.x;
+                t.y = e.y;
+            }
+            return t;
         }
         ,
         t.prototype.inverse = function(t) {

+ 50 - 11
index.html

@@ -22,7 +22,7 @@
 <script type="text/javascript">
     const ossPrefix = 'https://laser.4dkankan.com/data/';
     const ossPrefixDep = 'https://laser.4dkankan.com/public/';
-    const sceneNum = 't-iksBApb';
+    const sceneNum = 't-SNZRfWt';
 </script>
 <script src="IndoorViewerAPI.js"></script>
 <script type="text/javascript" src="js/OBJExporter.js"></script>
@@ -30,6 +30,7 @@
 <script type="text/javascript" src="js/AnimationHandler.js"></script>
 <script type="text/javascript" src="js/KeyFrameAnimation.js"></script>
 <script type="text/javascript" src="js/ColladaLoader.js"></script>
+<script type="text/javascript" src="js/OBJLoader.js"></script>
 
 <script type="text/javascript" src="js/tinyqueue.js"></script>
 <script type="text/javascript" src="js/THREE.MeshLine.js"></script>
@@ -58,15 +59,52 @@
     };
     var DoorOpenCLose = function(e) {
         var main_view = IV.getMainView();
-        var model;
-        var animations;
-        var kfAnimations = [];
-        var kfAnimationsLength = 0;
-
-        var progress = 0;
-        var lastTimestamp = 0;
-        var pre_select_map_id = -1;
-
+        // var model;
+        // var animations;
+        // var kfAnimations = [];
+        // var kfAnimationsLength = 0;
+
+        // var progress = 0;
+        // var lastTimestamp = 0;
+        // var pre_select_map_id = -1;
+        
+        // let path = './models/mesh/';
+        // var mtlLoader = new IV.THREE.MTLLoader()
+		// .setPath( path )
+		// .load('mesh.mtl', function ( materials ) {
+		// 	console.log(materials)
+		// 	materials.preload();
+			
+		// 	// 加载obj
+		// 	new IV.THREE.OBJLoader()
+		// 		.setMaterials( materials )
+		// 		.setPath( path )
+		// 		.load('mesh.obj', function ( object ) {
+		// 			// console.log(object)
+     						
+     	// 			// 设置旋转中心点
+	    //             //object.children[0].geometry.computeBoundingBox();
+
+		// 			//object.children[0].geometry.center()
+
+        //             object.position.x = 0;
+		// 			object.position.y = 0;
+        //             object.position.z = 0;
+		// 			// 将模型加入到场景
+		// 			scene.add( object );
+
+		// 		}, onProgress, onError );
+		// });
+        // OBJLoader_plugin();
+        // var loader = new IV.THREE.OBJLoader();
+        // loader.load('./models/mesh/mesh.obj', function (object) {
+        //     //controller = object.children[0];
+        //     var texture_loader = new IV.THREE.TextureLoader();
+        //     var material = new IV.THREE.MeshBasicMaterial();
+        //     main_view.scene.add(object);
+        // });
+    }
+        /*
         if (!IV.custom) { //自定义功能集合
             IV.custom = {};
         }
@@ -88,6 +126,7 @@
             //mesh.material.colorWrite = false;
         });
         var loader = new IV.THREE.ColladaLoader();
+        */
         // loader.load('./models/m4.dae', function (collada) {
         //     //console.log(collada)
         //     model = collada.scene;
@@ -175,7 +214,7 @@
             lastTimestamp = timestamp;
             requestAnimationFrame(animate);
         }
-    }
+    
 </script>
 <script src="./js/index.js"></script>