|
@@ -101514,19 +101514,35 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ /**
|
|
|
+ * Class used to generate realtime reflection / refraction cube textures
|
|
|
+ * @see http://doc.babylonjs.com/how_to/how_to_use_reflection_probes
|
|
|
+ */
|
|
|
var ReflectionProbe = /** @class */ (function () {
|
|
|
- function ReflectionProbe(name, size, scene, generateMipMaps) {
|
|
|
+ /**
|
|
|
+ * Creates a new reflection probe
|
|
|
+ * @param name defines the name of the probe
|
|
|
+ * @param size defines the texture resolution (for each face)
|
|
|
+ * @param scene defines the hosting scene
|
|
|
+ * @param generateMipMaps defines if mip maps should be generated automatically (true by default)
|
|
|
+ * @param useFloat defines if HDR data (flaot data) should be used to store colors (false by default)
|
|
|
+ */
|
|
|
+ function ReflectionProbe(
|
|
|
+ /** defines the name of the probe */
|
|
|
+ name, size, scene, generateMipMaps, useFloat) {
|
|
|
if (generateMipMaps === void 0) { generateMipMaps = true; }
|
|
|
+ if (useFloat === void 0) { useFloat = false; }
|
|
|
var _this = this;
|
|
|
this.name = name;
|
|
|
this._viewMatrix = BABYLON.Matrix.Identity();
|
|
|
this._target = BABYLON.Vector3.Zero();
|
|
|
this._add = BABYLON.Vector3.Zero();
|
|
|
this._invertYAxis = false;
|
|
|
+ /** Gets or sets probe position (center of the cube map) */
|
|
|
this.position = BABYLON.Vector3.Zero();
|
|
|
this._scene = scene;
|
|
|
this._scene.reflectionProbes.push(this);
|
|
|
- this._renderTargetTexture = new BABYLON.RenderTargetTexture(name, size, scene, generateMipMaps, true, BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT, true);
|
|
|
+ this._renderTargetTexture = new BABYLON.RenderTargetTexture(name, size, scene, generateMipMaps, true, useFloat ? BABYLON.Engine.TEXTURETYPE_FLOAT : BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT, true);
|
|
|
this._renderTargetTexture.onBeforeRenderObservable.add(function (faceIndex) {
|
|
|
switch (faceIndex) {
|
|
|
case 0:
|
|
@@ -101565,6 +101581,7 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
Object.defineProperty(ReflectionProbe.prototype, "samples", {
|
|
|
+ /** Gets or sets the number of samples to use for multi-sampling (0 by default). Required WebGL2 */
|
|
|
get: function () {
|
|
|
return this._renderTargetTexture.samples;
|
|
|
},
|
|
@@ -101575,6 +101592,7 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(ReflectionProbe.prototype, "refreshRate", {
|
|
|
+ /** Gets or sets the refresh rate to use (on every frame by default) */
|
|
|
get: function () {
|
|
|
return this._renderTargetTexture.refreshRate;
|
|
|
},
|
|
@@ -101584,10 +101602,15 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ /**
|
|
|
+ * Gets the hosting scene
|
|
|
+ * @returns a Scene
|
|
|
+ */
|
|
|
ReflectionProbe.prototype.getScene = function () {
|
|
|
return this._scene;
|
|
|
};
|
|
|
Object.defineProperty(ReflectionProbe.prototype, "cubeTexture", {
|
|
|
+ /** Gets the internal CubeTexture used to render to */
|
|
|
get: function () {
|
|
|
return this._renderTargetTexture;
|
|
|
},
|
|
@@ -101595,24 +101618,31 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(ReflectionProbe.prototype, "renderList", {
|
|
|
+ /** Gets the list of meshes to render */
|
|
|
get: function () {
|
|
|
return this._renderTargetTexture.renderList;
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ /**
|
|
|
+ * Attach the probe to a specific mesh (Rendering will be done from attached mesh's position)
|
|
|
+ * @param mesh defines the mesh to attach to
|
|
|
+ */
|
|
|
ReflectionProbe.prototype.attachToMesh = function (mesh) {
|
|
|
this._attachedMesh = mesh;
|
|
|
};
|
|
|
/**
|
|
|
- * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
|
|
|
- *
|
|
|
+ * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups
|
|
|
* @param renderingGroupId The rendering group id corresponding to its index
|
|
|
* @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
|
|
|
*/
|
|
|
ReflectionProbe.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil) {
|
|
|
this._renderTargetTexture.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Clean all associated resources
|
|
|
+ */
|
|
|
ReflectionProbe.prototype.dispose = function () {
|
|
|
var index = this._scene.reflectionProbes.indexOf(this);
|
|
|
if (index !== -1) {
|