Преглед изворни кода

Add predicate to getHierarchyBoundingVectors and add option to disable polynomial generation

sebastien пре 7 година
родитељ
комит
7466867a73

Разлика између датотеке није приказан због своје велике величине
+ 5370 - 5334
Playground/babylon.d.txt


Разлика између датотеке није приказан због своје велике величине
+ 4224 - 4188
dist/preview release/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 38 - 38
dist/preview release/babylon.js


+ 82 - 11
dist/preview release/babylon.max.js

@@ -15580,13 +15580,15 @@ var BABYLON;
          * @param onError defines an optional callback raised if there is an issue to load the texture
          * @param format defines the format of the data
          * @param forcedExtension defines the extension to use to pick the right loader
+         * @param createPolynomials defines wheter or not to create polynomails harmonics for the texture
          * @returns the cube texture as an InternalTexture
          */
-        Engine.prototype.createPrefilteredCubeTexture = function (rootUrl, scene, scale, offset, onLoad, onError, format, forcedExtension) {
+        Engine.prototype.createPrefilteredCubeTexture = function (rootUrl, scene, scale, offset, onLoad, onError, format, forcedExtension, createPolynomials) {
             var _this = this;
             if (onLoad === void 0) { onLoad = null; }
             if (onError === void 0) { onError = null; }
             if (forcedExtension === void 0) { forcedExtension = null; }
+            if (createPolynomials === void 0) { createPolynomials = true; }
             var callback = function (loadData) {
                 if (!loadData) {
                     if (onLoad) {
@@ -15595,7 +15597,10 @@ var BABYLON;
                     return;
                 }
                 var texture = loadData.texture;
-                if (loadData.info.sphericalPolynomial) {
+                if (!createPolynomials) {
+                    texture._sphericalPolynomial = new BABYLON.SphericalPolynomial();
+                }
+                else if (loadData.info.sphericalPolynomial) {
                     texture._sphericalPolynomial = loadData.info.sphericalPolynomial;
                 }
                 texture._dataSource = BABYLON.InternalTexture.DATASOURCE_CUBEPREFILTERED;
@@ -15654,7 +15659,7 @@ var BABYLON;
                     onLoad(texture);
                 }
             };
-            return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, true);
+            return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, createPolynomials);
         };
         /**
          * Creates a cube texture
@@ -20373,10 +20378,12 @@ var BABYLON;
         /**
          * Return the minimum and maximum world vectors of the entire hierarchy under current mesh
          * @param includeDescendants Include bounding info from descendants as well (true by default)
+         * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors
          * @returns the new bounding vectors
          */
-        AbstractMesh.prototype.getHierarchyBoundingVectors = function (includeDescendants) {
+        AbstractMesh.prototype.getHierarchyBoundingVectors = function (includeDescendants, predicate) {
             if (includeDescendants === void 0) { includeDescendants = true; }
+            if (predicate === void 0) { predicate = null; }
             // Ensures that all world matrix will be recomputed.
             this.getScene().incrementRenderId();
             this.computeWorldMatrix(true);
@@ -20397,6 +20404,10 @@ var BABYLON;
                     var descendant = descendants_1[_i];
                     var childMesh = descendant;
                     childMesh.computeWorldMatrix(true);
+                    // Filters meshes based on custom predicate function.
+                    if (predicate && !predicate(childMesh)) {
+                        continue;
+                    }
                     //make sure we have the needed params to get mix and max
                     if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {
                         continue;
@@ -30100,6 +30111,7 @@ var BABYLON;
                         }
                         _this.isReady = true;
                     }, null, this.format, this._extension);
+                    proxy._sphericalPolynomial = this._sphericalPolynomial;
                     return;
             }
         };
