@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
120 lines (119 loc) • 5.21 kB
TypeScript
import { RenderTargetTexture } from "../Materials/Textures/renderTargetTexture.js";
import { Vector3 } from "../Maths/math.vector.js";
import type { AbstractMesh } from "../Meshes/abstractMesh.js";
import type { Nullable } from "../types.js";
import { Scene } from "../scene.js";
import type { IAssetContainer } from "../IAssetContainer.js";
declare module "../scene.js" {
interface Scene {
/**
* The list of reflection probes added to the scene
* @see https://doc.babylonjs.com/features/featuresDeepDive/environment/reflectionProbes
*/
reflectionProbes: Array<ReflectionProbe>;
/**
* Removes the given reflection probe from this scene.
* @param toRemove The reflection probe to remove
* @returns The index of the removed reflection probe
*/
removeReflectionProbe(toRemove: ReflectionProbe): number;
/**
* Adds the given reflection probe to this scene.
* @param newReflectionProbe The reflection probe to add
*/
addReflectionProbe(newReflectionProbe: ReflectionProbe): void;
}
}
/**
* Class used to generate realtime reflection / refraction cube textures
* @see https://doc.babylonjs.com/features/featuresDeepDive/environment/reflectionProbes
*/
export declare class ReflectionProbe {
/** defines the name of the probe */
name: string;
private _scene;
private _renderTargetTexture;
private _projectionMatrix;
private _viewMatrix;
private _target;
private _add;
private _attachedMesh;
private _invertYAxis;
private _sceneUBOs;
private _currentSceneUBO;
/** Gets or sets probe position (center of the cube map) */
position: Vector3;
/**
* Gets or sets an object used to store user defined information for the reflection probe.
*/
metadata: any;
/** @internal */
_parentContainer: Nullable<IAssetContainer>;
/**
* 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 (float data) should be used to store colors (false by default)
* @param linearSpace defines if the probe should be generated in linear space or not (false by default)
*/
constructor(
/** defines the name of the probe */
name: string, size: number, scene: Scene, generateMipMaps?: boolean, useFloat?: boolean, linearSpace?: boolean);
/** Gets or sets the number of samples to use for multi-sampling (0 by default). Required WebGL2 */
get samples(): number;
set samples(value: number);
/** Gets or sets the refresh rate to use (on every frame by default) */
get refreshRate(): number;
set refreshRate(value: number);
/**
* Gets the hosting scene
* @returns a Scene
*/
getScene(): Scene;
/** Gets the internal CubeTexture used to render to */
get cubeTexture(): RenderTargetTexture;
/** Gets or sets the list of meshes to render */
get renderList(): Nullable<AbstractMesh[]>;
set renderList(value: Nullable<AbstractMesh[]>);
/**
* Attach the probe to a specific mesh (Rendering will be done from attached mesh's position)
* @param mesh defines the mesh to attach to
*/
attachToMesh(mesh: Nullable<AbstractMesh>): void;
/**
* 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.
*/
setRenderingAutoClearDepthStencil(renderingGroupId: number, autoClearDepthStencil: boolean): void;
/**
* Clean all associated resources
*/
dispose(): void;
/**
* Converts the reflection probe information to a readable string for debug purpose.
* @param fullDetails Supports for multiple levels of logging within scene loading
* @returns the human readable reflection probe info
*/
toString(fullDetails?: boolean): string;
/**
* Get the class name of the refection probe.
* @returns "ReflectionProbe"
*/
getClassName(): string;
/**
* Serialize the reflection probe to a JSON representation we can easily use in the respective Parse function.
* @returns The JSON representation of the texture
*/
serialize(): any;
/**
* Parse the JSON representation of a reflection probe in order to recreate the reflection probe in the given scene.
* @param parsedReflectionProbe Define the JSON representation of the reflection probe
* @param scene Define the scene the parsed reflection probe should be instantiated in
* @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies
* @returns The parsed reflection probe if successful
*/
static Parse(parsedReflectionProbe: any, scene: Scene, rootUrl: string): Nullable<ReflectionProbe>;
}