UNPKG

babylonjs

Version:

* We recommend using the [Core ES6-supported version](https://www.npmjs.com/package/@babylonjs/core);

1,126 lines (1,121 loc) 6.11 MB
declare module BABYLON { /** Alias type for value that can be null */ export type Nullable<T> = T | null; /** * Alias type for number that are floats */ export type float = number; /** * Alias type for number that are doubles. */ export type double = number; /** * Alias type for number that are integer */ export type int = number; /** * Empty */ export type Empty = []; /** * Removes the first element of T and shifts */ export type Shift<T> = T extends unknown[] ? (((...x: T) => void) extends (h: any, ...t: infer I) => void ? I : []) : unknown; /** * Gets the first element of T */ export type First<T> = T extends unknown[] ? (((...x: T) => void) extends (h: infer I, ...t: any) => void ? I : []) : never; /** * Inserts A into T at the start of T */ export type Unshift<T, A> = T extends unknown[] ? (((h: A, ...t: T) => void) extends (...i: infer I) => void ? I : unknown) : never; /** * Removes the last element of T */ export type Pop<T> = T extends unknown[] ? (((...x: T) => void) extends (...i: [...infer I, any]) => void ? I : unknown) : never; /** * Gets the last element of T */ export type Last<T> = T extends unknown[] ? (((...x: T) => void) extends (...i: [...infer H, infer I]) => void ? I : unknown) : never; /** * Appends A to T */ export type Push<T, A> = T extends unknown[] ? (((...a: [...T, A]) => void) extends (...i: infer I) => void ? I : unknown) : never; /** * Concats A and B */ export type Concat<A, B> = { 0: A; 1: Concat<Unshift<A, 0>, Shift<B>>; }[Empty extends B ? 0 : 1]; /** * Extracts from A what is not B * * @remarks * It does not remove duplicates (so Remove\<[0, 0, 0], [0, 0]\> yields [0]). This is intended and necessary behavior. */ export type Remove<A, B> = { 0: A; 1: Remove<Shift<A>, Shift<B>>; }[Empty extends B ? 0 : 1]; /** * The length of T */ export type Length<T> = T extends { length: number; } ? T["length"] : never; type _FromLength<N extends number, R = Empty> = { 0: R; 1: _FromLength<N, Unshift<R, 0>>; }[Length<R> extends N ? 0 : 1]; /** * Creates a tuple of length N */ export type FromLength<N extends number> = _FromLength<N>; /** * Increments N */ export type Increment<N extends number> = Length<Unshift<_FromLength<N>, 0>>; /** * Decrements N */ export type Decrement<N extends number> = Length<Shift<_FromLength<N>>>; /** * Gets the sum of A and B */ export type Add<A extends number, B extends number> = Length<Concat<_FromLength<A>, _FromLength<B>>>; /** * Subtracts B from A */ export type Subtract<A extends number, B extends number> = Length<Remove<_FromLength<A>, _FromLength<B>>>; /** * Gets the type of an array's members */ export type Member<T, D = null> = D extends 0 ? T : T extends (infer U)[] ? Member<U, D extends number ? Decrement<D> : null> : T; /** * Flattens an array */ export type FlattenArray<A extends unknown[], D = null> = A extends (infer U)[] ? Member<Exclude<U, A>, D>[] : A extends unknown[] ? { [K in keyof A]: Member<A[K], D>; } : A; /** * Whether T is a tuple */ export type IsTuple<T> = T extends [] ? false : T extends [infer Head, ...infer Rest] ? true : false; /** * Flattens a tuple */ export type FlattenTuple<A extends unknown[]> = A extends [infer U, ...infer Rest] ? (U extends unknown[] ? [...U, ...FlattenTuple<Rest>] : [U, ...FlattenTuple<Rest>]) : []; /** * Flattens an array or tuple */ export type Flatten<A extends unknown[]> = IsTuple<A> extends true ? FlattenTuple<A> : FlattenArray<A>; type _Tuple<T, N extends number, R extends unknown[] = Empty> = R["length"] extends N ? R : _Tuple<T, N, [T, ...R]>; /** * Creates a tuple of T with length N */ export type Tuple<T, N extends number> = _Tuple<T, N>; /** Alias type for number array or Float32Array */ export type FloatArray = number[] | Float32Array; /** Alias type for number array or Float32Array or Int32Array or Uint32Array or Uint16Array */ export type IndicesArray = number[] | Int32Array | Uint32Array | Uint16Array; /** * Alias type for all TypedArrays */ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; /** * Alias for types that can be used by a Buffer or VertexBuffer. */ export type DataArray = number[] | ArrayBuffer | ArrayBufferView; /** * Alias type for primitive types */ type Primitive = undefined | null | boolean | string | number | Function | Element; /** * Type modifier to make all the properties of an object Readonly */ export type Immutable<T> = T extends Primitive ? T : T extends Array<infer U> ? ReadonlyArray<U> : DeepImmutable<T>; /** * Type modifier to make all the properties of an object Readonly recursively */ export type DeepImmutable<T> = T extends Primitive ? T : T extends Array<infer U> ? DeepImmutableArray<U> : DeepImmutableObject<T>; /** * Type modifier to make all the properties of an object NonNullable */ export type NonNullableFields<T> = { [P in keyof T]: NonNullable<T[P]>; }; /** * Type modifier to make all the properties of an object Writable (remove "readonly") */ export type WritableObject<T> = { -readonly [P in keyof T]: T[P]; }; /** * Type modifier to make object properties readonly. */ export type DeepImmutableObject<T> = { readonly [K in keyof T]: DeepImmutable<T[K]>; }; /** @internal */ interface DeepImmutableArray<T> extends ReadonlyArray<DeepImmutable<T>> { } /** @internal */ export type Constructor<C extends new (...args: any[]) => any, I extends InstanceType<C> = InstanceType<C>> = { new (...args: ConstructorParameters<C>): I; }; /** * Alias type for image sources */ export type ImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas; /** * Type for typed array like objects */ export interface TypedArrayLike extends ArrayBufferView { /** * The size in bytes of the array. */ readonly length: number; [n: number]: number; } /** * Interface for a constructor of a TypedArray. */ export interface TypedArrayConstructor<T extends TypedArray = TypedArray> { new (length: number): T; new (elements: Iterable<number>): T; new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): T; /** * The size in bytes of each element in the array. */ readonly BYTES_PER_ELEMENT: number; } /** * Groups all the scene component constants in one place to ease maintenance. * @internal */ export class SceneComponentConstants { static readonly NAME_EFFECTLAYER = "EffectLayer"; static readonly NAME_LAYER = "Layer"; static readonly NAME_LENSFLARESYSTEM = "LensFlareSystem"; static readonly NAME_BOUNDINGBOXRENDERER = "BoundingBoxRenderer"; static readonly NAME_PARTICLESYSTEM = "ParticleSystem"; static readonly NAME_GAMEPAD = "Gamepad"; static readonly NAME_SIMPLIFICATIONQUEUE = "SimplificationQueue"; static readonly NAME_GEOMETRYBUFFERRENDERER = "GeometryBufferRenderer"; static readonly NAME_PREPASSRENDERER = "PrePassRenderer"; static readonly NAME_DEPTHRENDERER = "DepthRenderer"; static readonly NAME_DEPTHPEELINGRENDERER = "DepthPeelingRenderer"; static readonly NAME_POSTPROCESSRENDERPIPELINEMANAGER = "PostProcessRenderPipelineManager"; static readonly NAME_SPRITE = "Sprite"; static readonly NAME_SUBSURFACE = "SubSurface"; static readonly NAME_OUTLINERENDERER = "Outline"; static readonly NAME_PROCEDURALTEXTURE = "ProceduralTexture"; static readonly NAME_SHADOWGENERATOR = "ShadowGenerator"; static readonly NAME_OCTREE = "Octree"; static readonly NAME_PHYSICSENGINE = "PhysicsEngine"; static readonly NAME_AUDIO = "Audio"; static readonly NAME_FLUIDRENDERER = "FluidRenderer"; static readonly NAME_IBLCDFGENERATOR = "iblCDFGenerator"; static readonly STEP_ISREADYFORMESH_EFFECTLAYER = 0; static readonly STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0; static readonly STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0; static readonly STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER = 0; static readonly STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1; static readonly STEP_BEFORECAMERADRAW_PREPASS = 0; static readonly STEP_BEFORECAMERADRAW_EFFECTLAYER = 1; static readonly STEP_BEFORECAMERADRAW_LAYER = 2; static readonly STEP_BEFORERENDERTARGETDRAW_PREPASS = 0; static readonly STEP_BEFORERENDERTARGETDRAW_LAYER = 1; static readonly STEP_BEFORERENDERINGMESH_PREPASS = 0; static readonly STEP_BEFORERENDERINGMESH_OUTLINE = 1; static readonly STEP_AFTERRENDERINGMESH_PREPASS = 0; static readonly STEP_AFTERRENDERINGMESH_OUTLINE = 1; static readonly STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0; static readonly STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1; static readonly STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0; static readonly STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0; static readonly STEP_BEFORECLEAR_PREPASS = 1; static readonly STEP_BEFORERENDERTARGETCLEAR_PREPASS = 0; static readonly STEP_AFTERRENDERTARGETDRAW_PREPASS = 0; static readonly STEP_AFTERRENDERTARGETDRAW_LAYER = 1; static readonly STEP_AFTERCAMERADRAW_PREPASS = 0; static readonly STEP_AFTERCAMERADRAW_EFFECTLAYER = 1; static readonly STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 2; static readonly STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 3; static readonly STEP_AFTERCAMERADRAW_LAYER = 4; static readonly STEP_AFTERCAMERADRAW_FLUIDRENDERER = 5; static readonly STEP_AFTERCAMERAPOSTPROCESS_LAYER = 0; static readonly STEP_AFTERRENDERTARGETPOSTPROCESS_LAYER = 0; static readonly STEP_AFTERRENDER_AUDIO = 0; static readonly STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 0; static readonly STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1; static readonly STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 2; static readonly STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3; static readonly STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0; static readonly STEP_GATHERACTIVECAMERARENDERTARGETS_FLUIDRENDERER = 1; static readonly STEP_POINTERMOVE_SPRITE = 0; static readonly STEP_POINTERDOWN_SPRITE = 0; static readonly STEP_POINTERUP_SPRITE = 0; } /** * This represents a scene component. * * This is used to decouple the dependency the scene is having on the different workloads like * layers, post processes... */ export interface ISceneComponent { /** * The name of the component. Each component must have a unique name. */ name: string; /** * The scene the component belongs to. */ scene: Scene; /** * Register the component to one instance of a scene. */ register(): void; /** * Rebuilds the elements related to this component in case of * context lost for instance. */ rebuild(): void; /** * Disposes the component and the associated resources. */ dispose(): void; } /** * This represents a SERIALIZABLE scene component. * * This extends Scene Component to add Serialization methods on top. */ export interface ISceneSerializableComponent extends ISceneComponent { /** * Adds all the elements from the container to the scene * @param container the container holding the elements */ addFromContainer(container: IAssetContainer): void; /** * Removes all the elements in the container from the scene * @param container contains the elements to remove * @param dispose if the removed element should be disposed (default: false) */ removeFromContainer(container: IAssetContainer, dispose?: boolean): void; /** * Serializes the component data to the specified json object * @param serializationObject The object to serialize to */ serialize(serializationObject: any): void; } /** * Strong typing of a Mesh related stage step action */ export type MeshStageAction = (mesh: AbstractMesh, hardwareInstancedRendering: boolean) => boolean; /** * Strong typing of a Evaluate Sub Mesh related stage step action */ export type EvaluateSubMeshStageAction = (mesh: AbstractMesh, subMesh: SubMesh) => void; /** * Strong typing of a pre active Mesh related stage step action */ export type PreActiveMeshStageAction = (mesh: AbstractMesh) => void; /** * Strong typing of a Camera related stage step action */ export type CameraStageAction = (camera: Camera) => void; /** * Strong typing of a Camera Frame buffer related stage step action */ export type CameraStageFrameBufferAction = (camera: Camera) => boolean; /** * Strong typing of a Render Target related stage step action */ export type RenderTargetStageAction = (renderTarget: RenderTargetTexture, faceIndex?: number, layer?: number) => void; /** * Strong typing of a RenderingGroup related stage step action */ export type RenderingGroupStageAction = (renderingGroupId: number) => void; /** * Strong typing of a Mesh Render related stage step action */ export type RenderingMeshStageAction = (mesh: Mesh, subMesh: SubMesh, batch: any, effect: Nullable<Effect>) => void; /** * Strong typing of a simple stage step action */ export type SimpleStageAction = () => void; /** * Strong typing of a render target action. */ export type RenderTargetsStageAction = (renderTargets: SmartArrayNoDuplicate<RenderTargetTexture>) => void; /** * Strong typing of a pointer move action. */ export type PointerMoveStageAction = (unTranslatedPointerX: number, unTranslatedPointerY: number, pickResult: Nullable<PickingInfo>, isMeshPicked: boolean, element: Nullable<HTMLElement>) => Nullable<PickingInfo>; /** * Strong typing of a pointer up/down action. */ export type PointerUpDownStageAction = (unTranslatedPointerX: number, unTranslatedPointerY: number, pickResult: Nullable<PickingInfo>, evt: IPointerEvent, doubleClick: boolean) => Nullable<PickingInfo>; /** * Representation of a stage in the scene (Basically a list of ordered steps) * @internal */ export class Stage<T extends Function> extends Array<{ index: number; component: ISceneComponent; action: T; }> { /** * Hide ctor from the rest of the world. * @param items The items to add. */ private constructor(); /** * Creates a new Stage. * @returns A new instance of a Stage */ static Create<T extends Function>(): Stage<T>; /** * Registers a step in an ordered way in the targeted stage. * @param index Defines the position to register the step in * @param component Defines the component attached to the step * @param action Defines the action to launch during the step */ registerStep(index: number, component: ISceneComponent, action: T): void; /** * Clears all the steps from the stage. */ clear(): void; } /** * Define an interface for all classes that will hold resources */ export interface IDisposable { /** * Releases all held resources */ dispose(): void; } /** Interface defining initialization parameters for Scene class */ export interface SceneOptions { /** * Defines that scene should keep up-to-date a map of geometry to enable fast look-up by uniqueId * It will improve performance when the number of geometries becomes important. */ useGeometryUniqueIdsMap?: boolean; /** * Defines that each material of the scene should keep up-to-date a map of referencing meshes for fast disposing * It will improve performance when the number of mesh becomes important, but might consume a bit more memory */ useMaterialMeshMap?: boolean; /** * Defines that each mesh of the scene should keep up-to-date a map of referencing cloned meshes for fast disposing * It will improve performance when the number of mesh becomes important, but might consume a bit more memory */ useClonedMeshMap?: boolean; /** Defines if the creation of the scene should impact the engine (Eg. UtilityLayer's scene) */ virtual?: boolean; } /** * Define how the scene should favor performance over ease of use */ export enum ScenePerformancePriority { /** Default mode. No change. Performance will be treated as less important than backward compatibility */ BackwardCompatible = 0, /** Some performance options will be turned on trying to strike a balance between perf and ease of use */ Intermediate = 1, /** Performance will be top priority */ Aggressive = 2 } /** * Represents a scene to be rendered by the engine. * @see https://doc.babylonjs.com/features/featuresDeepDive/scene */ export class Scene implements IAnimatable, IClipPlanesHolder, IAssetContainer { /** The fog is deactivated */ static readonly FOGMODE_NONE: number; /** The fog density is following an exponential function */ static readonly FOGMODE_EXP: number; /** The fog density is following an exponential function faster than FOGMODE_EXP */ static readonly FOGMODE_EXP2: number; /** The fog density is following a linear function. */ static readonly FOGMODE_LINEAR: number; /** * Gets or sets the minimum deltatime when deterministic lock step is enabled * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep */ static MinDeltaTime: number; /** * Gets or sets the maximum deltatime when deterministic lock step is enabled * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep */ static MaxDeltaTime: number; /** * Factory used to create the default material. * @param scene The scene to create the material for * @returns The default material */ static DefaultMaterialFactory(scene: Scene): Material; private static readonly _OriginalDefaultMaterialFactory; /** * Factory used to create the a collision coordinator. * @returns The collision coordinator */ static CollisionCoordinatorFactory(): ICollisionCoordinator; /** @internal */ _tempPickingRay: Nullable<Ray>; /** @internal */ _cachedRayForTransform: Ray; /** @internal */ _pickWithRayInverseMatrix: Matrix; /** @internal */ _inputManager: InputManager; /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */ cameraToUseForPointers: Nullable<Camera>; /** @internal */ readonly _isScene = true; /** @internal */ _blockEntityCollection: boolean; /** * Gets or sets a boolean that indicates if the scene must clear the render buffer before rendering a frame */ autoClear: boolean; /** * Gets or sets a boolean that indicates if the scene must clear the depth and stencil buffers before rendering a frame */ autoClearDepthAndStencil: boolean; private _clearColor; /** * Observable triggered when the performance priority is changed */ onClearColorChangedObservable: Observable<Color4>; /** * Defines the color used to clear the render buffer (Default is (0.2, 0.2, 0.3, 1.0)) */ get clearColor(): Color4; set clearColor(value: Color4); /** * Defines the color used to simulate the ambient color (Default is (0, 0, 0)) */ ambientColor: Color3; /** * This is use to store the default BRDF lookup for PBR materials in your scene. * It should only be one of the following (if not the default embedded one): * * For uncorrelated BRDF (pbr.brdf.useEnergyConservation = false and pbr.brdf.useSmithVisibilityHeightCorrelated = false) : https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds * * For correlated BRDF (pbr.brdf.useEnergyConservation = false and pbr.brdf.useSmithVisibilityHeightCorrelated = true) : https://assets.babylonjs.com/environments/correlatedBRDF.dds * * For correlated multi scattering BRDF (pbr.brdf.useEnergyConservation = true and pbr.brdf.useSmithVisibilityHeightCorrelated = true) : https://assets.babylonjs.com/environments/correlatedMSBRDF.dds * The material properties need to be setup according to the type of texture in use. */ environmentBRDFTexture: BaseTexture; /** * Intensity of the environment (i.e. all indirect lighting) in all pbr material. * This dims or reinforces the indirect lighting overall (reflection and diffuse). * As in the majority of the scene they are the same (exception for multi room and so on), * this is easier to reference from here than from all the materials. * Note that this is more of a debugging parameter and is not physically accurate. * If you want to modify the intensity of the IBL texture, you should update iblIntensity instead. */ environmentIntensity: number; /** * Overall intensity of the IBL texture. * This value is multiplied with the reflectionTexture.level value to calculate the final IBL intensity. */ iblIntensity: number; /** @internal */ protected _imageProcessingConfiguration: ImageProcessingConfiguration; /** * Default image processing configuration used either in the rendering * Forward main pass or through the imageProcessingPostProcess if present. * As in the majority of the scene they are the same (exception for multi camera), * this is easier to reference from here than from all the materials and post process. * * No setter as we it is a shared configuration, you can set the values instead. */ get imageProcessingConfiguration(): ImageProcessingConfiguration; private _performancePriority; /** * Observable triggered when the performance priority is changed */ onScenePerformancePriorityChangedObservable: Observable<ScenePerformancePriority>; /** * Gets or sets a value indicating how to treat performance relatively to ease of use and backward compatibility */ get performancePriority(): ScenePerformancePriority; set performancePriority(value: ScenePerformancePriority); private _forceWireframe; /** * Gets or sets a boolean indicating if all rendering must be done in wireframe */ set forceWireframe(value: boolean); get forceWireframe(): boolean; private _skipFrustumClipping; /** * Gets or sets a boolean indicating if we should skip the frustum clipping part of the active meshes selection */ set skipFrustumClipping(value: boolean); get skipFrustumClipping(): boolean; private _forcePointsCloud; /** * Gets or sets a boolean indicating if all rendering must be done in point cloud */ set forcePointsCloud(value: boolean); get forcePointsCloud(): boolean; /** * Gets or sets the active clipplane 1 */ clipPlane: Nullable<Plane>; /** * Gets or sets the active clipplane 2 */ clipPlane2: Nullable<Plane>; /** * Gets or sets the active clipplane 3 */ clipPlane3: Nullable<Plane>; /** * Gets or sets the active clipplane 4 */ clipPlane4: Nullable<Plane>; /** * Gets or sets the active clipplane 5 */ clipPlane5: Nullable<Plane>; /** * Gets or sets the active clipplane 6 */ clipPlane6: Nullable<Plane>; /** * Gets the list of root nodes (ie. nodes with no parent) */ rootNodes: Node[]; /** All of the cameras added to this scene * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras */ cameras: Camera[]; /** * All of the lights added to this scene * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction */ lights: Light[]; /** * All of the (abstract) meshes added to this scene */ meshes: AbstractMesh[]; /** * The list of skeletons added to the scene * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons */ skeletons: Skeleton[]; /** * All of the particle systems added to this scene * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro */ particleSystems: IParticleSystem[]; /** * Gets the current delta time used by animation engine */ deltaTime: number; /** * Gets a list of Animations associated with the scene */ animations: Animation[]; /** * All of the animation groups added to this scene * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations */ animationGroups: AnimationGroup[]; /** * All of the multi-materials added to this scene * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials */ multiMaterials: MultiMaterial[]; /** * All of the materials added to this scene * In the context of a Scene, it is not supposed to be modified manually. * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods. * Note also that the order of the Material within the array is not significant and might change. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction */ materials: Material[]; /** * The list of morph target managers added to the scene * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph */ morphTargetManagers: MorphTargetManager[]; /** * The list of geometries used in the scene. */ geometries: Geometry[]; /** * All of the transform nodes added to this scene * In the context of a Scene, it is not supposed to be modified manually. * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods. * Note also that the order of the TransformNode within the array is not significant and might change. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node */ transformNodes: TransformNode[]; /** * ActionManagers available on the scene. */ actionManagers: AbstractActionManager[]; /** * Textures to keep. */ textures: BaseTexture[]; /** @internal */ protected _environmentTexture: Nullable<BaseTexture>; /** * Texture used in all pbr material as the reflection texture. * As in the majority of the scene they are the same (exception for multi room and so on), * this is easier to reference from here than from all the materials. */ get environmentTexture(): Nullable<BaseTexture>; /** * Texture used in all pbr material as the reflection texture. * As in the majority of the scene they are the same (exception for multi room and so on), * this is easier to set here than in all the materials. */ set environmentTexture(value: Nullable<BaseTexture>); /** * The list of postprocesses added to the scene */ postProcesses: PostProcess[]; /** * The list of effect layers (highlights/glow) added to the scene * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/highlightLayer * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer */ effectLayers: Array<EffectLayer>; /** * The list of sounds used in the scene. */ sounds: Nullable<Array<Sound>>; /** * The list of layers (background and foreground) of the scene */ layers: Array<Layer>; /** * The list of lens flare system added to the scene * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare */ lensFlareSystems: Array<LensFlareSystem>; /** * The list of procedural textures added to the scene * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/proceduralTextures */ proceduralTextures: Array<ProceduralTexture>; /** * @returns all meshes, lights, cameras, transformNodes and bones */ getNodes(): Array<Node>; /** * Gets or sets a boolean indicating if animations are enabled */ animationsEnabled: boolean; private _animationPropertiesOverride; /** * Gets or sets the animation properties override */ get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride>; set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>); /** * Gets or sets a boolean indicating if a constant deltatime has to be used * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate */ useConstantAnimationDeltaTime: boolean; /** * Gets or sets a boolean indicating if the scene must keep the meshUnderPointer property updated * Please note that it requires to run a ray cast through the scene on every frame */ constantlyUpdateMeshUnderPointer: boolean; /** * Defines the HTML cursor to use when hovering over interactive elements */ hoverCursor: string; /** * Defines the HTML default cursor to use (empty by default) */ defaultCursor: string; /** * Defines whether cursors are handled by the scene. */ doNotHandleCursors: boolean; /** * This is used to call preventDefault() on pointer down * in order to block unwanted artifacts like system double clicks */ preventDefaultOnPointerDown: boolean; /** * This is used to call preventDefault() on pointer up * in order to block unwanted artifacts like system double clicks */ preventDefaultOnPointerUp: boolean; /** * Gets or sets user defined metadata */ metadata: any; /** * For internal use only. Please do not use. */ reservedDataStore: any; /** * Gets the name of the plugin used to load this scene (null by default) */ loadingPluginName: string; /** * Use this array to add regular expressions used to disable offline support for specific urls */ disableOfflineSupportExceptionRules: RegExp[]; /** * An event triggered when the scene is disposed. */ onDisposeObservable: Observable<Scene>; private _onDisposeObserver; /** Sets a function to be executed when this scene is disposed. */ set onDispose(callback: () => void); /** * An event triggered before rendering the scene (right after animations and physics) */ onBeforeRenderObservable: Observable<Scene>; private _onBeforeRenderObserver; /** Sets a function to be executed before rendering this scene */ set beforeRender(callback: Nullable<() => void>); /** * An event triggered after rendering the scene */ onAfterRenderObservable: Observable<Scene>; /** * An event triggered after rendering the scene for an active camera (When scene.render is called this will be called after each camera) * This is triggered for each "sub" camera in a Camera Rig unlike onAfterCameraRenderObservable */ onAfterRenderCameraObservable: Observable<Camera>; private _onAfterRenderObserver; /** Sets a function to be executed after rendering this scene */ set afterRender(callback: Nullable<() => void>); /** * An event triggered before animating the scene */ onBeforeAnimationsObservable: Observable<Scene>; /** * An event triggered after animations processing */ onAfterAnimationsObservable: Observable<Scene>; /** * An event triggered before draw calls are ready to be sent */ onBeforeDrawPhaseObservable: Observable<Scene>; /** * An event triggered after draw calls have been sent */ onAfterDrawPhaseObservable: Observable<Scene>; /** * An event triggered when the scene is ready */ onReadyObservable: Observable<Scene>; /** * An event triggered before rendering a camera */ onBeforeCameraRenderObservable: Observable<Camera>; private _onBeforeCameraRenderObserver; /** Sets a function to be executed before rendering a camera*/ set beforeCameraRender(callback: () => void); /** * An event triggered after rendering a camera * This is triggered for the full rig Camera only unlike onAfterRenderCameraObservable */ onAfterCameraRenderObservable: Observable<Camera>; private _onAfterCameraRenderObserver; /** Sets a function to be executed after rendering a camera*/ set afterCameraRender(callback: () => void); /** * An event triggered when active meshes evaluation is about to start */ onBeforeActiveMeshesEvaluationObservable: Observable<Scene>; /** * An event triggered when active meshes evaluation is done */ onAfterActiveMeshesEvaluationObservable: Observable<Scene>; /** * An event triggered when particles rendering is about to start * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well) */ onBeforeParticlesRenderingObservable: Observable<Scene>; /** * An event triggered when particles rendering is done * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well) */ onAfterParticlesRenderingObservable: Observable<Scene>; /** * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed */ onDataLoadedObservable: Observable<Scene>; /** * An event triggered when a camera is created */ onNewCameraAddedObservable: Observable<Camera>; /** * An event triggered when a camera is removed */ onCameraRemovedObservable: Observable<Camera>; /** * An event triggered when a light is created */ onNewLightAddedObservable: Observable<Light>; /** * An event triggered when a light is removed */ onLightRemovedObservable: Observable<Light>; /** * An event triggered when a geometry is created */ onNewGeometryAddedObservable: Observable<Geometry>; /** * An event triggered when a geometry is removed */ onGeometryRemovedObservable: Observable<Geometry>; /** * An event triggered when a transform node is created */ onNewTransformNodeAddedObservable: Observable<TransformNode>; /** * An event triggered when a transform node is removed */ onTransformNodeRemovedObservable: Observable<TransformNode>; /** * An event triggered when a mesh is created */ onNewMeshAddedObservable: Observable<AbstractMesh>; /** * An event triggered when a mesh is removed */ onMeshRemovedObservable: Observable<AbstractMesh>; /** * An event triggered when a skeleton is created */ onNewSkeletonAddedObservable: Observable<Skeleton>; /** * An event triggered when a skeleton is removed */ onSkeletonRemovedObservable: Observable<Skeleton>; /** * An event triggered when a material is created */ onNewMaterialAddedObservable: Observable<Material>; /** * An event triggered when a multi material is created */ onNewMultiMaterialAddedObservable: Observable<MultiMaterial>; /** * An event triggered when a material is removed */ onMaterialRemovedObservable: Observable<Material>; /** * An event triggered when a multi material is removed */ onMultiMaterialRemovedObservable: Observable<MultiMaterial>; /** * An event triggered when a texture is created */ onNewTextureAddedObservable: Observable<BaseTexture>; /** * An event triggered when a texture is removed */ onTextureRemovedObservable: Observable<BaseTexture>; /** * An event triggered when render targets are about to be rendered * Can happen multiple times per frame. */ onBeforeRenderTargetsRenderObservable: Observable<Scene>; /** * An event triggered when render targets were rendered. * Can happen multiple times per frame. */ onAfterRenderTargetsRenderObservable: Observable<Scene>; /** * An event triggered before calculating deterministic simulation step */ onBeforeStepObservable: Observable<Scene>; /** * An event triggered after calculating deterministic simulation step */ onAfterStepObservable: Observable<Scene>; /** * An event triggered when the activeCamera property is updated */ onActiveCameraChanged: Observable<Scene>; /** * An event triggered when the activeCameras property is updated */ onActiveCamerasChanged: Observable<Scene>; /** * This Observable will be triggered before rendering each renderingGroup of each rendered camera. * The RenderingGroupInfo class contains all the information about the context in which the observable is called * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3) */ onBeforeRenderingGroupObservable: Observable<RenderingGroupInfo>; /** * This Observable will be triggered after rendering each renderingGroup of each rendered camera. * The RenderingGroupInfo class contains all the information about the context in which the observable is called * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3) */ onAfterRenderingGroupObservable: Observable<RenderingGroupInfo>; /** * This Observable will when a mesh has been imported into the scene. */ onMeshImportedObservable: Observable<AbstractMesh>; /** * This Observable will when an animation file has been imported into the scene. */ onAnimationFileImportedObservable: Observable<Scene>; /** * An event triggered when the environmentTexture is changed. */ onEnvironmentTextureChangedObservable: Observable<Nullable<BaseTexture>>; /** * An event triggered when the state of mesh under pointer, for a specific pointerId, changes. */ onMeshUnderPointerUpdatedObservable: Observable<{ mesh: Nullable<AbstractMesh>; pointerId: number; }>; /** * Gets or sets a user defined funtion to select LOD from a mesh and a camera. * By default this function is undefined and Babylon.js will select LOD based on distance to camera */ customLODSelector: (mesh: AbstractMesh, camera: Camera) => Nullable<AbstractMesh>; /** @internal */ _registeredForLateAnimationBindings: SmartArrayNoDuplicate<any>; private _pointerPickingConfiguration; /** * Gets or sets a predicate used to select candidate meshes for a pointer down event */ get pointerDownPredicate(): (Mesh: AbstractMesh) => boolean; set pointerDownPredicate(value: (Mesh: AbstractMesh) => boolean); /** * Gets or sets a predicate used to select candidate meshes for a pointer up event */ get pointerUpPredicate(): (Mesh: AbstractMesh) => boolean; set pointerUpPredicate(value: (Mesh: AbstractMesh) => boolean); /** * Gets or sets a predicate used to select candidate meshes for a pointer move event */ get pointerMovePredicate(): (Mesh: AbstractMesh) => boolean; set pointerMovePredicate(value: (Mesh: AbstractMesh) => boolean); /** * Gets or sets a predicate used to select candidate meshes for a pointer down event */ get pointerDownFastCheck(): boolean; set pointerDownFastCheck(value: boolean); /** * Gets or sets a predicate used to select candidate meshes for a pointer up event */ get pointerUpFastCheck(): boolean; set pointerUpFastCheck(value: boolean); /** * Gets or sets a predicate used to select candidate meshes for a pointer move event */ get pointerMoveFastCheck(): boolean; set pointerMoveFastCheck(value: boolean); /** * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer move event occurs. */ get skipPointerMovePicking(): boolean; set skipPointerMovePicking(value: boolean); /** * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer down event occurs. */ get skipPointerDownPicking(): boolean; set skipPointerDownPicking(value: boolean); /** * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer up event occurs. Off by default. */ get skipPointerUpPicking(): boolean; set skipPointerUpPicking(value: boolean); /** Callback called when a pointer move is detected */ onPointerMove?: (evt: IPointerEvent, pickInfo: PickingInfo, type: PointerEventTypes) => void; /** Callback called when a pointer down is detected */ onPointerDown?: (evt: IPointerEvent, pickInfo: PickingInfo, type: PointerEventTypes) => void; /** Callback called when a pointer up is detected */ onPointerUp?: (evt: IPointerEvent, pickInfo: Nullable<PickingInfo>, type: PointerEventTypes) => void; /** Callback called when a pointer pick is detected */ onPointerPick?: (evt: IPointerEvent, pickInfo: PickingInfo) => void; /** * Gets or sets a predicate used to select candidate faces for a pointer move event */ pointerMoveTrianglePredicate: ((p0: Vector3, p1: Vector3, p2: Vector3, ray: Ray) => boolean) | undefined; /** * Gets or sets a predicate used to select candidate faces for a pointer down event */ pointerDownTrianglePredicate: ((p0: Vector3, p1: Vector3, p2: Vector3, ray: Ray) => boolean) | undefined; /** * Gets or sets a predicate used to select candidate faces for a pointer up event */ pointerUpTrianglePredicate: ((p0: Vector3, p1: Vector3, p2: Vector3, ray: Ray) => boolean) | undefined; /** * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance). * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true */ onPrePointerObservable: Observable<PointerInfoPre>; /** * Observable event triggered each time an input event is received from the rendering canvas */ onPointerObservable: Observable<PointerInfo>; /** * Gets the pointer coordinates without any translation (ie. straight out of the pointer event) */ get unTranslatedPointer(): Vector2; /** * Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels */ static get DragMovementThreshold(): number; static set DragMovementThreshold(value: number); /** * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms */ static get LongPressDelay(): number; static set LongPressDelay(value: number); /** * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms */ static get DoubleClickDelay(): number; static set DoubleClickDelay(value: number); /** If you need to check double click without raising a single click at first click, enable this flag */ static get ExclusiveDoubleClickMode(): boolean; static set ExclusiveDoubleClickMode(value: boolean); /** * Bind the current view position to an effect. * @param effect The effect to be bound * @param variableName name of the shader variable that will hold the eye position * @param isVector3 true to indicates that variableName is a Vector3 and not a Vector4 * @returns the computed eye position */ bindEyePosition(effect: Nullable<Effect>, variableName?: string, isVector3?: boolean): Vector4; /** * Update the scene ubo before it can be used in rendering processing * @returns the scene UniformBuffer */ finalizeSceneUbo(): UniformBuffer; /** @internal */ _mirroredCameraPosition: Nullable<Vector3>; /** * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl() * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true */ onPreKeyboardObservable: Observable<KeyboardInfoPre>; /** * Observable event triggered each time an keyboard event is received from the hosting window */ onKeyboardObservable: Observable<KeyboardInfo>; private _useRightHandedSystem; /** * Gets or sets a boolean indicating if the scene must use right-handed coordinates system */ set useRightHandedSystem(value: boolean); get useRightHandedSystem(): boolean; private _timeAccumulator; private _currentStepId; private _currentInternalStep; /** * Sets the step Id us