7ef80d5f06b136dee38ad7d877651c6b99047307f348bfceec645a1fc1c124fc.json 500 KB

1
  1. {"ast":null,"code":"import { Tools } from \"./Misc/tools.js\";\nimport { PrecisionDate } from \"./Misc/precisionDate.js\";\nimport { Observable } from \"./Misc/observable.js\";\nimport { SmartArrayNoDuplicate, SmartArray } from \"./Misc/smartArray.js\";\nimport { StringDictionary } from \"./Misc/stringDictionary.js\";\nimport { Tags } from \"./Misc/tags.js\";\nimport { Vector3, Matrix, TmpVectors } from \"./Maths/math.vector.js\";\nimport { ImageProcessingConfiguration } from \"./Materials/imageProcessingConfiguration.js\";\nimport { UniformBuffer } from \"./Materials/uniformBuffer.js\";\nimport { PickingInfo } from \"./Collisions/pickingInfo.js\";\nimport { ActionEvent } from \"./Actions/actionEvent.js\";\nimport { PostProcessManager } from \"./PostProcesses/postProcessManager.js\";\nimport { RenderingManager } from \"./Rendering/renderingManager.js\";\nimport { Stage } from \"./sceneComponent.js\";\nimport { IsWindowObjectExist } from \"./Misc/domManagement.js\";\nimport { EngineStore } from \"./Engines/engineStore.js\";\nimport { _WarnImport } from \"./Misc/devTools.js\";\nimport { InputManager } from \"./Inputs/scene.inputManager.js\";\nimport { PerfCounter } from \"./Misc/perfCounter.js\";\nimport { Color4, Color3 } from \"./Maths/math.color.js\";\nimport { Frustum } from \"./Maths/math.frustum.js\";\nimport { UniqueIdGenerator } from \"./Misc/uniqueIdGenerator.js\";\nimport { ReadFile, RequestFile, LoadFile } from \"./Misc/fileTools.js\";\nimport { LightConstants } from \"./Lights/lightConstants.js\";\nimport { _ObserveArray } from \"./Misc/arrayTools.js\";\nimport { PointerPickingConfiguration } from \"./Inputs/pointerPickingConfiguration.js\";\nimport { Logger } from \"./Misc/logger.js\";\nimport { RegisterClass } from \"./Misc/typeStore.js\";\n/**\n * Define how the scene should favor performance over ease of use\n */\nexport var ScenePerformancePriority;\n(function (ScenePerformancePriority) {\n /** Default mode. No change. Performance will be treated as less important than backward compatibility */\n ScenePerformancePriority[ScenePerformancePriority[\"BackwardCompatible\"] = 0] = \"BackwardCompatible\";\n /** Some performance options will be turned on trying to strike a balance between perf and ease of use */\n ScenePerformancePriority[ScenePerformancePriority[\"Intermediate\"] = 1] = \"Intermediate\";\n /** Performance will be top priority */\n ScenePerformancePriority[ScenePerformancePriority[\"Aggressive\"] = 2] = \"Aggressive\";\n})(ScenePerformancePriority || (ScenePerformancePriority = {}));\n/**\n * Represents a scene to be rendered by the engine.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene\n */\nexport class Scene {\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Factory used to create the default material.\n * @param scene The scene to create the material for\n * @returns The default material\n */\n static DefaultMaterialFactory(scene) {\n throw _WarnImport(\"StandardMaterial\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Factory used to create the a collision coordinator.\n * @returns The collision coordinator\n */\n static CollisionCoordinatorFactory() {\n throw _WarnImport(\"DefaultCollisionCoordinator\");\n }\n /**\n * Defines the color used to clear the render buffer (Default is (0.2, 0.2, 0.3, 1.0))\n */\n get clearColor() {\n return this._clearColor;\n }\n set clearColor(value) {\n if (value !== this._clearColor) {\n this._clearColor = value;\n this.onClearColorChangedObservable.notifyObservers(this._clearColor);\n }\n }\n /**\n * Default image processing configuration used either in the rendering\n * Forward main pass or through the imageProcessingPostProcess if present.\n * As in the majority of the scene they are the same (exception for multi camera),\n * this is easier to reference from here than from all the materials and post process.\n *\n * No setter as we it is a shared configuration, you can set the values instead.\n */\n get imageProcessingConfiguration() {\n return this._imageProcessingConfiguration;\n }\n /**\n * Gets or sets a value indicating how to treat performance relatively to ease of use and backward compatibility\n */\n get performancePriority() {\n return this._performancePriority;\n }\n set performancePriority(value) {\n if (value === this._performancePriority) {\n return;\n }\n this._performancePriority = value;\n switch (value) {\n case 0 /* ScenePerformancePriority.BackwardCompatible */:\n this.skipFrustumClipping = false;\n this._renderingManager.maintainStateBetweenFrames = false;\n this.skipPointerMovePicking = false;\n this.autoClear = true;\n break;\n case 1 /* ScenePerformancePriority.Intermediate */:\n this.skipFrustumClipping = false;\n this._renderingManager.maintainStateBetweenFrames = false;\n this.skipPointerMovePicking = true;\n this.autoClear = false;\n break;\n case 2 /* ScenePerformancePriority.Aggressive */:\n this.skipFrustumClipping = true;\n this._renderingManager.maintainStateBetweenFrames = true;\n this.skipPointerMovePicking = true;\n this.autoClear = false;\n break;\n }\n this.onScenePerformancePriorityChangedObservable.notifyObservers(value);\n }\n /**\n * Gets or sets a boolean indicating if all rendering must be done in wireframe\n */\n set forceWireframe(value) {\n if (this._forceWireframe === value) {\n return;\n }\n this._forceWireframe = value;\n this.markAllMaterialsAsDirty(16);\n }\n get forceWireframe() {\n return this._forceWireframe;\n }\n /**\n * Gets or sets a boolean indicating if we should skip the frustum clipping part of the active meshes selection\n */\n set skipFrustumClipping(value) {\n if (this._skipFrustumClipping === value) {\n return;\n }\n this._skipFrustumClipping = value;\n }\n get skipFrustumClipping() {\n return this._skipFrustumClipping;\n }\n /**\n * Gets or sets a boolean indicating if all rendering must be done in point cloud\n */\n set forcePointsCloud(value) {\n if (this._forcePointsCloud === value) {\n return;\n }\n this._forcePointsCloud = value;\n this.markAllMaterialsAsDirty(16);\n }\n get forcePointsCloud() {\n return this._forcePointsCloud;\n }\n /**\n * Texture used in all pbr material as the reflection texture.\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to reference from here than from all the materials.\n */\n get environmentTexture() {\n return this._environmentTexture;\n }\n /**\n * Texture used in all pbr material as the reflection texture.\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to set here than in all the materials.\n */\n set environmentTexture(value) {\n if (this._environmentTexture === value) {\n return;\n }\n this._environmentTexture = value;\n this.markAllMaterialsAsDirty(1);\n }\n /**\n * @returns all meshes, lights, cameras, transformNodes and bones\n */\n getNodes() {\n let nodes = [];\n nodes = nodes.concat(this.meshes);\n nodes = nodes.concat(this.lights);\n nodes = nodes.concat(this.cameras);\n nodes = nodes.concat(this.transformNodes); // dummies\n this.skeletons.forEach(skeleton => nodes = nodes.concat(skeleton.bones));\n return nodes;\n }\n /**\n * Gets or sets the animation properties override\n */\n get animationPropertiesOverride() {\n return this._animationPropertiesOverride;\n }\n set animationPropertiesOverride(value) {\n this._animationPropertiesOverride = value;\n }\n /** Sets a function to be executed when this scene is disposed. */\n set onDispose(callback) {\n if (this._onDisposeObserver) {\n this.onDisposeObservable.remove(this._onDisposeObserver);\n }\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\n }\n /** Sets a function to be executed before rendering this scene */\n set beforeRender(callback) {\n if (this._onBeforeRenderObserver) {\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\n }\n if (callback) {\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\n }\n }\n /** Sets a function to be executed after rendering this scene */\n set afterRender(callback) {\n if (this._onAfterRenderObserver) {\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\n }\n if (callback) {\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\n }\n }\n /** Sets a function to be executed before rendering a camera*/\n set beforeCameraRender(callback) {\n if (this._onBeforeCameraRenderObserver) {\n this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\n }\n this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(callback);\n }\n /** Sets a function to be executed after rendering a camera*/\n set afterCameraRender(callback) {\n if (this._onAfterCameraRenderObserver) {\n this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\n }\n this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(callback);\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer down event\n */\n get pointerDownPredicate() {\n return this._pointerPickingConfiguration.pointerDownPredicate;\n }\n set pointerDownPredicate(value) {\n this._pointerPickingConfiguration.pointerDownPredicate = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer up event\n */\n get pointerUpPredicate() {\n return this._pointerPickingConfiguration.pointerUpPredicate;\n }\n set pointerUpPredicate(value) {\n this._pointerPickingConfiguration.pointerUpPredicate = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer move event\n */\n get pointerMovePredicate() {\n return this._pointerPickingConfiguration.pointerMovePredicate;\n }\n set pointerMovePredicate(value) {\n this._pointerPickingConfiguration.pointerMovePredicate = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer down event\n */\n get pointerDownFastCheck() {\n return this._pointerPickingConfiguration.pointerDownFastCheck;\n }\n set pointerDownFastCheck(value) {\n this._pointerPickingConfiguration.pointerDownFastCheck = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer up event\n */\n get pointerUpFastCheck() {\n return this._pointerPickingConfiguration.pointerUpFastCheck;\n }\n set pointerUpFastCheck(value) {\n this._pointerPickingConfiguration.pointerUpFastCheck = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer move event\n */\n get pointerMoveFastCheck() {\n return this._pointerPickingConfiguration.pointerMoveFastCheck;\n }\n set pointerMoveFastCheck(value) {\n this._pointerPickingConfiguration.pointerMoveFastCheck = value;\n }\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer move event occurs.\n */\n get skipPointerMovePicking() {\n return this._pointerPickingConfiguration.skipPointerMovePicking;\n }\n set skipPointerMovePicking(value) {\n this._pointerPickingConfiguration.skipPointerMovePicking = value;\n }\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer down event occurs.\n */\n get skipPointerDownPicking() {\n return this._pointerPickingConfiguration.skipPointerDownPicking;\n }\n set skipPointerDownPicking(value) {\n this._pointerPickingConfiguration.skipPointerDownPicking = value;\n }\n /**\n * 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.\n */\n get skipPointerUpPicking() {\n return this._pointerPickingConfiguration.skipPointerUpPicking;\n }\n set skipPointerUpPicking(value) {\n this._pointerPickingConfiguration.skipPointerUpPicking = value;\n }\n /**\n * Gets the pointer coordinates without any translation (ie. straight out of the pointer event)\n */\n get unTranslatedPointer() {\n return this._inputManager.unTranslatedPointer;\n }\n /**\n * Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels\n */\n static get DragMovementThreshold() {\n return InputManager.DragMovementThreshold;\n }\n static set DragMovementThreshold(value) {\n InputManager.DragMovementThreshold = value;\n }\n /**\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms\n */\n static get LongPressDelay() {\n return InputManager.LongPressDelay;\n }\n static set LongPressDelay(value) {\n InputManager.LongPressDelay = value;\n }\n /**\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms\n */\n static get DoubleClickDelay() {\n return InputManager.DoubleClickDelay;\n }\n static set DoubleClickDelay(value) {\n InputManager.DoubleClickDelay = value;\n }\n /** If you need to check double click without raising a single click at first click, enable this flag */\n static get ExclusiveDoubleClickMode() {\n return InputManager.ExclusiveDoubleClickMode;\n }\n static set ExclusiveDoubleClickMode(value) {\n InputManager.ExclusiveDoubleClickMode = value;\n }\n /**\n * Bind the current view position to an effect.\n * @param effect The effect to be bound\n * @param variableName name of the shader variable that will hold the eye position\n * @param isVector3 true to indicates that variableName is a Vector3 and not a Vector4\n * @returns the computed eye position\n */\n bindEyePosition(effect, variableName = \"vEyePosition\", isVector3 = false) {\n const eyePosition = this._forcedViewPosition ? this._forcedViewPosition : this._mirroredCameraPosition ? this._mirroredCameraPosition : this.activeCamera.globalPosition;\n const invertNormal = this.useRightHandedSystem === (this._mirroredCameraPosition != null);\n TmpVectors.Vector4[0].set(eyePosition.x, eyePosition.y, eyePosition.z, invertNormal ? -1 : 1);\n if (effect) {\n if (isVector3) {\n effect.setFloat3(variableName, TmpVectors.Vector4[0].x, TmpVectors.Vector4[0].y, TmpVectors.Vector4[0].z);\n } else {\n effect.setVector4(variableName, TmpVectors.Vector4[0]);\n }\n }\n return TmpVectors.Vector4[0];\n }\n /**\n * Update the scene ubo before it can be used in rendering processing\n * @returns the scene UniformBuffer\n */\n finalizeSceneUbo() {\n const ubo = this.getSceneUniformBuffer();\n const eyePosition = this.bindEyePosition(null);\n ubo.updateFloat4(\"vEyePosition\", eyePosition.x, eyePosition.y, eyePosition.z, eyePosition.w);\n ubo.update();\n return ubo;\n }\n /**\n * Gets or sets a boolean indicating if the scene must use right-handed coordinates system\n */\n set useRightHandedSystem(value) {\n if (this._useRightHandedSystem === value) {\n return;\n }\n this._useRightHandedSystem = value;\n this.markAllMaterialsAsDirty(16);\n }\n get useRightHandedSystem() {\n return this._useRightHandedSystem;\n }\n /**\n * Sets the step Id used by deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @param newStepId defines the step Id\n */\n setStepId(newStepId) {\n this._currentStepId = newStepId;\n }\n /**\n * Gets the step Id used by deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @returns the step Id\n */\n getStepId() {\n return this._currentStepId;\n }\n /**\n * Gets the internal step used by deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @returns the internal step\n */\n getInternalStep() {\n return this._currentInternalStep;\n }\n /**\n * Gets or sets a boolean indicating if fog is enabled on this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is true)\n */\n set fogEnabled(value) {\n if (this._fogEnabled === value) {\n return;\n }\n this._fogEnabled = value;\n this.markAllMaterialsAsDirty(16);\n }\n get fogEnabled() {\n return this._fogEnabled;\n }\n /**\n * Gets or sets the fog mode to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * | mode | value |\n * | --- | --- |\n * | FOGMODE_NONE | 0 |\n * | FOGMODE_EXP | 1 |\n * | FOGMODE_EXP2 | 2 |\n * | FOGMODE_LINEAR | 3 |\n */\n set fogMode(value) {\n if (this._fogMode === value) {\n return;\n }\n this._fogMode = value;\n this.markAllMaterialsAsDirty(16);\n }\n get fogMode() {\n return this._fogMode;\n }\n /**\n * Flag indicating that the frame buffer binding is handled by another component\n */\n get prePass() {\n return !!this.prePassRenderer && this.prePassRenderer.defaultRT.enabled;\n }\n /**\n * Gets or sets a boolean indicating if shadows are enabled on this scene\n */\n set shadowsEnabled(value) {\n if (this._shadowsEnabled === value) {\n return;\n }\n this._shadowsEnabled = value;\n this.markAllMaterialsAsDirty(2);\n }\n get shadowsEnabled() {\n return this._shadowsEnabled;\n }\n /**\n * Gets or sets a boolean indicating if lights are enabled on this scene\n */\n set lightsEnabled(value) {\n if (this._lightsEnabled === value) {\n return;\n }\n this._lightsEnabled = value;\n this.markAllMaterialsAsDirty(2);\n }\n get lightsEnabled() {\n return this._lightsEnabled;\n }\n /** All of the active cameras added to this scene. */\n get activeCameras() {\n return this._activeCameras;\n }\n set activeCameras(cameras) {\n if (this._unObserveActiveCameras) {\n this._unObserveActiveCameras();\n this._unObserveActiveCameras = null;\n }\n if (cameras) {\n this._unObserveActiveCameras = _ObserveArray(cameras, () => {\n this.onActiveCamerasChanged.notifyObservers(this);\n });\n }\n this._activeCameras = cameras;\n }\n /** Gets or sets the current active camera */\n get activeCamera() {\n return this._activeCamera;\n }\n set activeCamera(value) {\n if (value === this._activeCamera) {\n return;\n }\n this._activeCamera = value;\n this.onActiveCameraChanged.notifyObservers(this);\n }\n /** The default material used on meshes when no material is affected */\n get defaultMaterial() {\n if (!this._defaultMaterial) {\n this._defaultMaterial = Scene.DefaultMaterialFactory(this);\n }\n return this._defaultMaterial;\n }\n /** The default material used on meshes when no material is affected */\n set defaultMaterial(value) {\n this._defaultMaterial = value;\n }\n /**\n * Gets or sets a boolean indicating if textures are enabled on this scene\n */\n set texturesEnabled(value) {\n if (this._texturesEnabled === value) {\n return;\n }\n this._texturesEnabled = value;\n this.markAllMaterialsAsDirty(1);\n }\n get texturesEnabled() {\n return this._texturesEnabled;\n }\n /**\n * 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.\n */\n get frameGraph() {\n return this._frameGraph;\n }\n set frameGraph(value) {\n if (this._frameGraph) {\n this._frameGraph = value;\n if (!value) {\n this.customRenderFunction = this._currentCustomRenderFunction;\n }\n return;\n }\n this._frameGraph = value;\n if (value) {\n this._currentCustomRenderFunction = this.customRenderFunction;\n this.customRenderFunction = this._renderWithFrameGraph;\n }\n }\n /**\n * Gets or sets a boolean indicating if skeletons are enabled on this scene\n */\n set skeletonsEnabled(value) {\n if (this._skeletonsEnabled === value) {\n return;\n }\n this._skeletonsEnabled = value;\n this.markAllMaterialsAsDirty(8);\n }\n get skeletonsEnabled() {\n return this._skeletonsEnabled;\n }\n /** @internal */\n get collisionCoordinator() {\n if (!this._collisionCoordinator) {\n this._collisionCoordinator = Scene.CollisionCoordinatorFactory();\n this._collisionCoordinator.init(this);\n }\n return this._collisionCoordinator;\n }\n /**\n * Gets the scene's rendering manager\n */\n get renderingManager() {\n return this._renderingManager;\n }\n /**\n * Gets the list of frustum planes (built from the active camera)\n */\n get frustumPlanes() {\n return this._frustumPlanes;\n }\n /**\n * Registers the transient components if needed.\n */\n _registerTransientComponents() {\n // Register components that have been associated lately to the scene.\n if (this._transientComponents.length > 0) {\n for (const component of this._transientComponents) {\n component.register();\n }\n this._transientComponents.length = 0;\n }\n }\n /**\n * @internal\n * Add a component to the scene.\n * Note that the ccomponent could be registered on th next frame if this is called after\n * the register component stage.\n * @param component Defines the component to add to the scene\n */\n _addComponent(component) {\n this._components.push(component);\n this._transientComponents.push(component);\n const serializableComponent = component;\n if (serializableComponent.addFromContainer && serializableComponent.serialize) {\n this._serializableComponents.push(serializableComponent);\n }\n }\n /**\n * @internal\n * Gets a component from the scene.\n * @param name defines the name of the component to retrieve\n * @returns the component or null if not present\n */\n _getComponent(name) {\n for (const component of this._components) {\n if (component.name === name) {\n return component;\n }\n }\n return null;\n }\n /**\n * Creates a new Scene\n * @param engine defines the engine to use to render this scene\n * @param options defines the scene options\n */\n constructor(engine, options) {\n /** @internal */\n this._inputManager = new InputManager(this);\n /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */\n this.cameraToUseForPointers = null;\n /** @internal */\n this._isScene = true;\n /** @internal */\n this._blockEntityCollection = false;\n /**\n * Gets or sets a boolean that indicates if the scene must clear the render buffer before rendering a frame\n */\n this.autoClear = true;\n /**\n * Gets or sets a boolean that indicates if the scene must clear the depth and stencil buffers before rendering a frame\n */\n this.autoClearDepthAndStencil = true;\n this._clearColor = new Color4(0.2, 0.2, 0.3, 1.0);\n /**\n * Observable triggered when the performance priority is changed\n */\n this.onClearColorChangedObservable = new Observable();\n /**\n * Defines the color used to simulate the ambient color (Default is (0, 0, 0))\n */\n this.ambientColor = new Color3(0, 0, 0);\n /**\n * Intensity of the environment in all pbr material.\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to reference from here than from all the materials.\n */\n this.environmentIntensity = 1;\n this._performancePriority = 0 /* ScenePerformancePriority.BackwardCompatible */;\n /**\n * Observable triggered when the performance priority is changed\n */\n this.onScenePerformancePriorityChangedObservable = new Observable();\n this._forceWireframe = false;\n this._skipFrustumClipping = false;\n this._forcePointsCloud = false;\n /**\n * Gets the list of root nodes (ie. nodes with no parent)\n */\n this.rootNodes = [];\n /** All of the cameras added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\n */\n this.cameras = [];\n /**\n * All of the lights added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n */\n this.lights = [];\n /**\n * All of the (abstract) meshes added to this scene\n */\n this.meshes = [];\n /**\n * The list of skeletons added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\n */\n this.skeletons = [];\n /**\n * All of the particle systems added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\n */\n this.particleSystems = [];\n /**\n * Gets a list of Animations associated with the scene\n */\n this.animations = [];\n /**\n * All of the animation groups added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\n */\n this.animationGroups = [];\n /**\n * All of the multi-materials added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\n */\n this.multiMaterials = [];\n /**\n * All of the materials added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\n * Note also that the order of the Material within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\n */\n this.materials = [];\n /**\n * The list of morph target managers added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph\n */\n this.morphTargetManagers = [];\n /**\n * The list of geometries used in the scene.\n */\n this.geometries = [];\n /**\n * All of the transform nodes added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\n * Note also that the order of the TransformNode within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\n */\n this.transformNodes = [];\n /**\n * ActionManagers available on the scene.\n * @deprecated\n */\n this.actionManagers = [];\n /**\n * Textures to keep.\n */\n this.textures = [];\n /** @internal */\n this._environmentTexture = null;\n /**\n * The list of postprocesses added to the scene\n */\n this.postProcesses = [];\n /**\n * The list of effect layers (highlights/glow) added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/highlightLayer\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\n */\n this.effectLayers = [];\n /**\n * The list of sounds used in the scene.\n */\n this.sounds = null;\n /**\n * The list of layers (background and foreground) of the scene\n */\n this.layers = [];\n /**\n * The list of lens flare system added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare\n */\n this.lensFlareSystems = [];\n /**\n * The list of procedural textures added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/proceduralTextures\n */\n this.proceduralTextures = [];\n /**\n * Gets or sets a boolean indicating if animations are enabled\n */\n this.animationsEnabled = true;\n this._animationPropertiesOverride = null;\n /**\n * Gets or sets a boolean indicating if a constant deltatime has to be used\n * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate\n */\n this.useConstantAnimationDeltaTime = false;\n /**\n * Gets or sets a boolean indicating if the scene must keep the meshUnderPointer property updated\n * Please note that it requires to run a ray cast through the scene on every frame\n */\n this.constantlyUpdateMeshUnderPointer = false;\n /**\n * Defines the HTML cursor to use when hovering over interactive elements\n */\n this.hoverCursor = \"pointer\";\n /**\n * Defines the HTML default cursor to use (empty by default)\n */\n this.defaultCursor = \"\";\n /**\n * Defines whether cursors are handled by the scene.\n */\n this.doNotHandleCursors = false;\n /**\n * This is used to call preventDefault() on pointer down\n * in order to block unwanted artifacts like system double clicks\n */\n this.preventDefaultOnPointerDown = true;\n /**\n * This is used to call preventDefault() on pointer up\n * in order to block unwanted artifacts like system double clicks\n */\n this.preventDefaultOnPointerUp = true;\n // Metadata\n /**\n * Gets or sets user defined metadata\n */\n this.metadata = null;\n /**\n * For internal use only. Please do not use.\n */\n this.reservedDataStore = null;\n /**\n * Use this array to add regular expressions used to disable offline support for specific urls\n */\n this.disableOfflineSupportExceptionRules = [];\n /**\n * An event triggered when the scene is disposed.\n */\n this.onDisposeObservable = new Observable();\n this._onDisposeObserver = null;\n /**\n * An event triggered before rendering the scene (right after animations and physics)\n */\n this.onBeforeRenderObservable = new Observable();\n this._onBeforeRenderObserver = null;\n /**\n * An event triggered after rendering the scene\n */\n this.onAfterRenderObservable = new Observable();\n /**\n * An event triggered after rendering the scene for an active camera (When scene.render is called this will be called after each camera)\n * This is triggered for each \"sub\" camera in a Camera Rig unlike onAfterCameraRenderObservable\n */\n this.onAfterRenderCameraObservable = new Observable();\n this._onAfterRenderObserver = null;\n /**\n * An event triggered before animating the scene\n */\n this.onBeforeAnimationsObservable = new Observable();\n /**\n * An event triggered after animations processing\n */\n this.onAfterAnimationsObservable = new Observable();\n /**\n * An event triggered before draw calls are ready to be sent\n */\n this.onBeforeDrawPhaseObservable = new Observable();\n /**\n * An event triggered after draw calls have been sent\n */\n this.onAfterDrawPhaseObservable = new Observable();\n /**\n * An event triggered when the scene is ready\n */\n this.onReadyObservable = new Observable();\n /**\n * An event triggered before rendering a camera\n */\n this.onBeforeCameraRenderObservable = new Observable();\n this._onBeforeCameraRenderObserver = null;\n /**\n * An event triggered after rendering a camera\n * This is triggered for the full rig Camera only unlike onAfterRenderCameraObservable\n */\n this.onAfterCameraRenderObservable = new Observable();\n this._onAfterCameraRenderObserver = null;\n /**\n * An event triggered when active meshes evaluation is about to start\n */\n this.onBeforeActiveMeshesEvaluationObservable = new Observable();\n /**\n * An event triggered when active meshes evaluation is done\n */\n this.onAfterActiveMeshesEvaluationObservable = new Observable();\n /**\n * An event triggered when particles rendering is about to start\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\n */\n this.onBeforeParticlesRenderingObservable = new Observable();\n /**\n * An event triggered when particles rendering is done\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\n */\n this.onAfterParticlesRenderingObservable = new Observable();\n /**\n * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed\n */\n this.onDataLoadedObservable = new Observable();\n /**\n * An event triggered when a camera is created\n */\n this.onNewCameraAddedObservable = new Observable();\n /**\n * An event triggered when a camera is removed\n */\n this.onCameraRemovedObservable = new Observable();\n /**\n * An event triggered when a light is created\n */\n this.onNewLightAddedObservable = new Observable();\n /**\n * An event triggered when a light is removed\n */\n this.onLightRemovedObservable = new Observable();\n /**\n * An event triggered when a geometry is created\n */\n this.onNewGeometryAddedObservable = new Observable();\n /**\n * An event triggered when a geometry is removed\n */\n this.onGeometryRemovedObservable = new Observable();\n /**\n * An event triggered when a transform node is created\n */\n this.onNewTransformNodeAddedObservable = new Observable();\n /**\n * An event triggered when a transform node is removed\n */\n this.onTransformNodeRemovedObservable = new Observable();\n /**\n * An event triggered when a mesh is created\n */\n this.onNewMeshAddedObservable = new Observable();\n /**\n * An event triggered when a mesh is removed\n */\n this.onMeshRemovedObservable = new Observable();\n /**\n * An event triggered when a skeleton is created\n */\n this.onNewSkeletonAddedObservable = new Observable();\n /**\n * An event triggered when a skeleton is removed\n */\n this.onSkeletonRemovedObservable = new Observable();\n /**\n * An event triggered when a material is created\n */\n this.onNewMaterialAddedObservable = new Observable();\n /**\n * An event triggered when a multi material is created\n */\n this.onNewMultiMaterialAddedObservable = new Observable();\n /**\n * An event triggered when a material is removed\n */\n this.onMaterialRemovedObservable = new Observable();\n /**\n * An event triggered when a multi material is removed\n */\n this.onMultiMaterialRemovedObservable = new Observable();\n /**\n * An event triggered when a texture is created\n */\n this.onNewTextureAddedObservable = new Observable();\n /**\n * An event triggered when a texture is removed\n */\n this.onTextureRemovedObservable = new Observable();\n /**\n * An event triggered when render targets are about to be rendered\n * Can happen multiple times per frame.\n */\n this.onBeforeRenderTargetsRenderObservable = new Observable();\n /**\n * An event triggered when render targets were rendered.\n * Can happen multiple times per frame.\n */\n this.onAfterRenderTargetsRenderObservable = new Observable();\n /**\n * An event triggered before calculating deterministic simulation step\n */\n this.onBeforeStepObservable = new Observable();\n /**\n * An event triggered after calculating deterministic simulation step\n */\n this.onAfterStepObservable = new Observable();\n /**\n * An event triggered when the activeCamera property is updated\n */\n this.onActiveCameraChanged = new Observable();\n /**\n * An event triggered when the activeCameras property is updated\n */\n this.onActiveCamerasChanged = new Observable();\n /**\n * This Observable will be triggered before rendering each renderingGroup of each rendered camera.\n * The RenderingGroupInfo class contains all the information about the context in which the observable is called\n * 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)\n */\n this.onBeforeRenderingGroupObservable = new Observable();\n /**\n * This Observable will be triggered after rendering each renderingGroup of each rendered camera.\n * The RenderingGroupInfo class contains all the information about the context in which the observable is called\n * 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)\n */\n this.onAfterRenderingGroupObservable = new Observable();\n /**\n * This Observable will when a mesh has been imported into the scene.\n */\n this.onMeshImportedObservable = new Observable();\n /**\n * This Observable will when an animation file has been imported into the scene.\n */\n this.onAnimationFileImportedObservable = new Observable();\n // Animations\n /** @internal */\n this._registeredForLateAnimationBindings = new SmartArrayNoDuplicate(256);\n // Pointers\n this._pointerPickingConfiguration = new PointerPickingConfiguration();\n /**\n * 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).\n * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true\n */\n this.onPrePointerObservable = new Observable();\n /**\n * Observable event triggered each time an input event is received from the rendering canvas\n */\n this.onPointerObservable = new Observable();\n // Keyboard\n /**\n * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl()\n * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true\n */\n this.onPreKeyboardObservable = new Observable();\n /**\n * Observable event triggered each time an keyboard event is received from the hosting window\n */\n this.onKeyboardObservable = new Observable();\n // Coordinates system\n this._useRightHandedSystem = false;\n // Deterministic lockstep\n this._timeAccumulator = 0;\n this._currentStepId = 0;\n this._currentInternalStep = 0;\n // Fog\n this._fogEnabled = true;\n this._fogMode = Scene.FOGMODE_NONE;\n /**\n * Gets or sets the fog color to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is Color3(0.2, 0.2, 0.3))\n */\n this.fogColor = new Color3(0.2, 0.2, 0.3);\n /**\n * Gets or sets the fog density to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is 0.1)\n */\n this.fogDensity = 0.1;\n /**\n * Gets or sets the fog start distance to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is 0)\n */\n this.fogStart = 0;\n /**\n * Gets or sets the fog end distance to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is 1000)\n */\n this.fogEnd = 1000.0;\n /**\n * Flag indicating if we need to store previous matrices when rendering\n */\n this.needsPreviousWorldMatrices = false;\n // Lights\n this._shadowsEnabled = true;\n this._lightsEnabled = true;\n this._unObserveActiveCameras = null;\n // Textures\n this._texturesEnabled = true;\n this._frameGraph = null;\n // Physics\n /**\n * Gets or sets a boolean indicating if physic engines are enabled on this scene\n */\n this.physicsEnabled = true;\n // Particles\n /**\n * Gets or sets a boolean indicating if particles are enabled on this scene\n */\n this.particlesEnabled = true;\n // Sprites\n /**\n * Gets or sets a boolean indicating if sprites are enabled on this scene\n */\n this.spritesEnabled = true;\n // Skeletons\n this._skeletonsEnabled = true;\n // Lens flares\n /**\n * Gets or sets a boolean indicating if lens flares are enabled on this scene\n */\n this.lensFlaresEnabled = true;\n // Collisions\n /**\n * Gets or sets a boolean indicating if collisions are enabled on this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n this.collisionsEnabled = true;\n /**\n * Defines the gravity applied to this scene (used only for collisions)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n this.gravity = new Vector3(0, -9.807, 0);\n // Postprocesses\n /**\n * Gets or sets a boolean indicating if postprocesses are enabled on this scene\n */\n this.postProcessesEnabled = true;\n // Customs render targets\n /**\n * Gets or sets a boolean indicating if render targets are enabled on this scene\n */\n this.renderTargetsEnabled = true;\n /**\n * Gets or sets a boolean indicating if next render targets must be dumped as image for debugging purposes\n * We recommend not using it and instead rely on Spector.js: http://spector.babylonjs.com\n */\n this.dumpNextRenderTargets = false;\n /**\n * The list of user defined render targets added to the scene\n */\n this.customRenderTargets = [];\n /**\n * Gets the list of meshes imported to the scene through SceneLoader\n */\n this.importedMeshesFiles = [];\n // Probes\n /**\n * Gets or sets a boolean indicating if probes are enabled on this scene\n */\n this.probesEnabled = true;\n this._meshesForIntersections = new SmartArrayNoDuplicate(256);\n // Procedural textures\n /**\n * Gets or sets a boolean indicating if procedural textures are enabled on this scene\n */\n this.proceduralTexturesEnabled = true;\n // Performance counters\n this._totalVertices = new PerfCounter();\n /** @internal */\n this._activeIndices = new PerfCounter();\n /** @internal */\n this._activeParticles = new PerfCounter();\n /** @internal */\n this._activeBones = new PerfCounter();\n /** @internal */\n this._animationTime = 0;\n /**\n * Gets or sets a general scale for animation speed\n * @see https://www.babylonjs-playground.com/#IBU2W7#3\n */\n this.animationTimeScale = 1;\n this._renderId = 0;\n this._frameId = 0;\n this._executeWhenReadyTimeoutId = null;\n this._intermediateRendering = false;\n this._defaultFrameBufferCleared = false;\n this._viewUpdateFlag = -1;\n this._projectionUpdateFlag = -1;\n /** @internal */\n this._toBeDisposed = new Array(256);\n this._activeRequests = new Array();\n /** @internal */\n this._pendingData = new Array();\n this._isDisposed = false;\n /**\n * Gets or sets a boolean indicating that all submeshes of active meshes must be rendered\n * Use this boolean to avoid computing frustum clipping on submeshes (This could help when you are CPU bound)\n */\n this.dispatchAllSubMeshesOfActiveMeshes = false;\n this._activeMeshes = new SmartArray(256);\n this._processedMaterials = new SmartArray(256);\n this._renderTargets = new SmartArrayNoDuplicate(256);\n this._materialsRenderTargets = new SmartArrayNoDuplicate(256);\n /** @internal */\n this._activeParticleSystems = new SmartArray(256);\n this._activeSkeletons = new SmartArrayNoDuplicate(32);\n this._softwareSkinnedMeshes = new SmartArrayNoDuplicate(32);\n /** @internal */\n this._activeAnimatables = new Array();\n this._transformMatrix = Matrix.Zero();\n /**\n * Gets or sets a boolean indicating if lights must be sorted by priority (off by default)\n * This is useful if there are more lights that the maximum simulteanous authorized\n */\n this.requireLightSorting = false;\n /**\n * @internal\n * Backing store of defined scene components.\n */\n this._components = [];\n /**\n * @internal\n * Backing store of defined scene components.\n */\n this._serializableComponents = [];\n /**\n * List of components to register on the next registration step.\n */\n this._transientComponents = [];\n /**\n * @internal\n * Defines the actions happening before camera updates.\n */\n this._beforeCameraUpdateStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening before clear the canvas.\n */\n this._beforeClearStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening before clear the canvas.\n */\n this._beforeRenderTargetClearStage = Stage.Create();\n /**\n * @internal\n * Defines the actions when collecting render targets for the frame.\n */\n this._gatherRenderTargetsStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening for one camera in the frame.\n */\n this._gatherActiveCameraRenderTargetsStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the per mesh ready checks.\n */\n this._isReadyForMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening before evaluate active mesh checks.\n */\n this._beforeEvaluateActiveMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the evaluate sub mesh checks.\n */\n this._evaluateSubMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the active mesh stage.\n */\n this._preActiveMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the per camera render target step.\n */\n this._cameraDrawRenderTargetStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before the active camera is drawing.\n */\n this._beforeCameraDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before a render target is drawing.\n */\n this._beforeRenderTargetDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before a rendering group is drawing.\n */\n this._beforeRenderingGroupDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before a mesh is drawing.\n */\n this._beforeRenderingMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after a mesh has been drawn.\n */\n this._afterRenderingMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after a rendering group has been drawn.\n */\n this._afterRenderingGroupDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after the active camera has been drawn.\n */\n this._afterCameraDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after the post processing\n */\n this._afterCameraPostProcessStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after a render target has been drawn.\n */\n this._afterRenderTargetDrawStage = Stage.Create();\n /**\n * Defines the actions happening just after the post processing on a render target\n */\n this._afterRenderTargetPostProcessStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after rendering all cameras and computing intersections.\n */\n this._afterRenderStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening when a pointer move event happens.\n */\n this._pointerMoveStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening when a pointer down event happens.\n */\n this._pointerDownStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening when a pointer up event happens.\n */\n this._pointerUpStage = Stage.Create();\n /**\n * an optional map from Geometry Id to Geometry index in the 'geometries' array\n */\n this._geometriesByUniqueId = null;\n this._defaultMeshCandidates = {\n data: [],\n length: 0\n };\n this._defaultSubMeshCandidates = {\n data: [],\n length: 0\n };\n this._preventFreeActiveMeshesAndRenderingGroups = false;\n /** @internal */\n this._activeMeshesFrozen = false;\n /** @internal */\n this._activeMeshesFrozenButKeepClipping = false;\n this._skipEvaluateActiveMeshesCompletely = false;\n /** @internal */\n this._allowPostProcessClearColor = true;\n /**\n * User updatable function that will return a deterministic frame time when engine is in deterministic lock step mode\n * @returns the frame time\n */\n this.getDeterministicFrameTime = () => {\n return this._engine.getTimeStep();\n };\n /** @internal */\n this._registeredActions = 0;\n this._blockMaterialDirtyMechanism = false;\n /**\n * Internal perfCollector instance used for sharing between inspector and playground.\n * Marked as protected to allow sharing between prototype extensions, but disallow access at toplevel.\n */\n this._perfCollector = null;\n this.activeCameras = [];\n const fullOptions = {\n useGeometryUniqueIdsMap: true,\n useMaterialMeshMap: true,\n useClonedMeshMap: true,\n virtual: false,\n ...options\n };\n engine = this._engine = engine || EngineStore.LastCreatedEngine;\n if (fullOptions.virtual) {\n engine._virtualScenes.push(this);\n } else {\n EngineStore._LastCreatedScene = this;\n engine.scenes.push(this);\n }\n this._uid = null;\n this._renderingManager = new RenderingManager(this);\n if (PostProcessManager) {\n this.postProcessManager = new PostProcessManager(this);\n }\n if (IsWindowObjectExist()) {\n this.attachControl();\n }\n // Uniform Buffer\n this._createUbo();\n // Default Image processing definition\n if (ImageProcessingConfiguration) {\n this._imageProcessingConfiguration = new ImageProcessingConfiguration();\n }\n this.setDefaultCandidateProviders();\n if (fullOptions.useGeometryUniqueIdsMap) {\n this._geometriesByUniqueId = {};\n }\n this.useMaterialMeshMap = fullOptions.useMaterialMeshMap;\n this.useClonedMeshMap = fullOptions.useClonedMeshMap;\n if (!options || !options.virtual) {\n engine.onNewSceneAddedObservable.notifyObservers(this);\n }\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"Scene\" string\n */\n getClassName() {\n return \"Scene\";\n }\n /**\n * @internal\n */\n _getDefaultMeshCandidates() {\n this._defaultMeshCandidates.data = this.meshes;\n this._defaultMeshCandidates.length = this.meshes.length;\n return this._defaultMeshCandidates;\n }\n /**\n * @internal\n */\n _getDefaultSubMeshCandidates(mesh) {\n this._defaultSubMeshCandidates.data = mesh.subMeshes;\n this._defaultSubMeshCandidates.length = mesh.subMeshes.length;\n return this._defaultSubMeshCandidates;\n }\n /**\n * Sets the default candidate providers for the scene.\n * This sets the getActiveMeshCandidates, getActiveSubMeshCandidates, getIntersectingSubMeshCandidates\n * and getCollidingSubMeshCandidates to their default function\n */\n setDefaultCandidateProviders() {\n this.getActiveMeshCandidates = () => this._getDefaultMeshCandidates();\n this.getActiveSubMeshCandidates = mesh => this._getDefaultSubMeshCandidates(mesh);\n this.getIntersectingSubMeshCandidates = (mesh, localRay) => this._getDefaultSubMeshCandidates(mesh);\n this.getCollidingSubMeshCandidates = (mesh, collider) => this._getDefaultSubMeshCandidates(mesh);\n }\n /**\n * Gets the mesh that is currently under the pointer\n */\n get meshUnderPointer() {\n return this._inputManager.meshUnderPointer;\n }\n /**\n * Gets or sets the current on-screen X position of the pointer\n */\n get pointerX() {\n return this._inputManager.pointerX;\n }\n set pointerX(value) {\n this._inputManager.pointerX = value;\n }\n /**\n * Gets or sets the current on-screen Y position of the pointer\n */\n get pointerY() {\n return this._inputManager.pointerY;\n }\n set pointerY(value) {\n this._inputManager.pointerY = value;\n }\n /**\n * Gets the cached material (ie. the latest rendered one)\n * @returns the cached material\n */\n getCachedMaterial() {\n return this._cachedMaterial;\n }\n /**\n * Gets the cached effect (ie. the latest rendered one)\n * @returns the cached effect\n */\n getCachedEffect() {\n return this._cachedEffect;\n }\n /**\n * Gets the cached visibility state (ie. the latest rendered one)\n * @returns the cached visibility state\n */\n getCachedVisibility() {\n return this._cachedVisibility;\n }\n /**\n * Gets a boolean indicating if the current material / effect / visibility must be bind again\n * @param material defines the current material\n * @param effect defines the current effect\n * @param visibility defines the current visibility state\n * @returns true if one parameter is not cached\n */\n isCachedMaterialInvalid(material, effect, visibility = 1) {\n return this._cachedEffect !== effect || this._cachedMaterial !== material || this._cachedVisibility !== visibility;\n }\n /**\n * Gets the engine associated with the scene\n * @returns an Engine\n */\n getEngine() {\n return this._engine;\n }\n /**\n * Gets the total number of vertices rendered per frame\n * @returns the total number of vertices rendered per frame\n */\n getTotalVertices() {\n return this._totalVertices.current;\n }\n /**\n * Gets the performance counter for total vertices\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get totalVerticesPerfCounter() {\n return this._totalVertices;\n }\n /**\n * Gets the total number of active indices rendered per frame (You can deduce the number of rendered triangles by dividing this number by 3)\n * @returns the total number of active indices rendered per frame\n */\n getActiveIndices() {\n return this._activeIndices.current;\n }\n /**\n * Gets the performance counter for active indices\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get totalActiveIndicesPerfCounter() {\n return this._activeIndices;\n }\n /**\n * Gets the total number of active particles rendered per frame\n * @returns the total number of active particles rendered per frame\n */\n getActiveParticles() {\n return this._activeParticles.current;\n }\n /**\n * Gets the performance counter for active particles\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get activeParticlesPerfCounter() {\n return this._activeParticles;\n }\n /**\n * Gets the total number of active bones rendered per frame\n * @returns the total number of active bones rendered per frame\n */\n getActiveBones() {\n return this._activeBones.current;\n }\n /**\n * Gets the performance counter for active bones\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get activeBonesPerfCounter() {\n return this._activeBones;\n }\n /**\n * Gets the array of active meshes\n * @returns an array of AbstractMesh\n */\n getActiveMeshes() {\n return this._activeMeshes;\n }\n /**\n * Gets the animation ratio (which is 1.0 is the scene renders at 60fps and 2 if the scene renders at 30fps, etc.)\n * @returns a number\n */\n getAnimationRatio() {\n return this._animationRatio !== undefined ? this._animationRatio : 1;\n }\n /**\n * Gets an unique Id for the current render phase\n * @returns a number\n */\n getRenderId() {\n return this._renderId;\n }\n /**\n * Gets an unique Id for the current frame\n * @returns a number\n */\n getFrameId() {\n return this._frameId;\n }\n /** Call this function if you want to manually increment the render Id*/\n incrementRenderId() {\n this._renderId++;\n }\n _createUbo() {\n this.setSceneUniformBuffer(this.createSceneUniformBuffer());\n }\n /**\n * Use this method to simulate a pointer move on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @returns the current scene\n */\n simulatePointerMove(pickResult, pointerEventInit) {\n this._inputManager.simulatePointerMove(pickResult, pointerEventInit);\n return this;\n }\n /**\n * Use this method to simulate a pointer down on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @returns the current scene\n */\n simulatePointerDown(pickResult, pointerEventInit) {\n this._inputManager.simulatePointerDown(pickResult, pointerEventInit);\n return this;\n }\n /**\n * Use this method to simulate a pointer up on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\n * @returns the current scene\n */\n simulatePointerUp(pickResult, pointerEventInit, doubleTap) {\n this._inputManager.simulatePointerUp(pickResult, pointerEventInit, doubleTap);\n return this;\n }\n /**\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\n * @returns true if the pointer was captured\n */\n isPointerCaptured(pointerId = 0) {\n return this._inputManager.isPointerCaptured(pointerId);\n }\n /**\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\n * @param attachUp defines if you want to attach events to pointerup\n * @param attachDown defines if you want to attach events to pointerdown\n * @param attachMove defines if you want to attach events to pointermove\n */\n attachControl(attachUp = true, attachDown = true, attachMove = true) {\n this._inputManager.attachControl(attachUp, attachDown, attachMove);\n }\n /** Detaches all event handlers*/\n detachControl() {\n this._inputManager.detachControl();\n }\n /**\n * This function will check if the scene can be rendered (textures are loaded, shaders are compiled)\n * Delay loaded resources are not taking in account\n * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: true)\n * @returns true if all required resources are ready\n */\n isReady(checkRenderTargets = true) {\n var _this$activeCamera$re, _this$activeCamera, _this$prePassRenderer;\n if (this._isDisposed) {\n return false;\n }\n let index;\n const engine = this.getEngine();\n const currentRenderPassId = engine.currentRenderPassId;\n engine.currentRenderPassId = (_this$activeCamera$re = (_this$activeCamera = this.activeCamera) === null || _this$activeCamera === void 0 ? void 0 : _this$activeCamera.renderPassId) !== null && _this$activeCamera$re !== void 0 ? _this$activeCamera$re : currentRenderPassId;\n let isReady = true;\n // Pending data\n if (this._pendingData.length > 0) {\n isReady = false;\n }\n // Ensures that the pre-pass renderer is enabled if it is to be enabled.\n (_this$prePassRenderer = this.prePassRenderer) === null || _this$prePassRenderer === void 0 || _this$prePassRenderer.update();\n // OIT\n if (this.useOrderIndependentTransparency && this.depthPeelingRenderer) {\n isReady && (isReady = this.depthPeelingRenderer.isReady());\n }\n // Meshes\n if (checkRenderTargets) {\n this._processedMaterials.reset();\n this._materialsRenderTargets.reset();\n }\n for (index = 0; index < this.meshes.length; index++) {\n const mesh = this.meshes[index];\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\n continue;\n }\n // Do not stop at the first encountered \"unready\" object as we want to ensure\n // all materials are starting off their compilation in parallel.\n if (!mesh.isReady(true)) {\n isReady = false;\n continue;\n }\n const hardwareInstancedRendering = mesh.hasThinInstances || mesh.getClassName() === \"InstancedMesh\" || mesh.getClassName() === \"InstancedLinesMesh\" || engine.getCaps().instancedArrays && mesh.instances.length > 0;\n // Is Ready For Mesh\n for (const step of this._isReadyForMeshStage) {\n if (!step.action(mesh, hardwareInstancedRendering)) {\n isReady = false;\n }\n }\n if (!checkRenderTargets) {\n continue;\n }\n const mat = mesh.material || this.defaultMaterial;\n if (mat) {\n if (mat._storeEffectOnSubMeshes) {\n for (const subMesh of mesh.subMeshes) {\n const material = subMesh.getMaterial();\n if (material && material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\n if (this._processedMaterials.indexOf(material) === -1) {\n this._processedMaterials.push(material);\n this._materialsRenderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\n }\n }\n }\n } else {\n if (mat.hasRenderTargetTextures && mat.getRenderTargetTextures != null) {\n if (this._processedMaterials.indexOf(mat) === -1) {\n this._processedMaterials.push(mat);\n this._materialsRenderTargets.concatWithNoDuplicate(mat.getRenderTargetTextures());\n }\n }\n }\n }\n }\n // Render targets\n if (checkRenderTargets) {\n for (index = 0; index < this._materialsRenderTargets.length; ++index) {\n const rtt = this._materialsRenderTargets.data[index];\n if (!rtt.isReadyForRendering()) {\n isReady = false;\n }\n }\n }\n // Geometries\n for (index = 0; index < this.geometries.length; index++) {\n const geometry = this.geometries[index];\n if (geometry.delayLoadState === 2) {\n isReady = false;\n }\n }\n // Post-processes\n if (this.activeCameras && this.activeCameras.length > 0) {\n for (const camera of this.activeCameras) {\n if (!camera.isReady(true)) {\n isReady = false;\n }\n }\n } else if (this.activeCamera) {\n if (!this.activeCamera.isReady(true)) {\n isReady = false;\n }\n }\n // Particles\n for (const particleSystem of this.particleSystems) {\n if (!particleSystem.isReady()) {\n isReady = false;\n }\n }\n // Layers\n if (this.layers) {\n for (const layer of this.layers) {\n if (!layer.isReady()) {\n isReady = false;\n }\n }\n }\n // Effects\n if (!engine.areAllEffectsReady()) {\n isReady = false;\n }\n engine.currentRenderPassId = currentRenderPassId;\n return isReady;\n }\n /** Resets all cached information relative to material (including effect and visibility) */\n resetCachedMaterial() {\n this._cachedMaterial = null;\n this._cachedEffect = null;\n this._cachedVisibility = null;\n }\n /**\n * Registers a function to be called before every frame render\n * @param func defines the function to register\n */\n registerBeforeRender(func) {\n this.onBeforeRenderObservable.add(func);\n }\n /**\n * Unregisters a function called before every frame render\n * @param func defines the function to unregister\n */\n unregisterBeforeRender(func) {\n this.onBeforeRenderObservable.removeCallback(func);\n }\n /**\n * Registers a function to be called after every frame render\n * @param func defines the function to register\n */\n registerAfterRender(func) {\n this.onAfterRenderObservable.add(func);\n }\n /**\n * Unregisters a function called after every frame render\n * @param func defines the function to unregister\n */\n unregisterAfterRender(func) {\n this.onAfterRenderObservable.removeCallback(func);\n }\n _executeOnceBeforeRender(func) {\n const execFunc = () => {\n func();\n setTimeout(() => {\n this.unregisterBeforeRender(execFunc);\n });\n };\n this.registerBeforeRender(execFunc);\n }\n /**\n * The provided function will run before render once and will be disposed afterwards.\n * A timeout delay can be provided so that the function will be executed in N ms.\n * The timeout is using the browser's native setTimeout so time percision cannot be guaranteed.\n * @param func The function to be executed.\n * @param timeout optional delay in ms\n */\n executeOnceBeforeRender(func, timeout) {\n if (timeout !== undefined) {\n setTimeout(() => {\n this._executeOnceBeforeRender(func);\n }, timeout);\n } else {\n this._executeOnceBeforeRender(func);\n }\n }\n /**\n * This function can help adding any object to the list of data awaited to be ready in order to check for a complete scene loading.\n * @param data defines the object to wait for\n */\n addPendingData(data) {\n this._pendingData.push(data);\n }\n /**\n * Remove a pending data from the loading list which has previously been added with addPendingData.\n * @param data defines the object to remove from the pending list\n */\n removePendingData(data) {\n const wasLoading = this.isLoading;\n const index = this._pendingData.indexOf(data);\n if (index !== -1) {\n this._pendingData.splice(index, 1);\n }\n if (wasLoading && !this.isLoading) {\n this.onDataLoadedObservable.notifyObservers(this);\n }\n }\n /**\n * Returns the number of items waiting to be loaded\n * @returns the number of items waiting to be loaded\n */\n getWaitingItemsCount() {\n return this._pendingData.length;\n }\n /**\n * Returns a boolean indicating if the scene is still loading data\n */\n get isLoading() {\n return this._pendingData.length > 0;\n }\n /**\n * Registers a function to be executed when the scene is ready\n * @param func - the function to be executed\n * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: false)\n */\n executeWhenReady(func, checkRenderTargets = false) {\n this.onReadyObservable.addOnce(func);\n if (this._executeWhenReadyTimeoutId !== null) {\n return;\n }\n this._checkIsReady(checkRenderTargets);\n }\n /**\n * Returns a promise that resolves when the scene is ready\n * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: false)\n * @returns A promise that resolves when the scene is ready\n */\n whenReadyAsync(checkRenderTargets = false) {\n return new Promise(resolve => {\n this.executeWhenReady(() => {\n resolve();\n }, checkRenderTargets);\n });\n }\n /**\n * @internal\n */\n _checkIsReady(checkRenderTargets = false) {\n this._registerTransientComponents();\n if (this.isReady(checkRenderTargets)) {\n this.onReadyObservable.notifyObservers(this);\n this.onReadyObservable.clear();\n this._executeWhenReadyTimeoutId = null;\n return;\n }\n if (this._isDisposed) {\n this.onReadyObservable.clear();\n this._executeWhenReadyTimeoutId = null;\n return;\n }\n this._executeWhenReadyTimeoutId = setTimeout(() => {\n // Ensure materials effects are checked outside render loops\n this.incrementRenderId();\n this._checkIsReady(checkRenderTargets);\n }, 100);\n }\n /**\n * Gets all animatable attached to the scene\n */\n get animatables() {\n return this._activeAnimatables;\n }\n /**\n * Resets the last animation time frame.\n * Useful to override when animations start running when loading a scene for the first time.\n */\n resetLastAnimationTimeFrame() {\n this._animationTimeLast = PrecisionDate.Now;\n }\n // Matrix\n /**\n * Gets the current view matrix\n * @returns a Matrix\n */\n getViewMatrix() {\n return this._viewMatrix;\n }\n /**\n * Gets the current projection matrix\n * @returns a Matrix\n */\n getProjectionMatrix() {\n return this._projectionMatrix;\n }\n /**\n * Gets the current transform matrix\n * @returns a Matrix made of View * Projection\n */\n getTransformMatrix() {\n return this._transformMatrix;\n }\n /**\n * Sets the current transform matrix\n * @param viewL defines the View matrix to use\n * @param projectionL defines the Projection matrix to use\n * @param viewR defines the right View matrix to use (if provided)\n * @param projectionR defines the right Projection matrix to use (if provided)\n */\n setTransformMatrix(viewL, projectionL, viewR, projectionR) {\n // clear the multiviewSceneUbo if no viewR and projectionR are defined\n if (!viewR && !projectionR && this._multiviewSceneUbo) {\n this._multiviewSceneUbo.dispose();\n this._multiviewSceneUbo = null;\n }\n if (this._viewUpdateFlag === viewL.updateFlag && this._projectionUpdateFlag === projectionL.updateFlag) {\n return;\n }\n this._viewUpdateFlag = viewL.updateFlag;\n this._projectionUpdateFlag = projectionL.updateFlag;\n this._viewMatrix = viewL;\n this._projectionMatrix = projectionL;\n this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\n // Update frustum\n if (!this._frustumPlanes) {\n this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);\n } else {\n Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\n }\n if (this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo) {\n this._updateMultiviewUbo(viewR, projectionR);\n } else if (this._sceneUbo.useUbo) {\n this._sceneUbo.updateMatrix(\"viewProjection\", this._transformMatrix);\n this._sceneUbo.updateMatrix(\"view\", this._viewMatrix);\n this._sceneUbo.updateMatrix(\"projection\", this._projectionMatrix);\n }\n }\n /**\n * Gets the uniform buffer used to store scene data\n * @returns a UniformBuffer\n */\n getSceneUniformBuffer() {\n return this._multiviewSceneUbo ? this._multiviewSceneUbo : this._sceneUbo;\n }\n /**\n * Creates a scene UBO\n * @param name name of the uniform buffer (optional, for debugging purpose only)\n * @returns a new ubo\n */\n createSceneUniformBuffer(name) {\n const sceneUbo = new UniformBuffer(this._engine, undefined, false, name !== null && name !== void 0 ? name : \"scene\");\n sceneUbo.addUniform(\"viewProjection\", 16);\n sceneUbo.addUniform(\"view\", 16);\n sceneUbo.addUniform(\"projection\", 16);\n sceneUbo.addUniform(\"vEyePosition\", 4);\n return sceneUbo;\n }\n /**\n * Sets the scene ubo\n * @param ubo the ubo to set for the scene\n */\n setSceneUniformBuffer(ubo) {\n this._sceneUbo = ubo;\n this._viewUpdateFlag = -1;\n this._projectionUpdateFlag = -1;\n }\n /**\n * Gets an unique (relatively to the current scene) Id\n * @returns an unique number for the scene\n */\n getUniqueId() {\n return UniqueIdGenerator.UniqueId;\n }\n /**\n * Add a mesh to the list of scene's meshes\n * @param newMesh defines the mesh to add\n * @param recursive if all child meshes should also be added to the scene\n */\n addMesh(newMesh, recursive = false) {\n if (this._blockEntityCollection) {\n return;\n }\n this.meshes.push(newMesh);\n newMesh._resyncLightSources();\n if (!newMesh.parent) {\n newMesh._addToSceneRootNodes();\n }\n Tools.SetImmediate(() => {\n this.onNewMeshAddedObservable.notifyObservers(newMesh);\n });\n if (recursive) {\n newMesh.getChildMeshes().forEach(m => {\n this.addMesh(m);\n });\n }\n }\n /**\n * Remove a mesh for the list of scene's meshes\n * @param toRemove defines the mesh to remove\n * @param recursive if all child meshes should also be removed from the scene\n * @returns the index where the mesh was in the mesh list\n */\n removeMesh(toRemove, recursive = false) {\n const index = this.meshes.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if the mesh found\n this.meshes.splice(index, 1);\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n this._inputManager._invalidateMesh(toRemove);\n this.onMeshRemovedObservable.notifyObservers(toRemove);\n if (recursive) {\n toRemove.getChildMeshes().forEach(m => {\n this.removeMesh(m);\n });\n }\n return index;\n }\n /**\n * Add a transform node to the list of scene's transform nodes\n * @param newTransformNode defines the transform node to add\n */\n addTransformNode(newTransformNode) {\n if (this._blockEntityCollection) {\n return;\n }\n if (newTransformNode.getScene() === this && newTransformNode._indexInSceneTransformNodesArray !== -1) {\n // Already there?\n return;\n }\n newTransformNode._indexInSceneTransformNodesArray = this.transformNodes.length;\n this.transformNodes.push(newTransformNode);\n if (!newTransformNode.parent) {\n newTransformNode._addToSceneRootNodes();\n }\n this.onNewTransformNodeAddedObservable.notifyObservers(newTransformNode);\n }\n /**\n * Remove a transform node for the list of scene's transform nodes\n * @param toRemove defines the transform node to remove\n * @returns the index where the transform node was in the transform node list\n */\n removeTransformNode(toRemove) {\n const index = toRemove._indexInSceneTransformNodesArray;\n if (index !== -1) {\n if (index !== this.transformNodes.length - 1) {\n const lastNode = this.transformNodes[this.transformNodes.length - 1];\n this.transformNodes[index] = lastNode;\n lastNode._indexInSceneTransformNodesArray = index;\n }\n toRemove._indexInSceneTransformNodesArray = -1;\n this.transformNodes.pop();\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n this.onTransformNodeRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Remove a skeleton for the list of scene's skeletons\n * @param toRemove defines the skeleton to remove\n * @returns the index where the skeleton was in the skeleton list\n */\n removeSkeleton(toRemove) {\n const index = this.skeletons.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if found\n this.skeletons.splice(index, 1);\n this.onSkeletonRemovedObservable.notifyObservers(toRemove);\n // Clean active container\n this._executeActiveContainerCleanup(this._activeSkeletons);\n }\n return index;\n }\n /**\n * Remove a morph target for the list of scene's morph targets\n * @param toRemove defines the morph target to remove\n * @returns the index where the morph target was in the morph target list\n */\n removeMorphTargetManager(toRemove) {\n const index = this.morphTargetManagers.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if found\n this.morphTargetManagers.splice(index, 1);\n }\n return index;\n }\n /**\n * Remove a light for the list of scene's lights\n * @param toRemove defines the light to remove\n * @returns the index where the light was in the light list\n */\n removeLight(toRemove) {\n const index = this.lights.indexOf(toRemove);\n if (index !== -1) {\n // Remove from meshes\n for (const mesh of this.meshes) {\n mesh._removeLightSource(toRemove, false);\n }\n // Remove from the scene if mesh found\n this.lights.splice(index, 1);\n this.sortLightsByPriority();\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n this.onLightRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Remove a camera for the list of scene's cameras\n * @param toRemove defines the camera to remove\n * @returns the index where the camera was in the camera list\n */\n removeCamera(toRemove) {\n const index = this.cameras.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if mesh found\n this.cameras.splice(index, 1);\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n // Remove from activeCameras\n if (this.activeCameras) {\n const index2 = this.activeCameras.indexOf(toRemove);\n if (index2 !== -1) {\n // Remove from the scene if mesh found\n this.activeCameras.splice(index2, 1);\n }\n }\n // Reset the activeCamera\n if (this.activeCamera === toRemove) {\n if (this.cameras.length > 0) {\n this.activeCamera = this.cameras[0];\n } else {\n this.activeCamera = null;\n }\n }\n this.onCameraRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Remove a particle system for the list of scene's particle systems\n * @param toRemove defines the particle system to remove\n * @returns the index where the particle system was in the particle system list\n */\n removeParticleSystem(toRemove) {\n const index = this.particleSystems.indexOf(toRemove);\n if (index !== -1) {\n this.particleSystems.splice(index, 1);\n // Clean active container\n this._executeActiveContainerCleanup(this._activeParticleSystems);\n }\n return index;\n }\n /**\n * Remove a animation for the list of scene's animations\n * @param toRemove defines the animation to remove\n * @returns the index where the animation was in the animation list\n */\n removeAnimation(toRemove) {\n const index = this.animations.indexOf(toRemove);\n if (index !== -1) {\n this.animations.splice(index, 1);\n }\n return index;\n }\n /**\n * Will stop the animation of the given target\n * @param target - the target\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\n */\n stopAnimation(target, animationName, targetMask) {\n // Do nothing as code will be provided by animation component\n }\n /**\n * Removes the given animation group from this scene.\n * @param toRemove The animation group to remove\n * @returns The index of the removed animation group\n */\n removeAnimationGroup(toRemove) {\n const index = this.animationGroups.indexOf(toRemove);\n if (index !== -1) {\n this.animationGroups.splice(index, 1);\n }\n return index;\n }\n /**\n * Removes the given multi-material from this scene.\n * @param toRemove The multi-material to remove\n * @returns The index of the removed multi-material\n */\n removeMultiMaterial(toRemove) {\n const index = this.multiMaterials.indexOf(toRemove);\n if (index !== -1) {\n this.multiMaterials.splice(index, 1);\n }\n this.onMultiMaterialRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Removes the given material from this scene.\n * @param toRemove The material to remove\n * @returns The index of the removed material\n */\n removeMaterial(toRemove) {\n const index = toRemove._indexInSceneMaterialArray;\n if (index !== -1 && index < this.materials.length) {\n if (index !== this.materials.length - 1) {\n const lastMaterial = this.materials[this.materials.length - 1];\n this.materials[index] = lastMaterial;\n lastMaterial._indexInSceneMaterialArray = index;\n }\n toRemove._indexInSceneMaterialArray = -1;\n this.materials.pop();\n }\n this.onMaterialRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Removes the given action manager from this scene.\n * @deprecated\n * @param toRemove The action manager to remove\n * @returns The index of the removed action manager\n */\n removeActionManager(toRemove) {\n const index = this.actionManagers.indexOf(toRemove);\n if (index !== -1) {\n this.actionManagers.splice(index, 1);\n }\n return index;\n }\n /**\n * Removes the given texture from this scene.\n * @param toRemove The texture to remove\n * @returns The index of the removed texture\n */\n removeTexture(toRemove) {\n const index = this.textures.indexOf(toRemove);\n if (index !== -1) {\n this.textures.splice(index, 1);\n }\n this.onTextureRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Adds the given light to this scene\n * @param newLight The light to add\n */\n addLight(newLight) {\n if (this._blockEntityCollection) {\n return;\n }\n this.lights.push(newLight);\n this.sortLightsByPriority();\n if (!newLight.parent) {\n newLight._addToSceneRootNodes();\n }\n // Add light to all meshes (To support if the light is removed and then re-added)\n for (const mesh of this.meshes) {\n if (mesh.lightSources.indexOf(newLight) === -1) {\n mesh.lightSources.push(newLight);\n mesh._resyncLightSources();\n }\n }\n Tools.SetImmediate(() => {\n this.onNewLightAddedObservable.notifyObservers(newLight);\n });\n }\n /**\n * Sorts the list list based on light priorities\n */\n sortLightsByPriority() {\n if (this.requireLightSorting) {\n this.lights.sort(LightConstants.CompareLightsPriority);\n }\n }\n /**\n * Adds the given camera to this scene\n * @param newCamera The camera to add\n */\n addCamera(newCamera) {\n if (this._blockEntityCollection) {\n return;\n }\n this.cameras.push(newCamera);\n Tools.SetImmediate(() => {\n this.onNewCameraAddedObservable.notifyObservers(newCamera);\n });\n if (!newCamera.parent) {\n newCamera._addToSceneRootNodes();\n }\n }\n /**\n * Adds the given skeleton to this scene\n * @param newSkeleton The skeleton to add\n */\n addSkeleton(newSkeleton) {\n if (this._blockEntityCollection) {\n return;\n }\n this.skeletons.push(newSkeleton);\n Tools.SetImmediate(() => {\n this.onNewSkeletonAddedObservable.notifyObservers(newSkeleton);\n });\n }\n /**\n * Adds the given particle system to this scene\n * @param newParticleSystem The particle system to add\n */\n addParticleSystem(newParticleSystem) {\n if (this._blockEntityCollection) {\n return;\n }\n this.particleSystems.push(newParticleSystem);\n }\n /**\n * Adds the given animation to this scene\n * @param newAnimation The animation to add\n */\n addAnimation(newAnimation) {\n if (this._blockEntityCollection) {\n return;\n }\n this.animations.push(newAnimation);\n }\n /**\n * Adds the given animation group to this scene.\n * @param newAnimationGroup The animation group to add\n */\n addAnimationGroup(newAnimationGroup) {\n if (this._blockEntityCollection) {\n return;\n }\n this.animationGroups.push(newAnimationGroup);\n }\n /**\n * Adds the given multi-material to this scene\n * @param newMultiMaterial The multi-material to add\n */\n addMultiMaterial(newMultiMaterial) {\n if (this._blockEntityCollection) {\n return;\n }\n this.multiMaterials.push(newMultiMaterial);\n Tools.SetImmediate(() => {\n this.onNewMultiMaterialAddedObservable.notifyObservers(newMultiMaterial);\n });\n }\n /**\n * Adds the given material to this scene\n * @param newMaterial The material to add\n */\n addMaterial(newMaterial) {\n if (this._blockEntityCollection) {\n return;\n }\n if (newMaterial.getScene() === this && newMaterial._indexInSceneMaterialArray !== -1) {\n // Already there??\n return;\n }\n newMaterial._indexInSceneMaterialArray = this.materials.length;\n this.materials.push(newMaterial);\n Tools.SetImmediate(() => {\n this.onNewMaterialAddedObservable.notifyObservers(newMaterial);\n });\n }\n /**\n * Adds the given morph target to this scene\n * @param newMorphTargetManager The morph target to add\n */\n addMorphTargetManager(newMorphTargetManager) {\n if (this._blockEntityCollection) {\n return;\n }\n this.morphTargetManagers.push(newMorphTargetManager);\n }\n /**\n * Adds the given geometry to this scene\n * @param newGeometry The geometry to add\n */\n addGeometry(newGeometry) {\n if (this._blockEntityCollection) {\n return;\n }\n if (this._geometriesByUniqueId) {\n this._geometriesByUniqueId[newGeometry.uniqueId] = this.geometries.length;\n }\n this.geometries.push(newGeometry);\n }\n /**\n * Adds the given action manager to this scene\n * @deprecated\n * @param newActionManager The action manager to add\n */\n addActionManager(newActionManager) {\n this.actionManagers.push(newActionManager);\n }\n /**\n * Adds the given texture to this scene.\n * @param newTexture The texture to add\n */\n addTexture(newTexture) {\n if (this._blockEntityCollection) {\n return;\n }\n this.textures.push(newTexture);\n this.onNewTextureAddedObservable.notifyObservers(newTexture);\n }\n /**\n * Switch active camera\n * @param newCamera defines the new active camera\n * @param attachControl defines if attachControl must be called for the new active camera (default: true)\n */\n switchActiveCamera(newCamera, attachControl = true) {\n const canvas = this._engine.getInputElement();\n if (!canvas) {\n return;\n }\n if (this.activeCamera) {\n this.activeCamera.detachControl();\n }\n this.activeCamera = newCamera;\n if (attachControl) {\n newCamera.attachControl();\n }\n }\n /**\n * sets the active camera of the scene using its Id\n * @param id defines the camera's Id\n * @returns the new active camera or null if none found.\n */\n setActiveCameraById(id) {\n const camera = this.getCameraById(id);\n if (camera) {\n this.activeCamera = camera;\n return camera;\n }\n return null;\n }\n /**\n * sets the active camera of the scene using its name\n * @param name defines the camera's name\n * @returns the new active camera or null if none found.\n */\n setActiveCameraByName(name) {\n const camera = this.getCameraByName(name);\n if (camera) {\n this.activeCamera = camera;\n return camera;\n }\n return null;\n }\n /**\n * get an animation group using its name\n * @param name defines the material's name\n * @returns the animation group or null if none found.\n */\n getAnimationGroupByName(name) {\n for (let index = 0; index < this.animationGroups.length; index++) {\n if (this.animationGroups[index].name === name) {\n return this.animationGroups[index];\n }\n }\n return null;\n }\n _getMaterial(allowMultiMaterials, predicate) {\n for (let index = 0; index < this.materials.length; index++) {\n const material = this.materials[index];\n if (predicate(material)) {\n return material;\n }\n }\n if (allowMultiMaterials) {\n for (let index = 0; index < this.multiMaterials.length; index++) {\n const material = this.multiMaterials[index];\n if (predicate(material)) {\n return material;\n }\n }\n }\n return null;\n }\n /**\n * Get a material using its unique id\n * @param uniqueId defines the material's unique id\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the material or null if none found.\n */\n getMaterialByUniqueID(uniqueId, allowMultiMaterials = false) {\n return this._getMaterial(allowMultiMaterials, m => m.uniqueId === uniqueId);\n }\n /**\n * get a material using its id\n * @param id defines the material's Id\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the material or null if none found.\n */\n getMaterialById(id, allowMultiMaterials = false) {\n return this._getMaterial(allowMultiMaterials, m => m.id === id);\n }\n /**\n * Gets a material using its name\n * @param name defines the material's name\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the material or null if none found.\n */\n getMaterialByName(name, allowMultiMaterials = false) {\n return this._getMaterial(allowMultiMaterials, m => m.name === name);\n }\n /**\n * Gets a last added material using a given id\n * @param id defines the material's id\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the last material with the given id or null if none found.\n */\n getLastMaterialById(id, allowMultiMaterials = false) {\n for (let index = this.materials.length - 1; index >= 0; index--) {\n if (this.materials[index].id === id) {\n return this.materials[index];\n }\n }\n if (allowMultiMaterials) {\n for (let index = this.multiMaterials.length - 1; index >= 0; index--) {\n if (this.multiMaterials[index].id === id) {\n return this.multiMaterials[index];\n }\n }\n }\n return null;\n }\n /**\n * Get a texture using its unique id\n * @param uniqueId defines the texture's unique id\n * @returns the texture or null if none found.\n */\n getTextureByUniqueId(uniqueId) {\n for (let index = 0; index < this.textures.length; index++) {\n if (this.textures[index].uniqueId === uniqueId) {\n return this.textures[index];\n }\n }\n return null;\n }\n /**\n * Gets a texture using its name\n * @param name defines the texture's name\n * @returns the texture or null if none found.\n */\n getTextureByName(name) {\n for (let index = 0; index < this.textures.length; index++) {\n if (this.textures[index].name === name) {\n return this.textures[index];\n }\n }\n return null;\n }\n /**\n * Gets a camera using its Id\n * @param id defines the Id to look for\n * @returns the camera or null if not found\n */\n getCameraById(id) {\n for (let index = 0; index < this.cameras.length; index++) {\n if (this.cameras[index].id === id) {\n return this.cameras[index];\n }\n }\n return null;\n }\n /**\n * Gets a camera using its unique Id\n * @param uniqueId defines the unique Id to look for\n * @returns the camera or null if not found\n */\n getCameraByUniqueId(uniqueId) {\n for (let index = 0; index < this.cameras.length; index++) {\n if (this.cameras[index].uniqueId === uniqueId) {\n return this.cameras[index];\n }\n }\n return null;\n }\n /**\n * Gets a camera using its name\n * @param name defines the camera's name\n * @returns the camera or null if none found.\n */\n getCameraByName(name) {\n for (let index = 0; index < this.cameras.length; index++) {\n if (this.cameras[index].name === name) {\n return this.cameras[index];\n }\n }\n return null;\n }\n /**\n * Gets a bone using its Id\n * @param id defines the bone's Id\n * @returns the bone or null if not found\n */\n getBoneById(id) {\n for (let skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\n const skeleton = this.skeletons[skeletonIndex];\n for (let boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\n if (skeleton.bones[boneIndex].id === id) {\n return skeleton.bones[boneIndex];\n }\n }\n }\n return null;\n }\n /**\n * Gets a bone using its id\n * @param name defines the bone's name\n * @returns the bone or null if not found\n */\n getBoneByName(name) {\n for (let skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\n const skeleton = this.skeletons[skeletonIndex];\n for (let boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\n if (skeleton.bones[boneIndex].name === name) {\n return skeleton.bones[boneIndex];\n }\n }\n }\n return null;\n }\n /**\n * Gets a light node using its name\n * @param name defines the light's name\n * @returns the light or null if none found.\n */\n getLightByName(name) {\n for (let index = 0; index < this.lights.length; index++) {\n if (this.lights[index].name === name) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a light node using its Id\n * @param id defines the light's Id\n * @returns the light or null if none found.\n */\n getLightById(id) {\n for (let index = 0; index < this.lights.length; index++) {\n if (this.lights[index].id === id) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a light node using its scene-generated unique Id\n * @param uniqueId defines the light's unique Id\n * @returns the light or null if none found.\n */\n getLightByUniqueId(uniqueId) {\n for (let index = 0; index < this.lights.length; index++) {\n if (this.lights[index].uniqueId === uniqueId) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a particle system by Id\n * @param id defines the particle system Id\n * @returns the corresponding system or null if none found\n */\n getParticleSystemById(id) {\n for (let index = 0; index < this.particleSystems.length; index++) {\n if (this.particleSystems[index].id === id) {\n return this.particleSystems[index];\n }\n }\n return null;\n }\n /**\n * Gets a geometry using its Id\n * @param id defines the geometry's Id\n * @returns the geometry or null if none found.\n */\n getGeometryById(id) {\n for (let index = 0; index < this.geometries.length; index++) {\n if (this.geometries[index].id === id) {\n return this.geometries[index];\n }\n }\n return null;\n }\n _getGeometryByUniqueId(uniqueId) {\n if (this._geometriesByUniqueId) {\n const index = this._geometriesByUniqueId[uniqueId];\n if (index !== undefined) {\n return this.geometries[index];\n }\n } else {\n for (let index = 0; index < this.geometries.length; index++) {\n if (this.geometries[index].uniqueId === uniqueId) {\n return this.geometries[index];\n }\n }\n }\n return null;\n }\n /**\n * Add a new geometry to this scene\n * @param geometry defines the geometry to be added to the scene.\n * @param force defines if the geometry must be pushed even if a geometry with this id already exists\n * @returns a boolean defining if the geometry was added or not\n */\n pushGeometry(geometry, force) {\n if (!force && this._getGeometryByUniqueId(geometry.uniqueId)) {\n return false;\n }\n this.addGeometry(geometry);\n Tools.SetImmediate(() => {\n this.onNewGeometryAddedObservable.notifyObservers(geometry);\n });\n return true;\n }\n /**\n * Removes an existing geometry\n * @param geometry defines the geometry to be removed from the scene\n * @returns a boolean defining if the geometry was removed or not\n */\n removeGeometry(geometry) {\n let index;\n if (this._geometriesByUniqueId) {\n index = this._geometriesByUniqueId[geometry.uniqueId];\n if (index === undefined) {\n return false;\n }\n } else {\n index = this.geometries.indexOf(geometry);\n if (index < 0) {\n return false;\n }\n }\n if (index !== this.geometries.length - 1) {\n const lastGeometry = this.geometries[this.geometries.length - 1];\n if (lastGeometry) {\n this.geometries[index] = lastGeometry;\n if (this._geometriesByUniqueId) {\n this._geometriesByUniqueId[lastGeometry.uniqueId] = index;\n }\n }\n }\n if (this._geometriesByUniqueId) {\n this._geometriesByUniqueId[geometry.uniqueId] = undefined;\n }\n this.geometries.pop();\n this.onGeometryRemovedObservable.notifyObservers(geometry);\n return true;\n }\n /**\n * Gets the list of geometries attached to the scene\n * @returns an array of Geometry\n */\n getGeometries() {\n return this.geometries;\n }\n /**\n * Gets the first added mesh found of a given Id\n * @param id defines the Id to search for\n * @returns the mesh found or null if not found at all\n */\n getMeshById(id) {\n for (let index = 0; index < this.meshes.length; index++) {\n if (this.meshes[index].id === id) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a list of meshes using their Id\n * @param id defines the Id to search for\n * @returns a list of meshes\n */\n getMeshesById(id) {\n return this.meshes.filter(function (m) {\n return m.id === id;\n });\n }\n /**\n * Gets the first added transform node found of a given Id\n * @param id defines the Id to search for\n * @returns the found transform node or null if not found at all.\n */\n getTransformNodeById(id) {\n for (let index = 0; index < this.transformNodes.length; index++) {\n if (this.transformNodes[index].id === id) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a transform node with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found transform node or null if not found at all.\n */\n getTransformNodeByUniqueId(uniqueId) {\n for (let index = 0; index < this.transformNodes.length; index++) {\n if (this.transformNodes[index].uniqueId === uniqueId) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a list of transform nodes using their Id\n * @param id defines the Id to search for\n * @returns a list of transform nodes\n */\n getTransformNodesById(id) {\n return this.transformNodes.filter(function (m) {\n return m.id === id;\n });\n }\n /**\n * Gets a mesh with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found mesh or null if not found at all.\n */\n getMeshByUniqueId(uniqueId) {\n for (let index = 0; index < this.meshes.length; index++) {\n if (this.meshes[index].uniqueId === uniqueId) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a the last added mesh using a given Id\n * @param id defines the Id to search for\n * @returns the found mesh or null if not found at all.\n */\n getLastMeshById(id) {\n for (let index = this.meshes.length - 1; index >= 0; index--) {\n if (this.meshes[index].id === id) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a the last transform node using a given Id\n * @param id defines the Id to search for\n * @returns the found mesh or null if not found at all.\n */\n getLastTransformNodeById(id) {\n for (let index = this.transformNodes.length - 1; index >= 0; index--) {\n if (this.transformNodes[index].id === id) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a the last added node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n */\n getLastEntryById(id) {\n let index;\n for (index = this.meshes.length - 1; index >= 0; index--) {\n if (this.meshes[index].id === id) {\n return this.meshes[index];\n }\n }\n for (index = this.transformNodes.length - 1; index >= 0; index--) {\n if (this.transformNodes[index].id === id) {\n return this.transformNodes[index];\n }\n }\n for (index = this.cameras.length - 1; index >= 0; index--) {\n if (this.cameras[index].id === id) {\n return this.cameras[index];\n }\n }\n for (index = this.lights.length - 1; index >= 0; index--) {\n if (this.lights[index].id === id) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n */\n getNodeById(id) {\n const mesh = this.getMeshById(id);\n if (mesh) {\n return mesh;\n }\n const transformNode = this.getTransformNodeById(id);\n if (transformNode) {\n return transformNode;\n }\n const light = this.getLightById(id);\n if (light) {\n return light;\n }\n const camera = this.getCameraById(id);\n if (camera) {\n return camera;\n }\n const bone = this.getBoneById(id);\n if (bone) {\n return bone;\n }\n return null;\n }\n /**\n * Gets a node (Mesh, Camera, Light) using a given name\n * @param name defines the name to search for\n * @returns the found node or null if not found at all.\n */\n getNodeByName(name) {\n const mesh = this.getMeshByName(name);\n if (mesh) {\n return mesh;\n }\n const transformNode = this.getTransformNodeByName(name);\n if (transformNode) {\n return transformNode;\n }\n const light = this.getLightByName(name);\n if (light) {\n return light;\n }\n const camera = this.getCameraByName(name);\n if (camera) {\n return camera;\n }\n const bone = this.getBoneByName(name);\n if (bone) {\n return bone;\n }\n return null;\n }\n /**\n * Gets a mesh using a given name\n * @param name defines the name to search for\n * @returns the found mesh or null if not found at all.\n */\n getMeshByName(name) {\n for (let index = 0; index < this.meshes.length; index++) {\n if (this.meshes[index].name === name) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a transform node using a given name\n * @param name defines the name to search for\n * @returns the found transform node or null if not found at all.\n */\n getTransformNodeByName(name) {\n for (let index = 0; index < this.transformNodes.length; index++) {\n if (this.transformNodes[index].name === name) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given Id (if many are found, this function will pick the last one)\n * @param id defines the Id to search for\n * @returns the found skeleton or null if not found at all.\n */\n getLastSkeletonById(id) {\n for (let index = this.skeletons.length - 1; index >= 0; index--) {\n if (this.skeletons[index].id === id) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given auto generated unique id\n * @param uniqueId defines the unique id to search for\n * @returns the found skeleton or null if not found at all.\n */\n getSkeletonByUniqueId(uniqueId) {\n for (let index = 0; index < this.skeletons.length; index++) {\n if (this.skeletons[index].uniqueId === uniqueId) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given id (if many are found, this function will pick the first one)\n * @param id defines the id to search for\n * @returns the found skeleton or null if not found at all.\n */\n getSkeletonById(id) {\n for (let index = 0; index < this.skeletons.length; index++) {\n if (this.skeletons[index].id === id) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given name\n * @param name defines the name to search for\n * @returns the found skeleton or null if not found at all.\n */\n getSkeletonByName(name) {\n for (let index = 0; index < this.skeletons.length; index++) {\n if (this.skeletons[index].name === name) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a morph target manager using a given id (if many are found, this function will pick the last one)\n * @param id defines the id to search for\n * @returns the found morph target manager or null if not found at all.\n */\n getMorphTargetManagerById(id) {\n for (let index = 0; index < this.morphTargetManagers.length; index++) {\n if (this.morphTargetManagers[index].uniqueId === id) {\n return this.morphTargetManagers[index];\n }\n }\n return null;\n }\n /**\n * Gets a morph target using a given id (if many are found, this function will pick the first one)\n * @param id defines the id to search for\n * @returns the found morph target or null if not found at all.\n */\n getMorphTargetById(id) {\n for (let managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\n const morphTargetManager = this.morphTargetManagers[managerIndex];\n for (let index = 0; index < morphTargetManager.numTargets; ++index) {\n const target = morphTargetManager.getTarget(index);\n if (target.id === id) {\n return target;\n }\n }\n }\n return null;\n }\n /**\n * Gets a morph target using a given name (if many are found, this function will pick the first one)\n * @param name defines the name to search for\n * @returns the found morph target or null if not found at all.\n */\n getMorphTargetByName(name) {\n for (let managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\n const morphTargetManager = this.morphTargetManagers[managerIndex];\n for (let index = 0; index < morphTargetManager.numTargets; ++index) {\n const target = morphTargetManager.getTarget(index);\n if (target.name === name) {\n return target;\n }\n }\n }\n return null;\n }\n /**\n * Gets a post process using a given name (if many are found, this function will pick the first one)\n * @param name defines the name to search for\n * @returns the found post process or null if not found at all.\n */\n getPostProcessByName(name) {\n for (let postProcessIndex = 0; postProcessIndex < this.postProcesses.length; ++postProcessIndex) {\n const postProcess = this.postProcesses[postProcessIndex];\n if (postProcess.name === name) {\n return postProcess;\n }\n }\n return null;\n }\n /**\n * Gets a boolean indicating if the given mesh is active\n * @param mesh defines the mesh to look for\n * @returns true if the mesh is in the active list\n */\n isActiveMesh(mesh) {\n return this._activeMeshes.indexOf(mesh) !== -1;\n }\n /**\n * Return a unique id as a string which can serve as an identifier for the scene\n */\n get uid() {\n if (!this._uid) {\n this._uid = Tools.RandomId();\n }\n return this._uid;\n }\n /**\n * Add an externally attached data from its key.\n * This method call will fail and return false, if such key already exists.\n * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.\n * @param key the unique key that identifies the data\n * @param data the data object to associate to the key for this Engine instance\n * @returns true if no such key were already present and the data was added successfully, false otherwise\n */\n addExternalData(key, data) {\n if (!this._externalData) {\n this._externalData = new StringDictionary();\n }\n return this._externalData.add(key, data);\n }\n /**\n * Get an externally attached data from its key\n * @param key the unique key that identifies the data\n * @returns the associated data, if present (can be null), or undefined if not present\n */\n getExternalData(key) {\n if (!this._externalData) {\n return null;\n }\n return this._externalData.get(key);\n }\n /**\n * Get an externally attached data from its key, create it using a factory if it's not already present\n * @param key the unique key that identifies the data\n * @param factory the factory that will be called to create the instance if and only if it doesn't exists\n * @returns the associated data, can be null if the factory returned null.\n */\n getOrAddExternalDataWithFactory(key, factory) {\n if (!this._externalData) {\n this._externalData = new StringDictionary();\n }\n return this._externalData.getOrAddWithFactory(key, factory);\n }\n /**\n * Remove an externally attached data from the Engine instance\n * @param key the unique key that identifies the data\n * @returns true if the data was successfully removed, false if it doesn't exist\n */\n removeExternalData(key) {\n return this._externalData.remove(key);\n }\n _evaluateSubMesh(subMesh, mesh, initialMesh, forcePush) {\n if (forcePush || subMesh.isInFrustum(this._frustumPlanes)) {\n for (const step of this._evaluateSubMeshStage) {\n step.action(mesh, subMesh);\n }\n const material = subMesh.getMaterial();\n if (material !== null && material !== undefined) {\n // Render targets\n if (material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\n if (this._processedMaterials.indexOf(material) === -1) {\n this._processedMaterials.push(material);\n this._materialsRenderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\n }\n }\n // Dispatch\n this._renderingManager.dispatch(subMesh, mesh, material);\n }\n }\n }\n /**\n * Clear the processed materials smart array preventing retention point in material dispose.\n */\n freeProcessedMaterials() {\n this._processedMaterials.dispose();\n }\n /** Gets or sets a boolean blocking all the calls to freeActiveMeshes and freeRenderingGroups\n * It can be used in order to prevent going through methods freeRenderingGroups and freeActiveMeshes several times to improve performance\n * when disposing several meshes in a row or a hierarchy of meshes.\n * When used, it is the responsibility of the user to blockfreeActiveMeshesAndRenderingGroups back to false.\n */\n get blockfreeActiveMeshesAndRenderingGroups() {\n return this._preventFreeActiveMeshesAndRenderingGroups;\n }\n set blockfreeActiveMeshesAndRenderingGroups(value) {\n if (this._preventFreeActiveMeshesAndRenderingGroups === value) {\n return;\n }\n if (value) {\n this.freeActiveMeshes();\n this.freeRenderingGroups();\n }\n this._preventFreeActiveMeshesAndRenderingGroups = value;\n }\n /**\n * Clear the active meshes smart array preventing retention point in mesh dispose.\n */\n freeActiveMeshes() {\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\n return;\n }\n this._activeMeshes.dispose();\n if (this.activeCamera && this.activeCamera._activeMeshes) {\n this.activeCamera._activeMeshes.dispose();\n }\n if (this.activeCameras) {\n for (let i = 0; i < this.activeCameras.length; i++) {\n const activeCamera = this.activeCameras[i];\n if (activeCamera && activeCamera._activeMeshes) {\n activeCamera._activeMeshes.dispose();\n }\n }\n }\n }\n /**\n * Clear the info related to rendering groups preventing retention points during dispose.\n */\n freeRenderingGroups() {\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\n return;\n }\n if (this._renderingManager) {\n this._renderingManager.freeRenderingGroups();\n }\n if (this.textures) {\n for (let i = 0; i < this.textures.length; i++) {\n const texture = this.textures[i];\n if (texture && texture.renderList) {\n texture.freeRenderingGroups();\n }\n }\n }\n }\n /** @internal */\n _isInIntermediateRendering() {\n return this._intermediateRendering;\n }\n /**\n * Use this function to stop evaluating active meshes. The current list will be keep alive between frames\n * @param skipEvaluateActiveMeshes defines an optional boolean indicating that the evaluate active meshes step must be completely skipped\n * @param onSuccess optional success callback\n * @param onError optional error callback\n * @param freezeMeshes defines if meshes should be frozen (true by default)\n * @param keepFrustumCulling defines if you want to keep running the frustum clipping (false by default)\n * @returns the current scene\n */\n freezeActiveMeshes(skipEvaluateActiveMeshes = false, onSuccess, onError, freezeMeshes = true, keepFrustumCulling = false) {\n this.executeWhenReady(() => {\n if (!this.activeCamera) {\n onError && onError(\"No active camera found\");\n return;\n }\n if (!this._frustumPlanes) {\n this.updateTransformMatrix();\n }\n this._evaluateActiveMeshes();\n this._activeMeshesFrozen = true;\n this._activeMeshesFrozenButKeepClipping = keepFrustumCulling;\n this._skipEvaluateActiveMeshesCompletely = skipEvaluateActiveMeshes;\n if (freezeMeshes) {\n for (let index = 0; index < this._activeMeshes.length; index++) {\n this._activeMeshes.data[index]._freeze();\n }\n }\n onSuccess && onSuccess();\n });\n return this;\n }\n /**\n * Use this function to restart evaluating active meshes on every frame\n * @returns the current scene\n */\n unfreezeActiveMeshes() {\n for (let index = 0; index < this.meshes.length; index++) {\n const mesh = this.meshes[index];\n if (mesh._internalAbstractMeshDataInfo) {\n mesh._internalAbstractMeshDataInfo._isActive = false;\n }\n }\n for (let index = 0; index < this._activeMeshes.length; index++) {\n this._activeMeshes.data[index]._unFreeze();\n }\n this._activeMeshesFrozen = false;\n return this;\n }\n _executeActiveContainerCleanup(container) {\n const isInFastMode = this._engine.snapshotRendering && this._engine.snapshotRenderingMode === 1;\n if (!isInFastMode && this._activeMeshesFrozen && this._activeMeshes.length) {\n return; // Do not execute in frozen mode\n }\n // We need to ensure we are not in the rendering loop\n this.onBeforeRenderObservable.addOnce(() => container.dispose());\n }\n _evaluateActiveMeshes() {\n if (this._engine.snapshotRendering && this._engine.snapshotRenderingMode === 1) {\n if (this._activeMeshes.length > 0) {\n var _this$activeCamera2;\n (_this$activeCamera2 = this.activeCamera) === null || _this$activeCamera2 === void 0 || _this$activeCamera2._activeMeshes.reset();\n this._activeMeshes.reset();\n this._renderingManager.reset();\n this._processedMaterials.reset();\n this._activeParticleSystems.reset();\n this._activeSkeletons.reset();\n this._softwareSkinnedMeshes.reset();\n }\n return;\n }\n if (this._activeMeshesFrozen && this._activeMeshes.length) {\n if (!this._skipEvaluateActiveMeshesCompletely) {\n const len = this._activeMeshes.length;\n for (let i = 0; i < len; i++) {\n const mesh = this._activeMeshes.data[i];\n mesh.computeWorldMatrix();\n }\n }\n if (this._activeParticleSystems) {\n const psLength = this._activeParticleSystems.length;\n for (let i = 0; i < psLength; i++) {\n this._activeParticleSystems.data[i].animate();\n }\n }\n this._renderingManager.resetSprites();\n return;\n }\n if (!this.activeCamera) {\n return;\n }\n this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this);\n this.activeCamera._activeMeshes.reset();\n this._activeMeshes.reset();\n this._renderingManager.reset();\n this._processedMaterials.reset();\n this._activeParticleSystems.reset();\n this._activeSkeletons.reset();\n this._softwareSkinnedMeshes.reset();\n this._materialsRenderTargets.reset();\n for (const step of this._beforeEvaluateActiveMeshStage) {\n step.action();\n }\n // Determine mesh candidates\n const meshes = this.getActiveMeshCandidates();\n // Check each mesh\n const len = meshes.length;\n for (let i = 0; i < len; i++) {\n const mesh = meshes.data[i];\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = false;\n if (mesh.isBlocked) {\n continue;\n }\n this._totalVertices.addCount(mesh.getTotalVertices(), false);\n if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.hasAZeroComponent) {\n continue;\n }\n mesh.computeWorldMatrix();\n // Intersections\n if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(12, 13)) {\n this._meshesForIntersections.pushNoDuplicate(mesh);\n }\n // Switch to current LOD\n let meshToRender = this.customLODSelector ? this.customLODSelector(mesh, this.activeCamera) : mesh.getLOD(this.activeCamera);\n mesh._internalAbstractMeshDataInfo._currentLOD = meshToRender;\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = true;\n if (meshToRender === undefined || meshToRender === null) {\n continue;\n }\n // Compute world matrix if LOD is billboard\n if (meshToRender !== mesh && meshToRender.billboardMode !== 0) {\n meshToRender.computeWorldMatrix();\n }\n mesh._preActivate();\n if (mesh.isVisible && mesh.visibility > 0 && (mesh.layerMask & this.activeCamera.layerMask) !== 0 && (this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(this._frustumPlanes))) {\n this._activeMeshes.push(mesh);\n this.activeCamera._activeMeshes.push(mesh);\n if (meshToRender !== mesh) {\n meshToRender._activate(this._renderId, false);\n }\n for (const step of this._preActiveMeshStage) {\n step.action(mesh);\n }\n if (mesh._activate(this._renderId, false)) {\n if (!mesh.isAnInstance) {\n meshToRender._internalAbstractMeshDataInfo._onlyForInstances = false;\n } else {\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\n meshToRender = mesh;\n }\n }\n meshToRender._internalAbstractMeshDataInfo._isActive = true;\n this._activeMesh(mesh, meshToRender);\n }\n mesh._postActivate();\n }\n }\n this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this);\n // Particle systems\n if (this.particlesEnabled) {\n this.onBeforeParticlesRenderingObservable.notifyObservers(this);\n for (let particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {\n const particleSystem = this.particleSystems[particleIndex];\n if (!particleSystem.isStarted() || !particleSystem.emitter) {\n continue;\n }\n const emitter = particleSystem.emitter;\n if (!emitter.position || emitter.isEnabled()) {\n this._activeParticleSystems.push(particleSystem);\n particleSystem.animate();\n this._renderingManager.dispatchParticles(particleSystem);\n }\n }\n this.onAfterParticlesRenderingObservable.notifyObservers(this);\n }\n }\n /** @internal */\n _prepareSkeleton(mesh) {\n if (!this._skeletonsEnabled || !mesh.skeleton) {\n return;\n }\n if (this._activeSkeletons.pushNoDuplicate(mesh.skeleton)) {\n mesh.skeleton.prepare();\n this._activeBones.addCount(mesh.skeleton.bones.length, false);\n }\n if (!mesh.computeBonesUsingShaders) {\n if (this._softwareSkinnedMeshes.pushNoDuplicate(mesh) && this.frameGraph) {\n mesh.applySkeleton(mesh.skeleton);\n }\n }\n }\n _activeMesh(sourceMesh, mesh) {\n this._prepareSkeleton(mesh);\n let forcePush = sourceMesh.hasInstances || sourceMesh.isAnInstance || this.dispatchAllSubMeshesOfActiveMeshes || this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh;\n if (mesh && mesh.subMeshes && mesh.subMeshes.length > 0) {\n const subMeshes = this.getActiveSubMeshCandidates(mesh);\n const len = subMeshes.length;\n forcePush = forcePush || len === 1;\n for (let i = 0; i < len; i++) {\n const subMesh = subMeshes.data[i];\n this._evaluateSubMesh(subMesh, mesh, sourceMesh, forcePush);\n }\n }\n }\n /**\n * Update the transform matrix to update from the current active camera\n * @param force defines a boolean used to force the update even if cache is up to date\n */\n updateTransformMatrix(force) {\n const activeCamera = this.activeCamera;\n if (!activeCamera) {\n return;\n }\n if (activeCamera._renderingMultiview) {\n const leftCamera = activeCamera._rigCameras[0];\n const rightCamera = activeCamera._rigCameras[1];\n this.setTransformMatrix(leftCamera.getViewMatrix(), leftCamera.getProjectionMatrix(force), rightCamera.getViewMatrix(), rightCamera.getProjectionMatrix(force));\n } else {\n this.setTransformMatrix(activeCamera.getViewMatrix(), activeCamera.getProjectionMatrix(force));\n }\n }\n _bindFrameBuffer(camera, clear = true) {\n if (camera && camera._multiviewTexture) {\n camera._multiviewTexture._bindFrameBuffer();\n } else if (camera && camera.outputRenderTarget) {\n camera.outputRenderTarget._bindFrameBuffer();\n } else {\n if (!this._engine._currentFrameBufferIsDefaultFrameBuffer()) {\n this._engine.restoreDefaultFramebuffer();\n }\n }\n if (clear) {\n this._clearFrameBuffer(camera);\n }\n }\n _clearFrameBuffer(camera) {\n // we assume the framebuffer currently bound is the right one\n if (camera && camera._multiviewTexture) {\n // no clearing\n } else if (camera && camera.outputRenderTarget && !camera._renderingMultiview) {\n const rtt = camera.outputRenderTarget;\n if (rtt.onClearObservable.hasObservers()) {\n rtt.onClearObservable.notifyObservers(this._engine);\n } else if (!rtt.skipInitialClear && !camera.isRightCamera) {\n if (this.autoClear) {\n this._engine.clear(rtt.clearColor || this._clearColor, !rtt._cleared, true, true);\n }\n rtt._cleared = true;\n }\n } else {\n if (!this._defaultFrameBufferCleared) {\n this._defaultFrameBufferCleared = true;\n this._clear();\n } else {\n this._engine.clear(null, false, true, true);\n }\n }\n }\n /**\n * @internal\n */\n _renderForCamera(camera, rigParent, bindFrameBuffer = true) {\n var _ref, _camera$outputRenderT, _camera$outputRenderT2;\n if (camera && camera._skipRendering) {\n return;\n }\n const engine = this._engine;\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\n this._activeCamera = camera;\n if (!this.activeCamera) {\n throw new Error(\"Active camera not set\");\n }\n // Viewport\n engine.setViewport(this.activeCamera.viewport);\n // Camera\n this.resetCachedMaterial();\n this._renderId++;\n if (!this.prePass && bindFrameBuffer) {\n let skipInitialClear = true;\n if (camera._renderingMultiview && camera.outputRenderTarget) {\n skipInitialClear = camera.outputRenderTarget.skipInitialClear;\n if (this.autoClear) {\n this._defaultFrameBufferCleared = false;\n camera.outputRenderTarget.skipInitialClear = false;\n }\n }\n this._bindFrameBuffer(this._activeCamera);\n if (camera._renderingMultiview && camera.outputRenderTarget) {\n camera.outputRenderTarget.skipInitialClear = skipInitialClear;\n }\n }\n this.updateTransformMatrix();\n this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera);\n // Meshes\n this._evaluateActiveMeshes();\n // Software skinning\n for (let softwareSkinnedMeshIndex = 0; softwareSkinnedMeshIndex < this._softwareSkinnedMeshes.length; softwareSkinnedMeshIndex++) {\n const mesh = this._softwareSkinnedMeshes.data[softwareSkinnedMeshIndex];\n mesh.applySkeleton(mesh.skeleton);\n }\n // Render targets\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\n this._renderTargets.concatWithNoDuplicate(this._materialsRenderTargets);\n if (camera.customRenderTargets && camera.customRenderTargets.length > 0) {\n this._renderTargets.concatWithNoDuplicate(camera.customRenderTargets);\n }\n if (rigParent && rigParent.customRenderTargets && rigParent.customRenderTargets.length > 0) {\n this._renderTargets.concatWithNoDuplicate(rigParent.customRenderTargets);\n }\n if (this.environmentTexture && this.environmentTexture.isRenderTarget) {\n this._renderTargets.pushNoDuplicate(this.environmentTexture);\n }\n // Collects render targets from external components.\n for (const step of this._gatherActiveCameraRenderTargetsStage) {\n step.action(this._renderTargets);\n }\n let needRebind = false;\n if (this.renderTargetsEnabled) {\n this._intermediateRendering = true;\n if (this._renderTargets.length > 0) {\n Tools.StartPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\n for (let renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {\n const renderTarget = this._renderTargets.data[renderIndex];\n if (renderTarget._shouldRender()) {\n this._renderId++;\n const hasSpecialRenderTargetCamera = renderTarget.activeCamera && renderTarget.activeCamera !== this.activeCamera;\n renderTarget.render(hasSpecialRenderTargetCamera, this.dumpNextRenderTargets);\n needRebind = true;\n }\n }\n Tools.EndPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\n this._renderId++;\n }\n for (const step of this._cameraDrawRenderTargetStage) {\n needRebind = step.action(this.activeCamera) || needRebind;\n }\n this._intermediateRendering = false;\n }\n this._engine.currentRenderPassId = (_ref = (_camera$outputRenderT = (_camera$outputRenderT2 = camera.outputRenderTarget) === null || _camera$outputRenderT2 === void 0 ? void 0 : _camera$outputRenderT2.renderPassId) !== null && _camera$outputRenderT !== void 0 ? _camera$outputRenderT : camera.renderPassId) !== null && _ref !== void 0 ? _ref : 0;\n // Restore framebuffer after rendering to targets\n if (needRebind && !this.prePass) {\n this._bindFrameBuffer(this._activeCamera, false);\n this.updateTransformMatrix();\n }\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\n // Prepare Frame\n if (this.postProcessManager && !camera._multiviewTexture && !this.prePass) {\n this.postProcessManager._prepareFrame();\n }\n // Before Camera Draw\n for (const step of this._beforeCameraDrawStage) {\n step.action(this.activeCamera);\n }\n // Render\n this.onBeforeDrawPhaseObservable.notifyObservers(this);\n if (engine.snapshotRendering && engine.snapshotRenderingMode === 1) {\n this.finalizeSceneUbo();\n }\n this._renderingManager.render(null, null, true, true);\n this.onAfterDrawPhaseObservable.notifyObservers(this);\n // After Camera Draw\n for (const step of this._afterCameraDrawStage) {\n step.action(this.activeCamera);\n }\n // Finalize frame\n if (this.postProcessManager && !camera._multiviewTexture) {\n // if the camera has an output render target, render the post process to the render target\n const texture = camera.outputRenderTarget ? camera.outputRenderTarget.renderTarget : undefined;\n this.postProcessManager._finalizeFrame(camera.isIntermediate, texture);\n }\n // After post process\n for (const step of this._afterCameraPostProcessStage) {\n step.action(this.activeCamera);\n }\n // Reset some special arrays\n this._renderTargets.reset();\n this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera);\n }\n _processSubCameras(camera, bindFrameBuffer = true) {\n if (camera.cameraRigMode === 0 || camera._renderingMultiview) {\n if (camera._renderingMultiview && !this._multiviewSceneUbo) {\n this._createMultiviewUbo();\n }\n this._renderForCamera(camera, undefined, bindFrameBuffer);\n this.onAfterRenderCameraObservable.notifyObservers(camera);\n return;\n }\n if (camera._useMultiviewToSingleView) {\n this._renderMultiviewToSingleView(camera);\n } else {\n // rig cameras\n this.onBeforeCameraRenderObservable.notifyObservers(camera);\n for (let index = 0; index < camera._rigCameras.length; index++) {\n this._renderForCamera(camera._rigCameras[index], camera);\n }\n }\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\n this._activeCamera = camera;\n this.updateTransformMatrix();\n this.onAfterRenderCameraObservable.notifyObservers(camera);\n }\n _checkIntersections() {\n for (let index = 0; index < this._meshesForIntersections.length; index++) {\n const sourceMesh = this._meshesForIntersections.data[index];\n if (!sourceMesh.actionManager) {\n continue;\n }\n for (let actionIndex = 0; sourceMesh.actionManager && actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {\n const action = sourceMesh.actionManager.actions[actionIndex];\n if (action.trigger === 12 || action.trigger === 13) {\n const parameters = action.getTriggerParameter();\n const otherMesh = parameters.mesh ? parameters.mesh : parameters;\n const areIntersecting = otherMesh.intersectsMesh(sourceMesh, parameters.usePreciseIntersection);\n const currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);\n if (areIntersecting && currentIntersectionInProgress === -1) {\n if (action.trigger === 12) {\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\n sourceMesh._intersectionsInProgress.push(otherMesh);\n } else if (action.trigger === 13) {\n sourceMesh._intersectionsInProgress.push(otherMesh);\n }\n } else if (!areIntersecting && currentIntersectionInProgress > -1) {\n //They intersected, and now they don't.\n //is this trigger an exit trigger? execute an event.\n if (action.trigger === 13) {\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\n }\n //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.\n if (!sourceMesh.actionManager.hasSpecificTrigger(13, parameter => {\n const parameterMesh = parameter.mesh ? parameter.mesh : parameter;\n return otherMesh === parameterMesh;\n }) || action.trigger === 13) {\n sourceMesh._intersectionsInProgress.splice(currentIntersectionInProgress, 1);\n }\n }\n }\n }\n }\n }\n /**\n * @internal\n */\n _advancePhysicsEngineStep(step) {\n // Do nothing. Code will be replaced if physics engine component is referenced\n }\n /** @internal */\n _animate(customDeltaTime) {\n // Nothing to do as long as Animatable have not been imported.\n }\n /** Execute all animations (for a frame) */\n animate() {\n if (this._engine.isDeterministicLockStep()) {\n let deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime)) + this._timeAccumulator;\n const defaultFrameTime = this._engine.getTimeStep();\n const defaultFPS = 1000.0 / defaultFrameTime / 1000.0;\n let stepsTaken = 0;\n const maxSubSteps = this._engine.getLockstepMaxSteps();\n let internalSteps = Math.floor(deltaTime / defaultFrameTime);\n internalSteps = Math.min(internalSteps, maxSubSteps);\n while (deltaTime > 0 && stepsTaken < internalSteps) {\n this.onBeforeStepObservable.notifyObservers(this);\n // Animations\n this._animationRatio = defaultFrameTime * defaultFPS;\n this._animate(defaultFrameTime);\n this.onAfterAnimationsObservable.notifyObservers(this);\n // Physics\n if (this.physicsEnabled) {\n this._advancePhysicsEngineStep(defaultFrameTime);\n }\n this.onAfterStepObservable.notifyObservers(this);\n this._currentStepId++;\n stepsTaken++;\n deltaTime -= defaultFrameTime;\n }\n this._timeAccumulator = deltaTime < 0 ? 0 : deltaTime;\n } else {\n // Animations\n const deltaTime = this.useConstantAnimationDeltaTime ? 16 : Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));\n this._animationRatio = deltaTime * (60.0 / 1000.0);\n this._animate();\n this.onAfterAnimationsObservable.notifyObservers(this);\n // Physics\n if (this.physicsEnabled) {\n this._advancePhysicsEngineStep(deltaTime);\n }\n }\n }\n _clear() {\n if (this.autoClearDepthAndStencil || this.autoClear) {\n this._engine.clear(this._clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);\n }\n }\n _checkCameraRenderTarget(camera) {\n var _camera$rigCameras;\n if (camera !== null && camera !== void 0 && camera.outputRenderTarget && !(camera !== null && camera !== void 0 && camera.isRigCamera)) {\n camera.outputRenderTarget._cleared = false;\n }\n if (camera !== null && camera !== void 0 && (_camera$rigCameras = camera.rigCameras) !== null && _camera$rigCameras !== void 0 && _camera$rigCameras.length) {\n for (let i = 0; i < camera.rigCameras.length; ++i) {\n const rtt = camera.rigCameras[i].outputRenderTarget;\n if (rtt) {\n rtt._cleared = false;\n }\n }\n }\n }\n /**\n * Resets the draw wrappers cache of all meshes\n * @param passId If provided, releases only the draw wrapper corresponding to this render pass id\n */\n resetDrawCache(passId) {\n if (!this.meshes) {\n return;\n }\n for (const mesh of this.meshes) {\n mesh.resetDrawCache(passId);\n }\n }\n _renderWithFrameGraph(updateCameras = true, ignoreAnimations = false) {\n var _this$frameGraph;\n this.activeCamera = null;\n this._activeParticleSystems.reset();\n this._activeSkeletons.reset();\n // Update Cameras\n if (updateCameras) {\n for (const camera of this.cameras) {\n camera.update();\n if (camera.cameraRigMode !== 0) {\n // rig cameras\n for (let index = 0; index < camera._rigCameras.length; index++) {\n camera._rigCameras[index].update();\n }\n }\n }\n }\n // We must keep these steps because the procedural texture component relies on them.\n // TODO: move the procedural texture component to the frame graph.\n for (const step of this._beforeClearStage) {\n step.action();\n }\n // Process meshes\n const meshes = this.getActiveMeshCandidates();\n const len = meshes.length;\n for (let i = 0; i < len; i++) {\n const mesh = meshes.data[i];\n if (mesh.isBlocked) {\n continue;\n }\n this._totalVertices.addCount(mesh.getTotalVertices(), false);\n if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.hasAZeroComponent) {\n continue;\n }\n mesh.computeWorldMatrix();\n if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(12, 13)) {\n this._meshesForIntersections.pushNoDuplicate(mesh);\n }\n }\n // Animate Particle systems\n if (this.particlesEnabled) {\n for (let particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {\n const particleSystem = this.particleSystems[particleIndex];\n if (!particleSystem.isStarted() || !particleSystem.emitter) {\n continue;\n }\n const emitter = particleSystem.emitter;\n if (!emitter.position || emitter.isEnabled()) {\n this._activeParticleSystems.push(particleSystem);\n particleSystem.animate();\n }\n }\n }\n // Render the graph\n (_this$frameGraph = this.frameGraph) === null || _this$frameGraph === void 0 || _this$frameGraph.execute();\n }\n /**\n * Render the scene\n * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)\n * @param ignoreAnimations defines a boolean indicating if animations should not be executed (false by default)\n */\n render(updateCameras = true, ignoreAnimations = false) {\n var _this$activeCameras;\n if (this.isDisposed) {\n return;\n }\n if (this.onReadyObservable.hasObservers() && this._executeWhenReadyTimeoutId === null) {\n this._checkIsReady();\n }\n this._frameId++;\n this._defaultFrameBufferCleared = false;\n this._checkCameraRenderTarget(this.activeCamera);\n if ((_this$activeCameras = this.activeCameras) !== null && _this$activeCameras !== void 0 && _this$activeCameras.length) {\n this.activeCameras.forEach(this._checkCameraRenderTarget);\n }\n // Register components that have been associated lately to the scene.\n this._registerTransientComponents();\n this._activeParticles.fetchNewFrame();\n this._totalVertices.fetchNewFrame();\n this._activeIndices.fetchNewFrame();\n this._activeBones.fetchNewFrame();\n this._meshesForIntersections.reset();\n this.resetCachedMaterial();\n this.onBeforeAnimationsObservable.notifyObservers(this);\n // Actions\n if (this.actionManager) {\n this.actionManager.processTrigger(11);\n }\n // Animations\n if (!ignoreAnimations) {\n this.animate();\n }\n // Before camera update steps\n for (const step of this._beforeCameraUpdateStage) {\n step.action();\n }\n // Update Cameras\n if (updateCameras) {\n if (this.activeCameras && this.activeCameras.length > 0) {\n for (let cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\n const camera = this.activeCameras[cameraIndex];\n camera.update();\n if (camera.cameraRigMode !== 0) {\n // rig cameras\n for (let index = 0; index < camera._rigCameras.length; index++) {\n camera._rigCameras[index].update();\n }\n }\n }\n } else if (this.activeCamera) {\n this.activeCamera.update();\n if (this.activeCamera.cameraRigMode !== 0) {\n // rig cameras\n for (let index = 0; index < this.activeCamera._rigCameras.length; index++) {\n this.activeCamera._rigCameras[index].update();\n }\n }\n }\n }\n // Before render\n this.onBeforeRenderObservable.notifyObservers(this);\n // Custom render function?\n if (this.customRenderFunction) {\n this._renderId++;\n this._engine.currentRenderPassId = 0;\n this.customRenderFunction(updateCameras, ignoreAnimations);\n } else {\n var _this$activeCameras2, _currentActiveCamera$;\n const engine = this.getEngine();\n // Customs render targets\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\n const currentActiveCamera = (_this$activeCameras2 = this.activeCameras) !== null && _this$activeCameras2 !== void 0 && _this$activeCameras2.length ? this.activeCameras[0] : this.activeCamera;\n if (this.renderTargetsEnabled) {\n Tools.StartPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\n this._intermediateRendering = true;\n for (let customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {\n const renderTarget = this.customRenderTargets[customIndex];\n if (renderTarget._shouldRender()) {\n this._renderId++;\n this.activeCamera = renderTarget.activeCamera || this.activeCamera;\n if (!this.activeCamera) {\n throw new Error(\"Active camera not set\");\n }\n // Viewport\n engine.setViewport(this.activeCamera.viewport);\n // Camera\n this.updateTransformMatrix();\n renderTarget.render(currentActiveCamera !== this.activeCamera, this.dumpNextRenderTargets);\n }\n }\n Tools.EndPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\n this._intermediateRendering = false;\n this._renderId++;\n }\n this._engine.currentRenderPassId = (_currentActiveCamera$ = currentActiveCamera === null || currentActiveCamera === void 0 ? void 0 : currentActiveCamera.renderPassId) !== null && _currentActiveCamera$ !== void 0 ? _currentActiveCamera$ : 0;\n // Restore back buffer\n this.activeCamera = currentActiveCamera;\n if (this._activeCamera && this._activeCamera.cameraRigMode !== 22 && !this.prePass) {\n this._bindFrameBuffer(this._activeCamera, false);\n }\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\n for (const step of this._beforeClearStage) {\n step.action();\n }\n // Clear\n this._clearFrameBuffer(this.activeCamera);\n // Collects render targets from external components.\n for (const step of this._gatherRenderTargetsStage) {\n step.action(this._renderTargets);\n }\n // Multi-cameras?\n if (this.activeCameras && this.activeCameras.length > 0) {\n for (let cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\n this._processSubCameras(this.activeCameras[cameraIndex], cameraIndex > 0);\n }\n } else {\n if (!this.activeCamera) {\n throw new Error(\"No camera defined\");\n }\n this._processSubCameras(this.activeCamera, !!this.activeCamera.outputRenderTarget);\n }\n }\n // Intersection checks\n this._checkIntersections();\n // Executes the after render stage actions.\n for (const step of this._afterRenderStage) {\n step.action();\n }\n // After render\n if (this.afterRender) {\n this.afterRender();\n }\n this.onAfterRenderObservable.notifyObservers(this);\n // Cleaning\n if (this._toBeDisposed.length) {\n for (let index = 0; index < this._toBeDisposed.length; index++) {\n const data = this._toBeDisposed[index];\n if (data) {\n data.dispose();\n }\n }\n this._toBeDisposed.length = 0;\n }\n if (this.dumpNextRenderTargets) {\n this.dumpNextRenderTargets = false;\n }\n this._activeBones.addCount(0, true);\n this._activeIndices.addCount(0, true);\n this._activeParticles.addCount(0, true);\n this._engine.restoreDefaultFramebuffer();\n }\n /**\n * Freeze all materials\n * A frozen material will not be updatable but should be faster to render\n * Note: multimaterials will not be frozen, but their submaterials will\n */\n freezeMaterials() {\n for (let i = 0; i < this.materials.length; i++) {\n this.materials[i].freeze();\n }\n }\n /**\n * Unfreeze all materials\n * A frozen material will not be updatable but should be faster to render\n */\n unfreezeMaterials() {\n for (let i = 0; i < this.materials.length; i++) {\n this.materials[i].unfreeze();\n }\n }\n /**\n * Releases all held resources\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this.beforeRender = null;\n this.afterRender = null;\n this.metadata = null;\n this.skeletons.length = 0;\n this.morphTargetManagers.length = 0;\n this._transientComponents.length = 0;\n this._isReadyForMeshStage.clear();\n this._beforeEvaluateActiveMeshStage.clear();\n this._evaluateSubMeshStage.clear();\n this._preActiveMeshStage.clear();\n this._cameraDrawRenderTargetStage.clear();\n this._beforeCameraDrawStage.clear();\n this._beforeRenderTargetDrawStage.clear();\n this._beforeRenderingGroupDrawStage.clear();\n this._beforeRenderingMeshStage.clear();\n this._afterRenderingMeshStage.clear();\n this._afterRenderingGroupDrawStage.clear();\n this._afterCameraDrawStage.clear();\n this._afterRenderTargetDrawStage.clear();\n this._afterRenderStage.clear();\n this._beforeCameraUpdateStage.clear();\n this._beforeClearStage.clear();\n this._gatherRenderTargetsStage.clear();\n this._gatherActiveCameraRenderTargetsStage.clear();\n this._pointerMoveStage.clear();\n this._pointerDownStage.clear();\n this._pointerUpStage.clear();\n this.importedMeshesFiles = [];\n if (this._activeAnimatables && this.stopAllAnimations) {\n // Ensures that no animatable notifies a callback that could start a new animation group, constantly adding new animatables to the active list...\n this._activeAnimatables.forEach(animatable => {\n animatable.onAnimationEndObservable.clear();\n animatable.onAnimationEnd = null;\n });\n this.stopAllAnimations();\n }\n this.resetCachedMaterial();\n // Smart arrays\n if (this.activeCamera) {\n this.activeCamera._activeMeshes.dispose();\n this.activeCamera = null;\n }\n this.activeCameras = null;\n this._activeMeshes.dispose();\n this._renderingManager.dispose();\n this._processedMaterials.dispose();\n this._activeParticleSystems.dispose();\n this._activeSkeletons.dispose();\n this._softwareSkinnedMeshes.dispose();\n this._renderTargets.dispose();\n this._materialsRenderTargets.dispose();\n this._registeredForLateAnimationBindings.dispose();\n this._meshesForIntersections.dispose();\n this._toBeDisposed.length = 0;\n // Abort active requests\n const activeRequests = this._activeRequests.slice();\n for (const request of activeRequests) {\n request.abort();\n }\n this._activeRequests.length = 0;\n // Events\n try {\n this.onDisposeObservable.notifyObservers(this);\n } catch (e) {\n Logger.Error(\"An error occurred while calling onDisposeObservable!\", e);\n }\n this.detachControl();\n // Detach cameras\n const canvas = this._engine.getInputElement();\n if (canvas) {\n for (let index = 0; index < this.cameras.length; index++) {\n this.cameras[index].detachControl();\n }\n }\n // Release animation groups\n this._disposeList(this.animationGroups);\n // Release lights\n this._disposeList(this.lights);\n // Release materials\n if (this._defaultMaterial) {\n this._defaultMaterial.dispose();\n }\n this._disposeList(this.multiMaterials);\n this._disposeList(this.materials);\n // Release meshes\n this._disposeList(this.meshes, item => item.dispose(true));\n this._disposeList(this.transformNodes, item => item.dispose(true));\n // Release cameras\n const cameras = this.cameras;\n this._disposeList(cameras);\n // Release particles\n this._disposeList(this.particleSystems);\n // Release postProcesses\n this._disposeList(this.postProcesses);\n // Release textures\n this._disposeList(this.textures);\n // Release morph targets\n this._disposeList(this.morphTargetManagers);\n // Release UBO\n this._sceneUbo.dispose();\n if (this._multiviewSceneUbo) {\n this._multiviewSceneUbo.dispose();\n }\n // Post-processes\n this.postProcessManager.dispose();\n // Components\n this._disposeList(this._components);\n // Remove from engine\n let index = this._engine.scenes.indexOf(this);\n if (index > -1) {\n this._engine.scenes.splice(index, 1);\n }\n if (EngineStore._LastCreatedScene === this) {\n if (this._engine.scenes.length > 0) {\n EngineStore._LastCreatedScene = this._engine.scenes[this._engine.scenes.length - 1];\n } else {\n EngineStore._LastCreatedScene = null;\n }\n }\n index = this._engine._virtualScenes.indexOf(this);\n if (index > -1) {\n this._engine._virtualScenes.splice(index, 1);\n }\n this._engine.wipeCaches(true);\n this.onDisposeObservable.clear();\n this.onBeforeRenderObservable.clear();\n this.onAfterRenderObservable.clear();\n this.onBeforeRenderTargetsRenderObservable.clear();\n this.onAfterRenderTargetsRenderObservable.clear();\n this.onAfterStepObservable.clear();\n this.onBeforeStepObservable.clear();\n this.onBeforeActiveMeshesEvaluationObservable.clear();\n this.onAfterActiveMeshesEvaluationObservable.clear();\n this.onBeforeParticlesRenderingObservable.clear();\n this.onAfterParticlesRenderingObservable.clear();\n this.onBeforeDrawPhaseObservable.clear();\n this.onAfterDrawPhaseObservable.clear();\n this.onBeforeAnimationsObservable.clear();\n this.onAfterAnimationsObservable.clear();\n this.onDataLoadedObservable.clear();\n this.onBeforeRenderingGroupObservable.clear();\n this.onAfterRenderingGroupObservable.clear();\n this.onMeshImportedObservable.clear();\n this.onBeforeCameraRenderObservable.clear();\n this.onAfterCameraRenderObservable.clear();\n this.onAfterRenderCameraObservable.clear();\n this.onReadyObservable.clear();\n this.onNewCameraAddedObservable.clear();\n this.onCameraRemovedObservable.clear();\n this.onNewLightAddedObservable.clear();\n this.onLightRemovedObservable.clear();\n this.onNewGeometryAddedObservable.clear();\n this.onGeometryRemovedObservable.clear();\n this.onNewTransformNodeAddedObservable.clear();\n this.onTransformNodeRemovedObservable.clear();\n this.onNewMeshAddedObservable.clear();\n this.onMeshRemovedObservable.clear();\n this.onNewSkeletonAddedObservable.clear();\n this.onSkeletonRemovedObservable.clear();\n this.onNewMaterialAddedObservable.clear();\n this.onNewMultiMaterialAddedObservable.clear();\n this.onMaterialRemovedObservable.clear();\n this.onMultiMaterialRemovedObservable.clear();\n this.onNewTextureAddedObservable.clear();\n this.onTextureRemovedObservable.clear();\n this.onPrePointerObservable.clear();\n this.onPointerObservable.clear();\n this.onPreKeyboardObservable.clear();\n this.onKeyboardObservable.clear();\n this.onActiveCameraChanged.clear();\n this.onScenePerformancePriorityChangedObservable.clear();\n this.onClearColorChangedObservable.clear();\n this._isDisposed = true;\n }\n _disposeList(items, callback) {\n var _callback;\n const itemsCopy = items.slice(0);\n callback = (_callback = callback) !== null && _callback !== void 0 ? _callback : item => item.dispose();\n for (const item of itemsCopy) {\n callback(item);\n }\n items.length = 0;\n }\n /**\n * Gets if the scene is already disposed\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Call this function to reduce memory footprint of the scene.\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\n */\n clearCachedVertexData() {\n for (let meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\n const mesh = this.meshes[meshIndex];\n const geometry = mesh.geometry;\n if (geometry) {\n geometry.clearCachedData();\n }\n }\n }\n /**\n * This function will remove the local cached buffer data from texture.\n * It will save memory but will prevent the texture from being rebuilt\n */\n cleanCachedTextureBuffer() {\n for (const baseTexture of this.textures) {\n const buffer = baseTexture._buffer;\n if (buffer) {\n baseTexture._buffer = null;\n }\n }\n }\n /**\n * Get the world extend vectors with an optional filter\n *\n * @param filterPredicate the predicate - which meshes should be included when calculating the world size\n * @returns {{ min: Vector3; max: Vector3 }} min and max vectors\n */\n getWorldExtends(filterPredicate) {\n const min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n const max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n filterPredicate = filterPredicate || (() => true);\n this.meshes.filter(filterPredicate).forEach(mesh => {\n mesh.computeWorldMatrix(true);\n if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {\n return;\n }\n const boundingInfo = mesh.getBoundingInfo();\n const minBox = boundingInfo.boundingBox.minimumWorld;\n const maxBox = boundingInfo.boundingBox.maximumWorld;\n Vector3.CheckExtends(minBox, min, max);\n Vector3.CheckExtends(maxBox, min, max);\n });\n return {\n min: min,\n max: max\n };\n }\n // Picking\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\n * @param camera defines the camera to use for the picking\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\n * @returns a Ray\n */\n createPickingRay(x, y, world, camera, cameraViewSpace = false) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\n * @param result defines the ray where to store the picking ray\n * @param camera defines the camera to use for the picking\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\n * @param enableDistantPicking defines if picking should handle large values for mesh position/scaling (false by default)\n * @returns the current scene\n */\n createPickingRayToRef(x, y, world, result, camera, cameraViewSpace = false, enableDistantPicking = false) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param camera defines the camera to use for the picking\n * @returns a Ray\n */\n createPickingRayInCameraSpace(x, y, camera) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param result defines the ray where to store the picking ray\n * @param camera defines the camera to use for the picking\n * @returns the current scene\n */\n createPickingRayInCameraSpaceToRef(x, y, result, camera) {\n throw _WarnImport(\"Ray\");\n }\n /** Launch a ray to try to pick a mesh in the scene\n * @param x position on screen\n * @param y position on screen\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns a PickingInfo\n */\n pick(x, y, predicate, fastCheck, camera, trianglePredicate) {\n const warn = _WarnImport(\"Ray\", true);\n if (warn) {\n Logger.Warn(warn);\n }\n // Dummy info if picking as not been imported\n return new PickingInfo();\n }\n /** Launch a ray to try to pick a mesh in the scene using only bounding information of the main mesh (not using submeshes)\n * @param x position on screen\n * @param y position on screen\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\n * @returns a PickingInfo (Please note that some info will not be set like distance, bv, bu and everything that cannot be capture by only using bounding infos)\n */\n pickWithBoundingInfo(x, y, predicate, fastCheck, camera) {\n const warn = _WarnImport(\"Ray\", true);\n if (warn) {\n Logger.Warn(warn);\n }\n // Dummy info if picking as not been imported\n return new PickingInfo();\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Use the given ray to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\n * irrespective of orientation.\n * @param ray The ray to use to pick meshes\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns a PickingInfo\n */\n pickWithRay(ray, predicate, fastCheck, trianglePredicate) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Launch a ray to try to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\n * irrespective of orientation.\n * @param x X position on screen\n * @param y Y position on screen\n * @param predicate Predicate function used to determine eligible meshes and instances. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns an array of PickingInfo\n */\n multiPick(x, y, predicate, camera, trianglePredicate) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Launch a ray to try to pick a mesh in the scene\n * @param ray Ray to use\n * @param predicate Predicate function used to determine eligible meshes and instances. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns an array of PickingInfo\n */\n multiPickWithRay(ray, predicate, trianglePredicate) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Force the value of meshUnderPointer\n * @param mesh defines the mesh to use\n * @param pointerId optional pointer id when using more than one pointer\n * @param pickResult optional pickingInfo data used to find mesh\n */\n setPointerOverMesh(mesh, pointerId, pickResult) {\n this._inputManager.setPointerOverMesh(mesh, pointerId, pickResult);\n }\n /**\n * Gets the mesh under the pointer\n * @returns a Mesh or null if no mesh is under the pointer\n */\n getPointerOverMesh() {\n return this._inputManager.getPointerOverMesh();\n }\n // Misc.\n /** @internal */\n _rebuildGeometries() {\n for (const geometry of this.geometries) {\n geometry._rebuild();\n }\n for (const mesh of this.meshes) {\n mesh._rebuild();\n }\n if (this.postProcessManager) {\n this.postProcessManager._rebuild();\n }\n for (const component of this._components) {\n component.rebuild();\n }\n for (const system of this.particleSystems) {\n system.rebuild();\n }\n if (this.spriteManagers) {\n for (const spriteMgr of this.spriteManagers) {\n spriteMgr.rebuild();\n }\n }\n }\n /** @internal */\n _rebuildTextures() {\n for (const texture of this.textures) {\n texture._rebuild(true);\n }\n this.markAllMaterialsAsDirty(1);\n }\n /**\n * Get from a list of objects by tags\n * @param list the list of objects to use\n * @param tagsQuery the query to use\n * @param filter a predicate to filter for tags\n * @returns\n */\n _getByTags(list, tagsQuery, filter) {\n if (tagsQuery === undefined) {\n // returns the complete list (could be done with Tags.MatchesQuery but no need to have a for-loop here)\n return list;\n }\n const listByTags = [];\n for (const i in list) {\n const item = list[i];\n if (Tags && Tags.MatchesQuery(item, tagsQuery) && (!filter || filter(item))) {\n listByTags.push(item);\n }\n }\n return listByTags;\n }\n /**\n * Get a list of meshes by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of Mesh\n */\n getMeshesByTags(tagsQuery, filter) {\n return this._getByTags(this.meshes, tagsQuery, filter);\n }\n /**\n * Get a list of cameras by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of Camera\n */\n getCamerasByTags(tagsQuery, filter) {\n return this._getByTags(this.cameras, tagsQuery, filter);\n }\n /**\n * Get a list of lights by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of Light\n */\n getLightsByTags(tagsQuery, filter) {\n return this._getByTags(this.lights, tagsQuery, filter);\n }\n /**\n * Get a list of materials by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of Material\n */\n getMaterialByTags(tagsQuery, filter) {\n return this._getByTags(this.materials, tagsQuery, filter).concat(this._getByTags(this.multiMaterials, tagsQuery, filter));\n }\n /**\n * Get a list of transform nodes by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of TransformNode\n */\n getTransformNodesByTags(tagsQuery, filter) {\n return this._getByTags(this.transformNodes, tagsQuery, filter);\n }\n /**\n * Overrides the default sort function applied in the rendering group to prepare the meshes.\n * This allowed control for front to back rendering or reversly depending of the special needs.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\n */\n setRenderingOrder(renderingGroupId, opaqueSortCompareFn = null, alphaTestSortCompareFn = null, transparentSortCompareFn = null) {\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\n }\n /**\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\n * @param depth Automatically clears depth between groups if true and autoClear is true.\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\n */\n setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth = true, stencil = true) {\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth, stencil);\n }\n /**\n * Gets the current auto clear configuration for one rendering group of the rendering\n * manager.\n * @param index the rendering group index to get the information for\n * @returns The auto clear setup for the requested rendering group\n */\n getAutoClearDepthStencilSetup(index) {\n return this._renderingManager.getAutoClearDepthStencilSetup(index);\n }\n /** @internal */\n _forceBlockMaterialDirtyMechanism(value) {\n this._blockMaterialDirtyMechanism = value;\n }\n /** Gets or sets a boolean blocking all the calls to markAllMaterialsAsDirty (ie. the materials won't be updated if they are out of sync) */\n get blockMaterialDirtyMechanism() {\n return this._blockMaterialDirtyMechanism;\n }\n set blockMaterialDirtyMechanism(value) {\n if (this._blockMaterialDirtyMechanism === value) {\n return;\n }\n this._blockMaterialDirtyMechanism = value;\n if (!value) {\n // Do a complete update\n this.markAllMaterialsAsDirty(63);\n }\n }\n /**\n * Will flag all materials as dirty to trigger new shader compilation\n * @param flag defines the flag used to specify which material part must be marked as dirty\n * @param predicate If not null, it will be used to specify if a material has to be marked as dirty\n */\n markAllMaterialsAsDirty(flag, predicate) {\n if (this._blockMaterialDirtyMechanism) {\n return;\n }\n for (const material of this.materials) {\n if (predicate && !predicate(material)) {\n continue;\n }\n material.markAsDirty(flag);\n }\n }\n /**\n * @internal\n */\n _loadFile(fileOrUrl, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError, onOpened) {\n const request = LoadFile(fileOrUrl, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError, onOpened);\n this._activeRequests.push(request);\n request.onCompleteObservable.add(request => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * @internal\n */\n _loadFileAsync(fileOrUrl, onProgress, useOfflineSupport, useArrayBuffer, onOpened) {\n return new Promise((resolve, reject) => {\n this._loadFile(fileOrUrl, data => {\n resolve(data);\n }, onProgress, useOfflineSupport, useArrayBuffer, (request, exception) => {\n reject(exception);\n }, onOpened);\n });\n }\n /**\n * @internal\n */\n _requestFile(url, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError, onOpened) {\n const request = RequestFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError, onOpened);\n this._activeRequests.push(request);\n request.onCompleteObservable.add(request => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * @internal\n */\n _requestFileAsync(url, onProgress, useOfflineSupport, useArrayBuffer, onOpened) {\n return new Promise((resolve, reject) => {\n this._requestFile(url, data => {\n resolve(data);\n }, onProgress, useOfflineSupport, useArrayBuffer, error => {\n reject(error);\n }, onOpened);\n });\n }\n /**\n * @internal\n */\n _readFile(file, onSuccess, onProgress, useArrayBuffer, onError) {\n const request = ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError);\n this._activeRequests.push(request);\n request.onCompleteObservable.add(request => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * @internal\n */\n _readFileAsync(file, onProgress, useArrayBuffer) {\n return new Promise((resolve, reject) => {\n this._readFile(file, data => {\n resolve(data);\n }, onProgress, useArrayBuffer, error => {\n reject(error);\n });\n });\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * This method gets the performance collector belonging to the scene, which is generally shared with the inspector.\n * @returns the perf collector belonging to the scene.\n */\n getPerfCollector() {\n throw _WarnImport(\"performanceViewerSceneExtension\");\n }\n // deprecated\n /**\n * Sets the active camera of the scene using its Id\n * @param id defines the camera's Id\n * @returns the new active camera or null if none found.\n * @deprecated Please use setActiveCameraById instead\n */\n setActiveCameraByID(id) {\n return this.setActiveCameraById(id);\n }\n /**\n * Get a material using its id\n * @param id defines the material's Id\n * @returns the material or null if none found.\n * @deprecated Please use getMaterialById instead\n */\n getMaterialByID(id) {\n return this.getMaterialById(id);\n }\n /**\n * Gets a the last added material using a given id\n * @param id defines the material's Id\n * @returns the last material with the given id or null if none found.\n * @deprecated Please use getLastMaterialById instead\n */\n getLastMaterialByID(id) {\n return this.getLastMaterialById(id);\n }\n /**\n * Get a texture using its unique id\n * @param uniqueId defines the texture's unique id\n * @returns the texture or null if none found.\n * @deprecated Please use getTextureByUniqueId instead\n */\n getTextureByUniqueID(uniqueId) {\n return this.getTextureByUniqueId(uniqueId);\n }\n /**\n * Gets a camera using its Id\n * @param id defines the Id to look for\n * @returns the camera or null if not found\n * @deprecated Please use getCameraById instead\n */\n getCameraByID(id) {\n return this.getCameraById(id);\n }\n /**\n * Gets a camera using its unique Id\n * @param uniqueId defines the unique Id to look for\n * @returns the camera or null if not found\n * @deprecated Please use getCameraByUniqueId instead\n */\n getCameraByUniqueID(uniqueId) {\n return this.getCameraByUniqueId(uniqueId);\n }\n /**\n * Gets a bone using its Id\n * @param id defines the bone's Id\n * @returns the bone or null if not found\n * @deprecated Please use getBoneById instead\n */\n getBoneByID(id) {\n return this.getBoneById(id);\n }\n /**\n * Gets a light node using its Id\n * @param id defines the light's Id\n * @returns the light or null if none found.\n * @deprecated Please use getLightById instead\n */\n getLightByID(id) {\n return this.getLightById(id);\n }\n /**\n * Gets a light node using its scene-generated unique Id\n * @param uniqueId defines the light's unique Id\n * @returns the light or null if none found.\n * @deprecated Please use getLightByUniqueId instead\n */\n getLightByUniqueID(uniqueId) {\n return this.getLightByUniqueId(uniqueId);\n }\n /**\n * Gets a particle system by Id\n * @param id defines the particle system Id\n * @returns the corresponding system or null if none found\n * @deprecated Please use getParticleSystemById instead\n */\n getParticleSystemByID(id) {\n return this.getParticleSystemById(id);\n }\n /**\n * Gets a geometry using its Id\n * @param id defines the geometry's Id\n * @returns the geometry or null if none found.\n * @deprecated Please use getGeometryById instead\n */\n getGeometryByID(id) {\n return this.getGeometryById(id);\n }\n /**\n * Gets the first added mesh found of a given Id\n * @param id defines the Id to search for\n * @returns the mesh found or null if not found at all\n * @deprecated Please use getMeshById instead\n */\n getMeshByID(id) {\n return this.getMeshById(id);\n }\n /**\n * Gets a mesh with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found mesh or null if not found at all.\n * @deprecated Please use getMeshByUniqueId instead\n */\n getMeshByUniqueID(uniqueId) {\n return this.getMeshByUniqueId(uniqueId);\n }\n /**\n * Gets a the last added mesh using a given Id\n * @param id defines the Id to search for\n * @returns the found mesh or null if not found at all.\n * @deprecated Please use getLastMeshById instead\n */\n getLastMeshByID(id) {\n return this.getLastMeshById(id);\n }\n /**\n * Gets a list of meshes using their Id\n * @param id defines the Id to search for\n * @returns a list of meshes\n * @deprecated Please use getMeshesById instead\n */\n getMeshesByID(id) {\n return this.getMeshesById(id);\n }\n /**\n * Gets the first added transform node found of a given Id\n * @param id defines the Id to search for\n * @returns the found transform node or null if not found at all.\n * @deprecated Please use getTransformNodeById instead\n */\n getTransformNodeByID(id) {\n return this.getTransformNodeById(id);\n }\n /**\n * Gets a transform node with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found transform node or null if not found at all.\n * @deprecated Please use getTransformNodeByUniqueId instead\n */\n getTransformNodeByUniqueID(uniqueId) {\n return this.getTransformNodeByUniqueId(uniqueId);\n }\n /**\n * Gets a list of transform nodes using their Id\n * @param id defines the Id to search for\n * @returns a list of transform nodes\n * @deprecated Please use getTransformNodesById instead\n */\n getTransformNodesByID(id) {\n return this.getTransformNodesById(id);\n }\n /**\n * Gets a node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n * @deprecated Please use getNodeById instead\n */\n getNodeByID(id) {\n return this.getNodeById(id);\n }\n /**\n * Gets a the last added node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n * @deprecated Please use getLastEntryById instead\n */\n getLastEntryByID(id) {\n return this.getLastEntryById(id);\n }\n /**\n * Gets a skeleton using a given Id (if many are found, this function will pick the last one)\n * @param id defines the Id to search for\n * @returns the found skeleton or null if not found at all.\n * @deprecated Please use getLastSkeletonById instead\n */\n getLastSkeletonByID(id) {\n return this.getLastSkeletonById(id);\n }\n}\n/** The fog is deactivated */\nScene.FOGMODE_NONE = 0;\n/** The fog density is following an exponential function */\nScene.FOGMODE_EXP = 1;\n/** The fog density is following an exponential function faster than FOGMODE_EXP */\nScene.FOGMODE_EXP2 = 2;\n/** The fog density is following a linear function. */\nScene.FOGMODE_LINEAR = 3;\n/**\n * Gets or sets the minimum deltatime when deterministic lock step is enabled\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n */\nScene.MinDeltaTime = 1.0;\n/**\n * Gets or sets the maximum deltatime when deterministic lock step is enabled\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n */\nScene.MaxDeltaTime = 1000.0;\n// Register Class Name\nRegisterClass(\"BABYLON.Scene\", Scene);","map":{"version":3,"names":["Tools","PrecisionDate","Observable","SmartArrayNoDuplicate","SmartArray","StringDictionary","Tags","Vector3","Matrix","TmpVectors","ImageProcessingConfiguration","UniformBuffer","PickingInfo","ActionEvent","PostProcessManager","RenderingManager","Stage","IsWindowObjectExist","EngineStore","_WarnImport","InputManager","PerfCounter","Color4","Color3","Frustum","UniqueIdGenerator","ReadFile","RequestFile","LoadFile","LightConstants","_ObserveArray","PointerPickingConfiguration","Logger","RegisterClass","ScenePerformancePriority","Scene","DefaultMaterialFactory","scene","CollisionCoordinatorFactory","clearColor","_clearColor","value","onClearColorChangedObservable","notifyObservers","imageProcessingConfiguration","_imageProcessingConfiguration","performancePriority","_performancePriority","skipFrustumClipping","_renderingManager","maintainStateBetweenFrames","skipPointerMovePicking","autoClear","onScenePerformancePriorityChangedObservable","forceWireframe","_forceWireframe","markAllMaterialsAsDirty","_skipFrustumClipping","forcePointsCloud","_forcePointsCloud","environmentTexture","_environmentTexture","getNodes","nodes","concat","meshes","lights","cameras","transformNodes","skeletons","forEach","skeleton","bones","animationPropertiesOverride","_animationPropertiesOverride","onDispose","callback","_onDisposeObserver","onDisposeObservable","remove","add","beforeRender","_onBeforeRenderObserver","onBeforeRenderObservable","afterRender","_onAfterRenderObserver","onAfterRenderObservable","beforeCameraRender","_onBeforeCameraRenderObserver","onBeforeCameraRenderObservable","afterCameraRender","_onAfterCameraRenderObserver","onAfterCameraRenderObservable","pointerDownPredicate","_pointerPickingConfiguration","pointerUpPredicate","pointerMovePredicate","pointerDownFastCheck","pointerUpFastCheck","pointerMoveFastCheck","skipPointerDownPicking","skipPointerUpPicking","unTranslatedPointer","_inputManager","DragMovementThreshold","LongPressDelay","DoubleClickDelay","ExclusiveDoubleClickMode","bindEyePosition","effect","variableName","isVector3","eyePosition","_forcedViewPosition","_mirroredCameraPosition","activeCamera","globalPosition","invertNormal","useRightHandedSystem","Vector4","set","x","y","z","setFloat3","setVector4","finalizeSceneUbo","ubo","getSceneUniformBuffer","updateFloat4","w","update","_useRightHandedSystem","setStepId","newStepId","_currentStepId","getStepId","getInternalStep","_currentInternalStep","fogEnabled","_fogEnabled","fogMode","_fogMode","prePass","prePassRenderer","defaultRT","enabled","shadowsEnabled","_shadowsEnabled","lightsEnabled","_lightsEnabled","activeCameras","_activeCameras","_unObserveActiveCameras","onActiveCamerasChanged","_activeCamera","onActiveCameraChanged","defaultMaterial","_defaultMaterial","texturesEnabled","_texturesEnabled","frameGraph","_frameGraph","customRenderFunction","_currentCustomRenderFunction","_renderWithFrameGraph","skeletonsEnabled","_skeletonsEnabled","collisionCoordinator","_collisionCoordinator","init","renderingManager","frustumPlanes","_frustumPlanes","_registerTransientComponents","_transientComponents","length","component","register","_addComponent","_components","push","serializableComponent","addFromContainer","serialize","_serializableComponents","_getComponent","name","constructor","engine","options","cameraToUseForPointers","_isScene","_blockEntityCollection","autoClearDepthAndStencil","ambientColor","environmentIntensity","rootNodes","particleSystems","animations","animationGroups","multiMaterials","materials","morphTargetManagers","geometries","actionManagers","textures","postProcesses","effectLayers","sounds","layers","lensFlareSystems","proceduralTextures","animationsEnabled","useConstantAnimationDeltaTime","constantlyUpdateMeshUnderPointer","hoverCursor","defaultCursor","doNotHandleCursors","preventDefaultOnPointerDown","preventDefaultOnPointerUp","metadata","reservedDataStore","disableOfflineSupportExceptionRules","onAfterRenderCameraObservable","onBeforeAnimationsObservable","onAfterAnimationsObservable","onBeforeDrawPhaseObservable","onAfterDrawPhaseObservable","onReadyObservable","onBeforeActiveMeshesEvaluationObservable","onAfterActiveMeshesEvaluationObservable","onBeforeParticlesRenderingObservable","onAfterParticlesRenderingObservable","onDataLoadedObservable","onNewCameraAddedObservable","onCameraRemovedObservable","onNewLightAddedObservable","onLightRemovedObservable","onNewGeometryAddedObservable","onGeometryRemovedObservable","onNewTransformNodeAddedObservable","onTransformNodeRemovedObservable","onNewMeshAddedObservable","onMeshRemovedObservable","onNewSkeletonAddedObservable","onSkeletonRemovedObservable","onNewMaterialAddedObservable","onNewMultiMaterialAddedObservable","onMaterialRemovedObservable","onMultiMaterialRemovedObservable","onNewTextureAddedObservable","onTextureRemovedObservable","onBeforeRenderTargetsRenderObservable","onAfterRenderTargetsRenderObservable","onBeforeStepObservable","onAfterStepObservable","onBeforeRenderingGroupObservable","onAfterRenderingGroupObservable","onMeshImportedObservable","onAnimationFileImportedObservable","_registeredForLateAnimationBindings","onPrePointerObservable","onPointerObservable","onPreKeyboardObservable","onKeyboardObservable","_timeAccumulator","FOGMODE_NONE","fogColor","fogDensity","fogStart","fogEnd","needsPreviousWorldMatrices","physicsEnabled","particlesEnabled","spritesEnabled","lensFlaresEnabled","collisionsEnabled","gravity","postProcessesEnabled","renderTargetsEnabled","dumpNextRenderTargets","customRenderTargets","importedMeshesFiles","probesEnabled","_meshesForIntersections","proceduralTexturesEnabled","_totalVertices","_activeIndices","_activeParticles","_activeBones","_animationTime","animationTimeScale","_renderId","_frameId","_executeWhenReadyTimeoutId","_intermediateRendering","_defaultFrameBufferCleared","_viewUpdateFlag","_projectionUpdateFlag","_toBeDisposed","Array","_activeRequests","_pendingData","_isDisposed","dispatchAllSubMeshesOfActiveMeshes","_activeMeshes","_processedMaterials","_renderTargets","_materialsRenderTargets","_activeParticleSystems","_activeSkeletons","_softwareSkinnedMeshes","_activeAnimatables","_transformMatrix","Zero","requireLightSorting","_beforeCameraUpdateStage","Create","_beforeClearStage","_beforeRenderTargetClearStage","_gatherRenderTargetsStage","_gatherActiveCameraRenderTargetsStage","_isReadyForMeshStage","_beforeEvaluateActiveMeshStage","_evaluateSubMeshStage","_preActiveMeshStage","_cameraDrawRenderTargetStage","_beforeCameraDrawStage","_beforeRenderTargetDrawStage","_beforeRenderingGroupDrawStage","_beforeRenderingMeshStage","_afterRenderingMeshStage","_afterRenderingGroupDrawStage","_afterCameraDrawStage","_afterCameraPostProcessStage","_afterRenderTargetDrawStage","_afterRenderTargetPostProcessStage","_afterRenderStage","_pointerMoveStage","_pointerDownStage","_pointerUpStage","_geometriesByUniqueId","_defaultMeshCandidates","data","_defaultSubMeshCandidates","_preventFreeActiveMeshesAndRenderingGroups","_activeMeshesFrozen","_activeMeshesFrozenButKeepClipping","_skipEvaluateActiveMeshesCompletely","_allowPostProcessClearColor","getDeterministicFrameTime","_engine","getTimeStep","_registeredActions","_blockMaterialDirtyMechanism","_perfCollector","fullOptions","useGeometryUniqueIdsMap","useMaterialMeshMap","useClonedMeshMap","virtual","LastCreatedEngine","_virtualScenes","_LastCreatedScene","scenes","_uid","postProcessManager","attachControl","_createUbo","setDefaultCandidateProviders","onNewSceneAddedObservable","getClassName","_getDefaultMeshCandidates","_getDefaultSubMeshCandidates","mesh","subMeshes","getActiveMeshCandidates","getActiveSubMeshCandidates","getIntersectingSubMeshCandidates","localRay","getCollidingSubMeshCandidates","collider","meshUnderPointer","pointerX","pointerY","getCachedMaterial","_cachedMaterial","getCachedEffect","_cachedEffect","getCachedVisibility","_cachedVisibility","isCachedMaterialInvalid","material","visibility","getEngine","getTotalVertices","current","totalVerticesPerfCounter","getActiveIndices","totalActiveIndicesPerfCounter","getActiveParticles","activeParticlesPerfCounter","getActiveBones","activeBonesPerfCounter","getActiveMeshes","getAnimationRatio","_animationRatio","undefined","getRenderId","getFrameId","incrementRenderId","setSceneUniformBuffer","createSceneUniformBuffer","simulatePointerMove","pickResult","pointerEventInit","simulatePointerDown","simulatePointerUp","doubleTap","isPointerCaptured","pointerId","attachUp","attachDown","attachMove","detachControl","isReady","checkRenderTargets","_this$activeCamera$re","_this$activeCamera","_this$prePassRenderer","index","currentRenderPassId","renderPassId","useOrderIndependentTransparency","depthPeelingRenderer","reset","hardwareInstancedRendering","hasThinInstances","getCaps","instancedArrays","instances","step","action","mat","_storeEffectOnSubMeshes","subMesh","getMaterial","hasRenderTargetTextures","getRenderTargetTextures","indexOf","concatWithNoDuplicate","rtt","isReadyForRendering","geometry","delayLoadState","camera","particleSystem","layer","areAllEffectsReady","resetCachedMaterial","registerBeforeRender","func","unregisterBeforeRender","removeCallback","registerAfterRender","unregisterAfterRender","_executeOnceBeforeRender","execFunc","setTimeout","executeOnceBeforeRender","timeout","addPendingData","removePendingData","wasLoading","isLoading","splice","getWaitingItemsCount","executeWhenReady","addOnce","_checkIsReady","whenReadyAsync","Promise","resolve","clear","animatables","resetLastAnimationTimeFrame","_animationTimeLast","Now","getViewMatrix","_viewMatrix","getProjectionMatrix","_projectionMatrix","getTransformMatrix","setTransformMatrix","viewL","projectionL","viewR","projectionR","_multiviewSceneUbo","dispose","updateFlag","multiplyToRef","GetPlanes","GetPlanesToRef","useUbo","_updateMultiviewUbo","_sceneUbo","updateMatrix","sceneUbo","addUniform","getUniqueId","UniqueId","addMesh","newMesh","recursive","_resyncLightSources","parent","_addToSceneRootNodes","SetImmediate","getChildMeshes","m","removeMesh","toRemove","_removeFromSceneRootNodes","_invalidateMesh","addTransformNode","newTransformNode","getScene","_indexInSceneTransformNodesArray","removeTransformNode","lastNode","pop","removeSkeleton","_executeActiveContainerCleanup","removeMorphTargetManager","removeLight","_removeLightSource","sortLightsByPriority","removeCamera","index2","removeParticleSystem","removeAnimation","stopAnimation","target","animationName","targetMask","removeAnimationGroup","removeMultiMaterial","removeMaterial","_indexInSceneMaterialArray","lastMaterial","removeActionManager","removeTexture","addLight","newLight","lightSources","sort","CompareLightsPriority","addCamera","newCamera","addSkeleton","newSkeleton","addParticleSystem","newParticleSystem","addAnimation","newAnimation","addAnimationGroup","newAnimationGroup","addMultiMaterial","newMultiMaterial","addMaterial","newMaterial","addMorphTargetManager","newMorphTargetManager","addGeometry","newGeometry","uniqueId","addActionManager","newActionManager","addTexture","newTexture","switchActiveCamera","canvas","getInputElement","setActiveCameraById","id","getCameraById","setActiveCameraByName","getCameraByName","getAnimationGroupByName","_getMaterial","allowMultiMaterials","predicate","getMaterialByUniqueID","getMaterialById","getMaterialByName","getLastMaterialById","getTextureByUniqueId","getTextureByName","getCameraByUniqueId","getBoneById","skeletonIndex","boneIndex","getBoneByName","getLightByName","getLightById","getLightByUniqueId","getParticleSystemById","getGeometryById","_getGeometryByUniqueId","pushGeometry","force","removeGeometry","lastGeometry","getGeometries","getMeshById","getMeshesById","filter","getTransformNodeById","getTransformNodeByUniqueId","getTransformNodesById","getMeshByUniqueId","getLastMeshById","getLastTransformNodeById","getLastEntryById","getNodeById","transformNode","light","bone","getNodeByName","getMeshByName","getTransformNodeByName","getLastSkeletonById","getSkeletonByUniqueId","getSkeletonById","getSkeletonByName","getMorphTargetManagerById","getMorphTargetById","managerIndex","morphTargetManager","numTargets","getTarget","getMorphTargetByName","getPostProcessByName","postProcessIndex","postProcess","isActiveMesh","uid","RandomId","addExternalData","key","_externalData","getExternalData","get","getOrAddExternalDataWithFactory","factory","getOrAddWithFactory","removeExternalData","_evaluateSubMesh","initialMesh","forcePush","isInFrustum","dispatch","freeProcessedMaterials","blockfreeActiveMeshesAndRenderingGroups","freeActiveMeshes","freeRenderingGroups","i","texture","renderList","_isInIntermediateRendering","freezeActiveMeshes","skipEvaluateActiveMeshes","onSuccess","onError","freezeMeshes","keepFrustumCulling","updateTransformMatrix","_evaluateActiveMeshes","_freeze","unfreezeActiveMeshes","_internalAbstractMeshDataInfo","_isActive","_unFreeze","container","isInFastMode","snapshotRendering","snapshotRenderingMode","_this$activeCamera2","len","computeWorldMatrix","psLength","animate","resetSprites","_currentLODIsUpToDate","isBlocked","addCount","isEnabled","scaling","hasAZeroComponent","actionManager","hasSpecificTriggers2","pushNoDuplicate","meshToRender","customLODSelector","getLOD","_currentLOD","billboardMode","_preActivate","isVisible","layerMask","alwaysSelectAsActiveMesh","_activate","isAnInstance","_onlyForInstances","_actAsRegularMesh","_activeMesh","_postActivate","particleIndex","isStarted","emitter","position","dispatchParticles","_prepareSkeleton","prepare","computeBonesUsingShaders","applySkeleton","sourceMesh","hasInstances","_renderingMultiview","leftCamera","_rigCameras","rightCamera","_bindFrameBuffer","_multiviewTexture","outputRenderTarget","_currentFrameBufferIsDefaultFrameBuffer","restoreDefaultFramebuffer","_clearFrameBuffer","onClearObservable","hasObservers","skipInitialClear","isRightCamera","_cleared","_clear","_renderForCamera","rigParent","bindFrameBuffer","_ref","_camera$outputRenderT","_camera$outputRenderT2","_skipRendering","Error","setViewport","viewport","softwareSkinnedMeshIndex","isRenderTarget","needRebind","StartPerformanceCounter","renderIndex","renderTarget","_shouldRender","hasSpecialRenderTargetCamera","render","EndPerformanceCounter","_prepareFrame","_finalizeFrame","isIntermediate","_processSubCameras","cameraRigMode","_createMultiviewUbo","_useMultiviewToSingleView","_renderMultiviewToSingleView","_checkIntersections","actionIndex","actions","trigger","parameters","getTriggerParameter","otherMesh","areIntersecting","intersectsMesh","usePreciseIntersection","currentIntersectionInProgress","_intersectionsInProgress","_executeCurrent","CreateNew","hasSpecificTrigger","parameter","parameterMesh","_advancePhysicsEngineStep","_animate","customDeltaTime","isDeterministicLockStep","deltaTime","Math","max","MinDeltaTime","min","getDeltaTime","MaxDeltaTime","defaultFrameTime","defaultFPS","stepsTaken","maxSubSteps","getLockstepMaxSteps","internalSteps","floor","_checkCameraRenderTarget","_camera$rigCameras","isRigCamera","rigCameras","resetDrawCache","passId","updateCameras","ignoreAnimations","_this$frameGraph","execute","_this$activeCameras","isDisposed","fetchNewFrame","processTrigger","cameraIndex","_this$activeCameras2","_currentActiveCamera$","currentActiveCamera","customIndex","freezeMaterials","freeze","unfreezeMaterials","unfreeze","stopAllAnimations","animatable","onAnimationEndObservable","onAnimationEnd","activeRequests","slice","request","abort","e","_disposeList","item","wipeCaches","items","_callback","itemsCopy","clearCachedVertexData","meshIndex","clearCachedData","cleanCachedTextureBuffer","baseTexture","buffer","_buffer","getWorldExtends","filterPredicate","Number","MAX_VALUE","infiniteDistance","boundingInfo","getBoundingInfo","minBox","boundingBox","minimumWorld","maxBox","maximumWorld","CheckExtends","createPickingRay","world","cameraViewSpace","createPickingRayToRef","result","enableDistantPicking","createPickingRayInCameraSpace","createPickingRayInCameraSpaceToRef","pick","fastCheck","trianglePredicate","warn","Warn","pickWithBoundingInfo","pickWithRay","ray","multiPick","multiPickWithRay","setPointerOverMesh","getPointerOverMesh","_rebuildGeometries","_rebuild","rebuild","system","spriteManagers","spriteMgr","_rebuildTextures","_getByTags","list","tagsQuery","listByTags","MatchesQuery","getMeshesByTags","getCamerasByTags","getLightsByTags","getMaterialByTags","getTransformNodesByTags","setRenderingOrder","renderingGroupId","opaqueSortCompareFn","alphaTestSortCompareFn","transparentSortCompareFn","setRenderingAutoClearDepthStencil","autoClearDepthStencil","depth","stencil","getAutoClearDepthStencilSetup","_forceBlockMaterialDirtyMechanism","blockMaterialDirtyMechanism","flag","markAsDirty","_loadFile","fileOrUrl","onProgress","useOfflineSupport","useArrayBuffer","onOpened","offlineProvider","onCompleteObservable","_loadFileAsync","reject","exception","_requestFile","url","_requestFileAsync","error","_readFile","file","_readFileAsync","getPerfCollector","setActiveCameraByID","getMaterialByID","getLastMaterialByID","getTextureByUniqueID","getCameraByID","getCameraByUniqueID","getBoneByID","getLightByID","getLightByUniqueID","getParticleSystemByID","getGeometryByID","getMeshByID","getMeshByUniqueID","getLastMeshByID","getMeshesByID","getTransformNodeByID","getTransformNodeByUniqueID","getTransformNodesByID","getNodeByID","getLastEntryByID","getLastSkeletonByID","FOGMODE_EXP","FOGMODE_EXP2","FOGMODE_LINEAR"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/scene.js"],"sourcesContent":["import { Tools } from \"./Misc/tools.js\";\nimport { PrecisionDate } from \"./Misc/precisionDate.js\";\nimport { Observable } from \"./Misc/observable.js\";\nimport { SmartArrayNoDuplicate, SmartArray } from \"./Misc/smartArray.js\";\nimport { StringDictionary } from \"./Misc/stringDictionary.js\";\nimport { Tags } from \"./Misc/tags.js\";\nimport { Vector3, Matrix, TmpVectors } from \"./Maths/math.vector.js\";\nimport { ImageProcessingConfiguration } from \"./Materials/imageProcessingConfiguration.js\";\nimport { UniformBuffer } from \"./Materials/uniformBuffer.js\";\nimport { PickingInfo } from \"./Collisions/pickingInfo.js\";\nimport { ActionEvent } from \"./Actions/actionEvent.js\";\nimport { PostProcessManager } from \"./PostProcesses/postProcessManager.js\";\nimport { RenderingManager } from \"./Rendering/renderingManager.js\";\nimport { Stage } from \"./sceneComponent.js\";\n\nimport { IsWindowObjectExist } from \"./Misc/domManagement.js\";\nimport { EngineStore } from \"./Engines/engineStore.js\";\nimport { _WarnImport } from \"./Misc/devTools.js\";\nimport { InputManager } from \"./Inputs/scene.inputManager.js\";\nimport { PerfCounter } from \"./Misc/perfCounter.js\";\nimport { Color4, Color3 } from \"./Maths/math.color.js\";\nimport { Frustum } from \"./Maths/math.frustum.js\";\nimport { UniqueIdGenerator } from \"./Misc/uniqueIdGenerator.js\";\nimport { ReadFile, RequestFile, LoadFile } from \"./Misc/fileTools.js\";\nimport { LightConstants } from \"./Lights/lightConstants.js\";\nimport { _ObserveArray } from \"./Misc/arrayTools.js\";\nimport { PointerPickingConfiguration } from \"./Inputs/pointerPickingConfiguration.js\";\nimport { Logger } from \"./Misc/logger.js\";\nimport { RegisterClass } from \"./Misc/typeStore.js\";\n/**\n * Define how the scene should favor performance over ease of use\n */\nexport var ScenePerformancePriority;\n(function (ScenePerformancePriority) {\n /** Default mode. No change. Performance will be treated as less important than backward compatibility */\n ScenePerformancePriority[ScenePerformancePriority[\"BackwardCompatible\"] = 0] = \"BackwardCompatible\";\n /** Some performance options will be turned on trying to strike a balance between perf and ease of use */\n ScenePerformancePriority[ScenePerformancePriority[\"Intermediate\"] = 1] = \"Intermediate\";\n /** Performance will be top priority */\n ScenePerformancePriority[ScenePerformancePriority[\"Aggressive\"] = 2] = \"Aggressive\";\n})(ScenePerformancePriority || (ScenePerformancePriority = {}));\n/**\n * Represents a scene to be rendered by the engine.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene\n */\nexport class Scene {\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Factory used to create the default material.\n * @param scene The scene to create the material for\n * @returns The default material\n */\n static DefaultMaterialFactory(scene) {\n throw _WarnImport(\"StandardMaterial\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Factory used to create the a collision coordinator.\n * @returns The collision coordinator\n */\n static CollisionCoordinatorFactory() {\n throw _WarnImport(\"DefaultCollisionCoordinator\");\n }\n /**\n * Defines the color used to clear the render buffer (Default is (0.2, 0.2, 0.3, 1.0))\n */\n get clearColor() {\n return this._clearColor;\n }\n set clearColor(value) {\n if (value !== this._clearColor) {\n this._clearColor = value;\n this.onClearColorChangedObservable.notifyObservers(this._clearColor);\n }\n }\n /**\n * Default image processing configuration used either in the rendering\n * Forward main pass or through the imageProcessingPostProcess if present.\n * As in the majority of the scene they are the same (exception for multi camera),\n * this is easier to reference from here than from all the materials and post process.\n *\n * No setter as we it is a shared configuration, you can set the values instead.\n */\n get imageProcessingConfiguration() {\n return this._imageProcessingConfiguration;\n }\n /**\n * Gets or sets a value indicating how to treat performance relatively to ease of use and backward compatibility\n */\n get performancePriority() {\n return this._performancePriority;\n }\n set performancePriority(value) {\n if (value === this._performancePriority) {\n return;\n }\n this._performancePriority = value;\n switch (value) {\n case 0 /* ScenePerformancePriority.BackwardCompatible */:\n this.skipFrustumClipping = false;\n this._renderingManager.maintainStateBetweenFrames = false;\n this.skipPointerMovePicking = false;\n this.autoClear = true;\n break;\n case 1 /* ScenePerformancePriority.Intermediate */:\n this.skipFrustumClipping = false;\n this._renderingManager.maintainStateBetweenFrames = false;\n this.skipPointerMovePicking = true;\n this.autoClear = false;\n break;\n case 2 /* ScenePerformancePriority.Aggressive */:\n this.skipFrustumClipping = true;\n this._renderingManager.maintainStateBetweenFrames = true;\n this.skipPointerMovePicking = true;\n this.autoClear = false;\n break;\n }\n this.onScenePerformancePriorityChangedObservable.notifyObservers(value);\n }\n /**\n * Gets or sets a boolean indicating if all rendering must be done in wireframe\n */\n set forceWireframe(value) {\n if (this._forceWireframe === value) {\n return;\n }\n this._forceWireframe = value;\n this.markAllMaterialsAsDirty(16);\n }\n get forceWireframe() {\n return this._forceWireframe;\n }\n /**\n * Gets or sets a boolean indicating if we should skip the frustum clipping part of the active meshes selection\n */\n set skipFrustumClipping(value) {\n if (this._skipFrustumClipping === value) {\n return;\n }\n this._skipFrustumClipping = value;\n }\n get skipFrustumClipping() {\n return this._skipFrustumClipping;\n }\n /**\n * Gets or sets a boolean indicating if all rendering must be done in point cloud\n */\n set forcePointsCloud(value) {\n if (this._forcePointsCloud === value) {\n return;\n }\n this._forcePointsCloud = value;\n this.markAllMaterialsAsDirty(16);\n }\n get forcePointsCloud() {\n return this._forcePointsCloud;\n }\n /**\n * Texture used in all pbr material as the reflection texture.\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to reference from here than from all the materials.\n */\n get environmentTexture() {\n return this._environmentTexture;\n }\n /**\n * Texture used in all pbr material as the reflection texture.\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to set here than in all the materials.\n */\n set environmentTexture(value) {\n if (this._environmentTexture === value) {\n return;\n }\n this._environmentTexture = value;\n this.markAllMaterialsAsDirty(1);\n }\n /**\n * @returns all meshes, lights, cameras, transformNodes and bones\n */\n getNodes() {\n let nodes = [];\n nodes = nodes.concat(this.meshes);\n nodes = nodes.concat(this.lights);\n nodes = nodes.concat(this.cameras);\n nodes = nodes.concat(this.transformNodes); // dummies\n this.skeletons.forEach((skeleton) => (nodes = nodes.concat(skeleton.bones)));\n return nodes;\n }\n /**\n * Gets or sets the animation properties override\n */\n get animationPropertiesOverride() {\n return this._animationPropertiesOverride;\n }\n set animationPropertiesOverride(value) {\n this._animationPropertiesOverride = value;\n }\n /** Sets a function to be executed when this scene is disposed. */\n set onDispose(callback) {\n if (this._onDisposeObserver) {\n this.onDisposeObservable.remove(this._onDisposeObserver);\n }\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\n }\n /** Sets a function to be executed before rendering this scene */\n set beforeRender(callback) {\n if (this._onBeforeRenderObserver) {\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\n }\n if (callback) {\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\n }\n }\n /** Sets a function to be executed after rendering this scene */\n set afterRender(callback) {\n if (this._onAfterRenderObserver) {\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\n }\n if (callback) {\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\n }\n }\n /** Sets a function to be executed before rendering a camera*/\n set beforeCameraRender(callback) {\n if (this._onBeforeCameraRenderObserver) {\n this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\n }\n this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(callback);\n }\n /** Sets a function to be executed after rendering a camera*/\n set afterCameraRender(callback) {\n if (this._onAfterCameraRenderObserver) {\n this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\n }\n this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(callback);\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer down event\n */\n get pointerDownPredicate() {\n return this._pointerPickingConfiguration.pointerDownPredicate;\n }\n set pointerDownPredicate(value) {\n this._pointerPickingConfiguration.pointerDownPredicate = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer up event\n */\n get pointerUpPredicate() {\n return this._pointerPickingConfiguration.pointerUpPredicate;\n }\n set pointerUpPredicate(value) {\n this._pointerPickingConfiguration.pointerUpPredicate = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer move event\n */\n get pointerMovePredicate() {\n return this._pointerPickingConfiguration.pointerMovePredicate;\n }\n set pointerMovePredicate(value) {\n this._pointerPickingConfiguration.pointerMovePredicate = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer down event\n */\n get pointerDownFastCheck() {\n return this._pointerPickingConfiguration.pointerDownFastCheck;\n }\n set pointerDownFastCheck(value) {\n this._pointerPickingConfiguration.pointerDownFastCheck = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer up event\n */\n get pointerUpFastCheck() {\n return this._pointerPickingConfiguration.pointerUpFastCheck;\n }\n set pointerUpFastCheck(value) {\n this._pointerPickingConfiguration.pointerUpFastCheck = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer move event\n */\n get pointerMoveFastCheck() {\n return this._pointerPickingConfiguration.pointerMoveFastCheck;\n }\n set pointerMoveFastCheck(value) {\n this._pointerPickingConfiguration.pointerMoveFastCheck = value;\n }\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer move event occurs.\n */\n get skipPointerMovePicking() {\n return this._pointerPickingConfiguration.skipPointerMovePicking;\n }\n set skipPointerMovePicking(value) {\n this._pointerPickingConfiguration.skipPointerMovePicking = value;\n }\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer down event occurs.\n */\n get skipPointerDownPicking() {\n return this._pointerPickingConfiguration.skipPointerDownPicking;\n }\n set skipPointerDownPicking(value) {\n this._pointerPickingConfiguration.skipPointerDownPicking = value;\n }\n /**\n * 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.\n */\n get skipPointerUpPicking() {\n return this._pointerPickingConfiguration.skipPointerUpPicking;\n }\n set skipPointerUpPicking(value) {\n this._pointerPickingConfiguration.skipPointerUpPicking = value;\n }\n /**\n * Gets the pointer coordinates without any translation (ie. straight out of the pointer event)\n */\n get unTranslatedPointer() {\n return this._inputManager.unTranslatedPointer;\n }\n /**\n * Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels\n */\n static get DragMovementThreshold() {\n return InputManager.DragMovementThreshold;\n }\n static set DragMovementThreshold(value) {\n InputManager.DragMovementThreshold = value;\n }\n /**\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms\n */\n static get LongPressDelay() {\n return InputManager.LongPressDelay;\n }\n static set LongPressDelay(value) {\n InputManager.LongPressDelay = value;\n }\n /**\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms\n */\n static get DoubleClickDelay() {\n return InputManager.DoubleClickDelay;\n }\n static set DoubleClickDelay(value) {\n InputManager.DoubleClickDelay = value;\n }\n /** If you need to check double click without raising a single click at first click, enable this flag */\n static get ExclusiveDoubleClickMode() {\n return InputManager.ExclusiveDoubleClickMode;\n }\n static set ExclusiveDoubleClickMode(value) {\n InputManager.ExclusiveDoubleClickMode = value;\n }\n /**\n * Bind the current view position to an effect.\n * @param effect The effect to be bound\n * @param variableName name of the shader variable that will hold the eye position\n * @param isVector3 true to indicates that variableName is a Vector3 and not a Vector4\n * @returns the computed eye position\n */\n bindEyePosition(effect, variableName = \"vEyePosition\", isVector3 = false) {\n const eyePosition = this._forcedViewPosition ? this._forcedViewPosition : this._mirroredCameraPosition ? this._mirroredCameraPosition : this.activeCamera.globalPosition;\n const invertNormal = this.useRightHandedSystem === (this._mirroredCameraPosition != null);\n TmpVectors.Vector4[0].set(eyePosition.x, eyePosition.y, eyePosition.z, invertNormal ? -1 : 1);\n if (effect) {\n if (isVector3) {\n effect.setFloat3(variableName, TmpVectors.Vector4[0].x, TmpVectors.Vector4[0].y, TmpVectors.Vector4[0].z);\n }\n else {\n effect.setVector4(variableName, TmpVectors.Vector4[0]);\n }\n }\n return TmpVectors.Vector4[0];\n }\n /**\n * Update the scene ubo before it can be used in rendering processing\n * @returns the scene UniformBuffer\n */\n finalizeSceneUbo() {\n const ubo = this.getSceneUniformBuffer();\n const eyePosition = this.bindEyePosition(null);\n ubo.updateFloat4(\"vEyePosition\", eyePosition.x, eyePosition.y, eyePosition.z, eyePosition.w);\n ubo.update();\n return ubo;\n }\n /**\n * Gets or sets a boolean indicating if the scene must use right-handed coordinates system\n */\n set useRightHandedSystem(value) {\n if (this._useRightHandedSystem === value) {\n return;\n }\n this._useRightHandedSystem = value;\n this.markAllMaterialsAsDirty(16);\n }\n get useRightHandedSystem() {\n return this._useRightHandedSystem;\n }\n /**\n * Sets the step Id used by deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @param newStepId defines the step Id\n */\n setStepId(newStepId) {\n this._currentStepId = newStepId;\n }\n /**\n * Gets the step Id used by deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @returns the step Id\n */\n getStepId() {\n return this._currentStepId;\n }\n /**\n * Gets the internal step used by deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @returns the internal step\n */\n getInternalStep() {\n return this._currentInternalStep;\n }\n /**\n * Gets or sets a boolean indicating if fog is enabled on this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is true)\n */\n set fogEnabled(value) {\n if (this._fogEnabled === value) {\n return;\n }\n this._fogEnabled = value;\n this.markAllMaterialsAsDirty(16);\n }\n get fogEnabled() {\n return this._fogEnabled;\n }\n /**\n * Gets or sets the fog mode to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * | mode | value |\n * | --- | --- |\n * | FOGMODE_NONE | 0 |\n * | FOGMODE_EXP | 1 |\n * | FOGMODE_EXP2 | 2 |\n * | FOGMODE_LINEAR | 3 |\n */\n set fogMode(value) {\n if (this._fogMode === value) {\n return;\n }\n this._fogMode = value;\n this.markAllMaterialsAsDirty(16);\n }\n get fogMode() {\n return this._fogMode;\n }\n /**\n * Flag indicating that the frame buffer binding is handled by another component\n */\n get prePass() {\n return !!this.prePassRenderer && this.prePassRenderer.defaultRT.enabled;\n }\n /**\n * Gets or sets a boolean indicating if shadows are enabled on this scene\n */\n set shadowsEnabled(value) {\n if (this._shadowsEnabled === value) {\n return;\n }\n this._shadowsEnabled = value;\n this.markAllMaterialsAsDirty(2);\n }\n get shadowsEnabled() {\n return this._shadowsEnabled;\n }\n /**\n * Gets or sets a boolean indicating if lights are enabled on this scene\n */\n set lightsEnabled(value) {\n if (this._lightsEnabled === value) {\n return;\n }\n this._lightsEnabled = value;\n this.markAllMaterialsAsDirty(2);\n }\n get lightsEnabled() {\n return this._lightsEnabled;\n }\n /** All of the active cameras added to this scene. */\n get activeCameras() {\n return this._activeCameras;\n }\n set activeCameras(cameras) {\n if (this._unObserveActiveCameras) {\n this._unObserveActiveCameras();\n this._unObserveActiveCameras = null;\n }\n if (cameras) {\n this._unObserveActiveCameras = _ObserveArray(cameras, () => {\n this.onActiveCamerasChanged.notifyObservers(this);\n });\n }\n this._activeCameras = cameras;\n }\n /** Gets or sets the current active camera */\n get activeCamera() {\n return this._activeCamera;\n }\n set activeCamera(value) {\n if (value === this._activeCamera) {\n return;\n }\n this._activeCamera = value;\n this.onActiveCameraChanged.notifyObservers(this);\n }\n /** The default material used on meshes when no material is affected */\n get defaultMaterial() {\n if (!this._defaultMaterial) {\n this._defaultMaterial = Scene.DefaultMaterialFactory(this);\n }\n return this._defaultMaterial;\n }\n /** The default material used on meshes when no material is affected */\n set defaultMaterial(value) {\n this._defaultMaterial = value;\n }\n /**\n * Gets or sets a boolean indicating if textures are enabled on this scene\n */\n set texturesEnabled(value) {\n if (this._texturesEnabled === value) {\n return;\n }\n this._texturesEnabled = value;\n this.markAllMaterialsAsDirty(1);\n }\n get texturesEnabled() {\n return this._texturesEnabled;\n }\n /**\n * 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.\n */\n get frameGraph() {\n return this._frameGraph;\n }\n set frameGraph(value) {\n if (this._frameGraph) {\n this._frameGraph = value;\n if (!value) {\n this.customRenderFunction = this._currentCustomRenderFunction;\n }\n return;\n }\n this._frameGraph = value;\n if (value) {\n this._currentCustomRenderFunction = this.customRenderFunction;\n this.customRenderFunction = this._renderWithFrameGraph;\n }\n }\n /**\n * Gets or sets a boolean indicating if skeletons are enabled on this scene\n */\n set skeletonsEnabled(value) {\n if (this._skeletonsEnabled === value) {\n return;\n }\n this._skeletonsEnabled = value;\n this.markAllMaterialsAsDirty(8);\n }\n get skeletonsEnabled() {\n return this._skeletonsEnabled;\n }\n /** @internal */\n get collisionCoordinator() {\n if (!this._collisionCoordinator) {\n this._collisionCoordinator = Scene.CollisionCoordinatorFactory();\n this._collisionCoordinator.init(this);\n }\n return this._collisionCoordinator;\n }\n /**\n * Gets the scene's rendering manager\n */\n get renderingManager() {\n return this._renderingManager;\n }\n /**\n * Gets the list of frustum planes (built from the active camera)\n */\n get frustumPlanes() {\n return this._frustumPlanes;\n }\n /**\n * Registers the transient components if needed.\n */\n _registerTransientComponents() {\n // Register components that have been associated lately to the scene.\n if (this._transientComponents.length > 0) {\n for (const component of this._transientComponents) {\n component.register();\n }\n this._transientComponents.length = 0;\n }\n }\n /**\n * @internal\n * Add a component to the scene.\n * Note that the ccomponent could be registered on th next frame if this is called after\n * the register component stage.\n * @param component Defines the component to add to the scene\n */\n _addComponent(component) {\n this._components.push(component);\n this._transientComponents.push(component);\n const serializableComponent = component;\n if (serializableComponent.addFromContainer && serializableComponent.serialize) {\n this._serializableComponents.push(serializableComponent);\n }\n }\n /**\n * @internal\n * Gets a component from the scene.\n * @param name defines the name of the component to retrieve\n * @returns the component or null if not present\n */\n _getComponent(name) {\n for (const component of this._components) {\n if (component.name === name) {\n return component;\n }\n }\n return null;\n }\n /**\n * Creates a new Scene\n * @param engine defines the engine to use to render this scene\n * @param options defines the scene options\n */\n constructor(engine, options) {\n /** @internal */\n this._inputManager = new InputManager(this);\n /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */\n this.cameraToUseForPointers = null;\n /** @internal */\n this._isScene = true;\n /** @internal */\n this._blockEntityCollection = false;\n /**\n * Gets or sets a boolean that indicates if the scene must clear the render buffer before rendering a frame\n */\n this.autoClear = true;\n /**\n * Gets or sets a boolean that indicates if the scene must clear the depth and stencil buffers before rendering a frame\n */\n this.autoClearDepthAndStencil = true;\n this._clearColor = new Color4(0.2, 0.2, 0.3, 1.0);\n /**\n * Observable triggered when the performance priority is changed\n */\n this.onClearColorChangedObservable = new Observable();\n /**\n * Defines the color used to simulate the ambient color (Default is (0, 0, 0))\n */\n this.ambientColor = new Color3(0, 0, 0);\n /**\n * Intensity of the environment in all pbr material.\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to reference from here than from all the materials.\n */\n this.environmentIntensity = 1;\n this._performancePriority = 0 /* ScenePerformancePriority.BackwardCompatible */;\n /**\n * Observable triggered when the performance priority is changed\n */\n this.onScenePerformancePriorityChangedObservable = new Observable();\n this._forceWireframe = false;\n this._skipFrustumClipping = false;\n this._forcePointsCloud = false;\n /**\n * Gets the list of root nodes (ie. nodes with no parent)\n */\n this.rootNodes = [];\n /** All of the cameras added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\n */\n this.cameras = [];\n /**\n * All of the lights added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n */\n this.lights = [];\n /**\n * All of the (abstract) meshes added to this scene\n */\n this.meshes = [];\n /**\n * The list of skeletons added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\n */\n this.skeletons = [];\n /**\n * All of the particle systems added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\n */\n this.particleSystems = [];\n /**\n * Gets a list of Animations associated with the scene\n */\n this.animations = [];\n /**\n * All of the animation groups added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\n */\n this.animationGroups = [];\n /**\n * All of the multi-materials added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\n */\n this.multiMaterials = [];\n /**\n * All of the materials added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\n * Note also that the order of the Material within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\n */\n this.materials = [];\n /**\n * The list of morph target managers added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph\n */\n this.morphTargetManagers = [];\n /**\n * The list of geometries used in the scene.\n */\n this.geometries = [];\n /**\n * All of the transform nodes added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\n * Note also that the order of the TransformNode within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\n */\n this.transformNodes = [];\n /**\n * ActionManagers available on the scene.\n * @deprecated\n */\n this.actionManagers = [];\n /**\n * Textures to keep.\n */\n this.textures = [];\n /** @internal */\n this._environmentTexture = null;\n /**\n * The list of postprocesses added to the scene\n */\n this.postProcesses = [];\n /**\n * The list of effect layers (highlights/glow) added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/highlightLayer\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\n */\n this.effectLayers = [];\n /**\n * The list of sounds used in the scene.\n */\n this.sounds = null;\n /**\n * The list of layers (background and foreground) of the scene\n */\n this.layers = [];\n /**\n * The list of lens flare system added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare\n */\n this.lensFlareSystems = [];\n /**\n * The list of procedural textures added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/proceduralTextures\n */\n this.proceduralTextures = [];\n /**\n * Gets or sets a boolean indicating if animations are enabled\n */\n this.animationsEnabled = true;\n this._animationPropertiesOverride = null;\n /**\n * Gets or sets a boolean indicating if a constant deltatime has to be used\n * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate\n */\n this.useConstantAnimationDeltaTime = false;\n /**\n * Gets or sets a boolean indicating if the scene must keep the meshUnderPointer property updated\n * Please note that it requires to run a ray cast through the scene on every frame\n */\n this.constantlyUpdateMeshUnderPointer = false;\n /**\n * Defines the HTML cursor to use when hovering over interactive elements\n */\n this.hoverCursor = \"pointer\";\n /**\n * Defines the HTML default cursor to use (empty by default)\n */\n this.defaultCursor = \"\";\n /**\n * Defines whether cursors are handled by the scene.\n */\n this.doNotHandleCursors = false;\n /**\n * This is used to call preventDefault() on pointer down\n * in order to block unwanted artifacts like system double clicks\n */\n this.preventDefaultOnPointerDown = true;\n /**\n * This is used to call preventDefault() on pointer up\n * in order to block unwanted artifacts like system double clicks\n */\n this.preventDefaultOnPointerUp = true;\n // Metadata\n /**\n * Gets or sets user defined metadata\n */\n this.metadata = null;\n /**\n * For internal use only. Please do not use.\n */\n this.reservedDataStore = null;\n /**\n * Use this array to add regular expressions used to disable offline support for specific urls\n */\n this.disableOfflineSupportExceptionRules = [];\n /**\n * An event triggered when the scene is disposed.\n */\n this.onDisposeObservable = new Observable();\n this._onDisposeObserver = null;\n /**\n * An event triggered before rendering the scene (right after animations and physics)\n */\n this.onBeforeRenderObservable = new Observable();\n this._onBeforeRenderObserver = null;\n /**\n * An event triggered after rendering the scene\n */\n this.onAfterRenderObservable = new Observable();\n /**\n * An event triggered after rendering the scene for an active camera (When scene.render is called this will be called after each camera)\n * This is triggered for each \"sub\" camera in a Camera Rig unlike onAfterCameraRenderObservable\n */\n this.onAfterRenderCameraObservable = new Observable();\n this._onAfterRenderObserver = null;\n /**\n * An event triggered before animating the scene\n */\n this.onBeforeAnimationsObservable = new Observable();\n /**\n * An event triggered after animations processing\n */\n this.onAfterAnimationsObservable = new Observable();\n /**\n * An event triggered before draw calls are ready to be sent\n */\n this.onBeforeDrawPhaseObservable = new Observable();\n /**\n * An event triggered after draw calls have been sent\n */\n this.onAfterDrawPhaseObservable = new Observable();\n /**\n * An event triggered when the scene is ready\n */\n this.onReadyObservable = new Observable();\n /**\n * An event triggered before rendering a camera\n */\n this.onBeforeCameraRenderObservable = new Observable();\n this._onBeforeCameraRenderObserver = null;\n /**\n * An event triggered after rendering a camera\n * This is triggered for the full rig Camera only unlike onAfterRenderCameraObservable\n */\n this.onAfterCameraRenderObservable = new Observable();\n this._onAfterCameraRenderObserver = null;\n /**\n * An event triggered when active meshes evaluation is about to start\n */\n this.onBeforeActiveMeshesEvaluationObservable = new Observable();\n /**\n * An event triggered when active meshes evaluation is done\n */\n this.onAfterActiveMeshesEvaluationObservable = new Observable();\n /**\n * An event triggered when particles rendering is about to start\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\n */\n this.onBeforeParticlesRenderingObservable = new Observable();\n /**\n * An event triggered when particles rendering is done\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\n */\n this.onAfterParticlesRenderingObservable = new Observable();\n /**\n * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed\n */\n this.onDataLoadedObservable = new Observable();\n /**\n * An event triggered when a camera is created\n */\n this.onNewCameraAddedObservable = new Observable();\n /**\n * An event triggered when a camera is removed\n */\n this.onCameraRemovedObservable = new Observable();\n /**\n * An event triggered when a light is created\n */\n this.onNewLightAddedObservable = new Observable();\n /**\n * An event triggered when a light is removed\n */\n this.onLightRemovedObservable = new Observable();\n /**\n * An event triggered when a geometry is created\n */\n this.onNewGeometryAddedObservable = new Observable();\n /**\n * An event triggered when a geometry is removed\n */\n this.onGeometryRemovedObservable = new Observable();\n /**\n * An event triggered when a transform node is created\n */\n this.onNewTransformNodeAddedObservable = new Observable();\n /**\n * An event triggered when a transform node is removed\n */\n this.onTransformNodeRemovedObservable = new Observable();\n /**\n * An event triggered when a mesh is created\n */\n this.onNewMeshAddedObservable = new Observable();\n /**\n * An event triggered when a mesh is removed\n */\n this.onMeshRemovedObservable = new Observable();\n /**\n * An event triggered when a skeleton is created\n */\n this.onNewSkeletonAddedObservable = new Observable();\n /**\n * An event triggered when a skeleton is removed\n */\n this.onSkeletonRemovedObservable = new Observable();\n /**\n * An event triggered when a material is created\n */\n this.onNewMaterialAddedObservable = new Observable();\n /**\n * An event triggered when a multi material is created\n */\n this.onNewMultiMaterialAddedObservable = new Observable();\n /**\n * An event triggered when a material is removed\n */\n this.onMaterialRemovedObservable = new Observable();\n /**\n * An event triggered when a multi material is removed\n */\n this.onMultiMaterialRemovedObservable = new Observable();\n /**\n * An event triggered when a texture is created\n */\n this.onNewTextureAddedObservable = new Observable();\n /**\n * An event triggered when a texture is removed\n */\n this.onTextureRemovedObservable = new Observable();\n /**\n * An event triggered when render targets are about to be rendered\n * Can happen multiple times per frame.\n */\n this.onBeforeRenderTargetsRenderObservable = new Observable();\n /**\n * An event triggered when render targets were rendered.\n * Can happen multiple times per frame.\n */\n this.onAfterRenderTargetsRenderObservable = new Observable();\n /**\n * An event triggered before calculating deterministic simulation step\n */\n this.onBeforeStepObservable = new Observable();\n /**\n * An event triggered after calculating deterministic simulation step\n */\n this.onAfterStepObservable = new Observable();\n /**\n * An event triggered when the activeCamera property is updated\n */\n this.onActiveCameraChanged = new Observable();\n /**\n * An event triggered when the activeCameras property is updated\n */\n this.onActiveCamerasChanged = new Observable();\n /**\n * This Observable will be triggered before rendering each renderingGroup of each rendered camera.\n * The RenderingGroupInfo class contains all the information about the context in which the observable is called\n * 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)\n */\n this.onBeforeRenderingGroupObservable = new Observable();\n /**\n * This Observable will be triggered after rendering each renderingGroup of each rendered camera.\n * The RenderingGroupInfo class contains all the information about the context in which the observable is called\n * 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)\n */\n this.onAfterRenderingGroupObservable = new Observable();\n /**\n * This Observable will when a mesh has been imported into the scene.\n */\n this.onMeshImportedObservable = new Observable();\n /**\n * This Observable will when an animation file has been imported into the scene.\n */\n this.onAnimationFileImportedObservable = new Observable();\n // Animations\n /** @internal */\n this._registeredForLateAnimationBindings = new SmartArrayNoDuplicate(256);\n // Pointers\n this._pointerPickingConfiguration = new PointerPickingConfiguration();\n /**\n * 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).\n * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true\n */\n this.onPrePointerObservable = new Observable();\n /**\n * Observable event triggered each time an input event is received from the rendering canvas\n */\n this.onPointerObservable = new Observable();\n // Keyboard\n /**\n * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl()\n * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true\n */\n this.onPreKeyboardObservable = new Observable();\n /**\n * Observable event triggered each time an keyboard event is received from the hosting window\n */\n this.onKeyboardObservable = new Observable();\n // Coordinates system\n this._useRightHandedSystem = false;\n // Deterministic lockstep\n this._timeAccumulator = 0;\n this._currentStepId = 0;\n this._currentInternalStep = 0;\n // Fog\n this._fogEnabled = true;\n this._fogMode = Scene.FOGMODE_NONE;\n /**\n * Gets or sets the fog color to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is Color3(0.2, 0.2, 0.3))\n */\n this.fogColor = new Color3(0.2, 0.2, 0.3);\n /**\n * Gets or sets the fog density to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is 0.1)\n */\n this.fogDensity = 0.1;\n /**\n * Gets or sets the fog start distance to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is 0)\n */\n this.fogStart = 0;\n /**\n * Gets or sets the fog end distance to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is 1000)\n */\n this.fogEnd = 1000.0;\n /**\n * Flag indicating if we need to store previous matrices when rendering\n */\n this.needsPreviousWorldMatrices = false;\n // Lights\n this._shadowsEnabled = true;\n this._lightsEnabled = true;\n this._unObserveActiveCameras = null;\n // Textures\n this._texturesEnabled = true;\n this._frameGraph = null;\n // Physics\n /**\n * Gets or sets a boolean indicating if physic engines are enabled on this scene\n */\n this.physicsEnabled = true;\n // Particles\n /**\n * Gets or sets a boolean indicating if particles are enabled on this scene\n */\n this.particlesEnabled = true;\n // Sprites\n /**\n * Gets or sets a boolean indicating if sprites are enabled on this scene\n */\n this.spritesEnabled = true;\n // Skeletons\n this._skeletonsEnabled = true;\n // Lens flares\n /**\n * Gets or sets a boolean indicating if lens flares are enabled on this scene\n */\n this.lensFlaresEnabled = true;\n // Collisions\n /**\n * Gets or sets a boolean indicating if collisions are enabled on this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n this.collisionsEnabled = true;\n /**\n * Defines the gravity applied to this scene (used only for collisions)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n this.gravity = new Vector3(0, -9.807, 0);\n // Postprocesses\n /**\n * Gets or sets a boolean indicating if postprocesses are enabled on this scene\n */\n this.postProcessesEnabled = true;\n // Customs render targets\n /**\n * Gets or sets a boolean indicating if render targets are enabled on this scene\n */\n this.renderTargetsEnabled = true;\n /**\n * Gets or sets a boolean indicating if next render targets must be dumped as image for debugging purposes\n * We recommend not using it and instead rely on Spector.js: http://spector.babylonjs.com\n */\n this.dumpNextRenderTargets = false;\n /**\n * The list of user defined render targets added to the scene\n */\n this.customRenderTargets = [];\n /**\n * Gets the list of meshes imported to the scene through SceneLoader\n */\n this.importedMeshesFiles = [];\n // Probes\n /**\n * Gets or sets a boolean indicating if probes are enabled on this scene\n */\n this.probesEnabled = true;\n this._meshesForIntersections = new SmartArrayNoDuplicate(256);\n // Procedural textures\n /**\n * Gets or sets a boolean indicating if procedural textures are enabled on this scene\n */\n this.proceduralTexturesEnabled = true;\n // Performance counters\n this._totalVertices = new PerfCounter();\n /** @internal */\n this._activeIndices = new PerfCounter();\n /** @internal */\n this._activeParticles = new PerfCounter();\n /** @internal */\n this._activeBones = new PerfCounter();\n /** @internal */\n this._animationTime = 0;\n /**\n * Gets or sets a general scale for animation speed\n * @see https://www.babylonjs-playground.com/#IBU2W7#3\n */\n this.animationTimeScale = 1;\n this._renderId = 0;\n this._frameId = 0;\n this._executeWhenReadyTimeoutId = null;\n this._intermediateRendering = false;\n this._defaultFrameBufferCleared = false;\n this._viewUpdateFlag = -1;\n this._projectionUpdateFlag = -1;\n /** @internal */\n this._toBeDisposed = new Array(256);\n this._activeRequests = new Array();\n /** @internal */\n this._pendingData = new Array();\n this._isDisposed = false;\n /**\n * Gets or sets a boolean indicating that all submeshes of active meshes must be rendered\n * Use this boolean to avoid computing frustum clipping on submeshes (This could help when you are CPU bound)\n */\n this.dispatchAllSubMeshesOfActiveMeshes = false;\n this._activeMeshes = new SmartArray(256);\n this._processedMaterials = new SmartArray(256);\n this._renderTargets = new SmartArrayNoDuplicate(256);\n this._materialsRenderTargets = new SmartArrayNoDuplicate(256);\n /** @internal */\n this._activeParticleSystems = new SmartArray(256);\n this._activeSkeletons = new SmartArrayNoDuplicate(32);\n this._softwareSkinnedMeshes = new SmartArrayNoDuplicate(32);\n /** @internal */\n this._activeAnimatables = new Array();\n this._transformMatrix = Matrix.Zero();\n /**\n * Gets or sets a boolean indicating if lights must be sorted by priority (off by default)\n * This is useful if there are more lights that the maximum simulteanous authorized\n */\n this.requireLightSorting = false;\n /**\n * @internal\n * Backing store of defined scene components.\n */\n this._components = [];\n /**\n * @internal\n * Backing store of defined scene components.\n */\n this._serializableComponents = [];\n /**\n * List of components to register on the next registration step.\n */\n this._transientComponents = [];\n /**\n * @internal\n * Defines the actions happening before camera updates.\n */\n this._beforeCameraUpdateStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening before clear the canvas.\n */\n this._beforeClearStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening before clear the canvas.\n */\n this._beforeRenderTargetClearStage = Stage.Create();\n /**\n * @internal\n * Defines the actions when collecting render targets for the frame.\n */\n this._gatherRenderTargetsStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening for one camera in the frame.\n */\n this._gatherActiveCameraRenderTargetsStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the per mesh ready checks.\n */\n this._isReadyForMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening before evaluate active mesh checks.\n */\n this._beforeEvaluateActiveMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the evaluate sub mesh checks.\n */\n this._evaluateSubMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the active mesh stage.\n */\n this._preActiveMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the per camera render target step.\n */\n this._cameraDrawRenderTargetStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before the active camera is drawing.\n */\n this._beforeCameraDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before a render target is drawing.\n */\n this._beforeRenderTargetDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before a rendering group is drawing.\n */\n this._beforeRenderingGroupDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before a mesh is drawing.\n */\n this._beforeRenderingMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after a mesh has been drawn.\n */\n this._afterRenderingMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after a rendering group has been drawn.\n */\n this._afterRenderingGroupDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after the active camera has been drawn.\n */\n this._afterCameraDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after the post processing\n */\n this._afterCameraPostProcessStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after a render target has been drawn.\n */\n this._afterRenderTargetDrawStage = Stage.Create();\n /**\n * Defines the actions happening just after the post processing on a render target\n */\n this._afterRenderTargetPostProcessStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after rendering all cameras and computing intersections.\n */\n this._afterRenderStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening when a pointer move event happens.\n */\n this._pointerMoveStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening when a pointer down event happens.\n */\n this._pointerDownStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening when a pointer up event happens.\n */\n this._pointerUpStage = Stage.Create();\n /**\n * an optional map from Geometry Id to Geometry index in the 'geometries' array\n */\n this._geometriesByUniqueId = null;\n this._defaultMeshCandidates = {\n data: [],\n length: 0,\n };\n this._defaultSubMeshCandidates = {\n data: [],\n length: 0,\n };\n this._preventFreeActiveMeshesAndRenderingGroups = false;\n /** @internal */\n this._activeMeshesFrozen = false;\n /** @internal */\n this._activeMeshesFrozenButKeepClipping = false;\n this._skipEvaluateActiveMeshesCompletely = false;\n /** @internal */\n this._allowPostProcessClearColor = true;\n /**\n * User updatable function that will return a deterministic frame time when engine is in deterministic lock step mode\n * @returns the frame time\n */\n this.getDeterministicFrameTime = () => {\n return this._engine.getTimeStep();\n };\n /** @internal */\n this._registeredActions = 0;\n this._blockMaterialDirtyMechanism = false;\n /**\n * Internal perfCollector instance used for sharing between inspector and playground.\n * Marked as protected to allow sharing between prototype extensions, but disallow access at toplevel.\n */\n this._perfCollector = null;\n this.activeCameras = [];\n const fullOptions = {\n useGeometryUniqueIdsMap: true,\n useMaterialMeshMap: true,\n useClonedMeshMap: true,\n virtual: false,\n ...options,\n };\n engine = this._engine = engine || EngineStore.LastCreatedEngine;\n if (fullOptions.virtual) {\n engine._virtualScenes.push(this);\n }\n else {\n EngineStore._LastCreatedScene = this;\n engine.scenes.push(this);\n }\n this._uid = null;\n this._renderingManager = new RenderingManager(this);\n if (PostProcessManager) {\n this.postProcessManager = new PostProcessManager(this);\n }\n if (IsWindowObjectExist()) {\n this.attachControl();\n }\n // Uniform Buffer\n this._createUbo();\n // Default Image processing definition\n if (ImageProcessingConfiguration) {\n this._imageProcessingConfiguration = new ImageProcessingConfiguration();\n }\n this.setDefaultCandidateProviders();\n if (fullOptions.useGeometryUniqueIdsMap) {\n this._geometriesByUniqueId = {};\n }\n this.useMaterialMeshMap = fullOptions.useMaterialMeshMap;\n this.useClonedMeshMap = fullOptions.useClonedMeshMap;\n if (!options || !options.virtual) {\n engine.onNewSceneAddedObservable.notifyObservers(this);\n }\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"Scene\" string\n */\n getClassName() {\n return \"Scene\";\n }\n /**\n * @internal\n */\n _getDefaultMeshCandidates() {\n this._defaultMeshCandidates.data = this.meshes;\n this._defaultMeshCandidates.length = this.meshes.length;\n return this._defaultMeshCandidates;\n }\n /**\n * @internal\n */\n _getDefaultSubMeshCandidates(mesh) {\n this._defaultSubMeshCandidates.data = mesh.subMeshes;\n this._defaultSubMeshCandidates.length = mesh.subMeshes.length;\n return this._defaultSubMeshCandidates;\n }\n /**\n * Sets the default candidate providers for the scene.\n * This sets the getActiveMeshCandidates, getActiveSubMeshCandidates, getIntersectingSubMeshCandidates\n * and getCollidingSubMeshCandidates to their default function\n */\n setDefaultCandidateProviders() {\n this.getActiveMeshCandidates = () => this._getDefaultMeshCandidates();\n this.getActiveSubMeshCandidates = (mesh) => this._getDefaultSubMeshCandidates(mesh);\n this.getIntersectingSubMeshCandidates = (mesh, localRay) => this._getDefaultSubMeshCandidates(mesh);\n this.getCollidingSubMeshCandidates = (mesh, collider) => this._getDefaultSubMeshCandidates(mesh);\n }\n /**\n * Gets the mesh that is currently under the pointer\n */\n get meshUnderPointer() {\n return this._inputManager.meshUnderPointer;\n }\n /**\n * Gets or sets the current on-screen X position of the pointer\n */\n get pointerX() {\n return this._inputManager.pointerX;\n }\n set pointerX(value) {\n this._inputManager.pointerX = value;\n }\n /**\n * Gets or sets the current on-screen Y position of the pointer\n */\n get pointerY() {\n return this._inputManager.pointerY;\n }\n set pointerY(value) {\n this._inputManager.pointerY = value;\n }\n /**\n * Gets the cached material (ie. the latest rendered one)\n * @returns the cached material\n */\n getCachedMaterial() {\n return this._cachedMaterial;\n }\n /**\n * Gets the cached effect (ie. the latest rendered one)\n * @returns the cached effect\n */\n getCachedEffect() {\n return this._cachedEffect;\n }\n /**\n * Gets the cached visibility state (ie. the latest rendered one)\n * @returns the cached visibility state\n */\n getCachedVisibility() {\n return this._cachedVisibility;\n }\n /**\n * Gets a boolean indicating if the current material / effect / visibility must be bind again\n * @param material defines the current material\n * @param effect defines the current effect\n * @param visibility defines the current visibility state\n * @returns true if one parameter is not cached\n */\n isCachedMaterialInvalid(material, effect, visibility = 1) {\n return this._cachedEffect !== effect || this._cachedMaterial !== material || this._cachedVisibility !== visibility;\n }\n /**\n * Gets the engine associated with the scene\n * @returns an Engine\n */\n getEngine() {\n return this._engine;\n }\n /**\n * Gets the total number of vertices rendered per frame\n * @returns the total number of vertices rendered per frame\n */\n getTotalVertices() {\n return this._totalVertices.current;\n }\n /**\n * Gets the performance counter for total vertices\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get totalVerticesPerfCounter() {\n return this._totalVertices;\n }\n /**\n * Gets the total number of active indices rendered per frame (You can deduce the number of rendered triangles by dividing this number by 3)\n * @returns the total number of active indices rendered per frame\n */\n getActiveIndices() {\n return this._activeIndices.current;\n }\n /**\n * Gets the performance counter for active indices\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get totalActiveIndicesPerfCounter() {\n return this._activeIndices;\n }\n /**\n * Gets the total number of active particles rendered per frame\n * @returns the total number of active particles rendered per frame\n */\n getActiveParticles() {\n return this._activeParticles.current;\n }\n /**\n * Gets the performance counter for active particles\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get activeParticlesPerfCounter() {\n return this._activeParticles;\n }\n /**\n * Gets the total number of active bones rendered per frame\n * @returns the total number of active bones rendered per frame\n */\n getActiveBones() {\n return this._activeBones.current;\n }\n /**\n * Gets the performance counter for active bones\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get activeBonesPerfCounter() {\n return this._activeBones;\n }\n /**\n * Gets the array of active meshes\n * @returns an array of AbstractMesh\n */\n getActiveMeshes() {\n return this._activeMeshes;\n }\n /**\n * Gets the animation ratio (which is 1.0 is the scene renders at 60fps and 2 if the scene renders at 30fps, etc.)\n * @returns a number\n */\n getAnimationRatio() {\n return this._animationRatio !== undefined ? this._animationRatio : 1;\n }\n /**\n * Gets an unique Id for the current render phase\n * @returns a number\n */\n getRenderId() {\n return this._renderId;\n }\n /**\n * Gets an unique Id for the current frame\n * @returns a number\n */\n getFrameId() {\n return this._frameId;\n }\n /** Call this function if you want to manually increment the render Id*/\n incrementRenderId() {\n this._renderId++;\n }\n _createUbo() {\n this.setSceneUniformBuffer(this.createSceneUniformBuffer());\n }\n /**\n * Use this method to simulate a pointer move on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @returns the current scene\n */\n simulatePointerMove(pickResult, pointerEventInit) {\n this._inputManager.simulatePointerMove(pickResult, pointerEventInit);\n return this;\n }\n /**\n * Use this method to simulate a pointer down on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @returns the current scene\n */\n simulatePointerDown(pickResult, pointerEventInit) {\n this._inputManager.simulatePointerDown(pickResult, pointerEventInit);\n return this;\n }\n /**\n * Use this method to simulate a pointer up on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\n * @returns the current scene\n */\n simulatePointerUp(pickResult, pointerEventInit, doubleTap) {\n this._inputManager.simulatePointerUp(pickResult, pointerEventInit, doubleTap);\n return this;\n }\n /**\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\n * @returns true if the pointer was captured\n */\n isPointerCaptured(pointerId = 0) {\n return this._inputManager.isPointerCaptured(pointerId);\n }\n /**\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\n * @param attachUp defines if you want to attach events to pointerup\n * @param attachDown defines if you want to attach events to pointerdown\n * @param attachMove defines if you want to attach events to pointermove\n */\n attachControl(attachUp = true, attachDown = true, attachMove = true) {\n this._inputManager.attachControl(attachUp, attachDown, attachMove);\n }\n /** Detaches all event handlers*/\n detachControl() {\n this._inputManager.detachControl();\n }\n /**\n * This function will check if the scene can be rendered (textures are loaded, shaders are compiled)\n * Delay loaded resources are not taking in account\n * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: true)\n * @returns true if all required resources are ready\n */\n isReady(checkRenderTargets = true) {\n if (this._isDisposed) {\n return false;\n }\n let index;\n const engine = this.getEngine();\n const currentRenderPassId = engine.currentRenderPassId;\n engine.currentRenderPassId = this.activeCamera?.renderPassId ?? currentRenderPassId;\n let isReady = true;\n // Pending data\n if (this._pendingData.length > 0) {\n isReady = false;\n }\n // Ensures that the pre-pass renderer is enabled if it is to be enabled.\n this.prePassRenderer?.update();\n // OIT\n if (this.useOrderIndependentTransparency && this.depthPeelingRenderer) {\n isReady && (isReady = this.depthPeelingRenderer.isReady());\n }\n // Meshes\n if (checkRenderTargets) {\n this._processedMaterials.reset();\n this._materialsRenderTargets.reset();\n }\n for (index = 0; index < this.meshes.length; index++) {\n const mesh = this.meshes[index];\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\n continue;\n }\n // Do not stop at the first encountered \"unready\" object as we want to ensure\n // all materials are starting off their compilation in parallel.\n if (!mesh.isReady(true)) {\n isReady = false;\n continue;\n }\n const hardwareInstancedRendering = mesh.hasThinInstances ||\n mesh.getClassName() === \"InstancedMesh\" ||\n mesh.getClassName() === \"InstancedLinesMesh\" ||\n (engine.getCaps().instancedArrays && mesh.instances.length > 0);\n // Is Ready For Mesh\n for (const step of this._isReadyForMeshStage) {\n if (!step.action(mesh, hardwareInstancedRendering)) {\n isReady = false;\n }\n }\n if (!checkRenderTargets) {\n continue;\n }\n const mat = mesh.material || this.defaultMaterial;\n if (mat) {\n if (mat._storeEffectOnSubMeshes) {\n for (const subMesh of mesh.subMeshes) {\n const material = subMesh.getMaterial();\n if (material && material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\n if (this._processedMaterials.indexOf(material) === -1) {\n this._processedMaterials.push(material);\n this._materialsRenderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\n }\n }\n }\n }\n else {\n if (mat.hasRenderTargetTextures && mat.getRenderTargetTextures != null) {\n if (this._processedMaterials.indexOf(mat) === -1) {\n this._processedMaterials.push(mat);\n this._materialsRenderTargets.concatWithNoDuplicate(mat.getRenderTargetTextures());\n }\n }\n }\n }\n }\n // Render targets\n if (checkRenderTargets) {\n for (index = 0; index < this._materialsRenderTargets.length; ++index) {\n const rtt = this._materialsRenderTargets.data[index];\n if (!rtt.isReadyForRendering()) {\n isReady = false;\n }\n }\n }\n // Geometries\n for (index = 0; index < this.geometries.length; index++) {\n const geometry = this.geometries[index];\n if (geometry.delayLoadState === 2) {\n isReady = false;\n }\n }\n // Post-processes\n if (this.activeCameras && this.activeCameras.length > 0) {\n for (const camera of this.activeCameras) {\n if (!camera.isReady(true)) {\n isReady = false;\n }\n }\n }\n else if (this.activeCamera) {\n if (!this.activeCamera.isReady(true)) {\n isReady = false;\n }\n }\n // Particles\n for (const particleSystem of this.particleSystems) {\n if (!particleSystem.isReady()) {\n isReady = false;\n }\n }\n // Layers\n if (this.layers) {\n for (const layer of this.layers) {\n if (!layer.isReady()) {\n isReady = false;\n }\n }\n }\n // Effects\n if (!engine.areAllEffectsReady()) {\n isReady = false;\n }\n engine.currentRenderPassId = currentRenderPassId;\n return isReady;\n }\n /** Resets all cached information relative to material (including effect and visibility) */\n resetCachedMaterial() {\n this._cachedMaterial = null;\n this._cachedEffect = null;\n this._cachedVisibility = null;\n }\n /**\n * Registers a function to be called before every frame render\n * @param func defines the function to register\n */\n registerBeforeRender(func) {\n this.onBeforeRenderObservable.add(func);\n }\n /**\n * Unregisters a function called before every frame render\n * @param func defines the function to unregister\n */\n unregisterBeforeRender(func) {\n this.onBeforeRenderObservable.removeCallback(func);\n }\n /**\n * Registers a function to be called after every frame render\n * @param func defines the function to register\n */\n registerAfterRender(func) {\n this.onAfterRenderObservable.add(func);\n }\n /**\n * Unregisters a function called after every frame render\n * @param func defines the function to unregister\n */\n unregisterAfterRender(func) {\n this.onAfterRenderObservable.removeCallback(func);\n }\n _executeOnceBeforeRender(func) {\n const execFunc = () => {\n func();\n setTimeout(() => {\n this.unregisterBeforeRender(execFunc);\n });\n };\n this.registerBeforeRender(execFunc);\n }\n /**\n * The provided function will run before render once and will be disposed afterwards.\n * A timeout delay can be provided so that the function will be executed in N ms.\n * The timeout is using the browser's native setTimeout so time percision cannot be guaranteed.\n * @param func The function to be executed.\n * @param timeout optional delay in ms\n */\n executeOnceBeforeRender(func, timeout) {\n if (timeout !== undefined) {\n setTimeout(() => {\n this._executeOnceBeforeRender(func);\n }, timeout);\n }\n else {\n this._executeOnceBeforeRender(func);\n }\n }\n /**\n * This function can help adding any object to the list of data awaited to be ready in order to check for a complete scene loading.\n * @param data defines the object to wait for\n */\n addPendingData(data) {\n this._pendingData.push(data);\n }\n /**\n * Remove a pending data from the loading list which has previously been added with addPendingData.\n * @param data defines the object to remove from the pending list\n */\n removePendingData(data) {\n const wasLoading = this.isLoading;\n const index = this._pendingData.indexOf(data);\n if (index !== -1) {\n this._pendingData.splice(index, 1);\n }\n if (wasLoading && !this.isLoading) {\n this.onDataLoadedObservable.notifyObservers(this);\n }\n }\n /**\n * Returns the number of items waiting to be loaded\n * @returns the number of items waiting to be loaded\n */\n getWaitingItemsCount() {\n return this._pendingData.length;\n }\n /**\n * Returns a boolean indicating if the scene is still loading data\n */\n get isLoading() {\n return this._pendingData.length > 0;\n }\n /**\n * Registers a function to be executed when the scene is ready\n * @param func - the function to be executed\n * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: false)\n */\n executeWhenReady(func, checkRenderTargets = false) {\n this.onReadyObservable.addOnce(func);\n if (this._executeWhenReadyTimeoutId !== null) {\n return;\n }\n this._checkIsReady(checkRenderTargets);\n }\n /**\n * Returns a promise that resolves when the scene is ready\n * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: false)\n * @returns A promise that resolves when the scene is ready\n */\n whenReadyAsync(checkRenderTargets = false) {\n return new Promise((resolve) => {\n this.executeWhenReady(() => {\n resolve();\n }, checkRenderTargets);\n });\n }\n /**\n * @internal\n */\n _checkIsReady(checkRenderTargets = false) {\n this._registerTransientComponents();\n if (this.isReady(checkRenderTargets)) {\n this.onReadyObservable.notifyObservers(this);\n this.onReadyObservable.clear();\n this._executeWhenReadyTimeoutId = null;\n return;\n }\n if (this._isDisposed) {\n this.onReadyObservable.clear();\n this._executeWhenReadyTimeoutId = null;\n return;\n }\n this._executeWhenReadyTimeoutId = setTimeout(() => {\n // Ensure materials effects are checked outside render loops\n this.incrementRenderId();\n this._checkIsReady(checkRenderTargets);\n }, 100);\n }\n /**\n * Gets all animatable attached to the scene\n */\n get animatables() {\n return this._activeAnimatables;\n }\n /**\n * Resets the last animation time frame.\n * Useful to override when animations start running when loading a scene for the first time.\n */\n resetLastAnimationTimeFrame() {\n this._animationTimeLast = PrecisionDate.Now;\n }\n // Matrix\n /**\n * Gets the current view matrix\n * @returns a Matrix\n */\n getViewMatrix() {\n return this._viewMatrix;\n }\n /**\n * Gets the current projection matrix\n * @returns a Matrix\n */\n getProjectionMatrix() {\n return this._projectionMatrix;\n }\n /**\n * Gets the current transform matrix\n * @returns a Matrix made of View * Projection\n */\n getTransformMatrix() {\n return this._transformMatrix;\n }\n /**\n * Sets the current transform matrix\n * @param viewL defines the View matrix to use\n * @param projectionL defines the Projection matrix to use\n * @param viewR defines the right View matrix to use (if provided)\n * @param projectionR defines the right Projection matrix to use (if provided)\n */\n setTransformMatrix(viewL, projectionL, viewR, projectionR) {\n // clear the multiviewSceneUbo if no viewR and projectionR are defined\n if (!viewR && !projectionR && this._multiviewSceneUbo) {\n this._multiviewSceneUbo.dispose();\n this._multiviewSceneUbo = null;\n }\n if (this._viewUpdateFlag === viewL.updateFlag && this._projectionUpdateFlag === projectionL.updateFlag) {\n return;\n }\n this._viewUpdateFlag = viewL.updateFlag;\n this._projectionUpdateFlag = projectionL.updateFlag;\n this._viewMatrix = viewL;\n this._projectionMatrix = projectionL;\n this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\n // Update frustum\n if (!this._frustumPlanes) {\n this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);\n }\n else {\n Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\n }\n if (this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo) {\n this._updateMultiviewUbo(viewR, projectionR);\n }\n else if (this._sceneUbo.useUbo) {\n this._sceneUbo.updateMatrix(\"viewProjection\", this._transformMatrix);\n this._sceneUbo.updateMatrix(\"view\", this._viewMatrix);\n this._sceneUbo.updateMatrix(\"projection\", this._projectionMatrix);\n }\n }\n /**\n * Gets the uniform buffer used to store scene data\n * @returns a UniformBuffer\n */\n getSceneUniformBuffer() {\n return this._multiviewSceneUbo ? this._multiviewSceneUbo : this._sceneUbo;\n }\n /**\n * Creates a scene UBO\n * @param name name of the uniform buffer (optional, for debugging purpose only)\n * @returns a new ubo\n */\n createSceneUniformBuffer(name) {\n const sceneUbo = new UniformBuffer(this._engine, undefined, false, name ?? \"scene\");\n sceneUbo.addUniform(\"viewProjection\", 16);\n sceneUbo.addUniform(\"view\", 16);\n sceneUbo.addUniform(\"projection\", 16);\n sceneUbo.addUniform(\"vEyePosition\", 4);\n return sceneUbo;\n }\n /**\n * Sets the scene ubo\n * @param ubo the ubo to set for the scene\n */\n setSceneUniformBuffer(ubo) {\n this._sceneUbo = ubo;\n this._viewUpdateFlag = -1;\n this._projectionUpdateFlag = -1;\n }\n /**\n * Gets an unique (relatively to the current scene) Id\n * @returns an unique number for the scene\n */\n getUniqueId() {\n return UniqueIdGenerator.UniqueId;\n }\n /**\n * Add a mesh to the list of scene's meshes\n * @param newMesh defines the mesh to add\n * @param recursive if all child meshes should also be added to the scene\n */\n addMesh(newMesh, recursive = false) {\n if (this._blockEntityCollection) {\n return;\n }\n this.meshes.push(newMesh);\n newMesh._resyncLightSources();\n if (!newMesh.parent) {\n newMesh._addToSceneRootNodes();\n }\n Tools.SetImmediate(() => {\n this.onNewMeshAddedObservable.notifyObservers(newMesh);\n });\n if (recursive) {\n newMesh.getChildMeshes().forEach((m) => {\n this.addMesh(m);\n });\n }\n }\n /**\n * Remove a mesh for the list of scene's meshes\n * @param toRemove defines the mesh to remove\n * @param recursive if all child meshes should also be removed from the scene\n * @returns the index where the mesh was in the mesh list\n */\n removeMesh(toRemove, recursive = false) {\n const index = this.meshes.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if the mesh found\n this.meshes.splice(index, 1);\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n this._inputManager._invalidateMesh(toRemove);\n this.onMeshRemovedObservable.notifyObservers(toRemove);\n if (recursive) {\n toRemove.getChildMeshes().forEach((m) => {\n this.removeMesh(m);\n });\n }\n return index;\n }\n /**\n * Add a transform node to the list of scene's transform nodes\n * @param newTransformNode defines the transform node to add\n */\n addTransformNode(newTransformNode) {\n if (this._blockEntityCollection) {\n return;\n }\n if (newTransformNode.getScene() === this && newTransformNode._indexInSceneTransformNodesArray !== -1) {\n // Already there?\n return;\n }\n newTransformNode._indexInSceneTransformNodesArray = this.transformNodes.length;\n this.transformNodes.push(newTransformNode);\n if (!newTransformNode.parent) {\n newTransformNode._addToSceneRootNodes();\n }\n this.onNewTransformNodeAddedObservable.notifyObservers(newTransformNode);\n }\n /**\n * Remove a transform node for the list of scene's transform nodes\n * @param toRemove defines the transform node to remove\n * @returns the index where the transform node was in the transform node list\n */\n removeTransformNode(toRemove) {\n const index = toRemove._indexInSceneTransformNodesArray;\n if (index !== -1) {\n if (index !== this.transformNodes.length - 1) {\n const lastNode = this.transformNodes[this.transformNodes.length - 1];\n this.transformNodes[index] = lastNode;\n lastNode._indexInSceneTransformNodesArray = index;\n }\n toRemove._indexInSceneTransformNodesArray = -1;\n this.transformNodes.pop();\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n this.onTransformNodeRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Remove a skeleton for the list of scene's skeletons\n * @param toRemove defines the skeleton to remove\n * @returns the index where the skeleton was in the skeleton list\n */\n removeSkeleton(toRemove) {\n const index = this.skeletons.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if found\n this.skeletons.splice(index, 1);\n this.onSkeletonRemovedObservable.notifyObservers(toRemove);\n // Clean active container\n this._executeActiveContainerCleanup(this._activeSkeletons);\n }\n return index;\n }\n /**\n * Remove a morph target for the list of scene's morph targets\n * @param toRemove defines the morph target to remove\n * @returns the index where the morph target was in the morph target list\n */\n removeMorphTargetManager(toRemove) {\n const index = this.morphTargetManagers.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if found\n this.morphTargetManagers.splice(index, 1);\n }\n return index;\n }\n /**\n * Remove a light for the list of scene's lights\n * @param toRemove defines the light to remove\n * @returns the index where the light was in the light list\n */\n removeLight(toRemove) {\n const index = this.lights.indexOf(toRemove);\n if (index !== -1) {\n // Remove from meshes\n for (const mesh of this.meshes) {\n mesh._removeLightSource(toRemove, false);\n }\n // Remove from the scene if mesh found\n this.lights.splice(index, 1);\n this.sortLightsByPriority();\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n this.onLightRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Remove a camera for the list of scene's cameras\n * @param toRemove defines the camera to remove\n * @returns the index where the camera was in the camera list\n */\n removeCamera(toRemove) {\n const index = this.cameras.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if mesh found\n this.cameras.splice(index, 1);\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n // Remove from activeCameras\n if (this.activeCameras) {\n const index2 = this.activeCameras.indexOf(toRemove);\n if (index2 !== -1) {\n // Remove from the scene if mesh found\n this.activeCameras.splice(index2, 1);\n }\n }\n // Reset the activeCamera\n if (this.activeCamera === toRemove) {\n if (this.cameras.length > 0) {\n this.activeCamera = this.cameras[0];\n }\n else {\n this.activeCamera = null;\n }\n }\n this.onCameraRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Remove a particle system for the list of scene's particle systems\n * @param toRemove defines the particle system to remove\n * @returns the index where the particle system was in the particle system list\n */\n removeParticleSystem(toRemove) {\n const index = this.particleSystems.indexOf(toRemove);\n if (index !== -1) {\n this.particleSystems.splice(index, 1);\n // Clean active container\n this._executeActiveContainerCleanup(this._activeParticleSystems);\n }\n return index;\n }\n /**\n * Remove a animation for the list of scene's animations\n * @param toRemove defines the animation to remove\n * @returns the index where the animation was in the animation list\n */\n removeAnimation(toRemove) {\n const index = this.animations.indexOf(toRemove);\n if (index !== -1) {\n this.animations.splice(index, 1);\n }\n return index;\n }\n /**\n * Will stop the animation of the given target\n * @param target - the target\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\n */\n stopAnimation(target, animationName, targetMask) {\n // Do nothing as code will be provided by animation component\n }\n /**\n * Removes the given animation group from this scene.\n * @param toRemove The animation group to remove\n * @returns The index of the removed animation group\n */\n removeAnimationGroup(toRemove) {\n const index = this.animationGroups.indexOf(toRemove);\n if (index !== -1) {\n this.animationGroups.splice(index, 1);\n }\n return index;\n }\n /**\n * Removes the given multi-material from this scene.\n * @param toRemove The multi-material to remove\n * @returns The index of the removed multi-material\n */\n removeMultiMaterial(toRemove) {\n const index = this.multiMaterials.indexOf(toRemove);\n if (index !== -1) {\n this.multiMaterials.splice(index, 1);\n }\n this.onMultiMaterialRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Removes the given material from this scene.\n * @param toRemove The material to remove\n * @returns The index of the removed material\n */\n removeMaterial(toRemove) {\n const index = toRemove._indexInSceneMaterialArray;\n if (index !== -1 && index < this.materials.length) {\n if (index !== this.materials.length - 1) {\n const lastMaterial = this.materials[this.materials.length - 1];\n this.materials[index] = lastMaterial;\n lastMaterial._indexInSceneMaterialArray = index;\n }\n toRemove._indexInSceneMaterialArray = -1;\n this.materials.pop();\n }\n this.onMaterialRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Removes the given action manager from this scene.\n * @deprecated\n * @param toRemove The action manager to remove\n * @returns The index of the removed action manager\n */\n removeActionManager(toRemove) {\n const index = this.actionManagers.indexOf(toRemove);\n if (index !== -1) {\n this.actionManagers.splice(index, 1);\n }\n return index;\n }\n /**\n * Removes the given texture from this scene.\n * @param toRemove The texture to remove\n * @returns The index of the removed texture\n */\n removeTexture(toRemove) {\n const index = this.textures.indexOf(toRemove);\n if (index !== -1) {\n this.textures.splice(index, 1);\n }\n this.onTextureRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Adds the given light to this scene\n * @param newLight The light to add\n */\n addLight(newLight) {\n if (this._blockEntityCollection) {\n return;\n }\n this.lights.push(newLight);\n this.sortLightsByPriority();\n if (!newLight.parent) {\n newLight._addToSceneRootNodes();\n }\n // Add light to all meshes (To support if the light is removed and then re-added)\n for (const mesh of this.meshes) {\n if (mesh.lightSources.indexOf(newLight) === -1) {\n mesh.lightSources.push(newLight);\n mesh._resyncLightSources();\n }\n }\n Tools.SetImmediate(() => {\n this.onNewLightAddedObservable.notifyObservers(newLight);\n });\n }\n /**\n * Sorts the list list based on light priorities\n */\n sortLightsByPriority() {\n if (this.requireLightSorting) {\n this.lights.sort(LightConstants.CompareLightsPriority);\n }\n }\n /**\n * Adds the given camera to this scene\n * @param newCamera The camera to add\n */\n addCamera(newCamera) {\n if (this._blockEntityCollection) {\n return;\n }\n this.cameras.push(newCamera);\n Tools.SetImmediate(() => {\n this.onNewCameraAddedObservable.notifyObservers(newCamera);\n });\n if (!newCamera.parent) {\n newCamera._addToSceneRootNodes();\n }\n }\n /**\n * Adds the given skeleton to this scene\n * @param newSkeleton The skeleton to add\n */\n addSkeleton(newSkeleton) {\n if (this._blockEntityCollection) {\n return;\n }\n this.skeletons.push(newSkeleton);\n Tools.SetImmediate(() => {\n this.onNewSkeletonAddedObservable.notifyObservers(newSkeleton);\n });\n }\n /**\n * Adds the given particle system to this scene\n * @param newParticleSystem The particle system to add\n */\n addParticleSystem(newParticleSystem) {\n if (this._blockEntityCollection) {\n return;\n }\n this.particleSystems.push(newParticleSystem);\n }\n /**\n * Adds the given animation to this scene\n * @param newAnimation The animation to add\n */\n addAnimation(newAnimation) {\n if (this._blockEntityCollection) {\n return;\n }\n this.animations.push(newAnimation);\n }\n /**\n * Adds the given animation group to this scene.\n * @param newAnimationGroup The animation group to add\n */\n addAnimationGroup(newAnimationGroup) {\n if (this._blockEntityCollection) {\n return;\n }\n this.animationGroups.push(newAnimationGroup);\n }\n /**\n * Adds the given multi-material to this scene\n * @param newMultiMaterial The multi-material to add\n */\n addMultiMaterial(newMultiMaterial) {\n if (this._blockEntityCollection) {\n return;\n }\n this.multiMaterials.push(newMultiMaterial);\n Tools.SetImmediate(() => {\n this.onNewMultiMaterialAddedObservable.notifyObservers(newMultiMaterial);\n });\n }\n /**\n * Adds the given material to this scene\n * @param newMaterial The material to add\n */\n addMaterial(newMaterial) {\n if (this._blockEntityCollection) {\n return;\n }\n if (newMaterial.getScene() === this && newMaterial._indexInSceneMaterialArray !== -1) {\n // Already there??\n return;\n }\n newMaterial._indexInSceneMaterialArray = this.materials.length;\n this.materials.push(newMaterial);\n Tools.SetImmediate(() => {\n this.onNewMaterialAddedObservable.notifyObservers(newMaterial);\n });\n }\n /**\n * Adds the given morph target to this scene\n * @param newMorphTargetManager The morph target to add\n */\n addMorphTargetManager(newMorphTargetManager) {\n if (this._blockEntityCollection) {\n return;\n }\n this.morphTargetManagers.push(newMorphTargetManager);\n }\n /**\n * Adds the given geometry to this scene\n * @param newGeometry The geometry to add\n */\n addGeometry(newGeometry) {\n if (this._blockEntityCollection) {\n return;\n }\n if (this._geometriesByUniqueId) {\n this._geometriesByUniqueId[newGeometry.uniqueId] = this.geometries.length;\n }\n this.geometries.push(newGeometry);\n }\n /**\n * Adds the given action manager to this scene\n * @deprecated\n * @param newActionManager The action manager to add\n */\n addActionManager(newActionManager) {\n this.actionManagers.push(newActionManager);\n }\n /**\n * Adds the given texture to this scene.\n * @param newTexture The texture to add\n */\n addTexture(newTexture) {\n if (this._blockEntityCollection) {\n return;\n }\n this.textures.push(newTexture);\n this.onNewTextureAddedObservable.notifyObservers(newTexture);\n }\n /**\n * Switch active camera\n * @param newCamera defines the new active camera\n * @param attachControl defines if attachControl must be called for the new active camera (default: true)\n */\n switchActiveCamera(newCamera, attachControl = true) {\n const canvas = this._engine.getInputElement();\n if (!canvas) {\n return;\n }\n if (this.activeCamera) {\n this.activeCamera.detachControl();\n }\n this.activeCamera = newCamera;\n if (attachControl) {\n newCamera.attachControl();\n }\n }\n /**\n * sets the active camera of the scene using its Id\n * @param id defines the camera's Id\n * @returns the new active camera or null if none found.\n */\n setActiveCameraById(id) {\n const camera = this.getCameraById(id);\n if (camera) {\n this.activeCamera = camera;\n return camera;\n }\n return null;\n }\n /**\n * sets the active camera of the scene using its name\n * @param name defines the camera's name\n * @returns the new active camera or null if none found.\n */\n setActiveCameraByName(name) {\n const camera = this.getCameraByName(name);\n if (camera) {\n this.activeCamera = camera;\n return camera;\n }\n return null;\n }\n /**\n * get an animation group using its name\n * @param name defines the material's name\n * @returns the animation group or null if none found.\n */\n getAnimationGroupByName(name) {\n for (let index = 0; index < this.animationGroups.length; index++) {\n if (this.animationGroups[index].name === name) {\n return this.animationGroups[index];\n }\n }\n return null;\n }\n _getMaterial(allowMultiMaterials, predicate) {\n for (let index = 0; index < this.materials.length; index++) {\n const material = this.materials[index];\n if (predicate(material)) {\n return material;\n }\n }\n if (allowMultiMaterials) {\n for (let index = 0; index < this.multiMaterials.length; index++) {\n const material = this.multiMaterials[index];\n if (predicate(material)) {\n return material;\n }\n }\n }\n return null;\n }\n /**\n * Get a material using its unique id\n * @param uniqueId defines the material's unique id\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the material or null if none found.\n */\n getMaterialByUniqueID(uniqueId, allowMultiMaterials = false) {\n return this._getMaterial(allowMultiMaterials, (m) => m.uniqueId === uniqueId);\n }\n /**\n * get a material using its id\n * @param id defines the material's Id\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the material or null if none found.\n */\n getMaterialById(id, allowMultiMaterials = false) {\n return this._getMaterial(allowMultiMaterials, (m) => m.id === id);\n }\n /**\n * Gets a material using its name\n * @param name defines the material's name\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the material or null if none found.\n */\n getMaterialByName(name, allowMultiMaterials = false) {\n return this._getMaterial(allowMultiMaterials, (m) => m.name === name);\n }\n /**\n * Gets a last added material using a given id\n * @param id defines the material's id\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the last material with the given id or null if none found.\n */\n getLastMaterialById(id, allowMultiMaterials = false) {\n for (let index = this.materials.length - 1; index >= 0; index--) {\n if (this.materials[index].id === id) {\n return this.materials[index];\n }\n }\n if (allowMultiMaterials) {\n for (let index = this.multiMaterials.length - 1; index >= 0; index--) {\n if (this.multiMaterials[index].id === id) {\n return this.multiMaterials[index];\n }\n }\n }\n return null;\n }\n /**\n * Get a texture using its unique id\n * @param uniqueId defines the texture's unique id\n * @returns the texture or null if none found.\n */\n getTextureByUniqueId(uniqueId) {\n for (let index = 0; index < this.textures.length; index++) {\n if (this.textures[index].uniqueId === uniqueId) {\n return this.textures[index];\n }\n }\n return null;\n }\n /**\n * Gets a texture using its name\n * @param name defines the texture's name\n * @returns the texture or null if none found.\n */\n getTextureByName(name) {\n for (let index = 0; index < this.textures.length; index++) {\n if (this.textures[index].name === name) {\n return this.textures[index];\n }\n }\n return null;\n }\n /**\n * Gets a camera using its Id\n * @param id defines the Id to look for\n * @returns the camera or null if not found\n */\n getCameraById(id) {\n for (let index = 0; index < this.cameras.length; index++) {\n if (this.cameras[index].id === id) {\n return this.cameras[index];\n }\n }\n return null;\n }\n /**\n * Gets a camera using its unique Id\n * @param uniqueId defines the unique Id to look for\n * @returns the camera or null if not found\n */\n getCameraByUniqueId(uniqueId) {\n for (let index = 0; index < this.cameras.length; index++) {\n if (this.cameras[index].uniqueId === uniqueId) {\n return this.cameras[index];\n }\n }\n return null;\n }\n /**\n * Gets a camera using its name\n * @param name defines the camera's name\n * @returns the camera or null if none found.\n */\n getCameraByName(name) {\n for (let index = 0; index < this.cameras.length; index++) {\n if (this.cameras[index].name === name) {\n return this.cameras[index];\n }\n }\n return null;\n }\n /**\n * Gets a bone using its Id\n * @param id defines the bone's Id\n * @returns the bone or null if not found\n */\n getBoneById(id) {\n for (let skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\n const skeleton = this.skeletons[skeletonIndex];\n for (let boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\n if (skeleton.bones[boneIndex].id === id) {\n return skeleton.bones[boneIndex];\n }\n }\n }\n return null;\n }\n /**\n * Gets a bone using its id\n * @param name defines the bone's name\n * @returns the bone or null if not found\n */\n getBoneByName(name) {\n for (let skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\n const skeleton = this.skeletons[skeletonIndex];\n for (let boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\n if (skeleton.bones[boneIndex].name === name) {\n return skeleton.bones[boneIndex];\n }\n }\n }\n return null;\n }\n /**\n * Gets a light node using its name\n * @param name defines the light's name\n * @returns the light or null if none found.\n */\n getLightByName(name) {\n for (let index = 0; index < this.lights.length; index++) {\n if (this.lights[index].name === name) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a light node using its Id\n * @param id defines the light's Id\n * @returns the light or null if none found.\n */\n getLightById(id) {\n for (let index = 0; index < this.lights.length; index++) {\n if (this.lights[index].id === id) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a light node using its scene-generated unique Id\n * @param uniqueId defines the light's unique Id\n * @returns the light or null if none found.\n */\n getLightByUniqueId(uniqueId) {\n for (let index = 0; index < this.lights.length; index++) {\n if (this.lights[index].uniqueId === uniqueId) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a particle system by Id\n * @param id defines the particle system Id\n * @returns the corresponding system or null if none found\n */\n getParticleSystemById(id) {\n for (let index = 0; index < this.particleSystems.length; index++) {\n if (this.particleSystems[index].id === id) {\n return this.particleSystems[index];\n }\n }\n return null;\n }\n /**\n * Gets a geometry using its Id\n * @param id defines the geometry's Id\n * @returns the geometry or null if none found.\n */\n getGeometryById(id) {\n for (let index = 0; index < this.geometries.length; index++) {\n if (this.geometries[index].id === id) {\n return this.geometries[index];\n }\n }\n return null;\n }\n _getGeometryByUniqueId(uniqueId) {\n if (this._geometriesByUniqueId) {\n const index = this._geometriesByUniqueId[uniqueId];\n if (index !== undefined) {\n return this.geometries[index];\n }\n }\n else {\n for (let index = 0; index < this.geometries.length; index++) {\n if (this.geometries[index].uniqueId === uniqueId) {\n return this.geometries[index];\n }\n }\n }\n return null;\n }\n /**\n * Add a new geometry to this scene\n * @param geometry defines the geometry to be added to the scene.\n * @param force defines if the geometry must be pushed even if a geometry with this id already exists\n * @returns a boolean defining if the geometry was added or not\n */\n pushGeometry(geometry, force) {\n if (!force && this._getGeometryByUniqueId(geometry.uniqueId)) {\n return false;\n }\n this.addGeometry(geometry);\n Tools.SetImmediate(() => {\n this.onNewGeometryAddedObservable.notifyObservers(geometry);\n });\n return true;\n }\n /**\n * Removes an existing geometry\n * @param geometry defines the geometry to be removed from the scene\n * @returns a boolean defining if the geometry was removed or not\n */\n removeGeometry(geometry) {\n let index;\n if (this._geometriesByUniqueId) {\n index = this._geometriesByUniqueId[geometry.uniqueId];\n if (index === undefined) {\n return false;\n }\n }\n else {\n index = this.geometries.indexOf(geometry);\n if (index < 0) {\n return false;\n }\n }\n if (index !== this.geometries.length - 1) {\n const lastGeometry = this.geometries[this.geometries.length - 1];\n if (lastGeometry) {\n this.geometries[index] = lastGeometry;\n if (this._geometriesByUniqueId) {\n this._geometriesByUniqueId[lastGeometry.uniqueId] = index;\n }\n }\n }\n if (this._geometriesByUniqueId) {\n this._geometriesByUniqueId[geometry.uniqueId] = undefined;\n }\n this.geometries.pop();\n this.onGeometryRemovedObservable.notifyObservers(geometry);\n return true;\n }\n /**\n * Gets the list of geometries attached to the scene\n * @returns an array of Geometry\n */\n getGeometries() {\n return this.geometries;\n }\n /**\n * Gets the first added mesh found of a given Id\n * @param id defines the Id to search for\n * @returns the mesh found or null if not found at all\n */\n getMeshById(id) {\n for (let index = 0; index < this.meshes.length; index++) {\n if (this.meshes[index].id === id) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a list of meshes using their Id\n * @param id defines the Id to search for\n * @returns a list of meshes\n */\n getMeshesById(id) {\n return this.meshes.filter(function (m) {\n return m.id === id;\n });\n }\n /**\n * Gets the first added transform node found of a given Id\n * @param id defines the Id to search for\n * @returns the found transform node or null if not found at all.\n */\n getTransformNodeById(id) {\n for (let index = 0; index < this.transformNodes.length; index++) {\n if (this.transformNodes[index].id === id) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a transform node with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found transform node or null if not found at all.\n */\n getTransformNodeByUniqueId(uniqueId) {\n for (let index = 0; index < this.transformNodes.length; index++) {\n if (this.transformNodes[index].uniqueId === uniqueId) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a list of transform nodes using their Id\n * @param id defines the Id to search for\n * @returns a list of transform nodes\n */\n getTransformNodesById(id) {\n return this.transformNodes.filter(function (m) {\n return m.id === id;\n });\n }\n /**\n * Gets a mesh with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found mesh or null if not found at all.\n */\n getMeshByUniqueId(uniqueId) {\n for (let index = 0; index < this.meshes.length; index++) {\n if (this.meshes[index].uniqueId === uniqueId) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a the last added mesh using a given Id\n * @param id defines the Id to search for\n * @returns the found mesh or null if not found at all.\n */\n getLastMeshById(id) {\n for (let index = this.meshes.length - 1; index >= 0; index--) {\n if (this.meshes[index].id === id) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a the last transform node using a given Id\n * @param id defines the Id to search for\n * @returns the found mesh or null if not found at all.\n */\n getLastTransformNodeById(id) {\n for (let index = this.transformNodes.length - 1; index >= 0; index--) {\n if (this.transformNodes[index].id === id) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a the last added node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n */\n getLastEntryById(id) {\n let index;\n for (index = this.meshes.length - 1; index >= 0; index--) {\n if (this.meshes[index].id === id) {\n return this.meshes[index];\n }\n }\n for (index = this.transformNodes.length - 1; index >= 0; index--) {\n if (this.transformNodes[index].id === id) {\n return this.transformNodes[index];\n }\n }\n for (index = this.cameras.length - 1; index >= 0; index--) {\n if (this.cameras[index].id === id) {\n return this.cameras[index];\n }\n }\n for (index = this.lights.length - 1; index >= 0; index--) {\n if (this.lights[index].id === id) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n */\n getNodeById(id) {\n const mesh = this.getMeshById(id);\n if (mesh) {\n return mesh;\n }\n const transformNode = this.getTransformNodeById(id);\n if (transformNode) {\n return transformNode;\n }\n const light = this.getLightById(id);\n if (light) {\n return light;\n }\n const camera = this.getCameraById(id);\n if (camera) {\n return camera;\n }\n const bone = this.getBoneById(id);\n if (bone) {\n return bone;\n }\n return null;\n }\n /**\n * Gets a node (Mesh, Camera, Light) using a given name\n * @param name defines the name to search for\n * @returns the found node or null if not found at all.\n */\n getNodeByName(name) {\n const mesh = this.getMeshByName(name);\n if (mesh) {\n return mesh;\n }\n const transformNode = this.getTransformNodeByName(name);\n if (transformNode) {\n return transformNode;\n }\n const light = this.getLightByName(name);\n if (light) {\n return light;\n }\n const camera = this.getCameraByName(name);\n if (camera) {\n return camera;\n }\n const bone = this.getBoneByName(name);\n if (bone) {\n return bone;\n }\n return null;\n }\n /**\n * Gets a mesh using a given name\n * @param name defines the name to search for\n * @returns the found mesh or null if not found at all.\n */\n getMeshByName(name) {\n for (let index = 0; index < this.meshes.length; index++) {\n if (this.meshes[index].name === name) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a transform node using a given name\n * @param name defines the name to search for\n * @returns the found transform node or null if not found at all.\n */\n getTransformNodeByName(name) {\n for (let index = 0; index < this.transformNodes.length; index++) {\n if (this.transformNodes[index].name === name) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given Id (if many are found, this function will pick the last one)\n * @param id defines the Id to search for\n * @returns the found skeleton or null if not found at all.\n */\n getLastSkeletonById(id) {\n for (let index = this.skeletons.length - 1; index >= 0; index--) {\n if (this.skeletons[index].id === id) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given auto generated unique id\n * @param uniqueId defines the unique id to search for\n * @returns the found skeleton or null if not found at all.\n */\n getSkeletonByUniqueId(uniqueId) {\n for (let index = 0; index < this.skeletons.length; index++) {\n if (this.skeletons[index].uniqueId === uniqueId) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given id (if many are found, this function will pick the first one)\n * @param id defines the id to search for\n * @returns the found skeleton or null if not found at all.\n */\n getSkeletonById(id) {\n for (let index = 0; index < this.skeletons.length; index++) {\n if (this.skeletons[index].id === id) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given name\n * @param name defines the name to search for\n * @returns the found skeleton or null if not found at all.\n */\n getSkeletonByName(name) {\n for (let index = 0; index < this.skeletons.length; index++) {\n if (this.skeletons[index].name === name) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a morph target manager using a given id (if many are found, this function will pick the last one)\n * @param id defines the id to search for\n * @returns the found morph target manager or null if not found at all.\n */\n getMorphTargetManagerById(id) {\n for (let index = 0; index < this.morphTargetManagers.length; index++) {\n if (this.morphTargetManagers[index].uniqueId === id) {\n return this.morphTargetManagers[index];\n }\n }\n return null;\n }\n /**\n * Gets a morph target using a given id (if many are found, this function will pick the first one)\n * @param id defines the id to search for\n * @returns the found morph target or null if not found at all.\n */\n getMorphTargetById(id) {\n for (let managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\n const morphTargetManager = this.morphTargetManagers[managerIndex];\n for (let index = 0; index < morphTargetManager.numTargets; ++index) {\n const target = morphTargetManager.getTarget(index);\n if (target.id === id) {\n return target;\n }\n }\n }\n return null;\n }\n /**\n * Gets a morph target using a given name (if many are found, this function will pick the first one)\n * @param name defines the name to search for\n * @returns the found morph target or null if not found at all.\n */\n getMorphTargetByName(name) {\n for (let managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\n const morphTargetManager = this.morphTargetManagers[managerIndex];\n for (let index = 0; index < morphTargetManager.numTargets; ++index) {\n const target = morphTargetManager.getTarget(index);\n if (target.name === name) {\n return target;\n }\n }\n }\n return null;\n }\n /**\n * Gets a post process using a given name (if many are found, this function will pick the first one)\n * @param name defines the name to search for\n * @returns the found post process or null if not found at all.\n */\n getPostProcessByName(name) {\n for (let postProcessIndex = 0; postProcessIndex < this.postProcesses.length; ++postProcessIndex) {\n const postProcess = this.postProcesses[postProcessIndex];\n if (postProcess.name === name) {\n return postProcess;\n }\n }\n return null;\n }\n /**\n * Gets a boolean indicating if the given mesh is active\n * @param mesh defines the mesh to look for\n * @returns true if the mesh is in the active list\n */\n isActiveMesh(mesh) {\n return this._activeMeshes.indexOf(mesh) !== -1;\n }\n /**\n * Return a unique id as a string which can serve as an identifier for the scene\n */\n get uid() {\n if (!this._uid) {\n this._uid = Tools.RandomId();\n }\n return this._uid;\n }\n /**\n * Add an externally attached data from its key.\n * This method call will fail and return false, if such key already exists.\n * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.\n * @param key the unique key that identifies the data\n * @param data the data object to associate to the key for this Engine instance\n * @returns true if no such key were already present and the data was added successfully, false otherwise\n */\n addExternalData(key, data) {\n if (!this._externalData) {\n this._externalData = new StringDictionary();\n }\n return this._externalData.add(key, data);\n }\n /**\n * Get an externally attached data from its key\n * @param key the unique key that identifies the data\n * @returns the associated data, if present (can be null), or undefined if not present\n */\n getExternalData(key) {\n if (!this._externalData) {\n return null;\n }\n return this._externalData.get(key);\n }\n /**\n * Get an externally attached data from its key, create it using a factory if it's not already present\n * @param key the unique key that identifies the data\n * @param factory the factory that will be called to create the instance if and only if it doesn't exists\n * @returns the associated data, can be null if the factory returned null.\n */\n getOrAddExternalDataWithFactory(key, factory) {\n if (!this._externalData) {\n this._externalData = new StringDictionary();\n }\n return this._externalData.getOrAddWithFactory(key, factory);\n }\n /**\n * Remove an externally attached data from the Engine instance\n * @param key the unique key that identifies the data\n * @returns true if the data was successfully removed, false if it doesn't exist\n */\n removeExternalData(key) {\n return this._externalData.remove(key);\n }\n _evaluateSubMesh(subMesh, mesh, initialMesh, forcePush) {\n if (forcePush || subMesh.isInFrustum(this._frustumPlanes)) {\n for (const step of this._evaluateSubMeshStage) {\n step.action(mesh, subMesh);\n }\n const material = subMesh.getMaterial();\n if (material !== null && material !== undefined) {\n // Render targets\n if (material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\n if (this._processedMaterials.indexOf(material) === -1) {\n this._processedMaterials.push(material);\n this._materialsRenderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\n }\n }\n // Dispatch\n this._renderingManager.dispatch(subMesh, mesh, material);\n }\n }\n }\n /**\n * Clear the processed materials smart array preventing retention point in material dispose.\n */\n freeProcessedMaterials() {\n this._processedMaterials.dispose();\n }\n /** Gets or sets a boolean blocking all the calls to freeActiveMeshes and freeRenderingGroups\n * It can be used in order to prevent going through methods freeRenderingGroups and freeActiveMeshes several times to improve performance\n * when disposing several meshes in a row or a hierarchy of meshes.\n * When used, it is the responsibility of the user to blockfreeActiveMeshesAndRenderingGroups back to false.\n */\n get blockfreeActiveMeshesAndRenderingGroups() {\n return this._preventFreeActiveMeshesAndRenderingGroups;\n }\n set blockfreeActiveMeshesAndRenderingGroups(value) {\n if (this._preventFreeActiveMeshesAndRenderingGroups === value) {\n return;\n }\n if (value) {\n this.freeActiveMeshes();\n this.freeRenderingGroups();\n }\n this._preventFreeActiveMeshesAndRenderingGroups = value;\n }\n /**\n * Clear the active meshes smart array preventing retention point in mesh dispose.\n */\n freeActiveMeshes() {\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\n return;\n }\n this._activeMeshes.dispose();\n if (this.activeCamera && this.activeCamera._activeMeshes) {\n this.activeCamera._activeMeshes.dispose();\n }\n if (this.activeCameras) {\n for (let i = 0; i < this.activeCameras.length; i++) {\n const activeCamera = this.activeCameras[i];\n if (activeCamera && activeCamera._activeMeshes) {\n activeCamera._activeMeshes.dispose();\n }\n }\n }\n }\n /**\n * Clear the info related to rendering groups preventing retention points during dispose.\n */\n freeRenderingGroups() {\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\n return;\n }\n if (this._renderingManager) {\n this._renderingManager.freeRenderingGroups();\n }\n if (this.textures) {\n for (let i = 0; i < this.textures.length; i++) {\n const texture = this.textures[i];\n if (texture && texture.renderList) {\n texture.freeRenderingGroups();\n }\n }\n }\n }\n /** @internal */\n _isInIntermediateRendering() {\n return this._intermediateRendering;\n }\n /**\n * Use this function to stop evaluating active meshes. The current list will be keep alive between frames\n * @param skipEvaluateActiveMeshes defines an optional boolean indicating that the evaluate active meshes step must be completely skipped\n * @param onSuccess optional success callback\n * @param onError optional error callback\n * @param freezeMeshes defines if meshes should be frozen (true by default)\n * @param keepFrustumCulling defines if you want to keep running the frustum clipping (false by default)\n * @returns the current scene\n */\n freezeActiveMeshes(skipEvaluateActiveMeshes = false, onSuccess, onError, freezeMeshes = true, keepFrustumCulling = false) {\n this.executeWhenReady(() => {\n if (!this.activeCamera) {\n onError && onError(\"No active camera found\");\n return;\n }\n if (!this._frustumPlanes) {\n this.updateTransformMatrix();\n }\n this._evaluateActiveMeshes();\n this._activeMeshesFrozen = true;\n this._activeMeshesFrozenButKeepClipping = keepFrustumCulling;\n this._skipEvaluateActiveMeshesCompletely = skipEvaluateActiveMeshes;\n if (freezeMeshes) {\n for (let index = 0; index < this._activeMeshes.length; index++) {\n this._activeMeshes.data[index]._freeze();\n }\n }\n onSuccess && onSuccess();\n });\n return this;\n }\n /**\n * Use this function to restart evaluating active meshes on every frame\n * @returns the current scene\n */\n unfreezeActiveMeshes() {\n for (let index = 0; index < this.meshes.length; index++) {\n const mesh = this.meshes[index];\n if (mesh._internalAbstractMeshDataInfo) {\n mesh._internalAbstractMeshDataInfo._isActive = false;\n }\n }\n for (let index = 0; index < this._activeMeshes.length; index++) {\n this._activeMeshes.data[index]._unFreeze();\n }\n this._activeMeshesFrozen = false;\n return this;\n }\n _executeActiveContainerCleanup(container) {\n const isInFastMode = this._engine.snapshotRendering && this._engine.snapshotRenderingMode === 1;\n if (!isInFastMode && this._activeMeshesFrozen && this._activeMeshes.length) {\n return; // Do not execute in frozen mode\n }\n // We need to ensure we are not in the rendering loop\n this.onBeforeRenderObservable.addOnce(() => container.dispose());\n }\n _evaluateActiveMeshes() {\n if (this._engine.snapshotRendering && this._engine.snapshotRenderingMode === 1) {\n if (this._activeMeshes.length > 0) {\n this.activeCamera?._activeMeshes.reset();\n this._activeMeshes.reset();\n this._renderingManager.reset();\n this._processedMaterials.reset();\n this._activeParticleSystems.reset();\n this._activeSkeletons.reset();\n this._softwareSkinnedMeshes.reset();\n }\n return;\n }\n if (this._activeMeshesFrozen && this._activeMeshes.length) {\n if (!this._skipEvaluateActiveMeshesCompletely) {\n const len = this._activeMeshes.length;\n for (let i = 0; i < len; i++) {\n const mesh = this._activeMeshes.data[i];\n mesh.computeWorldMatrix();\n }\n }\n if (this._activeParticleSystems) {\n const psLength = this._activeParticleSystems.length;\n for (let i = 0; i < psLength; i++) {\n this._activeParticleSystems.data[i].animate();\n }\n }\n this._renderingManager.resetSprites();\n return;\n }\n if (!this.activeCamera) {\n return;\n }\n this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this);\n this.activeCamera._activeMeshes.reset();\n this._activeMeshes.reset();\n this._renderingManager.reset();\n this._processedMaterials.reset();\n this._activeParticleSystems.reset();\n this._activeSkeletons.reset();\n this._softwareSkinnedMeshes.reset();\n this._materialsRenderTargets.reset();\n for (const step of this._beforeEvaluateActiveMeshStage) {\n step.action();\n }\n // Determine mesh candidates\n const meshes = this.getActiveMeshCandidates();\n // Check each mesh\n const len = meshes.length;\n for (let i = 0; i < len; i++) {\n const mesh = meshes.data[i];\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = false;\n if (mesh.isBlocked) {\n continue;\n }\n this._totalVertices.addCount(mesh.getTotalVertices(), false);\n if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.hasAZeroComponent) {\n continue;\n }\n mesh.computeWorldMatrix();\n // Intersections\n if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(12, 13)) {\n this._meshesForIntersections.pushNoDuplicate(mesh);\n }\n // Switch to current LOD\n let meshToRender = this.customLODSelector ? this.customLODSelector(mesh, this.activeCamera) : mesh.getLOD(this.activeCamera);\n mesh._internalAbstractMeshDataInfo._currentLOD = meshToRender;\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = true;\n if (meshToRender === undefined || meshToRender === null) {\n continue;\n }\n // Compute world matrix if LOD is billboard\n if (meshToRender !== mesh && meshToRender.billboardMode !== 0) {\n meshToRender.computeWorldMatrix();\n }\n mesh._preActivate();\n if (mesh.isVisible &&\n mesh.visibility > 0 &&\n (mesh.layerMask & this.activeCamera.layerMask) !== 0 &&\n (this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(this._frustumPlanes))) {\n this._activeMeshes.push(mesh);\n this.activeCamera._activeMeshes.push(mesh);\n if (meshToRender !== mesh) {\n meshToRender._activate(this._renderId, false);\n }\n for (const step of this._preActiveMeshStage) {\n step.action(mesh);\n }\n if (mesh._activate(this._renderId, false)) {\n if (!mesh.isAnInstance) {\n meshToRender._internalAbstractMeshDataInfo._onlyForInstances = false;\n }\n else {\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\n meshToRender = mesh;\n }\n }\n meshToRender._internalAbstractMeshDataInfo._isActive = true;\n this._activeMesh(mesh, meshToRender);\n }\n mesh._postActivate();\n }\n }\n this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this);\n // Particle systems\n if (this.particlesEnabled) {\n this.onBeforeParticlesRenderingObservable.notifyObservers(this);\n for (let particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {\n const particleSystem = this.particleSystems[particleIndex];\n if (!particleSystem.isStarted() || !particleSystem.emitter) {\n continue;\n }\n const emitter = particleSystem.emitter;\n if (!emitter.position || emitter.isEnabled()) {\n this._activeParticleSystems.push(particleSystem);\n particleSystem.animate();\n this._renderingManager.dispatchParticles(particleSystem);\n }\n }\n this.onAfterParticlesRenderingObservable.notifyObservers(this);\n }\n }\n /** @internal */\n _prepareSkeleton(mesh) {\n if (!this._skeletonsEnabled || !mesh.skeleton) {\n return;\n }\n if (this._activeSkeletons.pushNoDuplicate(mesh.skeleton)) {\n mesh.skeleton.prepare();\n this._activeBones.addCount(mesh.skeleton.bones.length, false);\n }\n if (!mesh.computeBonesUsingShaders) {\n if (this._softwareSkinnedMeshes.pushNoDuplicate(mesh) && this.frameGraph) {\n mesh.applySkeleton(mesh.skeleton);\n }\n }\n }\n _activeMesh(sourceMesh, mesh) {\n this._prepareSkeleton(mesh);\n let forcePush = sourceMesh.hasInstances || sourceMesh.isAnInstance || this.dispatchAllSubMeshesOfActiveMeshes || this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh;\n if (mesh && mesh.subMeshes && mesh.subMeshes.length > 0) {\n const subMeshes = this.getActiveSubMeshCandidates(mesh);\n const len = subMeshes.length;\n forcePush = forcePush || len === 1;\n for (let i = 0; i < len; i++) {\n const subMesh = subMeshes.data[i];\n this._evaluateSubMesh(subMesh, mesh, sourceMesh, forcePush);\n }\n }\n }\n /**\n * Update the transform matrix to update from the current active camera\n * @param force defines a boolean used to force the update even if cache is up to date\n */\n updateTransformMatrix(force) {\n const activeCamera = this.activeCamera;\n if (!activeCamera) {\n return;\n }\n if (activeCamera._renderingMultiview) {\n const leftCamera = activeCamera._rigCameras[0];\n const rightCamera = activeCamera._rigCameras[1];\n this.setTransformMatrix(leftCamera.getViewMatrix(), leftCamera.getProjectionMatrix(force), rightCamera.getViewMatrix(), rightCamera.getProjectionMatrix(force));\n }\n else {\n this.setTransformMatrix(activeCamera.getViewMatrix(), activeCamera.getProjectionMatrix(force));\n }\n }\n _bindFrameBuffer(camera, clear = true) {\n if (camera && camera._multiviewTexture) {\n camera._multiviewTexture._bindFrameBuffer();\n }\n else if (camera && camera.outputRenderTarget) {\n camera.outputRenderTarget._bindFrameBuffer();\n }\n else {\n if (!this._engine._currentFrameBufferIsDefaultFrameBuffer()) {\n this._engine.restoreDefaultFramebuffer();\n }\n }\n if (clear) {\n this._clearFrameBuffer(camera);\n }\n }\n _clearFrameBuffer(camera) {\n // we assume the framebuffer currently bound is the right one\n if (camera && camera._multiviewTexture) {\n // no clearing\n }\n else if (camera && camera.outputRenderTarget && !camera._renderingMultiview) {\n const rtt = camera.outputRenderTarget;\n if (rtt.onClearObservable.hasObservers()) {\n rtt.onClearObservable.notifyObservers(this._engine);\n }\n else if (!rtt.skipInitialClear && !camera.isRightCamera) {\n if (this.autoClear) {\n this._engine.clear(rtt.clearColor || this._clearColor, !rtt._cleared, true, true);\n }\n rtt._cleared = true;\n }\n }\n else {\n if (!this._defaultFrameBufferCleared) {\n this._defaultFrameBufferCleared = true;\n this._clear();\n }\n else {\n this._engine.clear(null, false, true, true);\n }\n }\n }\n /**\n * @internal\n */\n _renderForCamera(camera, rigParent, bindFrameBuffer = true) {\n if (camera && camera._skipRendering) {\n return;\n }\n const engine = this._engine;\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\n this._activeCamera = camera;\n if (!this.activeCamera) {\n throw new Error(\"Active camera not set\");\n }\n // Viewport\n engine.setViewport(this.activeCamera.viewport);\n // Camera\n this.resetCachedMaterial();\n this._renderId++;\n if (!this.prePass && bindFrameBuffer) {\n let skipInitialClear = true;\n if (camera._renderingMultiview && camera.outputRenderTarget) {\n skipInitialClear = camera.outputRenderTarget.skipInitialClear;\n if (this.autoClear) {\n this._defaultFrameBufferCleared = false;\n camera.outputRenderTarget.skipInitialClear = false;\n }\n }\n this._bindFrameBuffer(this._activeCamera);\n if (camera._renderingMultiview && camera.outputRenderTarget) {\n camera.outputRenderTarget.skipInitialClear = skipInitialClear;\n }\n }\n this.updateTransformMatrix();\n this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera);\n // Meshes\n this._evaluateActiveMeshes();\n // Software skinning\n for (let softwareSkinnedMeshIndex = 0; softwareSkinnedMeshIndex < this._softwareSkinnedMeshes.length; softwareSkinnedMeshIndex++) {\n const mesh = this._softwareSkinnedMeshes.data[softwareSkinnedMeshIndex];\n mesh.applySkeleton(mesh.skeleton);\n }\n // Render targets\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\n this._renderTargets.concatWithNoDuplicate(this._materialsRenderTargets);\n if (camera.customRenderTargets && camera.customRenderTargets.length > 0) {\n this._renderTargets.concatWithNoDuplicate(camera.customRenderTargets);\n }\n if (rigParent && rigParent.customRenderTargets && rigParent.customRenderTargets.length > 0) {\n this._renderTargets.concatWithNoDuplicate(rigParent.customRenderTargets);\n }\n if (this.environmentTexture && this.environmentTexture.isRenderTarget) {\n this._renderTargets.pushNoDuplicate(this.environmentTexture);\n }\n // Collects render targets from external components.\n for (const step of this._gatherActiveCameraRenderTargetsStage) {\n step.action(this._renderTargets);\n }\n let needRebind = false;\n if (this.renderTargetsEnabled) {\n this._intermediateRendering = true;\n if (this._renderTargets.length > 0) {\n Tools.StartPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\n for (let renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {\n const renderTarget = this._renderTargets.data[renderIndex];\n if (renderTarget._shouldRender()) {\n this._renderId++;\n const hasSpecialRenderTargetCamera = renderTarget.activeCamera && renderTarget.activeCamera !== this.activeCamera;\n renderTarget.render(hasSpecialRenderTargetCamera, this.dumpNextRenderTargets);\n needRebind = true;\n }\n }\n Tools.EndPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\n this._renderId++;\n }\n for (const step of this._cameraDrawRenderTargetStage) {\n needRebind = step.action(this.activeCamera) || needRebind;\n }\n this._intermediateRendering = false;\n }\n this._engine.currentRenderPassId = camera.outputRenderTarget?.renderPassId ?? camera.renderPassId ?? 0;\n // Restore framebuffer after rendering to targets\n if (needRebind && !this.prePass) {\n this._bindFrameBuffer(this._activeCamera, false);\n this.updateTransformMatrix();\n }\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\n // Prepare Frame\n if (this.postProcessManager && !camera._multiviewTexture && !this.prePass) {\n this.postProcessManager._prepareFrame();\n }\n // Before Camera Draw\n for (const step of this._beforeCameraDrawStage) {\n step.action(this.activeCamera);\n }\n // Render\n this.onBeforeDrawPhaseObservable.notifyObservers(this);\n if (engine.snapshotRendering && engine.snapshotRenderingMode === 1) {\n this.finalizeSceneUbo();\n }\n this._renderingManager.render(null, null, true, true);\n this.onAfterDrawPhaseObservable.notifyObservers(this);\n // After Camera Draw\n for (const step of this._afterCameraDrawStage) {\n step.action(this.activeCamera);\n }\n // Finalize frame\n if (this.postProcessManager && !camera._multiviewTexture) {\n // if the camera has an output render target, render the post process to the render target\n const texture = camera.outputRenderTarget ? camera.outputRenderTarget.renderTarget : undefined;\n this.postProcessManager._finalizeFrame(camera.isIntermediate, texture);\n }\n // After post process\n for (const step of this._afterCameraPostProcessStage) {\n step.action(this.activeCamera);\n }\n // Reset some special arrays\n this._renderTargets.reset();\n this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera);\n }\n _processSubCameras(camera, bindFrameBuffer = true) {\n if (camera.cameraRigMode === 0 || camera._renderingMultiview) {\n if (camera._renderingMultiview && !this._multiviewSceneUbo) {\n this._createMultiviewUbo();\n }\n this._renderForCamera(camera, undefined, bindFrameBuffer);\n this.onAfterRenderCameraObservable.notifyObservers(camera);\n return;\n }\n if (camera._useMultiviewToSingleView) {\n this._renderMultiviewToSingleView(camera);\n }\n else {\n // rig cameras\n this.onBeforeCameraRenderObservable.notifyObservers(camera);\n for (let index = 0; index < camera._rigCameras.length; index++) {\n this._renderForCamera(camera._rigCameras[index], camera);\n }\n }\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\n this._activeCamera = camera;\n this.updateTransformMatrix();\n this.onAfterRenderCameraObservable.notifyObservers(camera);\n }\n _checkIntersections() {\n for (let index = 0; index < this._meshesForIntersections.length; index++) {\n const sourceMesh = this._meshesForIntersections.data[index];\n if (!sourceMesh.actionManager) {\n continue;\n }\n for (let actionIndex = 0; sourceMesh.actionManager && actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {\n const action = sourceMesh.actionManager.actions[actionIndex];\n if (action.trigger === 12 || action.trigger === 13) {\n const parameters = action.getTriggerParameter();\n const otherMesh = parameters.mesh ? parameters.mesh : parameters;\n const areIntersecting = otherMesh.intersectsMesh(sourceMesh, parameters.usePreciseIntersection);\n const currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);\n if (areIntersecting && currentIntersectionInProgress === -1) {\n if (action.trigger === 12) {\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\n sourceMesh._intersectionsInProgress.push(otherMesh);\n }\n else if (action.trigger === 13) {\n sourceMesh._intersectionsInProgress.push(otherMesh);\n }\n }\n else if (!areIntersecting && currentIntersectionInProgress > -1) {\n //They intersected, and now they don't.\n //is this trigger an exit trigger? execute an event.\n if (action.trigger === 13) {\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\n }\n //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.\n if (!sourceMesh.actionManager.hasSpecificTrigger(13, (parameter) => {\n const parameterMesh = parameter.mesh ? parameter.mesh : parameter;\n return otherMesh === parameterMesh;\n }) ||\n action.trigger === 13) {\n sourceMesh._intersectionsInProgress.splice(currentIntersectionInProgress, 1);\n }\n }\n }\n }\n }\n }\n /**\n * @internal\n */\n _advancePhysicsEngineStep(step) {\n // Do nothing. Code will be replaced if physics engine component is referenced\n }\n /** @internal */\n _animate(customDeltaTime) {\n // Nothing to do as long as Animatable have not been imported.\n }\n /** Execute all animations (for a frame) */\n animate() {\n if (this._engine.isDeterministicLockStep()) {\n let deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime)) + this._timeAccumulator;\n const defaultFrameTime = this._engine.getTimeStep();\n const defaultFPS = 1000.0 / defaultFrameTime / 1000.0;\n let stepsTaken = 0;\n const maxSubSteps = this._engine.getLockstepMaxSteps();\n let internalSteps = Math.floor(deltaTime / defaultFrameTime);\n internalSteps = Math.min(internalSteps, maxSubSteps);\n while (deltaTime > 0 && stepsTaken < internalSteps) {\n this.onBeforeStepObservable.notifyObservers(this);\n // Animations\n this._animationRatio = defaultFrameTime * defaultFPS;\n this._animate(defaultFrameTime);\n this.onAfterAnimationsObservable.notifyObservers(this);\n // Physics\n if (this.physicsEnabled) {\n this._advancePhysicsEngineStep(defaultFrameTime);\n }\n this.onAfterStepObservable.notifyObservers(this);\n this._currentStepId++;\n stepsTaken++;\n deltaTime -= defaultFrameTime;\n }\n this._timeAccumulator = deltaTime < 0 ? 0 : deltaTime;\n }\n else {\n // Animations\n const deltaTime = this.useConstantAnimationDeltaTime ? 16 : Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));\n this._animationRatio = deltaTime * (60.0 / 1000.0);\n this._animate();\n this.onAfterAnimationsObservable.notifyObservers(this);\n // Physics\n if (this.physicsEnabled) {\n this._advancePhysicsEngineStep(deltaTime);\n }\n }\n }\n _clear() {\n if (this.autoClearDepthAndStencil || this.autoClear) {\n this._engine.clear(this._clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);\n }\n }\n _checkCameraRenderTarget(camera) {\n if (camera?.outputRenderTarget && !camera?.isRigCamera) {\n camera.outputRenderTarget._cleared = false;\n }\n if (camera?.rigCameras?.length) {\n for (let i = 0; i < camera.rigCameras.length; ++i) {\n const rtt = camera.rigCameras[i].outputRenderTarget;\n if (rtt) {\n rtt._cleared = false;\n }\n }\n }\n }\n /**\n * Resets the draw wrappers cache of all meshes\n * @param passId If provided, releases only the draw wrapper corresponding to this render pass id\n */\n resetDrawCache(passId) {\n if (!this.meshes) {\n return;\n }\n for (const mesh of this.meshes) {\n mesh.resetDrawCache(passId);\n }\n }\n _renderWithFrameGraph(updateCameras = true, ignoreAnimations = false) {\n this.activeCamera = null;\n this._activeParticleSystems.reset();\n this._activeSkeletons.reset();\n // Update Cameras\n if (updateCameras) {\n for (const camera of this.cameras) {\n camera.update();\n if (camera.cameraRigMode !== 0) {\n // rig cameras\n for (let index = 0; index < camera._rigCameras.length; index++) {\n camera._rigCameras[index].update();\n }\n }\n }\n }\n // We must keep these steps because the procedural texture component relies on them.\n // TODO: move the procedural texture component to the frame graph.\n for (const step of this._beforeClearStage) {\n step.action();\n }\n // Process meshes\n const meshes = this.getActiveMeshCandidates();\n const len = meshes.length;\n for (let i = 0; i < len; i++) {\n const mesh = meshes.data[i];\n if (mesh.isBlocked) {\n continue;\n }\n this._totalVertices.addCount(mesh.getTotalVertices(), false);\n if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.hasAZeroComponent) {\n continue;\n }\n mesh.computeWorldMatrix();\n if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(12, 13)) {\n this._meshesForIntersections.pushNoDuplicate(mesh);\n }\n }\n // Animate Particle systems\n if (this.particlesEnabled) {\n for (let particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {\n const particleSystem = this.particleSystems[particleIndex];\n if (!particleSystem.isStarted() || !particleSystem.emitter) {\n continue;\n }\n const emitter = particleSystem.emitter;\n if (!emitter.position || emitter.isEnabled()) {\n this._activeParticleSystems.push(particleSystem);\n particleSystem.animate();\n }\n }\n }\n // Render the graph\n this.frameGraph?.execute();\n }\n /**\n * Render the scene\n * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)\n * @param ignoreAnimations defines a boolean indicating if animations should not be executed (false by default)\n */\n render(updateCameras = true, ignoreAnimations = false) {\n if (this.isDisposed) {\n return;\n }\n if (this.onReadyObservable.hasObservers() && this._executeWhenReadyTimeoutId === null) {\n this._checkIsReady();\n }\n this._frameId++;\n this._defaultFrameBufferCleared = false;\n this._checkCameraRenderTarget(this.activeCamera);\n if (this.activeCameras?.length) {\n this.activeCameras.forEach(this._checkCameraRenderTarget);\n }\n // Register components that have been associated lately to the scene.\n this._registerTransientComponents();\n this._activeParticles.fetchNewFrame();\n this._totalVertices.fetchNewFrame();\n this._activeIndices.fetchNewFrame();\n this._activeBones.fetchNewFrame();\n this._meshesForIntersections.reset();\n this.resetCachedMaterial();\n this.onBeforeAnimationsObservable.notifyObservers(this);\n // Actions\n if (this.actionManager) {\n this.actionManager.processTrigger(11);\n }\n // Animations\n if (!ignoreAnimations) {\n this.animate();\n }\n // Before camera update steps\n for (const step of this._beforeCameraUpdateStage) {\n step.action();\n }\n // Update Cameras\n if (updateCameras) {\n if (this.activeCameras && this.activeCameras.length > 0) {\n for (let cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\n const camera = this.activeCameras[cameraIndex];\n camera.update();\n if (camera.cameraRigMode !== 0) {\n // rig cameras\n for (let index = 0; index < camera._rigCameras.length; index++) {\n camera._rigCameras[index].update();\n }\n }\n }\n }\n else if (this.activeCamera) {\n this.activeCamera.update();\n if (this.activeCamera.cameraRigMode !== 0) {\n // rig cameras\n for (let index = 0; index < this.activeCamera._rigCameras.length; index++) {\n this.activeCamera._rigCameras[index].update();\n }\n }\n }\n }\n // Before render\n this.onBeforeRenderObservable.notifyObservers(this);\n // Custom render function?\n if (this.customRenderFunction) {\n this._renderId++;\n this._engine.currentRenderPassId = 0;\n this.customRenderFunction(updateCameras, ignoreAnimations);\n }\n else {\n const engine = this.getEngine();\n // Customs render targets\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\n const currentActiveCamera = this.activeCameras?.length ? this.activeCameras[0] : this.activeCamera;\n if (this.renderTargetsEnabled) {\n Tools.StartPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\n this._intermediateRendering = true;\n for (let customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {\n const renderTarget = this.customRenderTargets[customIndex];\n if (renderTarget._shouldRender()) {\n this._renderId++;\n this.activeCamera = renderTarget.activeCamera || this.activeCamera;\n if (!this.activeCamera) {\n throw new Error(\"Active camera not set\");\n }\n // Viewport\n engine.setViewport(this.activeCamera.viewport);\n // Camera\n this.updateTransformMatrix();\n renderTarget.render(currentActiveCamera !== this.activeCamera, this.dumpNextRenderTargets);\n }\n }\n Tools.EndPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\n this._intermediateRendering = false;\n this._renderId++;\n }\n this._engine.currentRenderPassId = currentActiveCamera?.renderPassId ?? 0;\n // Restore back buffer\n this.activeCamera = currentActiveCamera;\n if (this._activeCamera && this._activeCamera.cameraRigMode !== 22 && !this.prePass) {\n this._bindFrameBuffer(this._activeCamera, false);\n }\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\n for (const step of this._beforeClearStage) {\n step.action();\n }\n // Clear\n this._clearFrameBuffer(this.activeCamera);\n // Collects render targets from external components.\n for (const step of this._gatherRenderTargetsStage) {\n step.action(this._renderTargets);\n }\n // Multi-cameras?\n if (this.activeCameras && this.activeCameras.length > 0) {\n for (let cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\n this._processSubCameras(this.activeCameras[cameraIndex], cameraIndex > 0);\n }\n }\n else {\n if (!this.activeCamera) {\n throw new Error(\"No camera defined\");\n }\n this._processSubCameras(this.activeCamera, !!this.activeCamera.outputRenderTarget);\n }\n }\n // Intersection checks\n this._checkIntersections();\n // Executes the after render stage actions.\n for (const step of this._afterRenderStage) {\n step.action();\n }\n // After render\n if (this.afterRender) {\n this.afterRender();\n }\n this.onAfterRenderObservable.notifyObservers(this);\n // Cleaning\n if (this._toBeDisposed.length) {\n for (let index = 0; index < this._toBeDisposed.length; index++) {\n const data = this._toBeDisposed[index];\n if (data) {\n data.dispose();\n }\n }\n this._toBeDisposed.length = 0;\n }\n if (this.dumpNextRenderTargets) {\n this.dumpNextRenderTargets = false;\n }\n this._activeBones.addCount(0, true);\n this._activeIndices.addCount(0, true);\n this._activeParticles.addCount(0, true);\n this._engine.restoreDefaultFramebuffer();\n }\n /**\n * Freeze all materials\n * A frozen material will not be updatable but should be faster to render\n * Note: multimaterials will not be frozen, but their submaterials will\n */\n freezeMaterials() {\n for (let i = 0; i < this.materials.length; i++) {\n this.materials[i].freeze();\n }\n }\n /**\n * Unfreeze all materials\n * A frozen material will not be updatable but should be faster to render\n */\n unfreezeMaterials() {\n for (let i = 0; i < this.materials.length; i++) {\n this.materials[i].unfreeze();\n }\n }\n /**\n * Releases all held resources\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this.beforeRender = null;\n this.afterRender = null;\n this.metadata = null;\n this.skeletons.length = 0;\n this.morphTargetManagers.length = 0;\n this._transientComponents.length = 0;\n this._isReadyForMeshStage.clear();\n this._beforeEvaluateActiveMeshStage.clear();\n this._evaluateSubMeshStage.clear();\n this._preActiveMeshStage.clear();\n this._cameraDrawRenderTargetStage.clear();\n this._beforeCameraDrawStage.clear();\n this._beforeRenderTargetDrawStage.clear();\n this._beforeRenderingGroupDrawStage.clear();\n this._beforeRenderingMeshStage.clear();\n this._afterRenderingMeshStage.clear();\n this._afterRenderingGroupDrawStage.clear();\n this._afterCameraDrawStage.clear();\n this._afterRenderTargetDrawStage.clear();\n this._afterRenderStage.clear();\n this._beforeCameraUpdateStage.clear();\n this._beforeClearStage.clear();\n this._gatherRenderTargetsStage.clear();\n this._gatherActiveCameraRenderTargetsStage.clear();\n this._pointerMoveStage.clear();\n this._pointerDownStage.clear();\n this._pointerUpStage.clear();\n this.importedMeshesFiles = [];\n if (this._activeAnimatables && this.stopAllAnimations) {\n // Ensures that no animatable notifies a callback that could start a new animation group, constantly adding new animatables to the active list...\n this._activeAnimatables.forEach((animatable) => {\n animatable.onAnimationEndObservable.clear();\n animatable.onAnimationEnd = null;\n });\n this.stopAllAnimations();\n }\n this.resetCachedMaterial();\n // Smart arrays\n if (this.activeCamera) {\n this.activeCamera._activeMeshes.dispose();\n this.activeCamera = null;\n }\n this.activeCameras = null;\n this._activeMeshes.dispose();\n this._renderingManager.dispose();\n this._processedMaterials.dispose();\n this._activeParticleSystems.dispose();\n this._activeSkeletons.dispose();\n this._softwareSkinnedMeshes.dispose();\n this._renderTargets.dispose();\n this._materialsRenderTargets.dispose();\n this._registeredForLateAnimationBindings.dispose();\n this._meshesForIntersections.dispose();\n this._toBeDisposed.length = 0;\n // Abort active requests\n const activeRequests = this._activeRequests.slice();\n for (const request of activeRequests) {\n request.abort();\n }\n this._activeRequests.length = 0;\n // Events\n try {\n this.onDisposeObservable.notifyObservers(this);\n }\n catch (e) {\n Logger.Error(\"An error occurred while calling onDisposeObservable!\", e);\n }\n this.detachControl();\n // Detach cameras\n const canvas = this._engine.getInputElement();\n if (canvas) {\n for (let index = 0; index < this.cameras.length; index++) {\n this.cameras[index].detachControl();\n }\n }\n // Release animation groups\n this._disposeList(this.animationGroups);\n // Release lights\n this._disposeList(this.lights);\n // Release materials\n if (this._defaultMaterial) {\n this._defaultMaterial.dispose();\n }\n this._disposeList(this.multiMaterials);\n this._disposeList(this.materials);\n // Release meshes\n this._disposeList(this.meshes, (item) => item.dispose(true));\n this._disposeList(this.transformNodes, (item) => item.dispose(true));\n // Release cameras\n const cameras = this.cameras;\n this._disposeList(cameras);\n // Release particles\n this._disposeList(this.particleSystems);\n // Release postProcesses\n this._disposeList(this.postProcesses);\n // Release textures\n this._disposeList(this.textures);\n // Release morph targets\n this._disposeList(this.morphTargetManagers);\n // Release UBO\n this._sceneUbo.dispose();\n if (this._multiviewSceneUbo) {\n this._multiviewSceneUbo.dispose();\n }\n // Post-processes\n this.postProcessManager.dispose();\n // Components\n this._disposeList(this._components);\n // Remove from engine\n let index = this._engine.scenes.indexOf(this);\n if (index > -1) {\n this._engine.scenes.splice(index, 1);\n }\n if (EngineStore._LastCreatedScene === this) {\n if (this._engine.scenes.length > 0) {\n EngineStore._LastCreatedScene = this._engine.scenes[this._engine.scenes.length - 1];\n }\n else {\n EngineStore._LastCreatedScene = null;\n }\n }\n index = this._engine._virtualScenes.indexOf(this);\n if (index > -1) {\n this._engine._virtualScenes.splice(index, 1);\n }\n this._engine.wipeCaches(true);\n this.onDisposeObservable.clear();\n this.onBeforeRenderObservable.clear();\n this.onAfterRenderObservable.clear();\n this.onBeforeRenderTargetsRenderObservable.clear();\n this.onAfterRenderTargetsRenderObservable.clear();\n this.onAfterStepObservable.clear();\n this.onBeforeStepObservable.clear();\n this.onBeforeActiveMeshesEvaluationObservable.clear();\n this.onAfterActiveMeshesEvaluationObservable.clear();\n this.onBeforeParticlesRenderingObservable.clear();\n this.onAfterParticlesRenderingObservable.clear();\n this.onBeforeDrawPhaseObservable.clear();\n this.onAfterDrawPhaseObservable.clear();\n this.onBeforeAnimationsObservable.clear();\n this.onAfterAnimationsObservable.clear();\n this.onDataLoadedObservable.clear();\n this.onBeforeRenderingGroupObservable.clear();\n this.onAfterRenderingGroupObservable.clear();\n this.onMeshImportedObservable.clear();\n this.onBeforeCameraRenderObservable.clear();\n this.onAfterCameraRenderObservable.clear();\n this.onAfterRenderCameraObservable.clear();\n this.onReadyObservable.clear();\n this.onNewCameraAddedObservable.clear();\n this.onCameraRemovedObservable.clear();\n this.onNewLightAddedObservable.clear();\n this.onLightRemovedObservable.clear();\n this.onNewGeometryAddedObservable.clear();\n this.onGeometryRemovedObservable.clear();\n this.onNewTransformNodeAddedObservable.clear();\n this.onTransformNodeRemovedObservable.clear();\n this.onNewMeshAddedObservable.clear();\n this.onMeshRemovedObservable.clear();\n this.onNewSkeletonAddedObservable.clear();\n this.onSkeletonRemovedObservable.clear();\n this.onNewMaterialAddedObservable.clear();\n this.onNewMultiMaterialAddedObservable.clear();\n this.onMaterialRemovedObservable.clear();\n this.onMultiMaterialRemovedObservable.clear();\n this.onNewTextureAddedObservable.clear();\n this.onTextureRemovedObservable.clear();\n this.onPrePointerObservable.clear();\n this.onPointerObservable.clear();\n this.onPreKeyboardObservable.clear();\n this.onKeyboardObservable.clear();\n this.onActiveCameraChanged.clear();\n this.onScenePerformancePriorityChangedObservable.clear();\n this.onClearColorChangedObservable.clear();\n this._isDisposed = true;\n }\n _disposeList(items, callback) {\n const itemsCopy = items.slice(0);\n callback = callback ?? ((item) => item.dispose());\n for (const item of itemsCopy) {\n callback(item);\n }\n items.length = 0;\n }\n /**\n * Gets if the scene is already disposed\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Call this function to reduce memory footprint of the scene.\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\n */\n clearCachedVertexData() {\n for (let meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\n const mesh = this.meshes[meshIndex];\n const geometry = mesh.geometry;\n if (geometry) {\n geometry.clearCachedData();\n }\n }\n }\n /**\n * This function will remove the local cached buffer data from texture.\n * It will save memory but will prevent the texture from being rebuilt\n */\n cleanCachedTextureBuffer() {\n for (const baseTexture of this.textures) {\n const buffer = baseTexture._buffer;\n if (buffer) {\n baseTexture._buffer = null;\n }\n }\n }\n /**\n * Get the world extend vectors with an optional filter\n *\n * @param filterPredicate the predicate - which meshes should be included when calculating the world size\n * @returns {{ min: Vector3; max: Vector3 }} min and max vectors\n */\n getWorldExtends(filterPredicate) {\n const min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n const max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n filterPredicate = filterPredicate || (() => true);\n this.meshes.filter(filterPredicate).forEach((mesh) => {\n mesh.computeWorldMatrix(true);\n if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {\n return;\n }\n const boundingInfo = mesh.getBoundingInfo();\n const minBox = boundingInfo.boundingBox.minimumWorld;\n const maxBox = boundingInfo.boundingBox.maximumWorld;\n Vector3.CheckExtends(minBox, min, max);\n Vector3.CheckExtends(maxBox, min, max);\n });\n return {\n min: min,\n max: max,\n };\n }\n // Picking\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\n * @param camera defines the camera to use for the picking\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\n * @returns a Ray\n */\n createPickingRay(x, y, world, camera, cameraViewSpace = false) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\n * @param result defines the ray where to store the picking ray\n * @param camera defines the camera to use for the picking\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\n * @param enableDistantPicking defines if picking should handle large values for mesh position/scaling (false by default)\n * @returns the current scene\n */\n createPickingRayToRef(x, y, world, result, camera, cameraViewSpace = false, enableDistantPicking = false) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param camera defines the camera to use for the picking\n * @returns a Ray\n */\n createPickingRayInCameraSpace(x, y, camera) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param result defines the ray where to store the picking ray\n * @param camera defines the camera to use for the picking\n * @returns the current scene\n */\n createPickingRayInCameraSpaceToRef(x, y, result, camera) {\n throw _WarnImport(\"Ray\");\n }\n /** Launch a ray to try to pick a mesh in the scene\n * @param x position on screen\n * @param y position on screen\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns a PickingInfo\n */\n pick(x, y, predicate, fastCheck, camera, trianglePredicate) {\n const warn = _WarnImport(\"Ray\", true);\n if (warn) {\n Logger.Warn(warn);\n }\n // Dummy info if picking as not been imported\n return new PickingInfo();\n }\n /** Launch a ray to try to pick a mesh in the scene using only bounding information of the main mesh (not using submeshes)\n * @param x position on screen\n * @param y position on screen\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\n * @returns a PickingInfo (Please note that some info will not be set like distance, bv, bu and everything that cannot be capture by only using bounding infos)\n */\n pickWithBoundingInfo(x, y, predicate, fastCheck, camera) {\n const warn = _WarnImport(\"Ray\", true);\n if (warn) {\n Logger.Warn(warn);\n }\n // Dummy info if picking as not been imported\n return new PickingInfo();\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Use the given ray to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\n * irrespective of orientation.\n * @param ray The ray to use to pick meshes\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns a PickingInfo\n */\n pickWithRay(ray, predicate, fastCheck, trianglePredicate) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Launch a ray to try to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\n * irrespective of orientation.\n * @param x X position on screen\n * @param y Y position on screen\n * @param predicate Predicate function used to determine eligible meshes and instances. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns an array of PickingInfo\n */\n multiPick(x, y, predicate, camera, trianglePredicate) {\n throw _WarnImport(\"Ray\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * Launch a ray to try to pick a mesh in the scene\n * @param ray Ray to use\n * @param predicate Predicate function used to determine eligible meshes and instances. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true. thinInstanceIndex is -1 when the mesh is non-instanced\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns an array of PickingInfo\n */\n multiPickWithRay(ray, predicate, trianglePredicate) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Force the value of meshUnderPointer\n * @param mesh defines the mesh to use\n * @param pointerId optional pointer id when using more than one pointer\n * @param pickResult optional pickingInfo data used to find mesh\n */\n setPointerOverMesh(mesh, pointerId, pickResult) {\n this._inputManager.setPointerOverMesh(mesh, pointerId, pickResult);\n }\n /**\n * Gets the mesh under the pointer\n * @returns a Mesh or null if no mesh is under the pointer\n */\n getPointerOverMesh() {\n return this._inputManager.getPointerOverMesh();\n }\n // Misc.\n /** @internal */\n _rebuildGeometries() {\n for (const geometry of this.geometries) {\n geometry._rebuild();\n }\n for (const mesh of this.meshes) {\n mesh._rebuild();\n }\n if (this.postProcessManager) {\n this.postProcessManager._rebuild();\n }\n for (const component of this._components) {\n component.rebuild();\n }\n for (const system of this.particleSystems) {\n system.rebuild();\n }\n if (this.spriteManagers) {\n for (const spriteMgr of this.spriteManagers) {\n spriteMgr.rebuild();\n }\n }\n }\n /** @internal */\n _rebuildTextures() {\n for (const texture of this.textures) {\n texture._rebuild(true);\n }\n this.markAllMaterialsAsDirty(1);\n }\n /**\n * Get from a list of objects by tags\n * @param list the list of objects to use\n * @param tagsQuery the query to use\n * @param filter a predicate to filter for tags\n * @returns\n */\n _getByTags(list, tagsQuery, filter) {\n if (tagsQuery === undefined) {\n // returns the complete list (could be done with Tags.MatchesQuery but no need to have a for-loop here)\n return list;\n }\n const listByTags = [];\n for (const i in list) {\n const item = list[i];\n if (Tags && Tags.MatchesQuery(item, tagsQuery) && (!filter || filter(item))) {\n listByTags.push(item);\n }\n }\n return listByTags;\n }\n /**\n * Get a list of meshes by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of Mesh\n */\n getMeshesByTags(tagsQuery, filter) {\n return this._getByTags(this.meshes, tagsQuery, filter);\n }\n /**\n * Get a list of cameras by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of Camera\n */\n getCamerasByTags(tagsQuery, filter) {\n return this._getByTags(this.cameras, tagsQuery, filter);\n }\n /**\n * Get a list of lights by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of Light\n */\n getLightsByTags(tagsQuery, filter) {\n return this._getByTags(this.lights, tagsQuery, filter);\n }\n /**\n * Get a list of materials by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of Material\n */\n getMaterialByTags(tagsQuery, filter) {\n return this._getByTags(this.materials, tagsQuery, filter).concat(this._getByTags(this.multiMaterials, tagsQuery, filter));\n }\n /**\n * Get a list of transform nodes by tags\n * @param tagsQuery defines the tags query to use\n * @param filter defines a predicate used to filter results\n * @returns an array of TransformNode\n */\n getTransformNodesByTags(tagsQuery, filter) {\n return this._getByTags(this.transformNodes, tagsQuery, filter);\n }\n /**\n * Overrides the default sort function applied in the rendering group to prepare the meshes.\n * This allowed control for front to back rendering or reversly depending of the special needs.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\n */\n setRenderingOrder(renderingGroupId, opaqueSortCompareFn = null, alphaTestSortCompareFn = null, transparentSortCompareFn = null) {\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\n }\n /**\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\n * @param depth Automatically clears depth between groups if true and autoClear is true.\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\n */\n setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth = true, stencil = true) {\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth, stencil);\n }\n /**\n * Gets the current auto clear configuration for one rendering group of the rendering\n * manager.\n * @param index the rendering group index to get the information for\n * @returns The auto clear setup for the requested rendering group\n */\n getAutoClearDepthStencilSetup(index) {\n return this._renderingManager.getAutoClearDepthStencilSetup(index);\n }\n /** @internal */\n _forceBlockMaterialDirtyMechanism(value) {\n this._blockMaterialDirtyMechanism = value;\n }\n /** Gets or sets a boolean blocking all the calls to markAllMaterialsAsDirty (ie. the materials won't be updated if they are out of sync) */\n get blockMaterialDirtyMechanism() {\n return this._blockMaterialDirtyMechanism;\n }\n set blockMaterialDirtyMechanism(value) {\n if (this._blockMaterialDirtyMechanism === value) {\n return;\n }\n this._blockMaterialDirtyMechanism = value;\n if (!value) {\n // Do a complete update\n this.markAllMaterialsAsDirty(63);\n }\n }\n /**\n * Will flag all materials as dirty to trigger new shader compilation\n * @param flag defines the flag used to specify which material part must be marked as dirty\n * @param predicate If not null, it will be used to specify if a material has to be marked as dirty\n */\n markAllMaterialsAsDirty(flag, predicate) {\n if (this._blockMaterialDirtyMechanism) {\n return;\n }\n for (const material of this.materials) {\n if (predicate && !predicate(material)) {\n continue;\n }\n material.markAsDirty(flag);\n }\n }\n /**\n * @internal\n */\n _loadFile(fileOrUrl, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError, onOpened) {\n const request = LoadFile(fileOrUrl, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError, onOpened);\n this._activeRequests.push(request);\n request.onCompleteObservable.add((request) => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * @internal\n */\n _loadFileAsync(fileOrUrl, onProgress, useOfflineSupport, useArrayBuffer, onOpened) {\n return new Promise((resolve, reject) => {\n this._loadFile(fileOrUrl, (data) => {\n resolve(data);\n }, onProgress, useOfflineSupport, useArrayBuffer, (request, exception) => {\n reject(exception);\n }, onOpened);\n });\n }\n /**\n * @internal\n */\n _requestFile(url, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError, onOpened) {\n const request = RequestFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError, onOpened);\n this._activeRequests.push(request);\n request.onCompleteObservable.add((request) => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * @internal\n */\n _requestFileAsync(url, onProgress, useOfflineSupport, useArrayBuffer, onOpened) {\n return new Promise((resolve, reject) => {\n this._requestFile(url, (data) => {\n resolve(data);\n }, onProgress, useOfflineSupport, useArrayBuffer, (error) => {\n reject(error);\n }, onOpened);\n });\n }\n /**\n * @internal\n */\n _readFile(file, onSuccess, onProgress, useArrayBuffer, onError) {\n const request = ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError);\n this._activeRequests.push(request);\n request.onCompleteObservable.add((request) => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * @internal\n */\n _readFileAsync(file, onProgress, useArrayBuffer) {\n return new Promise((resolve, reject) => {\n this._readFile(file, (data) => {\n resolve(data);\n }, onProgress, useArrayBuffer, (error) => {\n reject(error);\n });\n });\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * This method gets the performance collector belonging to the scene, which is generally shared with the inspector.\n * @returns the perf collector belonging to the scene.\n */\n getPerfCollector() {\n throw _WarnImport(\"performanceViewerSceneExtension\");\n }\n // deprecated\n /**\n * Sets the active camera of the scene using its Id\n * @param id defines the camera's Id\n * @returns the new active camera or null if none found.\n * @deprecated Please use setActiveCameraById instead\n */\n setActiveCameraByID(id) {\n return this.setActiveCameraById(id);\n }\n /**\n * Get a material using its id\n * @param id defines the material's Id\n * @returns the material or null if none found.\n * @deprecated Please use getMaterialById instead\n */\n getMaterialByID(id) {\n return this.getMaterialById(id);\n }\n /**\n * Gets a the last added material using a given id\n * @param id defines the material's Id\n * @returns the last material with the given id or null if none found.\n * @deprecated Please use getLastMaterialById instead\n */\n getLastMaterialByID(id) {\n return this.getLastMaterialById(id);\n }\n /**\n * Get a texture using its unique id\n * @param uniqueId defines the texture's unique id\n * @returns the texture or null if none found.\n * @deprecated Please use getTextureByUniqueId instead\n */\n getTextureByUniqueID(uniqueId) {\n return this.getTextureByUniqueId(uniqueId);\n }\n /**\n * Gets a camera using its Id\n * @param id defines the Id to look for\n * @returns the camera or null if not found\n * @deprecated Please use getCameraById instead\n */\n getCameraByID(id) {\n return this.getCameraById(id);\n }\n /**\n * Gets a camera using its unique Id\n * @param uniqueId defines the unique Id to look for\n * @returns the camera or null if not found\n * @deprecated Please use getCameraByUniqueId instead\n */\n getCameraByUniqueID(uniqueId) {\n return this.getCameraByUniqueId(uniqueId);\n }\n /**\n * Gets a bone using its Id\n * @param id defines the bone's Id\n * @returns the bone or null if not found\n * @deprecated Please use getBoneById instead\n */\n getBoneByID(id) {\n return this.getBoneById(id);\n }\n /**\n * Gets a light node using its Id\n * @param id defines the light's Id\n * @returns the light or null if none found.\n * @deprecated Please use getLightById instead\n */\n getLightByID(id) {\n return this.getLightById(id);\n }\n /**\n * Gets a light node using its scene-generated unique Id\n * @param uniqueId defines the light's unique Id\n * @returns the light or null if none found.\n * @deprecated Please use getLightByUniqueId instead\n */\n getLightByUniqueID(uniqueId) {\n return this.getLightByUniqueId(uniqueId);\n }\n /**\n * Gets a particle system by Id\n * @param id defines the particle system Id\n * @returns the corresponding system or null if none found\n * @deprecated Please use getParticleSystemById instead\n */\n getParticleSystemByID(id) {\n return this.getParticleSystemById(id);\n }\n /**\n * Gets a geometry using its Id\n * @param id defines the geometry's Id\n * @returns the geometry or null if none found.\n * @deprecated Please use getGeometryById instead\n */\n getGeometryByID(id) {\n return this.getGeometryById(id);\n }\n /**\n * Gets the first added mesh found of a given Id\n * @param id defines the Id to search for\n * @returns the mesh found or null if not found at all\n * @deprecated Please use getMeshById instead\n */\n getMeshByID(id) {\n return this.getMeshById(id);\n }\n /**\n * Gets a mesh with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found mesh or null if not found at all.\n * @deprecated Please use getMeshByUniqueId instead\n */\n getMeshByUniqueID(uniqueId) {\n return this.getMeshByUniqueId(uniqueId);\n }\n /**\n * Gets a the last added mesh using a given Id\n * @param id defines the Id to search for\n * @returns the found mesh or null if not found at all.\n * @deprecated Please use getLastMeshById instead\n */\n getLastMeshByID(id) {\n return this.getLastMeshById(id);\n }\n /**\n * Gets a list of meshes using their Id\n * @param id defines the Id to search for\n * @returns a list of meshes\n * @deprecated Please use getMeshesById instead\n */\n getMeshesByID(id) {\n return this.getMeshesById(id);\n }\n /**\n * Gets the first added transform node found of a given Id\n * @param id defines the Id to search for\n * @returns the found transform node or null if not found at all.\n * @deprecated Please use getTransformNodeById instead\n */\n getTransformNodeByID(id) {\n return this.getTransformNodeById(id);\n }\n /**\n * Gets a transform node with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found transform node or null if not found at all.\n * @deprecated Please use getTransformNodeByUniqueId instead\n */\n getTransformNodeByUniqueID(uniqueId) {\n return this.getTransformNodeByUniqueId(uniqueId);\n }\n /**\n * Gets a list of transform nodes using their Id\n * @param id defines the Id to search for\n * @returns a list of transform nodes\n * @deprecated Please use getTransformNodesById instead\n */\n getTransformNodesByID(id) {\n return this.getTransformNodesById(id);\n }\n /**\n * Gets a node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n * @deprecated Please use getNodeById instead\n */\n getNodeByID(id) {\n return this.getNodeById(id);\n }\n /**\n * Gets a the last added node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n * @deprecated Please use getLastEntryById instead\n */\n getLastEntryByID(id) {\n return this.getLastEntryById(id);\n }\n /**\n * Gets a skeleton using a given Id (if many are found, this function will pick the last one)\n * @param id defines the Id to search for\n * @returns the found skeleton or null if not found at all.\n * @deprecated Please use getLastSkeletonById instead\n */\n getLastSkeletonByID(id) {\n return this.getLastSkeletonById(id);\n }\n}\n/** The fog is deactivated */\nScene.FOGMODE_NONE = 0;\n/** The fog density is following an exponential function */\nScene.FOGMODE_EXP = 1;\n/** The fog density is following an exponential function faster than FOGMODE_EXP */\nScene.FOGMODE_EXP2 = 2;\n/** The fog density is following a linear function. */\nScene.FOGMODE_LINEAR = 3;\n/**\n * Gets or sets the minimum deltatime when deterministic lock step is enabled\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n */\nScene.MinDeltaTime = 1.0;\n/**\n * Gets or sets the maximum deltatime when deterministic lock step is enabled\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n */\nScene.MaxDeltaTime = 1000.0;\n// Register Class Name\nRegisterClass(\"BABYLON.Scene\", Scene);\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,iBAAiB;AACvC,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,qBAAqB,EAAEC,UAAU,QAAQ,sBAAsB;AACxE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,IAAI,QAAQ,gBAAgB;AACrC,SAASC,OAAO,EAAEC,MAAM,EAAEC,UAAU,QAAQ,wBAAwB;AACpE,SAASC,4BAA4B,QAAQ,6CAA6C;AAC1F,SAASC,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,WAAW,QAAQ,6BAA6B;AACzD,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,kBAAkB,QAAQ,uCAAuC;AAC1E,SAASC,gBAAgB,QAAQ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AACA;AACA;AACA;AACA;EACI8W,oBAAoBA,CAAC9W,EAAE,EAAE;IACrB,OAAO,IAAI,CAACiC,oBAAoB,CAACjC,EAAE,CAAC;EACxC;EACA;AACJ;AACA;AACA;AACA;AACA;EACI+W,0BAA0BA,CAACxX,QAAQ,EAAE;IACjC,OAAO,IAAI,CAAC2C,0BAA0B,CAAC3C,QAAQ,CAAC;EACpD;EACA;AACJ;AACA;AACA;AACA;AACA;EACIyX,qBAAqBA,CAAChX,EAAE,EAAE;IACtB,OAAO,IAAI,CAACmC,qBAAqB,CAACnC,EAAE,CAAC;EACzC;EACA;AACJ;AACA;AACA;AACA;AACA;EACIiX,WAAWA,CAACjX,EAAE,EAAE;IACZ,OAAO,IAAI,CAACwC,WAAW,CAACxC,EAAE,CAAC;EAC/B;EACA;AACJ;AACA;AACA;AACA;AACA;EACIkX,gBAAgBA,CAAClX,EAAE,EAAE;IACjB,OAAO,IAAI,CAACuC,gBAAgB,CAACvC,EAAE,CAAC;EACpC;EACA;AACJ;AACA;AACA;AACA;AACA;EACImX,mBAAmBA,CAACnX,EAAE,EAAE;IACpB,OAAO,IAAI,CAAC+C,mBAAmB,CAAC/C,EAAE,CAAC;EACvC;AACJ;AACA;AACAviB,KAAK,CAACwO,YAAY,GAAG,CAAC;AACtB;AACAxO,KAAK,CAAC25B,WAAW,GAAG,CAAC;AACrB;AACA35B,KAAK,CAAC45B,YAAY,GAAG,CAAC;AACtB;AACA55B,KAAK,CAAC65B,cAAc,GAAG,CAAC;AACxB;AACA;AACA;AACA;AACA75B,KAAK,CAAC2vB,YAAY,GAAG,GAAG;AACxB;AACA;AACA;AACA;AACA3vB,KAAK,CAAC8vB,YAAY,GAAG,MAAM;AAC3B;AACAhwB,aAAa,CAAC,eAAe,EAAEE,KAAK,CAAC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}