|
@@ -15580,13 +15580,15 @@ var BABYLON;
|
|
* @param onError defines an optional callback raised if there is an issue to load the texture
|
|
* @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 format defines the format of the data
|
|
* @param forcedExtension defines the extension to use to pick the right loader
|
|
* @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
|
|
* @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;
|
|
var _this = this;
|
|
if (onLoad === void 0) { onLoad = null; }
|
|
if (onLoad === void 0) { onLoad = null; }
|
|
if (onError === void 0) { onError = null; }
|
|
if (onError === void 0) { onError = null; }
|
|
if (forcedExtension === void 0) { forcedExtension = null; }
|
|
if (forcedExtension === void 0) { forcedExtension = null; }
|
|
|
|
+ if (createPolynomials === void 0) { createPolynomials = true; }
|
|
var callback = function (loadData) {
|
|
var callback = function (loadData) {
|
|
if (!loadData) {
|
|
if (!loadData) {
|
|
if (onLoad) {
|
|
if (onLoad) {
|
|
@@ -15595,7 +15597,10 @@ var BABYLON;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
var texture = loadData.texture;
|
|
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._sphericalPolynomial = loadData.info.sphericalPolynomial;
|
|
}
|
|
}
|
|
texture._dataSource = BABYLON.InternalTexture.DATASOURCE_CUBEPREFILTERED;
|
|
texture._dataSource = BABYLON.InternalTexture.DATASOURCE_CUBEPREFILTERED;
|
|
@@ -15654,7 +15659,7 @@ var BABYLON;
|
|
onLoad(texture);
|
|
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
|
|
* Creates a cube texture
|
|
@@ -20373,10 +20378,12 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* Return the minimum and maximum world vectors of the entire hierarchy under current mesh
|
|
* 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 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
|
|
* @returns the new bounding vectors
|
|
*/
|
|
*/
|
|
- AbstractMesh.prototype.getHierarchyBoundingVectors = function (includeDescendants) {
|
|
|
|
|
|
+ AbstractMesh.prototype.getHierarchyBoundingVectors = function (includeDescendants, predicate) {
|
|
if (includeDescendants === void 0) { includeDescendants = true; }
|
|
if (includeDescendants === void 0) { includeDescendants = true; }
|
|
|
|
+ if (predicate === void 0) { predicate = null; }
|
|
// Ensures that all world matrix will be recomputed.
|
|
// Ensures that all world matrix will be recomputed.
|
|
this.getScene().incrementRenderId();
|
|
this.getScene().incrementRenderId();
|
|
this.computeWorldMatrix(true);
|
|
this.computeWorldMatrix(true);
|
|
@@ -20397,6 +20404,10 @@ var BABYLON;
|
|
var descendant = descendants_1[_i];
|
|
var descendant = descendants_1[_i];
|
|
var childMesh = descendant;
|
|
var childMesh = descendant;
|
|
childMesh.computeWorldMatrix(true);
|
|
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
|
|
//make sure we have the needed params to get mix and max
|
|
if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {
|
|
if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {
|
|
continue;
|
|
continue;
|
|
@@ -30100,6 +30111,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
_this.isReady = true;
|
|
_this.isReady = true;
|
|
}, null, this.format, this._extension);
|
|
}, null, this.format, this._extension);
|
|
|
|
+ proxy._sphericalPolynomial = this._sphericalPolynomial;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -41920,6 +41932,25 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: 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", {
|
|
Object.defineProperty(ColorCurves.prototype, "highlightsHue", {
|
|
/**
|
|
/**
|
|
* Gets the highlights Hue value.
|
|
* Gets the highlights Hue value.
|
|
@@ -63537,7 +63568,23 @@ var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
var CubeTexture = /** @class */ (function (_super) {
|
|
var CubeTexture = /** @class */ (function (_super) {
|
|
__extends(CubeTexture, _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 (extensions === void 0) { extensions = null; }
|
|
if (noMipmap === void 0) { noMipmap = false; }
|
|
if (noMipmap === void 0) { noMipmap = false; }
|
|
if (files === void 0) { files = null; }
|
|
if (files === void 0) { files = null; }
|
|
@@ -63546,6 +63593,7 @@ var BABYLON;
|
|
if (format === void 0) { format = BABYLON.Engine.TEXTUREFORMAT_RGBA; }
|
|
if (format === void 0) { format = BABYLON.Engine.TEXTUREFORMAT_RGBA; }
|
|
if (prefiltered === void 0) { prefiltered = false; }
|
|
if (prefiltered === void 0) { prefiltered = false; }
|
|
if (forcedExtension === void 0) { forcedExtension = null; }
|
|
if (forcedExtension === void 0) { forcedExtension = null; }
|
|
|
|
+ if (createPolynomials === void 0) { createPolynomials = false; }
|
|
var _this = _super.call(this, scene) || this;
|
|
var _this = _super.call(this, scene) || this;
|
|
_this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
|
|
_this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
|
|
/**
|
|
/**
|
|
@@ -63562,6 +63610,7 @@ var BABYLON;
|
|
_this._prefiltered = prefiltered;
|
|
_this._prefiltered = prefiltered;
|
|
_this.isCube = true;
|
|
_this.isCube = true;
|
|
_this._textureMatrix = BABYLON.Matrix.Identity();
|
|
_this._textureMatrix = BABYLON.Matrix.Identity();
|
|
|
|
+ _this._createPolynomials = createPolynomials;
|
|
if (prefiltered) {
|
|
if (prefiltered) {
|
|
_this.gammaSpace = false;
|
|
_this.gammaSpace = false;
|
|
}
|
|
}
|
|
@@ -63587,7 +63636,7 @@ var BABYLON;
|
|
if (!_this._texture) {
|
|
if (!_this._texture) {
|
|
if (!scene.useDelayedTextureLoading) {
|
|
if (!scene.useDelayedTextureLoading) {
|
|
if (prefiltered) {
|
|
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 {
|
|
else {
|
|
_this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension);
|
|
_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; });
|
|
files.forEach(function (url) { return rootUrlKey += url; });
|
|
return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);
|
|
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; }
|
|
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
|
|
// Methods
|
|
CubeTexture.prototype.delayLoad = function () {
|
|
CubeTexture.prototype.delayLoad = function () {
|
|
@@ -63669,7 +63727,7 @@ var BABYLON;
|
|
this._texture = this._getFromCache(this.url, this._noMipmap);
|
|
this._texture = this._getFromCache(this.url, this._noMipmap);
|
|
if (!this._texture) {
|
|
if (!this._texture) {
|
|
if (this._prefiltered) {
|
|
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 {
|
|
else {
|
|
this._texture = scene.getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, undefined, undefined, this._format);
|
|
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) {
|
|
PhysicsImpostor.prototype.unregisterOnPhysicsCollide = function (collideAgainst, func) {
|
|
var collidedAgainstList = collideAgainst instanceof Array ? collideAgainst : [collideAgainst];
|
|
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);
|
|
this._onPhysicsCollideCallbacks.splice(index, 1);
|
|
}
|
|
}
|
|
else {
|
|
else {
|