浏览代码

Merge pull request #770 from RaananW/optimizations

Optimization default submesh creation
David Catuhe 9 年之前
父节点
当前提交
7e657dfe19
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/Mesh/babylon.subMesh.ts

+ 4 - 2
src/Mesh/babylon.subMesh.ts

@@ -67,10 +67,12 @@
             }
 
             var indices = this._renderingMesh.getIndices();
-            var extend;
+            var extend: { minimum: Vector3, maximum: Vector3 };
 
+            //is this the only submesh?
             if (this.indexStart === 0 && this.indexCount === indices.length) {
-                extend = Tools.ExtractMinAndMax(data, this.verticesStart, this.verticesCount);
+                //the rendering mesh's bounding info can be used, it is the standard submesh for all indices.
+                extend = { minimum: this._renderingMesh.getBoundingInfo().minimum.clone(), maximum: this._renderingMesh.getBoundingInfo().maximum.clone() };
             } else {
                 extend = Tools.ExtractMinAndMaxIndexed(data, indices, this.indexStart, this.indexCount);
             }