@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.
1,221 lines • 109 kB
TypeScript
import type { Nullable } from "./types.js";
import type { IAnimatable } from "./Animations/animatable.interface.js";
import { Observable } from "./Misc/observable.js";
import type { ISmartArrayLike } from "./Misc/smartArray.js";
import { SmartArrayNoDuplicate, SmartArray } from "./Misc/smartArray.js";
import type { Vector2, Vector4 } from "./Maths/math.vector.js";
import { Vector3, Matrix } from "./Maths/math.vector.js";
import type { IParticleSystem } from "./Particles/IParticleSystem.js";
import { ImageProcessingConfiguration } from "./Materials/imageProcessingConfiguration.js";
import { UniformBuffer } from "./Materials/uniformBuffer.js";
import { PickingInfo } from "./Collisions/pickingInfo.js";
import type { ICollisionCoordinator } from "./Collisions/collisionCoordinator.js";
import type { PointerEventTypes, PointerInfoPre, PointerInfo } from "./Events/pointerEvents.js";
import type { KeyboardInfoPre, KeyboardInfo } from "./Events/keyboardEvents.js";
import { PostProcessManager } from "./PostProcesses/postProcessManager.js";
import type { IOfflineProvider } from "./Offline/IOfflineProvider.js";
import type { RenderingGroupInfo, IRenderingManagerAutoClearSetup } from "./Rendering/renderingManager.js";
import { RenderingManager } from "./Rendering/renderingManager.js";
import type { ISceneComponent, ISceneSerializableComponent, SimpleStageAction, RenderTargetsStageAction, RenderTargetStageAction, MeshStageAction, EvaluateSubMeshStageAction, PreActiveMeshStageAction, CameraStageAction, RenderingGroupStageAction, RenderingMeshStageAction, PointerMoveStageAction, PointerUpDownStageAction, CameraStageFrameBufferAction } from "./sceneComponent.js";
import { Stage } from "./sceneComponent.js";
import type { AbstractActionManager } from "./Actions/abstractActionManager.js";
import type { WebRequest } from "./Misc/webRequest.js";
import { InputManager } from "./Inputs/scene.inputManager.js";
import { PerfCounter } from "./Misc/perfCounter.js";
import type { IFileRequest } from "./Misc/fileRequest.js";
import { Color4, Color3 } from "./Maths/math.color.js";
import type { Plane } from "./Maths/math.plane.js";
import type { LoadFileError, RequestFileError, ReadFileError } from "./Misc/fileTools.js";
import type { IClipPlanesHolder } from "./Misc/interfaces/iClipPlanesHolder.js";
import type { IPointerEvent } from "./Events/deviceInputEvents.js";
import type { AnimationPropertiesOverride } from "./Animations/animationPropertiesOverride.js";
import type { AnimationGroup } from "./Animations/animationGroup.js";
import type { Skeleton } from "./Bones/skeleton.js";
import type { Bone } from "./Bones/bone.js";
import type { Camera } from "./Cameras/camera.js";
import type { Collider } from "./Collisions/collider.js";
import type { Ray, MeshPredicate, TrianglePickingPredicate } from "./Culling/ray.core.js";
import type { Light } from "./Lights/light.js";
import type { PerformanceViewerCollector } from "./Misc/PerformanceViewer/performanceViewerCollector.js";
import type { MorphTarget } from "./Morph/morphTarget.js";
import type { MorphTargetManager } from "./Morph/morphTargetManager.js";
import type { PostProcess } from "./PostProcesses/postProcess.js";
import type { Material } from "./Materials/material.js";
import type { BaseTexture } from "./Materials/Textures/baseTexture.js";
import type { Geometry } from "./Meshes/geometry.js";
import type { TransformNode } from "./Meshes/transformNode.js";
import type { AbstractMesh } from "./Meshes/abstractMesh.js";
import type { MultiMaterial } from "./Materials/multiMaterial.js";
import type { Effect } from "./Materials/effect.js";
import type { RenderTargetTexture } from "./Materials/Textures/renderTargetTexture.js";
import type { SubMesh } from "./Meshes/subMesh.js";
import type { Node } from "./node.js";
import type { Animation } from "./Animations/animation.js";
import type { Animatable } from "./Animations/animatable.core.js";
import type { AbstractEngine } from "./Engines/abstractEngine.js";
import type { FrameGraph } from "./FrameGraph/frameGraph.js";
import type { IAssetContainer } from "./IAssetContainer.js";
import type { EffectLayer } from "./Layers/effectLayer.js";
import type { Sound } from "./Audio/sound.js";
import type { Layer } from "./Layers/layer.js";
import type { LensFlareSystem } from "./LensFlares/lensFlareSystem.js";
import type { ProceduralTexture } from "./Materials/Textures/Procedurals/proceduralTexture.js";
/**
* 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 declare 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 declare 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.
* @deprecated
*/
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 used by deterministic lock step
* @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep
* @param newStepId defines the step Id
*/
setStepId(newStepId: number): void;
/**
* Gets the step Id used by deterministic lock step
* @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep
* @returns the step Id
*/
getStepId(): number;
/**
* Gets the internal step used by deterministic lock step
* @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep
* @returns the internal step
*/
getInternalStep(): number;
private _fogEnabled;
/**
* Gets or sets a boolean indicating if fog is enabled on this scene
* @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog
* (Default is true)
*/
set fogEnabled(value: boolean);
get fogEnabled(): boolean;
private _fogMode;
/**
* Gets or sets the fog mode to use
* @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog
* | mode | value |
* | --- | --- |
* | FOGMODE_NONE | 0 |
* | FOGMODE_EXP | 1 |
* | FOGMODE_EXP2 | 2 |
* | FOGMODE_LINEAR | 3 |
*/
set fogMode(value: number);
get fogMode(): number;
/**
* Gets or sets the fog color to use
* @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog
* (Default is Color3(0.2, 0.2, 0.3))
*/
fogColor: Color3;
/**
* Gets or sets the fog density to use
* @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog
* (Default is 0.1)
*/
fogDensity: number;
/**
* Gets or sets the fog start distance to use
* @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog
* (Default is 0)
*/
fogStart: number;
/**
* Gets or sets the fog end distance to use
* @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog
* (Default is 1000)
*/
fogEnd: number;
/**
* Flag indicating that the frame buffer binding is handled by another component
*/
get prePass(): boolean;
/**
* Flag indicating if we need to store previous matrices when rendering
*/
needsPreviousWorldMatrices: boolean;
private _shadowsEnabled;
/**
* Gets or sets a boolean indicating if shadows are enabled on this scene
*/
set shadowsEnabled(value: boolean);
get shadowsEnabled(): boolean;
private _lightsEnabled;
/**
* Gets or sets a boolean indicating if lights are enabled on this scene
*/
set lightsEnabled(value: boolean);
get lightsEnabled(): boolean;
private _activeCameras;
private _unObserveActiveCameras;
/** All of the active cameras added to this scene. */
get activeCameras(): Nullable<Camera[]>;
set activeCameras(cameras: Nullable<Camera[]>);
/** @internal */
_activeCamera: Nullable<Camera>;
/** Gets or sets the current active camera */
get activeCamera(): Nullable<Camera>;
set activeCamera(value: Nullable<Camera>);
/** @internal */
get _hasDefaultMaterial(): boolean;
private _defaultMaterial;
/** The default material used on meshes when no material is affected */
get defaultMaterial(): Material;
/** The default material used on meshes when no material is affected */
set defaultMaterial(value: Material);
private _texturesEnabled;
/**
* Gets or sets a boolean indicating if textures are enabled on this scene
*/
set texturesEnabled(value: boolean);
get texturesEnabled(): boolean;
private _frameGraph;
private _currentCustomRenderFunction?;
/**
* Gets or sets the frame graph used to render the scene. If set, the scene will use the frame graph to render the scene instead of the default render loop.
*/
get frameGraph(): Nullable<FrameGraph>;
set frameGraph(value: Nullable<FrameGraph>);
/**
* List of frame graphs associated with the scene
*/
frameGraphs: FrameGraph[];
/**
* Gets or sets a boolean indicating if physic engines are enabled on this scene
*/
physicsEnabled: boolean;
/**
* Gets or sets a boolean indicating if particles are enabled on this scene
*/
particlesEnabled: boolean;
/**
* Gets or sets a boolean indicating if sprites are enabled on this scene
*/
spritesEnabled: boolean;
private _skeletonsEnabled;
/**
* Gets or sets a boolean indicating if skeletons are enabled on this scene
*/
set skeletonsEnabled(value: boolean);
get skeletonsEnabled(): boolean;
/**
* Gets or sets a boolean indicating if lens flares are enabled on this scene
*/
lensFlaresEnabled: boolean;
/**
* Gets or sets a boolean indicating if collisions are enabled on this scene
* @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions
*/
collisionsEnabled: boolean;
private _collisionCoordinator;
/** @internal */
get collisionCoordinator(): ICollisionCoordinator;
/**
* Defines the gravity applied to this scene (used only for collisions)
* @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions
*/
gravity: Vector3;
/**
* Gets or sets a boolean indicating if postprocesses are enabled on this scene
*/
postProcessesEnabled: boolean;
/**
* Gets the current postprocess manager
*/
postProcessManager: PostProcessManager;
/**
* Gets or sets a boolean indicating if render targets are enabled on this scene
*/
renderTargetsEnabled: boolean;
/**
* Gets or sets a boolean indicating if next render targets must be dumped as image for debugging purposes
* We recommend not using it and instead rely on Spector.js: http://spector.babylonjs.com
*/
dumpNextRenderTargets: boolean;
/**
* The list of user defined render targets added to the scene
*/
customRenderTargets: RenderTargetTexture[];
/**
* Defines if texture loading must be delayed
* If true, textures will only be loaded when they need to be rendered
*/
useDelayedTextureLoading: boolean;
/**
* Gets the list of meshes imported to the scene through SceneLoader
*/
importedMeshesFiles: string[];
/**
* Gets or sets a boolean indicating if probes are enabled on this scene
*/
probesEnabled: boolean;
/**
* Gets or sets the current offline provider to use to store scene data
* @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimizeCached
*/
offlineProvider: IOfflineProvider;
/**
* Gets or sets the action manager associated with the scene
* @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
*/
actionManager: AbstractActionManager;
private _meshesForIntersections;
/**
* Gets or sets a boolean indicating if procedural textures are enabled on this scene
*/
proceduralTexturesEnabled: boolean;
private _engine;
private _totalVertices;
/** @internal */
_activeIndices: PerfCounter;
/** @internal */
_activeParticles: PerfCounter;
/** @internal */
_activeBones: PerfCounter;
private _animationRatio;
/** @internal */
_animationTimeLast: number;
/** @internal */
_animationTime: number;
/**
* Gets or sets a general scale for animation speed
* @see https://www.babylonjs-playground.com/#IBU2W7#3
*/
animationTimeScale: number;
/** @internal */
_cachedMaterial: Nullable<Material>;
/** @internal */
_cachedEffect: Nullable<Effect>;
/** @internal */
_cachedVisibility: Nullable<number>;
private _renderId;
private _frameId;
private _executeWhenReadyTimeoutId;
private _intermediateRendering;
private _defaultFrameBufferCleared;
private _viewUpdateFlag;
private _projectionUpdateFlag;
/** @internal */
_toBeDisposed: Nullable<IDisposable>[];
private _activeRequests;
/** @internal */
_pendingData: any[];
private _isDisposed;
/**
* Gets or sets a boolean indicating that all submeshes of active meshes must be rendered
* Use this boolean to avoid computing frustum clipping on submeshes (This could help when you are CPU bound)
*/
dispatchAllSubMeshesOfActiveMeshes: boolean;
private _activeMeshes;
private _processedMaterials;
private _renderTargets;
private _materialsRenderTargets;
/** @internal */
_activeParticleSystems: SmartArray<IParticleSystem>;
private _activeSkeletons;
private _softwareSkinnedMeshes;
private _renderingManager;
/**
* Gets the scene's rendering manager
*/
get renderingManager(): RenderingManager;
/** @internal */
_activeAnimatables: Animatable[];
private _transformMatrix;
private _sceneUbo;
/** @internal */
_viewMatrix: Matrix;
/** @internal */
_projectionMatrix: Matrix;
/** @internal */
_forcedViewPosition: Nullable<Vector3>;
/** @internal */
_frustumPlanes: Plane[];
/**
* Gets the list of frustum planes (built from the active camera)
*/
get frustumPlanes(): Plane[];
/**
* Gets or sets a boolean indicating if lights must be sorted by priority (off by default)
* This is useful if there are more lights that the maximum simulteanous authorized
*/
requireLightSorting: boolean;
/** @internal */
readonly useMaterialMeshMap: boolean;
/** @internal */
readonly useClonedMeshMap: boolean;
private _externalData;
private _uid;
/**
* @internal
* Backing store of defined scene components.
*/
_components: ISceneComponent[];
/**
* @internal
* Backing store of defined scene components.
*/
_serializableComponents: ISceneSerializableComponent[];
/**
* List of components to register on the next registration step.
*/
private _transientComponents;
/**
* Registers the transient components if needed.
*/
private _registerTransientComponents;
/**
* @internal
* Add a component to the scene.
* Note that the ccomponent could be registered on th next frame if this is called after
* the register component stage.
* @param component Defines the component to add to the scene
*/
_addComponent(component: ISceneComponent): void;
/**
* @internal
* Gets a component from the scene.
* @param name defines the name of the component to retrieve
* @returns the component or null if not present
*/
_getComponent(name: string): Nullable<ISceneComponent>;
/**
* @internal
* Defines the actions happening before camera updates.
*/
_beforeCameraUpdateStage: Stage<SimpleStageAction>;
/**
* @internal
* Defines the actions happening before clear the canvas.
*/
_beforeClearStage: Stage<SimpleStageAction>;
/**
* @internal
* Defines the actions happening before clear the canvas.
*/
_beforeRenderTargetClearStage: Stage<RenderTargetStageAction>;
/**
* @internal
* Defines the actions when collecting render targets for the frame.
*/
_gatherRenderTargetsStage: Stage<RenderTargetsStageAction>;
/**
* @internal
* Defines the actions happening for one camera in the frame.
*/
_gatherActiveCameraRenderTargetsStage: Stage<RenderTargetsStageAction>;
/**
* @internal
* Defines the actions happening during the per mesh ready checks.
*/
_isReadyForMeshStage: Stage<MeshStageAction>;
/**
* @internal
* Defines the actions happening before evaluate active mesh checks.
*/
_beforeEvaluateActiveMeshStage: Stage<SimpleStageAction>;
/**
* @internal
* Defines the actions happening during the evaluate sub mesh checks.
*/
_evaluateSubMeshStage: Stage<EvaluateSubMeshStageAction>;
/**
* @internal
* Defines the actions happening during the active mesh stage.
*/
_preActiveMeshStage: Stage<PreActiveMeshStageAction>;
/**
* @internal
* Defines the actions happening during the per camera render target step.
*/
_cameraDrawRenderTargetStage: Stage<CameraStageFrameBufferAction>;
/**
* @internal
* Defines the actions happening just before the active camera is drawing.
*/
_beforeCameraDrawStage: Stage<CameraStageAction>;
/**
* @internal
* Defines the actions happening just before a render target is drawing.
*/
_beforeRenderTargetDrawStage: Stage<RenderTargetStageAction>;
/**
* @internal
* Defines the actions happening just before a rendering group is drawing.
*/
_beforeRenderingGroupDrawStage: Stage<RenderingGroupStageAction>;
/**
* @internal
* Defines the actions happening just before a mesh is drawing.
*/
_beforeRenderingMeshStage: Stage<RenderingMeshStageAction>;
/**
* @internal
* Defines the actions happening just after a mesh has been drawn.
*/
_afterRenderingMeshStage: Stage<RenderingMeshStageAction>;
/**
* @internal
* Defines the actions happening just after a rendering group has been drawn.
*/
_afterRenderingGroupDrawStage: Stage<RenderingGroupStageAction>;
/**
* @internal
* Defines the actions happening just after the active camera has been drawn.
*/
_afterCameraDrawStage: Stage<CameraStageAction>;
/**
* @internal
* Defines the actions happening just after the post processing
*/
_afterCameraPostProcessStage: Stage<CameraStageAction>;
/**
* @internal
* Defines the actions happening just after a render target has been drawn.
*/
_afterRenderTargetDrawStage: Stage<RenderTargetStageAction>;
/**
* Defines the actions happening just after the post processing on a render target
*/
_afterRenderTargetPostProcessStage: Stage<RenderTargetStageAction>;
/**
* @internal
* Defines the actions happening just after rendering all cameras and computing intersections.
*/
_afterRenderStage: Stage<SimpleStageAction>;
/**
* @internal
* Defines the actions happening when a pointer move event happens.
*/
_pointerMoveStage: Stage<PointerMoveStageAction>;
/**
* @internal
* Defines the actions happening when a pointer down event happens.
*/
_pointerDownStage: Sta