|
@@ -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 &&
|