xzw 1 rok temu
rodzic
commit
d5faa05006

Plik diff jest za duży
+ 2744 - 2380
service/PanoBoxFrame.js


+ 1 - 1
service/planeCoverService.js

@@ -76,7 +76,7 @@ function outputJson(boxCenvert, sceneNum, player){
   let json = {
     sceneNum, 
     boxes:boxCenvert.boxes.map(e=> e.toJson()),
-    boundingBox: {min:player.model.boundingBox.min.toArray(),max:player.model.boundingBox.max.toArray()}
+    boundingBox: {min:boxCenvert.safeBound.min.toArray(),max:boxCenvert.safeBound.max.toArray()}
   }
   
   return json

+ 1 - 1
service/util/BoundingMesh.js

@@ -15,7 +15,7 @@ export default class BoundingMesh extends THREE.Mesh {
         super(geometry, material)
         var center = new THREE.Vector3()
         boundingBox.getCenter(center)
-        center.y += skyHeight - 0.1
+        skyHeight && (center.y += skyHeight - 0.1)
 
         this.position.copy(center)
         this.frustumCulled = !1

+ 3 - 1
service/util/Model.js

@@ -12,6 +12,7 @@ export default class Model extends THREE.Object3D{
         this.floors = new FloorCollection(this)
         this.boundingBox = new THREE.Box3
         this.supportsTiles = true
+        this.chunks = []
     }
     
     
@@ -26,10 +27,11 @@ export default class Model extends THREE.Object3D{
         this.floors.forEach(
             function (floor) {
                 this.boundingBox.union(floor.boundingBox)
+                this.chunks.push(...floor.chunks)
             }.bind(this)
         ) 
          
-          
+            
         
         var size = new THREE.Vector3()
         var center = new THREE.Vector3()

+ 12 - 8
service/util/common.js

@@ -332,20 +332,22 @@ common.getTime = function (second) {
     var str = JSON.stringify(data)
     return JSON.parse(str)
 }),
-    (common.CloneObject = function (copyObj, result, isSimpleCopy, simpleCopyList = []) {
+    (common.CloneObject = function (copyObj, isSimpleCopy, simpleCopyList = []) {
         //isSimpleCopy 只复制最外层
         //复制json		result的可能:普通数字或字符串、普通数组、复杂对象
 
-        simpleCopyList.push(THREE.Object3D) //遇到simpleCopyList中的类直接使用不拷贝
+        //isSimpleCopy 只复制最外层
+        //复制json		result的可能:普通数字或字符串、普通数组、复杂对象
+
+        simpleCopyList.includes(THREE.Object3D) || simpleCopyList.push(THREE.Object3D) //遇到simpleCopyList中的类直接使用不拷贝
 
         if (!copyObj || typeof copyObj == 'number' || typeof copyObj == 'string' || copyObj instanceof Function || simpleCopyList.some(className => copyObj instanceof className)) {
             return copyObj
-        }
-
-        result = result || {}
+        } 
+        
         if (copyObj instanceof Array) {
             return copyObj.map(e => {
-                return this.CloneObject(e)
+                return this.CloneObject(e,  isSimpleCopy, simpleCopyList)
             })
         } else {
             if (copyObj.clone instanceof Function) {
@@ -353,8 +355,10 @@ common.getTime = function (second) {
                 return copyObj.clone()
             }
         }
+        
+        let result = {}
         for (var key in copyObj) {
-            if (copyObj[key] instanceof Object && !isSimpleCopy) result[key] = this.CloneObject(copyObj[key])
+            if (copyObj[key] instanceof Object && !isSimpleCopy) result[key] = this.CloneObject(copyObj[key], isSimpleCopy, simpleCopyList  )
             else result[key] = copyObj[key]
             //如果是函数类同基本数据,即复制引用
         }
@@ -372,7 +376,7 @@ common.getTime = function (second) {
         for (let i in copyObj) {
             if (i in copyObj.__proto__) break //到函数了跳出
 
-            targetObj[i] = this.CloneObject(copyObj[i], null)
+            targetObj[i] = this.CloneObject(copyObj[i])
         }
     }),
     (common.ifSame = function (object1, object2) {