浏览代码

Merge pull request #3772 from RaananW/viewer-load-meh-fix

declaration update
Raanan Weber 7 年之前
父节点
当前提交
6bde14969e

文件差异内容过多而无法显示
+ 12353 - 12347
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 4 - 4
dist/preview release/babylon.js


+ 15 - 6
dist/preview release/babylon.max.js

@@ -24499,21 +24499,27 @@ var BABYLON;
             }
         };
         // Octrees
-        Scene.prototype.getWorldExtends = function () {
+        /**
+         * Get the world extend vectors with an optional filter
+         *
+         * @param {(mesh: AbstractMesh) => boolean} [filterPredicate] the predicate - which meshes should be included when calculating the world size
+         * @returns {{ min: Vector3; max: Vector3 }} min and max vectors
+         */
+        Scene.prototype.getWorldExtends = function (filterPredicate) {
             var min = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
             var max = new BABYLON.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
-            for (var index = 0; index < this.meshes.length; index++) {
-                var mesh = this.meshes[index];
+            filterPredicate = filterPredicate || (function () { return true; });
+            this.meshes.filter(filterPredicate).forEach(function (mesh) {
                 mesh.computeWorldMatrix(true);
                 if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {
-                    continue;
+                    return;
                 }
                 var boundingInfo = mesh.getBoundingInfo();
                 var minBox = boundingInfo.boundingBox.minimumWorld;
                 var maxBox = boundingInfo.boundingBox.maximumWorld;
                 BABYLON.Tools.CheckExtends(minBox, min, max);
                 BABYLON.Tools.CheckExtends(maxBox, min, max);
-            }
+            });
             return {
                 min: min,
                 max: max
@@ -90082,13 +90088,16 @@ var BABYLON;
          * Get the scene sizes according to the setup.
          */
         EnvironmentHelper.prototype._getSceneSize = function () {
+            var _this = this;
             var groundSize = this._options.groundSize;
             var skyboxSize = this._options.skyboxSize;
             var rootPosition = this._options.rootPosition;
             if (!this._scene.meshes || this._scene.meshes.length === 1) {
                 return { groundSize: groundSize, skyboxSize: skyboxSize, rootPosition: rootPosition };
             }
-            var sceneExtends = this._scene.getWorldExtends();
+            var sceneExtends = this._scene.getWorldExtends(function (mesh) {
+                return (mesh !== _this._ground && mesh !== _this._rootMesh && mesh !== _this._skybox);
+            });
             var sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);
             if (this._options.sizeAuto) {
                 if (this._scene.activeCamera instanceof BABYLON.ArcRotateCamera &&

文件差异内容过多而无法显示
+ 4 - 4
dist/preview release/babylon.worker.js


+ 15 - 6
dist/preview release/es6.js

@@ -24485,21 +24485,27 @@ var BABYLON;
             }
         };
         // Octrees
-        Scene.prototype.getWorldExtends = function () {
+        /**
+         * Get the world extend vectors with an optional filter
+         *
+         * @param {(mesh: AbstractMesh) => boolean} [filterPredicate] the predicate - which meshes should be included when calculating the world size
+         * @returns {{ min: Vector3; max: Vector3 }} min and max vectors
+         */
+        Scene.prototype.getWorldExtends = function (filterPredicate) {
             var min = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
             var max = new BABYLON.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
-            for (var index = 0; index < this.meshes.length; index++) {
-                var mesh = this.meshes[index];
+            filterPredicate = filterPredicate || (function () { return true; });
+            this.meshes.filter(filterPredicate).forEach(function (mesh) {
                 mesh.computeWorldMatrix(true);
                 if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {
-                    continue;
+                    return;
                 }
                 var boundingInfo = mesh.getBoundingInfo();
                 var minBox = boundingInfo.boundingBox.minimumWorld;
                 var maxBox = boundingInfo.boundingBox.maximumWorld;
                 BABYLON.Tools.CheckExtends(minBox, min, max);
                 BABYLON.Tools.CheckExtends(maxBox, min, max);
-            }
+            });
             return {
                 min: min,
                 max: max
@@ -90068,13 +90074,16 @@ var BABYLON;
          * Get the scene sizes according to the setup.
          */
         EnvironmentHelper.prototype._getSceneSize = function () {
+            var _this = this;
             var groundSize = this._options.groundSize;
             var skyboxSize = this._options.skyboxSize;
             var rootPosition = this._options.rootPosition;
             if (!this._scene.meshes || this._scene.meshes.length === 1) {
                 return { groundSize: groundSize, skyboxSize: skyboxSize, rootPosition: rootPosition };
             }
-            var sceneExtends = this._scene.getWorldExtends();
+            var sceneExtends = this._scene.getWorldExtends(function (mesh) {
+                return (mesh !== _this._ground && mesh !== _this._rootMesh && mesh !== _this._skybox);
+            });
             var sceneDiagonal = sceneExtends.max.subtract(sceneExtends.min);
             if (this._options.sizeAuto) {
                 if (this._scene.activeCamera instanceof BABYLON.ArcRotateCamera &&

+ 2 - 1
src/babylon.scene.ts

@@ -4230,10 +4230,11 @@
         }
 
         // Octrees
+
         /**
          * Get the world extend vectors with an optional filter
          * 
-         * @param {(mesh: AbstractMesh) => boolean} [filterPredicate] the predicate - which meshes should be included when calculating the world size
+         * @param filterPredicate the predicate - which meshes should be included when calculating the world size
          * @returns {{ min: Vector3; max: Vector3 }} min and max vectors
          */
         public getWorldExtends(filterPredicate?: (mesh: AbstractMesh) => boolean): { min: Vector3; max: Vector3 } {