瀏覽代碼

Changes to refreshBoundingInfo (commented for now)

Popov72 5 年之前
父節點
當前提交
40d0efb1cd
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. 18 0
      loaders/src/glTF/2.0/glTFLoader.ts

+ 18 - 0
loaders/src/glTF/2.0/glTFLoader.ts

@@ -701,8 +701,22 @@ export class GLTFLoader implements IGLTFLoader {
         this.logClose();
 
         return Promise.all(promises).then(() => {
+            //const min = new Vector3(0, 0, 0), max = new Vector3(0, 0, 0);
             this._forEachPrimitive(node, (babylonMesh) => {
                 babylonMesh.refreshBoundingInfo(true);
+                /*min.x = (babylonMesh as any).__min[0];
+                min.y = (babylonMesh as any).__min[1];
+                min.z = (babylonMesh as any).__min[2];
+                max.x = (babylonMesh as any).__max[0];
+                max.y = (babylonMesh as any).__max[1];
+                max.z = (babylonMesh as any).__max[2];
+                babylonMesh._boundingInfo!.reConstruct(min, max);
+                if (babylonMesh.subMeshes) {
+                    for (var index = 0; index < babylonMesh.subMeshes.length; index++) {
+                        babylonMesh.subMeshes[index].getBoundingInfo().reConstruct(min, max);
+                    }
+                }
+                babylonMesh._updateBoundingInfo();*/
             });
 
             return node._babylonTransformNode!;
@@ -881,6 +895,10 @@ export class GLTFLoader implements IGLTFLoader {
                 babylonGeometry.setVerticesBuffer(babylonVertexBuffer, accessor.count);
             }));
 
+            /*if (attribute === "POSITION") {
+                (babylonMesh as any).__min = accessor.min;
+                (babylonMesh as any).__max = accessor.max;
+            }*/
             if (kind == VertexBuffer.MatricesIndicesExtraKind) {
                 babylonMesh.numBoneInfluencers = 8;
             }