@@ -41920,6 +41932,25 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ColorCurves.prototype, "globalExposure", {
+            /**
+             * Gets the global Exposure value.
+             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
+             */
+            get: function () {
+                return this._globalExposure;
+            },
+            /**
+             * Sets the global Exposure value.
+             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
+             */
+            set: function (value) {
+                this._globalExposure = value;
+                this._dirty = true;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ColorCurves.prototype, "highlightsHue", {
             /**
              * Gets the highlights Hue value.
@@ -63537,7 +63568,23 @@ var BABYLON;
 (function (BABYLON) {
     var CubeTexture = /** @class */ (function (_super) {
         __extends(CubeTexture, _super);
-        function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension) {
+        /**
+         * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well
+         * as prefiltered data.
+         * @param rootUrl defines the url of the texture or the root name of the six images
+         * @param scene defines the scene the texture is attached to
+         * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...
+         * @param noMipmap defines if mipmaps should be created or not
+         * @param files defines the six files to load for the different faces
+         * @param onLoad defines a callback triggered at the end of the file load if no errors occured
+         * @param onError defines a callback triggered in case of error during load
+         * @param format defines the internal format to use for the texture once loaded
+         * @param prefiltered defines whether or not the texture is created from prefiltered data
+         * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name
+         * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary
+         * @return the cube texture
+         */
+        function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension, createPolynomials) {
             if (extensions === void 0) { extensions = null; }
             if (noMipmap === void 0) { noMipmap = false; }
             if (files === void 0) { files = null; }
@@ -63546,6 +63593,7 @@ var BABYLON;
             if (format === void 0) { format = BABYLON.Engine.TEXTUREFORMAT_RGBA; }
             if (prefiltered === void 0) { prefiltered = false; }
             if (forcedExtension === void 0) { forcedExtension = null; }
+            if (createPolynomials === void 0) { createPolynomials = false; }
             var _this = _super.call(this, scene) || this;
             _this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
             /**
@@ -63562,6 +63610,7 @@ var BABYLON;
             _this._prefiltered = prefiltered;
             _this.isCube = true;
             _this._textureMatrix = BABYLON.Matrix.Identity();
+            _this._createPolynomials = createPolynomials;
             if (prefiltered) {
                 _this.gammaSpace = false;
             }
@@ -63587,7 +63636,7 @@ var BABYLON;
             if (!_this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                     if (prefiltered) {
-                        _this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, _this.lodGenerationScale, _this.lodGenerationOffset, onLoad, onError, format, forcedExtension);
+                        _this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, _this.lodGenerationScale, _this.lodGenerationOffset, onLoad, onError, format, forcedExtension, _this._createPolynomials);
                     }
                     else {
                         _this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension);
@@ -63652,9 +63701,18 @@ var BABYLON;
             files.forEach(function (url) { return rootUrlKey += url; });
             return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);
         };
-        CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension) {
+        /**
+         * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.
+         * @param url defines the url of the prefiltered texture
+         * @param scene defines the scene the texture is attached to
+         * @param forcedExtension defines the extension of the file if different from the url
+         * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary
+         * @return the prefiltered texture
+         */
+        CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension, createPolynomials) {
             if (forcedExtension === void 0) { forcedExtension = null; }
-            return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension);
+            if (createPolynomials === void 0) { createPolynomials = true; }
+            return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);
         };
         // Methods
         CubeTexture.prototype.delayLoad = function () {
@@ -63669,7 +63727,7 @@ var BABYLON;
             this._texture = this._getFromCache(this.url, this._noMipmap);
             if (!this._texture) {
                 if (this._prefiltered) {
-                    this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, undefined, undefined, this._format);
+                    this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, undefined, undefined, this._format, undefined, this._createPolynomials);
                 }
                 else {
                     this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, undefined, undefined, this._format);
@@ -82906,8 +82964,21 @@ var BABYLON;
         };
         PhysicsImpostor.prototype.unregisterOnPhysicsCollide = function (collideAgainst, func) {
             var collidedAgainstList = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];
-            var index = this._onPhysicsCollideCallbacks.indexOf({ callback: func, otherImpostors: collidedAgainstList });
-            if (index > -1) {
+            var index = -1;
+            var found = this._onPhysicsCollideCallbacks.some(function (cbDef, idx) {
+                if (cbDef.callback === func && cbDef.otherImpostors.length === collidedAgainstList.length) {
+                    // chcek the arrays match
+                    var sameList = cbDef.otherImpostors.every(function (impostor) {
+                        return collidedAgainstList.indexOf(impostor) > -1;
+                    });
+                    if (sameList) {
+                        index = idx;
+                    }
+                    return sameList;
+                }
+                return false;
+            });
+            if (found) {
                 this._onPhysicsCollideCallbacks.splice(index, 1);
             }
             else {

+ 82 - 11
dist/preview release/babylon.no-module.max.js

@@ -15547,13 +15547,15 @@ var BABYLON;
          * @param onError defines an optional callback raised if there is an issue to load the texture
          * @param format defines the format of the data
          * @param forcedExtension defines the extension to use to pick the right loader
+         * @param createPolynomials defines wheter or not to create polynomails harmonics for the texture
          * @returns the cube texture as an InternalTexture
          */
-        Engine.prototype.createPrefilteredCubeTexture = function (rootUrl, scene, scale, offset, onLoad, onError, format, forcedExtension) {
+        Engine.prototype.createPrefilteredCubeTexture = function (rootUrl, scene, scale, offset, onLoad, onError, format, forcedExtension, createPolynomials) {
             var _this = this;
             if (onLoad === void 0) { onLoad = null; }
             if (onError === void 0) { onError = null; }
             if (forcedExtension === void 0) { forcedExtension = null; }
+            if (createPolynomials === void 0) { createPolynomials = true; }
             var callback = function (loadData) {
                 if (!loadData) {
                     if (onLoad) {
@@ -15562,7 +15564,10 @@ var BABYLON;
                     return;
                 }
                 var texture = loadData.texture;
-                if (loadData.info.sphericalPolynomial) {
+                if (!createPolynomials) {
+                    texture._sphericalPolynomial = new BABYLON.SphericalPolynomial();
+                }
+                else if (loadData.info.sphericalPolynomial) {
                     texture._sphericalPolynomial = loadData.info.sphericalPolynomial;
                 }
                 texture._dataSource = BABYLON.InternalTexture.DATASOURCE_CUBEPREFILTERED;
@@ -15621,7 +15626,7 @@ var BABYLON;
                     onLoad(texture);
                 }
             };
-            return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, true);
+            return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, createPolynomials);
         };
         /**
          * Creates a cube texture
@@ -20340,10 +20345,12 @@ var BABYLON;
         /**
          * Return the minimum and maximum world vectors of the entire hierarchy under current mesh
          * @param includeDescendants Include bounding info from descendants as well (true by default)
+         * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors
          * @returns the new bounding vectors
          */
-        AbstractMesh.prototype.getHierarchyBoundingVectors = function (includeDescendants) {
+        AbstractMesh.prototype.getHierarchyBoundingVectors = function (includeDescendants, predicate) {
             if (includeDescendants === void 0) { includeDescendants = true; }
+            if (predicate === void 0) { predicate = null; }
             // Ensures that all world matrix will be recomputed.
             this.getScene().incrementRenderId();
             this.computeWorldMatrix(true);
@@ -20364,6 +20371,10 @@ var BABYLON;
                     var descendant = descendants_1[_i];
                     var childMesh = descendant;
                     childMesh.computeWorldMatrix(true);
+                    // Filters meshes based on custom predicate function.
+                    if (predicate && !predicate(childMesh)) {
+                        continue;
+                    }
                     //make sure we have the needed params to get mix and max
                     if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {
                         continue;
@@ -30067,6 +30078,7 @@ var BABYLON;
                         }
                         _this.isReady = true;
                     }, null, this.format, this._extension);
+                    proxy._sphericalPolynomial = this._sphericalPolynomial;
                     return;
             }
         };
@@ -41887,6 +41899,25 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ColorCurves.prototype, "globalExposure", {
+            /**
+             * Gets the global Exposure value.
+             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
+             */
+            get: function () {
+                return this._globalExposure;
+            },
+            /**
+             * Sets the global Exposure value.
+             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
+             */
+            set: function (value) {
+                this._globalExposure = value;
+                this._dirty = true;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ColorCurves.prototype, "highlightsHue", {
             /**
              * Gets the highlights Hue value.
@@ -63504,7 +63535,23 @@ var BABYLON;
 (function (BABYLON) {
     var CubeTexture = /** @class */ (function (_super) {
         __extends(CubeTexture, _super);
-        function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension) {
+        /**
+         * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well
+         * as prefiltered data.
+         * @param rootUrl defines the url of the texture or the root name of the six images
+         * @param scene defines the scene the texture is attached to
+         * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...
+         * @param noMipmap defines if mipmaps should be created or not
+         * @param files defines the six files to load for the different faces
+         * @param onLoad defines a callback triggered at the end of the file load if no errors occured
+         * @param onError defines a callback triggered in case of error during load
+         * @param format defines the internal format to use for the texture once loaded
+         * @param prefiltered defines whether or not the texture is created from prefiltered data
+         * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name
+         * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary
+         * @return the cube texture
+         */
+        function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension, createPolynomials) {
             if (extensions === void 0) { extensions = null; }
             if (noMipmap === void 0) { noMipmap = false; }
             if (files === void 0) { files = null; }
@@ -63513,6 +63560,7 @@ var BABYLON;
             if (format === void 0) { format = BABYLON.Engine.TEXTUREFORMAT_RGBA; }
             if (prefiltered === void 0) { prefiltered = false; }
             if (forcedExtension === void 0) { forcedExtension = null; }
+            if (createPolynomials === void 0) { createPolynomials = false; }
             var _this = _super.call(this, scene) || this;
             _this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
             /**
@@ -63529,6 +63577,7 @@ var BABYLON;
             _this._prefiltered = prefiltered;
             _this.isCube = true;
             _this._textureMatrix = BABYLON.Matrix.Identity();
+            _this._createPolynomials = createPolynomials;
             if (prefiltered) {
                 _this.gammaSpace = false;
             }
@@ -63554,7 +63603,7 @@ var BABYLON;
             if (!_this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                     if (prefiltered) {
-                        _this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, _this.lodGenerationScale, _this.lodGenerationOffset, onLoad, onError, format, forcedExtension);
+                        _this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, _this.lodGenerationScale, _this.lodGenerationOffset, onLoad, onError, format, forcedExtension, _this._createPolynomials);
                     }
                     else {
                         _this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension);
@@ -63619,9 +63668,18 @@ var BABYLON;
             files.forEach(function (url) { return rootUrlKey += url; });
             return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);
         };
-        CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension) {
+        /**
+         * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.
+         * @param url defines the url of the prefiltered texture
+         * @param scene defines the scene the texture is attached to
+         * @param forcedExtension defines the extension of the file if different from the url
+         * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary
+         * @return the prefiltered texture
+         */
+        CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension, createPolynomials) {
             if (forcedExtension === void 0) { forcedExtension = null; }
-            return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension);
+            if (createPolynomials === void 0) { createPolynomials = true; }
+            return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);
         };
         // Methods
         CubeTexture.prototype.delayLoad = function () {
@@ -63636,7 +63694,7 @@ var BABYLON;
             this._texture = this._getFromCache(this.url, this._noMipmap);
             if (!this._texture) {
                 if (this._prefiltered) {
-                    this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, undefined, undefined, this._format);
+                    this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, undefined, undefined, this._format, undefined, this._createPolynomials);
                 }
                 else {
                     this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, undefined, undefined, this._format);
@@ -82873,8 +82931,21 @@ var BABYLON;
         };
         PhysicsImpostor.prototype.unregisterOnPhysicsCollide = function (collideAgainst, func) {
             var collidedAgainstList = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];
-            var index = this._onPhysicsCollideCallbacks.indexOf({ callback: func, otherImpostors: collidedAgainstList });
-            if (index > -1) {
+            var index = -1;
+            var found = this._onPhysicsCollideCallbacks.some(function (cbDef, idx) {
+                if (cbDef.callback === func && cbDef.otherImpostors.length === collidedAgainstList.length) {
+                    // chcek the arrays match
+                    var sameList = cbDef.otherImpostors.every(function (impostor) {
+                        return collidedAgainstList.indexOf(impostor) > -1;
+                    });
+                    if (sameList) {
+                        index = idx;
+                    }
+                    return sameList;
+                }
+                return false;
+            });
+            if (found) {
                 this._onPhysicsCollideCallbacks.splice(index, 1);
             }
             else {

Разлика између датотеке није приказан због своје велике величине
+ 38 - 38
dist/preview release/babylon.worker.js


+ 82 - 11
dist/preview release/es6.js

@@ -15547,13 +15547,15 @@ var BABYLON;
          * @param onError defines an optional callback raised if there is an issue to load the texture
          * @param format defines the format of the data
          * @param forcedExtension defines the extension to use to pick the right loader
+         * @param createPolynomials defines wheter or not to create polynomails harmonics for the texture
          * @returns the cube texture as an InternalTexture
          */
-        Engine.prototype.createPrefilteredCubeTexture = function (rootUrl, scene, scale, offset, onLoad, onError, format, forcedExtension) {
+        Engine.prototype.createPrefilteredCubeTexture = function (rootUrl, scene, scale, offset, onLoad, onError, format, forcedExtension, createPolynomials) {
             var _this = this;
             if (onLoad === void 0) { onLoad = null; }
             if (onError === void 0) { onError = null; }
             if (forcedExtension === void 0) { forcedExtension = null; }
+            if (createPolynomials === void 0) { createPolynomials = true; }
             var callback = function (loadData) {
                 if (!loadData) {
                     if (onLoad) {
@@ -15562,7 +15564,10 @@ var BABYLON;
                     return;
                 }
                 var texture = loadData.texture;
-                if (loadData.info.sphericalPolynomial) {
+                if (!createPolynomials) {
+                    texture._sphericalPolynomial = new BABYLON.SphericalPolynomial();
+                }
+                else if (loadData.info.sphericalPolynomial) {
                     texture._sphericalPolynomial = loadData.info.sphericalPolynomial;
                 }
                 texture._dataSource = BABYLON.InternalTexture.DATASOURCE_CUBEPREFILTERED;
@@ -15621,7 +15626,7 @@ var BABYLON;
                     onLoad(texture);
                 }
             };
-            return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, true);
+            return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, createPolynomials);
         };
         /**
          * Creates a cube texture
@@ -20340,10 +20345,12 @@ var BABYLON;
         /**
          * Return the minimum and maximum world vectors of the entire hierarchy under current mesh
          * @param includeDescendants Include bounding info from descendants as well (true by default)
+         * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors
          * @returns the new bounding vectors
          */
-        AbstractMesh.prototype.getHierarchyBoundingVectors = function (includeDescendants) {
+        AbstractMesh.prototype.getHierarchyBoundingVectors = function (includeDescendants, predicate) {
             if (includeDescendants === void 0) { includeDescendants = true; }
+            if (predicate === void 0) { predicate = null; }
             // Ensures that all world matrix will be recomputed.
             this.getScene().incrementRenderId();
             this.computeWorldMatrix(true);
@@ -20364,6 +20371,10 @@ var BABYLON;
                     var descendant = descendants_1[_i];
                     var childMesh = descendant;
                     childMesh.computeWorldMatrix(true);
+                    // Filters meshes based on custom predicate function.
+                    if (predicate && !predicate(childMesh)) {
+                        continue;
+                    }
                     //make sure we have the needed params to get mix and max
                     if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {
                         continue;
@@ -30067,6 +30078,7 @@ var BABYLON;
                         }
                         _this.isReady = true;
                     }, null, this.format, this._extension);
+                    proxy._sphericalPolynomial = this._sphericalPolynomial;
                     return;
             }
         };
@@ -41887,6 +41899,25 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ColorCurves.prototype, "globalExposure", {
+            /**
+             * Gets the global Exposure value.
+             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
+             */
+            get: function () {
+                return this._globalExposure;
+            },
+            /**
+             * Sets the global Exposure value.
+             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
+             */
+            set: function (value) {
+                this._globalExposure = value;
+                this._dirty = true;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ColorCurves.prototype, "highlightsHue", {
             /**
              * Gets the highlights Hue value.
@@ -63504,7 +63535,23 @@ var BABYLON;
 (function (BABYLON) {
     var CubeTexture = /** @class */ (function (_super) {
         __extends(CubeTexture, _super);
-        function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension) {
+        /**
+         * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well
+         * as prefiltered data.
+         * @param rootUrl defines the url of the texture or the root name of the six images
+         * @param scene defines the scene the texture is attached to
+         * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...
+         * @param noMipmap defines if mipmaps should be created or not
+         * @param files defines the six files to load for the different faces
+         * @param onLoad defines a callback triggered at the end of the file load if no errors occured
+         * @param onError defines a callback triggered in case of error during load
+         * @param format defines the internal format to use for the texture once loaded
+         * @param prefiltered defines whether or not the texture is created from prefiltered data
+         * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name
+         * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary
+         * @return the cube texture
+         */
+        function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError, format, prefiltered, forcedExtension, createPolynomials) {
             if (extensions === void 0) { extensions = null; }
             if (noMipmap === void 0) { noMipmap = false; }
             if (files === void 0) { files = null; }
@@ -63513,6 +63560,7 @@ var BABYLON;
             if (format === void 0) { format = BABYLON.Engine.TEXTUREFORMAT_RGBA; }
             if (prefiltered === void 0) { prefiltered = false; }
             if (forcedExtension === void 0) { forcedExtension = null; }
+            if (createPolynomials === void 0) { createPolynomials = false; }
             var _this = _super.call(this, scene) || this;
             _this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
             /**
@@ -63529,6 +63577,7 @@ var BABYLON;
             _this._prefiltered = prefiltered;
             _this.isCube = true;
             _this._textureMatrix = BABYLON.Matrix.Identity();
+            _this._createPolynomials = createPolynomials;
             if (prefiltered) {
                 _this.gammaSpace = false;
             }
@@ -63554,7 +63603,7 @@ var BABYLON;
             if (!_this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                     if (prefiltered) {
-                        _this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, _this.lodGenerationScale, _this.lodGenerationOffset, onLoad, onError, format, forcedExtension);
+                        _this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, _this.lodGenerationScale, _this.lodGenerationOffset, onLoad, onError, format, forcedExtension, _this._createPolynomials);
                     }
                     else {
                         _this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension);
@@ -63619,9 +63668,18 @@ var BABYLON;
             files.forEach(function (url) { return rootUrlKey += url; });
             return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);
         };
-        CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension) {
+        /**
+         * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.
+         * @param url defines the url of the prefiltered texture
+         * @param scene defines the scene the texture is attached to
+         * @param forcedExtension defines the extension of the file if different from the url
+         * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary
+         * @return the prefiltered texture
+         */
+        CubeTexture.CreateFromPrefilteredData = function (url, scene, forcedExtension, createPolynomials) {
             if (forcedExtension === void 0) { forcedExtension = null; }
-            return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension);
+            if (createPolynomials === void 0) { createPolynomials = true; }
+            return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);
         };
         // Methods
         CubeTexture.prototype.delayLoad = function () {
@@ -63636,7 +63694,7 @@ var BABYLON;
             this._texture = this._getFromCache(this.url, this._noMipmap);
             if (!this._texture) {
                 if (this._prefiltered) {
-                    this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, undefined, undefined, this._format);
+                    this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, undefined, undefined, this._format, undefined, this._createPolynomials);
                 }
                 else {
                     this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, undefined, undefined, this._format);
@@ -82873,8 +82931,21 @@ var BABYLON;
         };
         PhysicsImpostor.prototype.unregisterOnPhysicsCollide = function (collideAgainst, func) {
             var collidedAgainstList = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];
-            var index = this._onPhysicsCollideCallbacks.indexOf({ callback: func, otherImpostors: collidedAgainstList });
-            if (index > -1) {
+            var index = -1;
+            var found = this._onPhysicsCollideCallbacks.some(function (cbDef, idx) {
+                if (cbDef.callback === func && cbDef.otherImpostors.length === collidedAgainstList.length) {
+                    // chcek the arrays match
+                    var sameList = cbDef.otherImpostors.every(function (impostor) {
+                        return collidedAgainstList.indexOf(impostor) > -1;
+                    });
+                    if (sameList) {
+                        index = idx;
+                    }
+                    return sameList;
+                }
+                return false;
+            });
+            if (found) {
                 this._onPhysicsCollideCallbacks.splice(index, 1);
             }
             else {

+ 2 - 24
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
-  "errors": 4313,
+  "errors": 4309,
   "babylon.typedoc.json": {
-    "errors": 4313,
+    "errors": 4309,
     "Animatable": {
       "Class": {
         "Comments": {
@@ -4721,28 +4721,6 @@
             }
           }
         },
-        "CreateFromPrefilteredData": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "url": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "scene": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "forcedExtension": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "Parse": {
           "Comments": {
             "MissingText": true

+ 4 - 0
dist/preview release/viewer/babylon.viewer.d.ts

@@ -1081,6 +1081,7 @@ declare module BabylonViewer {
             bllomThreshold?: number;
             hdr?: boolean;
             samples?: number;
+            glowLayerEnabled?: boolean;
     }
     export interface IModelConfiguration {
             id?: string;
@@ -1207,6 +1208,9 @@ declare module BabylonViewer {
             environmentTexture?: string;
             colorGrading?: IColorGradingConfiguration;
             environmentRotationY?: number;
+            /**
+                * Deprecated, please use default rendering pipeline
+                */
             glow?: boolean | BABYLON.IGlowLayerOptions;
             disableHdr?: boolean;
             renderInBackground?: boolean;

Разлика између датотеке није приказан због своје велике величине
+ 56 - 56
dist/preview release/viewer/babylon.viewer.js


Разлика између датотеке није приказан због своје велике величине
+ 246 - 123
dist/preview release/viewer/babylon.viewer.max.js


+ 4 - 0
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -1081,6 +1081,7 @@ declare module 'babylonjs-viewer/configuration/configuration' {
             bllomThreshold?: number;
             hdr?: boolean;
             samples?: number;
+            glowLayerEnabled?: boolean;
     }
     export interface IModelConfiguration {
             id?: string;
@@ -1207,6 +1208,9 @@ declare module 'babylonjs-viewer/configuration/configuration' {
             environmentTexture?: string;
             colorGrading?: IColorGradingConfiguration;
             environmentRotationY?: number;
+            /**
+                * Deprecated, please use default rendering pipeline
+                */
             glow?: boolean | IGlowLayerOptions;
             disableHdr?: boolean;
             renderInBackground?: boolean;

+ 2 - 0
dist/preview release/what's new.md

@@ -9,6 +9,8 @@
 - Add the choice of [forming a closed loop](http://doc.babylonjs.com/how_to/how_to_use_curve3#catmull-rom-spline) to the catamull-rom-spline curve3 ([johnk](https://github.com/babylonjsguide))
 - Add support for specifying the center of rotation to textures ([bghgary](http://www.github.com/bghgary))
 - Add webVR support for Oculus Go ([TrevorDev](https://github.com/TrevorDev))
+- Add ability to not generate polynomials harmonics upon prefiltered texture creation ([sebavan](http://www.github.com/sebavan))
+- Add predicate function to customize the list of mesh included in the computation of bounding vectors in the ```getHierarchyBoundingVectors``` method ([sebavan](http://www.github.com/sebavan))
 
 ### glTF Loader
 

+ 8 - 3
src/Engine/babylon.engine.ts

@@ -5351,11 +5351,13 @@
          * @param onError defines an optional callback raised if there is an issue to load the texture
          * @param format defines the format of the data
          * @param forcedExtension defines the extension to use to pick the right loader
+         * @param createPolynomials defines wheter or not to create polynomails harmonics for the texture
          * @returns the cube texture as an InternalTexture
          */
         public createPrefilteredCubeTexture(rootUrl: string, scene: Nullable<Scene>, scale: number, offset: number,
             onLoad: Nullable<(internalTexture: Nullable<InternalTexture>) => void> = null,
-            onError: Nullable<(message?: string, exception?: any) => void> = null, format?: number, forcedExtension: any = null): InternalTexture {
+            onError: Nullable<(message?: string, exception?: any) => void> = null, format?: number, forcedExtension: any = null,
+            createPolynomials: boolean = true): InternalTexture {
             var callback = (loadData: any) => {
                 if (!loadData) {
                     if (onLoad) {
@@ -5365,7 +5367,10 @@
                 }
 
                 let texture = loadData.texture as InternalTexture;
-                if(loadData.info.sphericalPolynomial){
+                if (!createPolynomials) {
+                    texture._sphericalPolynomial = new BABYLON.SphericalPolynomial();
+                }
+                else if(loadData.info.sphericalPolynomial){
                     texture._sphericalPolynomial = loadData.info.sphericalPolynomial;
                 }
                 texture._dataSource = InternalTexture.DATASOURCE_CUBEPREFILTERED;
@@ -5440,7 +5445,7 @@
                 }
             };
 
-            return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, true);
+            return this.createCubeTexture(rootUrl, scene, null, false, callback, onError, format, forcedExtension, createPolynomials);
         }
 
         /**

+ 32 - 5
src/Materials/Textures/babylon.cubeTexture.ts

@@ -54,6 +54,7 @@
         private _textureMatrix: Matrix;
         private _format: number;
         private _prefiltered: boolean;
+        private _createPolynomials: boolean;
 
         public static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean) {
             let rootUrlKey = "";
@@ -63,12 +64,37 @@
             return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);
         }
 
-        public static CreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null) {
-            return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension);
+        /**
+         * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.
+         * @param url defines the url of the prefiltered texture
+         * @param scene defines the scene the texture is attached to
+         * @param forcedExtension defines the extension of the file if different from the url
+         * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary
+         * @return the prefiltered texture
+         */
+        public static CreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null, createPolynomials: boolean = true) {
+            return new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);
         }
 
+        /**
+         * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well
+         * as prefiltered data.
+         * @param rootUrl defines the url of the texture or the root name of the six images
+         * @param scene defines the scene the texture is attached to
+         * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...
+         * @param noMipmap defines if mipmaps should be created or not
+         * @param files defines the six files to load for the different faces
+         * @param onLoad defines a callback triggered at the end of the file load if no errors occured
+         * @param onError defines a callback triggered in case of error during load
+         * @param format defines the internal format to use for the texture once loaded
+         * @param prefiltered defines whether or not the texture is created from prefiltered data
+         * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name
+         * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary
+         * @return the cube texture
+         */
         constructor(rootUrl: string, scene: Scene, extensions: Nullable<string[]> = null, noMipmap: boolean = false, files: Nullable<string[]> = null,
-            onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, format: number = Engine.TEXTUREFORMAT_RGBA, prefiltered = false, forcedExtension: any = null) {
+            onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, format: number = Engine.TEXTUREFORMAT_RGBA, prefiltered = false, 
+            forcedExtension: any = null, createPolynomials: boolean = false) {
             super(scene);
 
             this.name = rootUrl;
@@ -79,6 +105,7 @@
             this._prefiltered = prefiltered;
             this.isCube = true;
             this._textureMatrix = Matrix.Identity();
+            this._createPolynomials = createPolynomials;
             if (prefiltered) {
                 this.gammaSpace = false;
             }
@@ -113,7 +140,7 @@
             if (!this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                     if (prefiltered) {
-                        this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, this.lodGenerationScale, this.lodGenerationOffset, onLoad, onError, format, forcedExtension);
+                        this._texture = scene.getEngine().createPrefilteredCubeTexture(rootUrl, scene, this.lodGenerationScale, this.lodGenerationOffset, onLoad, onError, format, forcedExtension, this._createPolynomials);
                     }
                     else {
                         this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, this._format, forcedExtension);
@@ -146,7 +173,7 @@
 
             if (!this._texture) {
                 if (this._prefiltered) {
-                    this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, undefined, undefined, this._format);
+                    this._texture = scene.getEngine().createPrefilteredCubeTexture(this.url, scene, this.lodGenerationScale, this.lodGenerationOffset, undefined, undefined, this._format, undefined, this._createPolynomials);
                 }
                 else {
                     this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, undefined, undefined, this._format);

+ 1 - 0
src/Materials/Textures/babylon.internalTexture.ts

@@ -353,6 +353,7 @@ module BABYLON {
 
                         this.isReady = true;
                     }, null, this.format, this._extension);
+                    proxy._sphericalPolynomial = this._sphericalPolynomial;
                     return;
             }
         }

+ 7 - 2
src/Mesh/babylon.abstractMesh.ts

@@ -1056,9 +1056,10 @@
         /**
          * Return the minimum and maximum world vectors of the entire hierarchy under current mesh
          * @param includeDescendants Include bounding info from descendants as well (true by default)
+         * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors
          * @returns the new bounding vectors
          */
-        public getHierarchyBoundingVectors(includeDescendants = true): { min: Vector3, max: Vector3 } {
+        public getHierarchyBoundingVectors(includeDescendants = true, predicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null): { min: Vector3, max: Vector3 } {
             // Ensures that all world matrix will be recomputed.
             this.getScene().incrementRenderId();
 
@@ -1081,9 +1082,13 @@
 
                 for (var descendant of descendants) {
                     let childMesh = <AbstractMesh>descendant;
-
                     childMesh.computeWorldMatrix(true);
 
+                    // Filters meshes based on custom predicate function.
+                    if (predicate && !predicate(childMesh)) {
+                        continue;
+                    }
+
                     //make sure we have the needed params to get mix and max
                     if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {
                         continue;