ソースを参照

Remove the useBoundingInfoFromGeometry property

Popov72 5 年 前
コミット
f9f2ff2475
2 ファイル変更6 行追加13 行削除
  1. 1 2
      loaders/src/glTF/2.0/glTFLoader.ts
  2. 5 11
      src/Meshes/geometry.ts

+ 1 - 2
loaders/src/glTF/2.0/glTFLoader.ts

@@ -689,7 +689,7 @@ export class GLTFLoader implements IGLTFLoader {
 
         return Promise.all(promises).then(() => {
             this._forEachPrimitive(node, (babylonMesh) => {
-                if ((babylonMesh as Mesh).geometry && (babylonMesh as Mesh).geometry!.useBoundingInfoFromGeometry) {
+                if ((babylonMesh as Mesh).geometry && (babylonMesh as Mesh).geometry!._boundingInfo) {
                     // simply apply the world matrices to the bounding info - the extends are already ok
                     babylonMesh._updateBoundingInfo();
                 } else {
@@ -878,7 +878,6 @@ export class GLTFLoader implements IGLTFLoader {
                         min.copyFromFloats(...mmin);
                         max.copyFromFloats(...mmax);
                         babylonGeometry._boundingInfo = new BoundingInfo(min, max);
-                        babylonGeometry.useBoundingInfoFromGeometry = true;
                     }
                 }
             }));

+ 5 - 11
src/Meshes/geometry.ts

@@ -113,12 +113,6 @@ export class Geometry implements IGetSetVerticesData {
     }
 
     /**
-     * If set to true (false by defaut), the bounding info applied to the meshes sharing this geometry will be the bounding info defined at the class level
-     * and won't be computed based on the vertex positions (which is what we get when useBoundingInfoFromGeometry = false)
-     */
-    public useBoundingInfoFromGeometry = false;
-
-    /**
      * Creates a new geometry
      * @param id defines the unique ID
      * @param scene defines the hosting scene
@@ -281,8 +275,8 @@ export class Geometry implements IGetSetVerticesData {
             var meshes = this._meshes;
             var numOfMeshes = meshes.length;
 
-            var minimum = this.useBoundingInfoFromGeometry && this._boundingInfo ? this._boundingInfo.minimum : this._extend.minimum;
-            var maximum = this.useBoundingInfoFromGeometry && this._boundingInfo ? this._boundingInfo.maximum : this._extend.maximum;
+            var minimum = this._boundingInfo?.minimum ?? this._extend.minimum;
+            var maximum = this._boundingInfo?.maximum ?? this._extend.maximum;
 
             for (var index = 0; index < numOfMeshes; index++) {
                 var mesh = meshes[index];
@@ -350,8 +344,8 @@ export class Geometry implements IGetSetVerticesData {
         this._resetPointsArrayCache();
 
         if (updateExtends) {
-            var minimum = this.useBoundingInfoFromGeometry && this._boundingInfo ? this._boundingInfo.minimum : this._extend.minimum;
-            var maximum = this.useBoundingInfoFromGeometry && this._boundingInfo ? this._boundingInfo.maximum : this._extend.maximum;
+            var minimum = this._boundingInfo?.minimum ?? this._extend.minimum;
+            var maximum = this._boundingInfo?.maximum ?? this._extend.maximum;
 
             var meshes = this._meshes;
             for (const mesh of meshes) {
@@ -729,7 +723,7 @@ export class Geometry implements IGetSetVerticesData {
             }
 
             if (kind === VertexBuffer.PositionKind) {
-                if (this.useBoundingInfoFromGeometry && this._boundingInfo) {
+                if (this._boundingInfo) {
                     mesh._boundingInfo = new BoundingInfo(this._boundingInfo.minimum, this._boundingInfo.maximum);
                 } else {
                     if (!this._extend) {