@babylonjs/core 5.32.1 → 5.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Actions/abstractActionManager.d.ts +1 -1
- package/Actions/abstractActionManager.js +1 -1
- package/Actions/abstractActionManager.js.map +1 -1
- package/Actions/action.d.ts +1 -1
- package/Actions/action.js +1 -1
- package/Actions/action.js.map +1 -1
- package/Actions/actionManager.d.ts +18 -18
- package/Actions/actionManager.js +18 -18
- package/Actions/actionManager.js.map +1 -1
- package/Actions/directActions.d.ts +10 -10
- package/Actions/directActions.js +10 -10
- package/Actions/directActions.js.map +1 -1
- package/Actions/interpolateValueAction.d.ts +1 -1
- package/Actions/interpolateValueAction.js +1 -1
- package/Actions/interpolateValueAction.js.map +1 -1
- package/Animations/animatable.d.ts +2 -2
- package/Animations/animatable.js +2 -2
- package/Animations/animatable.js.map +1 -1
- package/Animations/animationGroup.d.ts +3 -3
- package/Animations/animationGroup.js +3 -3
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/easing.d.ts +14 -14
- package/Animations/easing.js +13 -13
- package/Animations/easing.js.map +1 -1
- package/Audio/Interfaces/IAudioEngine.d.ts +2 -2
- package/Audio/Interfaces/IAudioEngine.js.map +1 -1
- package/Audio/Interfaces/ISoundOptions.d.ts +3 -3
- package/Audio/Interfaces/ISoundOptions.js.map +1 -1
- package/Audio/analyser.d.ts +1 -1
- package/Audio/analyser.js +1 -1
- package/Audio/analyser.js.map +1 -1
- package/Audio/audioEngine.d.ts +2 -2
- package/Audio/audioEngine.js +2 -2
- package/Audio/audioEngine.js.map +1 -1
- package/Audio/audioSceneComponent.d.ts +4 -4
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.d.ts +13 -13
- package/Audio/sound.js +13 -13
- package/Audio/sound.js.map +1 -1
- package/Audio/soundTrack.d.ts +5 -5
- package/Audio/soundTrack.js +5 -5
- package/Audio/soundTrack.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.d.ts +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.d.ts +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Cameras/bouncingBehavior.d.ts +1 -1
- package/Behaviors/Cameras/bouncingBehavior.js +1 -1
- package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
- package/Behaviors/Cameras/framingBehavior.js +1 -1
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.d.ts +8 -0
- package/Behaviors/Meshes/pointerDragBehavior.js +9 -3
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Bones/bone.d.ts +1 -1
- package/Bones/bone.js +1 -1
- package/Bones/bone.js.map +1 -1
- package/Bones/boneIKController.d.ts +3 -2
- package/Bones/boneIKController.js +28 -11
- package/Bones/boneIKController.js.map +1 -1
- package/Bones/boneLookController.d.ts +1 -1
- package/Bones/boneLookController.js +1 -1
- package/Bones/boneLookController.js.map +1 -1
- package/Bones/skeleton.d.ts +3 -3
- package/Bones/skeleton.js +2 -2
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js +2 -2
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +2 -2
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraGamepadInput.d.ts +1 -1
- package/Cameras/Inputs/arcRotateCameraGamepadInput.js +1 -1
- package/Cameras/Inputs/arcRotateCameraGamepadInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.d.ts +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.d.ts +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +3 -3
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +1 -1
- package/Cameras/Inputs/arcRotateCameraPointersInput.js +1 -1
- package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.d.ts +1 -1
- package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js +1 -1
- package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.d.ts +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.js +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.d.ts +2 -2
- package/Cameras/Inputs/flyCameraMouseInput.js +4 -4
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.d.ts +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/followCameraMouseWheelInput.d.ts +1 -1
- package/Cameras/Inputs/followCameraMouseWheelInput.js +3 -3
- package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/followCameraPointersInput.d.ts +1 -1
- package/Cameras/Inputs/followCameraPointersInput.js +1 -1
- package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.d.ts +2 -2
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +2 -2
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraGamepadInput.d.ts +1 -1
- package/Cameras/Inputs/freeCameraGamepadInput.js +1 -1
- package/Cameras/Inputs/freeCameraGamepadInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.d.ts +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.d.ts +3 -2
- package/Cameras/Inputs/freeCameraMouseInput.js +18 -7
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseWheelInput.d.ts +1 -1
- package/Cameras/Inputs/freeCameraMouseWheelInput.js +1 -1
- package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraTouchInput.d.ts +2 -2
- package/Cameras/Inputs/freeCameraTouchInput.js +4 -4
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.d.ts +1 -1
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js +1 -1
- package/Cameras/Inputs/freeCameraVirtualJoystickInput.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js.map +1 -1
- package/Cameras/VR/vrCameraMetrics.d.ts +1 -1
- package/Cameras/VR/vrCameraMetrics.js +1 -1
- package/Cameras/VR/vrCameraMetrics.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.js +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.js +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +2 -2
- package/Cameras/VR/vrExperienceHelper.js +2 -2
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/VR/webVRCamera.d.ts +2 -2
- package/Cameras/VR/webVRCamera.js +2 -2
- package/Cameras/VR/webVRCamera.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +9 -9
- package/Cameras/arcRotateCamera.js +9 -9
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/arcRotateCameraInputsManager.d.ts +1 -1
- package/Cameras/arcRotateCameraInputsManager.js +1 -1
- package/Cameras/arcRotateCameraInputsManager.js.map +1 -1
- package/Cameras/camera.d.ts +4 -4
- package/Cameras/camera.js +4 -4
- package/Cameras/camera.js.map +1 -1
- package/Cameras/cameraInputsManager.d.ts +1 -1
- package/Cameras/cameraInputsManager.js +1 -1
- package/Cameras/cameraInputsManager.js.map +1 -1
- package/Cameras/flyCamera.d.ts +1 -1
- package/Cameras/flyCamera.js +1 -1
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/flyCameraInputsManager.d.ts +1 -1
- package/Cameras/flyCameraInputsManager.js +1 -1
- package/Cameras/flyCameraInputsManager.js.map +1 -1
- package/Cameras/followCamera.d.ts +4 -4
- package/Cameras/followCamera.js +4 -4
- package/Cameras/followCamera.js.map +1 -1
- package/Cameras/followCameraInputsManager.d.ts +1 -1
- package/Cameras/followCameraInputsManager.js +1 -1
- package/Cameras/followCameraInputsManager.js.map +1 -1
- package/Cameras/freeCamera.d.ts +3 -3
- package/Cameras/freeCamera.js +3 -3
- package/Cameras/freeCamera.js.map +1 -1
- package/Cameras/freeCameraInputsManager.d.ts +1 -1
- package/Cameras/freeCameraInputsManager.js +1 -1
- package/Cameras/freeCameraInputsManager.js.map +1 -1
- package/Cameras/gamepadCamera.d.ts +2 -2
- package/Cameras/gamepadCamera.js +2 -2
- package/Cameras/gamepadCamera.js.map +1 -1
- package/Cameras/targetCamera.d.ts +2 -2
- package/Cameras/targetCamera.js +2 -2
- package/Cameras/targetCamera.js.map +1 -1
- package/Cameras/touchCamera.d.ts +2 -2
- package/Cameras/touchCamera.js +2 -2
- package/Cameras/touchCamera.js.map +1 -1
- package/Cameras/universalCamera.d.ts +2 -2
- package/Cameras/universalCamera.js +2 -2
- package/Cameras/universalCamera.js.map +1 -1
- package/Cameras/virtualJoysticksCamera.d.ts +2 -2
- package/Cameras/virtualJoysticksCamera.js +2 -2
- package/Cameras/virtualJoysticksCamera.js.map +1 -1
- package/Collisions/pickingInfo.d.ts +1 -1
- package/Collisions/pickingInfo.js +1 -1
- package/Collisions/pickingInfo.js.map +1 -1
- package/Culling/Octrees/octree.d.ts +2 -2
- package/Culling/Octrees/octree.js +2 -2
- package/Culling/Octrees/octree.js.map +1 -1
- package/Culling/Octrees/octreeBlock.d.ts +1 -1
- package/Culling/Octrees/octreeBlock.js +1 -1
- package/Culling/Octrees/octreeBlock.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.d.ts +3 -3
- package/Culling/Octrees/octreeSceneComponent.js +1 -1
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/Culling/boundingInfo.d.ts +8 -3
- package/Culling/boundingInfo.js +7 -2
- package/Culling/boundingInfo.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Debug/rayHelper.d.ts +2 -2
- package/Debug/rayHelper.js +2 -2
- package/Debug/rayHelper.js.map +1 -1
- package/Engines/Extensions/engine.alpha.d.ts +2 -2
- package/Engines/Extensions/engine.alpha.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.d.ts +2 -2
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.query.d.ts +8 -8
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.d.ts +1 -1
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.uniformBuffer.d.ts +3 -3
- package/Engines/Extensions/engine.uniformBuffer.js.map +1 -1
- package/Engines/Extensions/engine.videoTexture.d.ts +2 -1
- package/Engines/Extensions/engine.videoTexture.js.map +1 -1
- package/Engines/Extensions/engine.views.d.ts +2 -2
- package/Engines/Extensions/engine.views.js +1 -1
- package/Engines/Extensions/engine.views.js.map +1 -1
- package/Engines/Extensions/engine.webVR.d.ts +1 -1
- package/Engines/Extensions/engine.webVR.js.map +1 -1
- package/Engines/Processors/shaderProcessor.d.ts +2 -2
- package/Engines/Processors/shaderProcessor.js +2 -2
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.js +21 -9
- package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.js +11 -9
- package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.d.ts +6 -0
- package/Engines/WebGPU/webgpuTextureHelper.js +157 -0
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/constants.d.ts +17 -17
- package/Engines/constants.js +17 -17
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +12 -12
- package/Engines/engine.js +11 -11
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +2 -2
- package/Engines/nativeEngine.js +23 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +5 -5
- package/Engines/nullEngine.js +5 -5
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +8 -8
- package/Engines/thinEngine.js +6 -6
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +4 -4
- package/Engines/webgpuEngine.js +1 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gamepads/gamepadSceneComponent.d.ts +1 -1
- package/Gamepads/gamepadSceneComponent.js.map +1 -1
- package/Gizmos/gizmo.d.ts +6 -7
- package/Gizmos/gizmo.js +43 -36
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +17 -7
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.d.ts +4 -0
- package/Gizmos/positionGizmo.js +21 -0
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.d.ts +4 -0
- package/Gizmos/rotationGizmo.js +20 -0
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +2 -0
- package/Gizmos/scaleGizmo.js +10 -0
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Helpers/sceneHelpers.d.ts +7 -7
- package/Helpers/sceneHelpers.js.map +1 -1
- package/Inputs/scene.inputManager.js +34 -25
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Instrumentation/engineInstrumentation.d.ts +2 -2
- package/Instrumentation/engineInstrumentation.js +2 -2
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Instrumentation/sceneInstrumentation.d.ts +2 -2
- package/Instrumentation/sceneInstrumentation.js +2 -2
- package/Instrumentation/sceneInstrumentation.js.map +1 -1
- package/Layers/effectLayer.js +7 -28
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/effectLayerSceneComponent.d.ts +2 -2
- package/Layers/effectLayerSceneComponent.js.map +1 -1
- package/Layers/glowLayer.d.ts +1 -1
- package/Layers/glowLayer.js +1 -1
- package/Layers/glowLayer.js.map +1 -1
- package/LensFlares/lensFlare.d.ts +3 -3
- package/LensFlares/lensFlare.js +3 -3
- package/LensFlares/lensFlare.js.map +1 -1
- package/LensFlares/lensFlareSystem.d.ts +2 -2
- package/LensFlares/lensFlareSystem.js +2 -2
- package/LensFlares/lensFlareSystem.js.map +1 -1
- package/LensFlares/lensFlareSystemSceneComponent.d.ts +1 -1
- package/LensFlares/lensFlareSystemSceneComponent.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.d.ts +2 -2
- package/Lights/Shadows/shadowGenerator.js +11 -30
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/directionalLight.d.ts +2 -2
- package/Lights/directionalLight.js +2 -2
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/hemisphericLight.d.ts +1 -1
- package/Lights/hemisphericLight.js +1 -1
- package/Lights/hemisphericLight.js.map +1 -1
- package/Lights/light.d.ts +1 -1
- package/Lights/light.js +1 -1
- package/Lights/light.js.map +1 -1
- package/Lights/pointLight.d.ts +2 -2
- package/Lights/pointLight.js +2 -2
- package/Lights/pointLight.js.map +1 -1
- package/Lights/spotLight.d.ts +2 -2
- package/Lights/spotLight.js +2 -2
- package/Lights/spotLight.js.map +1 -1
- package/Loading/loadingScreen.d.ts +2 -2
- package/Loading/loadingScreen.js +1 -1
- package/Loading/loadingScreen.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +4 -8
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +9 -8
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/reciprocalBlock.js +6 -2
- package/Materials/Node/Blocks/reciprocalBlock.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +5 -9
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrMaterial.d.ts +1 -1
- package/Materials/PBR/pbrMaterial.js +1 -1
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/Textures/Packer/packer.d.ts +1 -1
- package/Materials/Textures/Packer/packer.js +1 -1
- package/Materials/Textures/Packer/packer.js.map +1 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -2
- package/Materials/Textures/Procedurals/customProceduralTexture.js +2 -2
- package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.d.ts +2 -2
- package/Materials/Textures/Procedurals/proceduralTexture.js +2 -2
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.d.ts +1 -1
- package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +2 -2
- package/Materials/Textures/cubeTexture.js +2 -2
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/dynamicTexture.d.ts +1 -1
- package/Materials/Textures/dynamicTexture.js +1 -1
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +1 -0
- package/Materials/Textures/htmlElementTexture.js +3 -1
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.d.ts +3 -3
- package/Materials/Textures/mirrorTexture.js +3 -3
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/refractionTexture.d.ts +3 -3
- package/Materials/Textures/refractionTexture.js +3 -3
- package/Materials/Textures/refractionTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +10 -10
- package/Materials/Textures/texture.js +10 -10
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/videoTexture.d.ts +3 -2
- package/Materials/Textures/videoTexture.js +7 -3
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/clipPlaneMaterialHelper.d.ts +8 -0
- package/Materials/clipPlaneMaterialHelper.js +78 -0
- package/Materials/clipPlaneMaterialHelper.js.map +1 -0
- package/Materials/effect.d.ts +20 -2
- package/Materials/effect.js +28 -4
- package/Materials/effect.js.map +1 -1
- package/Materials/fresnelParameters.d.ts +1 -1
- package/Materials/fresnelParameters.js +1 -1
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/index.d.ts +1 -1
- package/Materials/index.js +1 -1
- package/Materials/index.js.map +1 -1
- package/Materials/material.d.ts +28 -2
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.d.ts +3 -7
- package/Materials/materialHelper.js +5 -45
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/multiMaterial.d.ts +2 -2
- package/Materials/multiMaterial.js +2 -2
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +2 -2
- package/Materials/shaderMaterial.js +7 -38
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/shadowDepthWrapper.d.ts +1 -1
- package/Materials/shadowDepthWrapper.js +2 -2
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.d.ts +18 -18
- package/Materials/standardMaterial.js +10 -14
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.path.d.ts +7 -7
- package/Maths/math.path.js +7 -7
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.vector.d.ts +4 -4
- package/Maths/math.vector.js +4 -4
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/boxBuilder.d.ts +3 -3
- package/Meshes/Builders/boxBuilder.js +3 -3
- package/Meshes/Builders/boxBuilder.js.map +1 -1
- package/Meshes/Builders/capsuleBuilder.d.ts +1 -1
- package/Meshes/Builders/capsuleBuilder.js +1 -1
- package/Meshes/Builders/capsuleBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.d.ts +2 -2
- package/Meshes/Builders/cylinderBuilder.js +2 -2
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.d.ts +1 -1
- package/Meshes/Builders/decalBuilder.js +1 -1
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/discBuilder.d.ts +2 -2
- package/Meshes/Builders/discBuilder.js +2 -2
- package/Meshes/Builders/discBuilder.js.map +1 -1
- package/Meshes/Builders/geodesicBuilder.d.ts +1 -1
- package/Meshes/Builders/geodesicBuilder.js +1 -1
- package/Meshes/Builders/geodesicBuilder.js.map +1 -1
- package/Meshes/Builders/goldbergBuilder.d.ts +1 -1
- package/Meshes/Builders/goldbergBuilder.js +1 -1
- package/Meshes/Builders/goldbergBuilder.js.map +1 -1
- package/Meshes/Builders/groundBuilder.d.ts +4 -4
- package/Meshes/Builders/groundBuilder.js +4 -4
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Builders/icoSphereBuilder.d.ts +2 -2
- package/Meshes/Builders/icoSphereBuilder.js +2 -2
- package/Meshes/Builders/icoSphereBuilder.js.map +1 -1
- package/Meshes/Builders/latheBuilder.d.ts +2 -2
- package/Meshes/Builders/latheBuilder.js +2 -2
- package/Meshes/Builders/latheBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.d.ts +6 -6
- package/Meshes/Builders/linesBuilder.js +6 -6
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/Builders/planeBuilder.d.ts +2 -2
- package/Meshes/Builders/planeBuilder.js +2 -2
- package/Meshes/Builders/planeBuilder.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.d.ts +1 -1
- package/Meshes/Builders/polygonBuilder.js +1 -1
- package/Meshes/Builders/polygonBuilder.js.map +1 -1
- package/Meshes/Builders/polyhedronBuilder.d.ts +3 -3
- package/Meshes/Builders/polyhedronBuilder.js +3 -3
- package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
- package/Meshes/Builders/ribbonBuilder.d.ts +4 -4
- package/Meshes/Builders/ribbonBuilder.js +4 -4
- package/Meshes/Builders/ribbonBuilder.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.d.ts +9 -9
- package/Meshes/Builders/shapeBuilder.js +9 -9
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/Meshes/Builders/sphereBuilder.d.ts +2 -2
- package/Meshes/Builders/sphereBuilder.js +2 -2
- package/Meshes/Builders/sphereBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.d.ts +2 -2
- package/Meshes/Builders/tiledBoxBuilder.js +2 -2
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/tiledPlaneBuilder.d.ts +2 -2
- package/Meshes/Builders/tiledPlaneBuilder.js +2 -2
- package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
- package/Meshes/Builders/torusBuilder.d.ts +2 -2
- package/Meshes/Builders/torusBuilder.js +2 -2
- package/Meshes/Builders/torusBuilder.js.map +1 -1
- package/Meshes/Builders/torusKnotBuilder.d.ts +2 -2
- package/Meshes/Builders/torusKnotBuilder.js +2 -2
- package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
- package/Meshes/Builders/tubeBuilder.d.ts +4 -4
- package/Meshes/Builders/tubeBuilder.js +4 -4
- package/Meshes/Builders/tubeBuilder.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +35 -35
- package/Meshes/abstractMesh.js +34 -34
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +3 -3
- package/Meshes/instancedMesh.js +1 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/linesMesh.d.ts +2 -2
- package/Meshes/linesMesh.js +3 -3
- package/Meshes/linesMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +36 -36
- package/Meshes/mesh.js +9 -17
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/meshLODLevel.d.ts +1 -1
- package/Meshes/meshLODLevel.js +1 -1
- package/Meshes/meshLODLevel.js.map +1 -1
- package/Meshes/meshSimplification.d.ts +6 -6
- package/Meshes/meshSimplification.js +4 -4
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/meshSimplificationSceneComponent.d.ts +1 -1
- package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
- package/Meshes/polygonMesh.d.ts +2 -2
- package/Meshes/polygonMesh.js +2 -2
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/transformNode.d.ts +1 -1
- package/Meshes/transformNode.js +1 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/assetsManager.d.ts +2 -2
- package/Misc/assetsManager.js +2 -2
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/dumpTools.d.ts +49 -0
- package/Misc/dumpTools.js +145 -0
- package/Misc/dumpTools.js.map +1 -0
- package/Misc/environmentTextureTools.js +2 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/iInspectable.d.ts +1 -1
- package/Misc/iInspectable.js.map +1 -1
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/sceneOptimizer.d.ts +12 -12
- package/Misc/sceneOptimizer.js +12 -12
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/screenshotTools.d.ts +10 -10
- package/Misc/screenshotTools.js +27 -23
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/tools.d.ts +6 -10
- package/Misc/tools.js +11 -68
- package/Misc/tools.js.map +1 -1
- package/Misc/videoRecorder.d.ts +1 -1
- package/Misc/videoRecorder.js +1 -1
- package/Misc/videoRecorder.js.map +1 -1
- package/Morph/morphTarget.d.ts +1 -1
- package/Morph/morphTarget.js +1 -1
- package/Morph/morphTarget.js.map +1 -1
- package/Morph/morphTargetManager.d.ts +1 -1
- package/Morph/morphTargetManager.js +1 -1
- package/Morph/morphTargetManager.js.map +1 -1
- package/Offline/IOfflineProvider.d.ts +1 -1
- package/Offline/IOfflineProvider.js.map +1 -1
- package/Offline/database.d.ts +1 -1
- package/Offline/database.js +1 -1
- package/Offline/database.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +1 -1
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +32 -7
- package/Particles/baseParticleSystem.js +1 -1
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +1 -1
- package/Particles/gpuParticleSystem.js +6 -38
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +2 -2
- package/Particles/particleSystem.js +7 -38
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +15 -15
- package/Particles/solidParticleSystem.js +13 -13
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Physics/IPhysicsEngine.d.ts +1 -1
- package/Physics/IPhysicsEngine.js.map +1 -1
- package/Physics/Plugins/ammoJSPlugin.d.ts +1 -1
- package/Physics/Plugins/ammoJSPlugin.js +1 -1
- package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/physicsEngine.d.ts +1 -1
- package/Physics/physicsEngine.js +1 -1
- package/Physics/physicsEngine.js.map +1 -1
- package/Physics/physicsEngineComponent.d.ts +3 -3
- package/Physics/physicsEngineComponent.js +2 -2
- package/Physics/physicsEngineComponent.js.map +1 -1
- package/Physics/physicsHelper.d.ts +12 -12
- package/Physics/physicsHelper.js +6 -6
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/physicsImpostor.d.ts +3 -3
- package/Physics/physicsImpostor.js +1 -1
- package/Physics/physicsImpostor.js.map +1 -1
- package/Physics/physicsJoint.d.ts +9 -9
- package/Physics/physicsJoint.js +5 -5
- package/Physics/physicsJoint.js.map +1 -1
- package/Physics/physicsRaycastResult.d.ts +1 -1
- package/Physics/physicsRaycastResult.js +1 -1
- package/Physics/physicsRaycastResult.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.d.ts +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.d.ts +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderEffect.d.ts +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderEffect.js +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderEffect.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.d.ts +2 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.d.ts +2 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js +2 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.d.ts +2 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.d.ts +1 -1
- package/PostProcesses/blackAndWhitePostProcess.js +1 -1
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.d.ts +1 -1
- package/PostProcesses/fxaaPostProcess.js +1 -1
- package/PostProcesses/fxaaPostProcess.js.map +1 -1
- package/PostProcesses/highlightsPostProcess.d.ts +2 -2
- package/PostProcesses/highlightsPostProcess.js +2 -2
- package/PostProcesses/highlightsPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.d.ts +1 -1
- package/PostProcesses/imageProcessingPostProcess.js +1 -1
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +32 -2
- package/PostProcesses/postProcess.js +49 -3
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/postProcessManager.d.ts +1 -1
- package/PostProcesses/postProcessManager.js +1 -1
- package/PostProcesses/postProcessManager.js.map +1 -1
- package/PostProcesses/refractionPostProcess.d.ts +2 -2
- package/PostProcesses/refractionPostProcess.js +2 -2
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/Probes/reflectionProbe.d.ts +2 -2
- package/Probes/reflectionProbe.js +1 -1
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/depthRenderer.js +10 -28
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +2 -2
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js +26 -45
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/imageProcessingFunctions.js +4 -1
- package/Shaders/ShadersInclude/imageProcessingFunctions.js.map +1 -1
- package/Shaders/circleOfConfusion.fragment.js +3 -1
- package/Shaders/circleOfConfusion.fragment.js.map +1 -1
- package/Sprites/sprite.d.ts +1 -1
- package/Sprites/sprite.js +1 -1
- package/Sprites/sprite.js.map +1 -1
- package/Sprites/spriteManager.d.ts +2 -2
- package/Sprites/spriteManager.js +1 -1
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spritePackedManager.d.ts +1 -1
- package/Sprites/spritePackedManager.js +1 -1
- package/Sprites/spritePackedManager.js.map +1 -1
- package/Sprites/spriteSceneComponent.d.ts +1 -1
- package/Sprites/spriteSceneComponent.js.map +1 -1
- package/Sprites/thinSprite.d.ts +1 -1
- package/Sprites/thinSprite.js +1 -1
- package/Sprites/thinSprite.js.map +1 -1
- package/XR/webXRCamera.d.ts +1 -1
- package/XR/webXRCamera.js +1 -1
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRExperienceHelper.d.ts +1 -1
- package/XR/webXRExperienceHelper.js +1 -1
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRInputSource.d.ts +1 -1
- package/XR/webXRInputSource.js +1 -1
- package/XR/webXRInputSource.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +1 -1
- package/XR/webXRSessionManager.js +1 -1
- package/XR/webXRSessionManager.js.map +1 -1
- package/abstractScene.d.ts +9 -9
- package/abstractScene.js +9 -9
- package/abstractScene.js.map +1 -1
- package/node.d.ts +6 -6
- package/node.js +5 -5
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +29 -24
- package/scene.js +24 -18
- package/scene.js.map +1 -1
- package/Materials/thinMaterialHelper.d.ts +0 -17
- package/Materials/thinMaterialHelper.js +0 -41
- package/Materials/thinMaterialHelper.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webXRInputSource.js","sourceRoot":"","sources":["../../../../../lts/core/generated/XR/webXRInputSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAI3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,IAAI,OAAO,GAAG,CAAC,CAAC;AA2BhB;;GAEG;AACH,MAAM,OAAO,gBAAgB;IA0CzB;;;;;;OAMG;IACH,YACY,MAAa;IACrB,sDAAsD;IAC/C,WAA0B,EACzB,WAAoC,EAAE;QAHtC,WAAM,GAAN,MAAM,CAAO;QAEd,gBAAW,GAAX,WAAW,CAAe;QACzB,aAAQ,GAAR,QAAQ,CAA8B;QApD1C,eAAU,GAAG,IAAI,OAAO,EAAE,CAAC;QAE3B,cAAS,GAAG,KAAK,CAAC;QAY1B;;;;WAIG;QACI,wBAAmB,GAAG,IAAI,UAAU,EAAoB,CAAC;QAChE;;;;WAIG;QACI,2BAAsB,GAAG,IAAI,UAAU,EAAgB,CAAC;QAC/D;;WAEG;QACI,qCAAgC,GAAG,IAAI,UAAU,EAAiC,CAAC;QAyBtF,IAAI,CAAC,SAAS,GAAG,cAAc,OAAO,EAAE,IAAI,WAAW,CAAC,aAAa,IAAI,WAAW,CAAC,UAA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W,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;gBAC9F,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE;oBACnC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC3B,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBACtC,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;iBACzC;aACJ;YACD,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;SACtC;QACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,kEAAkE;YAClE,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;SACpD;IACL,CAAC;CACJ","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\nimport type { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { WebXRAbstractMotionController } from \"./motionController/webXRAbstractMotionController\";\r\nimport { WebXRMotionControllerManager } from \"./motionController/webXRMotionControllerManager\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { WebXRCamera } from \"./webXRCamera\";\r\n\r\nlet idCount = 0;\r\n\r\n/**\r\n * Configuration options for the WebXR controller creation\r\n */\r\nexport interface IWebXRControllerOptions {\r\n /**\r\n * Should the controller mesh be animated when a user interacts with it\r\n * The pressed buttons / thumbstick and touchpad animations will be disabled\r\n */\r\n disableMotionControllerAnimation?: boolean;\r\n /**\r\n * Do not load the controller mesh, in case a different mesh needs to be loaded.\r\n */\r\n doNotLoadControllerMesh?: boolean;\r\n /**\r\n * Force a specific controller type for this controller.\r\n * This can be used when creating your own profile or when testing different controllers\r\n */\r\n forceControllerProfile?: string;\r\n /**\r\n * Defines a rendering group ID for meshes that will be loaded.\r\n * This is for the default controllers only.\r\n */\r\n renderingGroupId?: number;\r\n}\r\n\r\n/**\r\n * Represents an XR controller\r\n */\r\nexport class WebXRInputSource {\r\n private _tmpVector = new Vector3();\r\n private _uniqueId: string;\r\n private _disposed = false;\r\n\r\n /**\r\n * Represents the part of the controller that is held. This may not exist if the controller is the head mounted display itself, if that's the case only the pointer from the head will be available\r\n */\r\n public grip?: AbstractMesh;\r\n /**\r\n * If available, this is the gamepad object related to this controller.\r\n * Using this object it is possible to get click events and trackpad changes of the\r\n * webxr controller that is currently being used.\r\n */\r\n public motionController?: WebXRAbstractMotionController;\r\n /**\r\n * Event that fires when the controller is removed/disposed.\r\n * The object provided as event data is this controller, after associated assets were disposed.\r\n * uniqueId is still available.\r\n */\r\n public onDisposeObservable = new Observable<WebXRInputSource>();\r\n /**\r\n * Will be triggered when the mesh associated with the motion controller is done loading.\r\n * It is also possible that this will never trigger (!) if no mesh was loaded, or if the developer decides to load a different mesh\r\n * A shortened version of controller -> motion controller -> on mesh loaded.\r\n */\r\n public onMeshLoadedObservable = new Observable<AbstractMesh>();\r\n /**\r\n * Observers registered here will trigger when a motion controller profile was assigned to this xr controller\r\n */\r\n public onMotionControllerInitObservable = new Observable<WebXRAbstractMotionController>();\r\n /**\r\n * Pointer which can be used to select objects or attach a visible laser to\r\n */\r\n public pointer: AbstractMesh;\r\n\r\n /**\r\n * The last XRPose the was calculated on the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRPose?: XRPose;\r\n\r\n /**\r\n * Creates the input source object\r\n * @see https://doc.babylonjs.com/how_to/webxr_controllers_support\r\n * @param _scene the scene which the controller should be associated to\r\n * @param inputSource the underlying input source for the controller\r\n * @param _options options for this controller creation\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n /** The underlying input source for the controller */\r\n public inputSource: XRInputSource,\r\n private _options: IWebXRControllerOptions = {}\r\n ) {\r\n this._uniqueId = `controller-${idCount++}-${inputSource.targetRayMode}-${inputSource.handedness}`;\r\n\r\n this.pointer = new AbstractMesh(`${this._uniqueId}-pointer`, _scene);\r\n this.pointer.rotationQuaternion = new Quaternion();\r\n\r\n if (this.inputSource.gripSpace) {\r\n this.grip = new AbstractMesh(`${this._uniqueId}-grip`, this._scene);\r\n this.grip.rotationQuaternion = new Quaternion();\r\n }\r\n\r\n this._tmpVector.set(0, 0, this._scene.useRightHandedSystem ? -1.0 : 1.0);\r\n\r\n // for now only load motion controllers if gamepad object available\r\n if (this.inputSource.gamepad && this.inputSource.targetRayMode === \"tracked-pointer\") {\r\n WebXRMotionControllerManager.GetMotionControllerWithXRInput(inputSource, _scene, this._options.forceControllerProfile).then(\r\n (motionController) => {\r\n this.motionController = motionController;\r\n this.onMotionControllerInitObservable.notifyObservers(motionController);\r\n // should the model be loaded?\r\n if (!this._options.doNotLoadControllerMesh && !this.motionController._doNotLoadControllerMesh) {\r\n this.motionController.loadModel().then((success) => {\r\n if (success && this.motionController && this.motionController.rootMesh) {\r\n if (this._options.renderingGroupId) {\r\n // anything other than 0?\r\n this.motionController.rootMesh.renderingGroupId = this._options.renderingGroupId;\r\n this.motionController.rootMesh.getChildMeshes(false).forEach((mesh) => (mesh.renderingGroupId = this._options.renderingGroupId!));\r\n }\r\n this.onMeshLoadedObservable.notifyObservers(this.motionController.rootMesh);\r\n this.motionController.rootMesh.parent = this.grip || this.pointer;\r\n this.motionController.disableAnimation = !!this._options.disableMotionControllerAnimation;\r\n }\r\n // make sure to dispose is the controller is already disposed\r\n if (this._disposed) {\r\n this.motionController?.dispose();\r\n }\r\n });\r\n }\r\n },\r\n () => {\r\n Tools.Warn(`Could not find a matching motion controller for the registered input source`);\r\n }\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get this controllers unique id\r\n */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /**\r\n * Disposes of the object\r\n */\r\n public dispose() {\r\n if (this.grip) {\r\n this.grip.dispose(true);\r\n }\r\n if (this.motionController) {\r\n this.motionController.dispose();\r\n }\r\n this.pointer.dispose(true);\r\n this.onMotionControllerInitObservable.clear();\r\n this.onMeshLoadedObservable.clear();\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this._disposed = true;\r\n }\r\n\r\n /**\r\n * Gets a world space ray coming from the pointer or grip\r\n * @param result the resulting ray\r\n * @param gripIfAvailable use the grip mesh instead of the pointer, if available\r\n */\r\n public getWorldPointerRayToRef(result: Ray, gripIfAvailable: boolean = false) {\r\n const object = gripIfAvailable && this.grip ? this.grip : this.pointer;\r\n Vector3.TransformNormalToRef(this._tmpVector, object.getWorldMatrix(), result.direction);\r\n result.direction.normalize();\r\n result.origin.copyFrom(object.absolutePosition);\r\n result.length = 1000;\r\n }\r\n\r\n /**\r\n * Updates the controller pose based on the given XRFrame\r\n * @param xrFrame xr frame to update the pose with\r\n * @param referenceSpace reference space to use\r\n * @param xrCamera the xr camera, used for parenting\r\n */\r\n public updateFromXRFrame(xrFrame: XRFrame, referenceSpace: XRReferenceSpace, xrCamera: WebXRCamera) {\r\n const pose = xrFrame.getPose(this.inputSource.targetRaySpace, referenceSpace);\r\n this._lastXRPose = pose;\r\n\r\n // Update the pointer mesh\r\n if (pose) {\r\n const pos = pose.transform.position;\r\n this.pointer.position.set(pos.x, pos.y, pos.z);\r\n const orientation = pose.transform.orientation;\r\n this.pointer.rotationQuaternion!.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this.pointer.position.z *= -1;\r\n this.pointer.rotationQuaternion!.z *= -1;\r\n this.pointer.rotationQuaternion!.w *= -1;\r\n }\r\n this.pointer.parent = xrCamera.parent;\r\n }\r\n\r\n // Update the grip mesh if it exists\r\n if (this.inputSource.gripSpace && this.grip) {\r\n const pose = xrFrame.getPose(this.inputSource.gripSpace, referenceSpace);\r\n if (pose) {\r\n const pos = pose.transform.position;\r\n const orientation = pose.transform.orientation;\r\n this.grip.position.set(pos.x, pos.y, pos.z);\r\n this.grip.rotationQuaternion!.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this.grip.position.z *= -1;\r\n this.grip.rotationQuaternion!.z *= -1;\r\n this.grip.rotationQuaternion!.w *= -1;\r\n }\r\n }\r\n this.grip.parent = xrCamera.parent;\r\n }\r\n if (this.motionController) {\r\n // either update buttons only or also position, if in gamepad mode\r\n this.motionController.updateFromXRFrame(xrFrame);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webXRInputSource.js","sourceRoot":"","sources":["../../../../../lts/core/generated/XR/webXRInputSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAI3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,IAAI,OAAO,GAAG,CAAC,CAAC;AA2BhB;;GAEG;AACH,MAAM,OAAO,gBAAgB;IA0CzB;;;;;;OAMG;IACH,YACY,MAAa;IACrB,sDAAsD;IAC/C,WAA0B,EACzB,WAAoC,EAAE;QAHtC,WAAM,GAAN,MAAM,CAAO;QAEd,gBAAW,GAAX,WAAW,CAAe;QACzB,aAAQ,GAAR,QAAQ,CAA8B;QApD1C,eAAU,GAAG,IAAI,OAAO,EAAE,CAAC;QAE3B,cAAS,GAAG,KAAK,CAAC;QAY1B;;;;WAIG;QACI,wBAAmB,GAAG,IAAI,UAAU,EAAoB,CAAC;QAChE;;;;WAIG;QACI,2BAAsB,GAAG,IAAI,UAAU,EAAgB,CAAC;QAC/D;;WAEG;QACI,qCAAgC,GAAG,IAAI,UAAU,EAAiC,CAAC;QAyBtF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C;gBAC5C,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;gBAC9F,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE;oBACnC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC3B,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBACtC,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;iBACzC;aACJ;YACD,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;SACtC;QACD,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,kEAAkE;YAClE,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;SACpD;IACL,CAAC;CACJ","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector\";\r\nimport type { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { WebXRAbstractMotionController } from \"./motionController/webXRAbstractMotionController\";\r\nimport { WebXRMotionControllerManager } from \"./motionController/webXRMotionControllerManager\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { WebXRCamera } from \"./webXRCamera\";\r\n\r\nlet idCount = 0;\r\n\r\n/**\r\n * Configuration options for the WebXR controller creation\r\n */\r\nexport interface IWebXRControllerOptions {\r\n /**\r\n * Should the controller mesh be animated when a user interacts with it\r\n * The pressed buttons / thumbstick and touchpad animations will be disabled\r\n */\r\n disableMotionControllerAnimation?: boolean;\r\n /**\r\n * Do not load the controller mesh, in case a different mesh needs to be loaded.\r\n */\r\n doNotLoadControllerMesh?: boolean;\r\n /**\r\n * Force a specific controller type for this controller.\r\n * This can be used when creating your own profile or when testing different controllers\r\n */\r\n forceControllerProfile?: string;\r\n /**\r\n * Defines a rendering group ID for meshes that will be loaded.\r\n * This is for the default controllers only.\r\n */\r\n renderingGroupId?: number;\r\n}\r\n\r\n/**\r\n * Represents an XR controller\r\n */\r\nexport class WebXRInputSource {\r\n private _tmpVector = new Vector3();\r\n private _uniqueId: string;\r\n private _disposed = false;\r\n\r\n /**\r\n * Represents the part of the controller that is held. This may not exist if the controller is the head mounted display itself, if that's the case only the pointer from the head will be available\r\n */\r\n public grip?: AbstractMesh;\r\n /**\r\n * If available, this is the gamepad object related to this controller.\r\n * Using this object it is possible to get click events and trackpad changes of the\r\n * webxr controller that is currently being used.\r\n */\r\n public motionController?: WebXRAbstractMotionController;\r\n /**\r\n * Event that fires when the controller is removed/disposed.\r\n * The object provided as event data is this controller, after associated assets were disposed.\r\n * uniqueId is still available.\r\n */\r\n public onDisposeObservable = new Observable<WebXRInputSource>();\r\n /**\r\n * Will be triggered when the mesh associated with the motion controller is done loading.\r\n * It is also possible that this will never trigger (!) if no mesh was loaded, or if the developer decides to load a different mesh\r\n * A shortened version of controller -> motion controller -> on mesh loaded.\r\n */\r\n public onMeshLoadedObservable = new Observable<AbstractMesh>();\r\n /**\r\n * Observers registered here will trigger when a motion controller profile was assigned to this xr controller\r\n */\r\n public onMotionControllerInitObservable = new Observable<WebXRAbstractMotionController>();\r\n /**\r\n * Pointer which can be used to select objects or attach a visible laser to\r\n */\r\n public pointer: AbstractMesh;\r\n\r\n /**\r\n * The last XRPose the was calculated on the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRPose?: XRPose;\r\n\r\n /**\r\n * Creates the input source object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRInputControllerSupport\r\n * @param _scene the scene which the controller should be associated to\r\n * @param inputSource the underlying input source for the controller\r\n * @param _options options for this controller creation\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n /** The underlying input source for the controller */\r\n public inputSource: XRInputSource,\r\n private _options: IWebXRControllerOptions = {}\r\n ) {\r\n this._uniqueId = `controller-${idCount++}-${inputSource.targetRayMode}-${inputSource.handedness}`;\r\n\r\n this.pointer = new AbstractMesh(`${this._uniqueId}-pointer`, _scene);\r\n this.pointer.rotationQuaternion = new Quaternion();\r\n\r\n if (this.inputSource.gripSpace) {\r\n this.grip = new AbstractMesh(`${this._uniqueId}-grip`, this._scene);\r\n this.grip.rotationQuaternion = new Quaternion();\r\n }\r\n\r\n this._tmpVector.set(0, 0, this._scene.useRightHandedSystem ? -1.0 : 1.0);\r\n\r\n // for now only load motion controllers if gamepad object available\r\n if (this.inputSource.gamepad && this.inputSource.targetRayMode === \"tracked-pointer\") {\r\n WebXRMotionControllerManager.GetMotionControllerWithXRInput(inputSource, _scene, this._options.forceControllerProfile).then(\r\n (motionController) => {\r\n this.motionController = motionController;\r\n this.onMotionControllerInitObservable.notifyObservers(motionController);\r\n // should the model be loaded?\r\n if (!this._options.doNotLoadControllerMesh && !this.motionController._doNotLoadControllerMesh) {\r\n this.motionController.loadModel().then((success) => {\r\n if (success && this.motionController && this.motionController.rootMesh) {\r\n if (this._options.renderingGroupId) {\r\n // anything other than 0?\r\n this.motionController.rootMesh.renderingGroupId = this._options.renderingGroupId;\r\n this.motionController.rootMesh.getChildMeshes(false).forEach((mesh) => (mesh.renderingGroupId = this._options.renderingGroupId!));\r\n }\r\n this.onMeshLoadedObservable.notifyObservers(this.motionController.rootMesh);\r\n this.motionController.rootMesh.parent = this.grip || this.pointer;\r\n this.motionController.disableAnimation = !!this._options.disableMotionControllerAnimation;\r\n }\r\n // make sure to dispose is the controller is already disposed\r\n if (this._disposed) {\r\n this.motionController?.dispose();\r\n }\r\n });\r\n }\r\n },\r\n () => {\r\n Tools.Warn(`Could not find a matching motion controller for the registered input source`);\r\n }\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get this controllers unique id\r\n */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /**\r\n * Disposes of the object\r\n */\r\n public dispose() {\r\n if (this.grip) {\r\n this.grip.dispose(true);\r\n }\r\n if (this.motionController) {\r\n this.motionController.dispose();\r\n }\r\n this.pointer.dispose(true);\r\n this.onMotionControllerInitObservable.clear();\r\n this.onMeshLoadedObservable.clear();\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this._disposed = true;\r\n }\r\n\r\n /**\r\n * Gets a world space ray coming from the pointer or grip\r\n * @param result the resulting ray\r\n * @param gripIfAvailable use the grip mesh instead of the pointer, if available\r\n */\r\n public getWorldPointerRayToRef(result: Ray, gripIfAvailable: boolean = false) {\r\n const object = gripIfAvailable && this.grip ? this.grip : this.pointer;\r\n Vector3.TransformNormalToRef(this._tmpVector, object.getWorldMatrix(), result.direction);\r\n result.direction.normalize();\r\n result.origin.copyFrom(object.absolutePosition);\r\n result.length = 1000;\r\n }\r\n\r\n /**\r\n * Updates the controller pose based on the given XRFrame\r\n * @param xrFrame xr frame to update the pose with\r\n * @param referenceSpace reference space to use\r\n * @param xrCamera the xr camera, used for parenting\r\n */\r\n public updateFromXRFrame(xrFrame: XRFrame, referenceSpace: XRReferenceSpace, xrCamera: WebXRCamera) {\r\n const pose = xrFrame.getPose(this.inputSource.targetRaySpace, referenceSpace);\r\n this._lastXRPose = pose;\r\n\r\n // Update the pointer mesh\r\n if (pose) {\r\n const pos = pose.transform.position;\r\n this.pointer.position.set(pos.x, pos.y, pos.z);\r\n const orientation = pose.transform.orientation;\r\n this.pointer.rotationQuaternion!.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this.pointer.position.z *= -1;\r\n this.pointer.rotationQuaternion!.z *= -1;\r\n this.pointer.rotationQuaternion!.w *= -1;\r\n }\r\n this.pointer.parent = xrCamera.parent;\r\n }\r\n\r\n // Update the grip mesh if it exists\r\n if (this.inputSource.gripSpace && this.grip) {\r\n const pose = xrFrame.getPose(this.inputSource.gripSpace, referenceSpace);\r\n if (pose) {\r\n const pos = pose.transform.position;\r\n const orientation = pose.transform.orientation;\r\n this.grip.position.set(pos.x, pos.y, pos.z);\r\n this.grip.rotationQuaternion!.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this.grip.position.z *= -1;\r\n this.grip.rotationQuaternion!.z *= -1;\r\n this.grip.rotationQuaternion!.w *= -1;\r\n }\r\n }\r\n this.grip.parent = xrCamera.parent;\r\n }\r\n if (this.motionController) {\r\n // either update buttons only or also position, if in gamepad mode\r\n this.motionController.updateFromXRFrame(xrFrame);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -9,7 +9,7 @@ import type { Viewport } from "../Maths/math.viewport";
|
|
|
9
9
|
import type { WebXRLayerWrapper } from "./webXRLayerWrapper";
|
|
10
10
|
/**
|
|
11
11
|
* Manages an XRSession to work with Babylon's engine
|
|
12
|
-
* @see https://doc.babylonjs.com/
|
|
12
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRSessionManagers
|
|
13
13
|
*/
|
|
14
14
|
export declare class WebXRSessionManager implements IDisposable, IWebXRRenderTargetTextureProvider {
|
|
15
15
|
/** The scene which the session should be created for */
|
|
@@ -5,7 +5,7 @@ import { NativeXRLayerWrapper, NativeXRRenderTarget } from "./native/nativeXRRen
|
|
|
5
5
|
import { WebXRWebGLLayerWrapper } from "./webXRWebGLLayer.js";
|
|
6
6
|
/**
|
|
7
7
|
* Manages an XRSession to work with Babylon's engine
|
|
8
|
-
* @see https://doc.babylonjs.com/
|
|
8
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRSessionManagers
|
|
9
9
|
*/
|
|
10
10
|
export class WebXRSessionManager {
|
|
11
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webXRSessionManager.js","sourceRoot":"","sources":["../../../../../lts/core/generated/XR/webXR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I,IAAI,CAAC,aAAa,EAAE;YACpB,QAAQ,EAAE,CAAC;SACd;aAAM,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,oBAAoB,EAAE;YAClD,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SAC9C;IACL,CAAC;IAED;;OAEG;IACH,IAAW,yBAAyB;;QAChC,OAAO,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,yBAAyB,KAAI,KAAK,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;;QACrB,OAAO,CAAA,MAAA,IAAI,CAAC,iBAAiB,0CAAE,cAAc,KAAI,IAAI,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc,CAAC,KAAuB;QAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,iBAAiB,EAAE;YACxB,IAAI,CAAC,iBAAiB,CAAC,cAAc,GAAG,GAAG,CAAC;SAC/C;IACL,CAAC;CACJ","sourcesContent":["import { Logger } from \"../Misc/logger\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { IDisposable, Scene } from \"../scene\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { WebXRRenderTarget } from \"./webXRTypes\";\r\nimport { WebXRManagedOutputCanvas, WebXRManagedOutputCanvasOptions } from \"./webXRManagedOutputCanvas\";\r\nimport type { Engine } from \"../Engines/engine\";\r\nimport type { IWebXRRenderTargetTextureProvider, WebXRLayerRenderTargetTextureProvider } from \"./webXRRenderTargetTextureProvider\";\r\nimport type { Viewport } from \"../Maths/math.viewport\";\r\nimport type { WebXRLayerWrapper } from \"./webXRLayerWrapper\";\r\nimport { NativeXRLayerWrapper, NativeXRRenderTarget } from \"./native/nativeXRRenderTarget\";\r\nimport { WebXRWebGLLayerWrapper } from \"./webXRWebGLLayer\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\n\r\n/**\r\n * Manages an XRSession to work with Babylon's engine\r\n * @see https://doc.babylonjs.com/how_to/webxr_session_manager\r\n */\r\nexport class WebXRSessionManager implements IDisposable, IWebXRRenderTargetTextureProvider {\r\n private _engine: Nullable<Engine>;\r\n private _referenceSpace: XRReferenceSpace;\r\n private _baseLayerWrapper: Nullable<WebXRLayerWrapper>;\r\n private _baseLayerRTTProvider: Nullable<WebXRLayerRenderTargetTextureProvider>;\r\n private _xrNavigator: any;\r\n private _sessionMode: XRSessionMode;\r\n private _onEngineDisposedObserver: Nullable<Observer<ThinEngine>>;\r\n\r\n /**\r\n * The base reference space from which the session started. good if you want to reset your\r\n * reference space\r\n */\r\n public baseReferenceSpace: XRReferenceSpace;\r\n /**\r\n * Current XR frame\r\n */\r\n public currentFrame: Nullable<XRFrame>;\r\n /** WebXR timestamp updated every frame */\r\n public currentTimestamp: number = -1;\r\n /**\r\n * Used just in case of a failure to initialize an immersive session.\r\n * The viewer reference space is compensated using this height, creating a kind of \"viewer-floor\" reference space\r\n */\r\n public defaultHeightCompensation = 1.7;\r\n /**\r\n * Fires every time a new xrFrame arrives which can be used to update the camera\r\n */\r\n public onXRFrameObservable: Observable<XRFrame> = new Observable<XRFrame>();\r\n /**\r\n * Fires when the reference space changed\r\n */\r\n public onXRReferenceSpaceChanged: Observable<XRReferenceSpace> = new Observable();\r\n /**\r\n * Fires when the xr session is ended either by the device or manually done\r\n */\r\n public onXRSessionEnded: Observable<any> = new Observable<any>();\r\n /**\r\n * Fires when the xr session is initialized: right after requestSession was called and returned with a successful result\r\n */\r\n public onXRSessionInit: Observable<XRSession> = new Observable<XRSession>();\r\n /**\r\n * Underlying xr session\r\n */\r\n public session: XRSession;\r\n /**\r\n * The viewer (head position) reference space. This can be used to get the XR world coordinates\r\n * or get the offset the player is currently at.\r\n */\r\n public viewerReferenceSpace: XRReferenceSpace;\r\n /**\r\n * Are we currently in the XR loop?\r\n */\r\n public inXRFrameLoop: boolean = false;\r\n /**\r\n * Are we in an XR session?\r\n */\r\n public inXRSession: boolean = false;\r\n\r\n /**\r\n * Constructs a WebXRSessionManager, this must be initialized within a user action before usage\r\n * @param scene The scene which the session should be created for\r\n */\r\n constructor(\r\n /** The scene which the session should be created for */\r\n public scene: Scene\r\n ) {\r\n this._engine = scene.getEngine();\r\n this._onEngineDisposedObserver = this._engine.onDisposeObservable.addOnce(() => {\r\n this._engine = null;\r\n });\r\n scene.onDisposeObservable.addOnce(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * The current reference space used in this session. This reference space can constantly change!\r\n * It is mainly used to offset the camera's position.\r\n */\r\n public get referenceSpace(): XRReferenceSpace {\r\n return this._referenceSpace;\r\n }\r\n\r\n /**\r\n * Set a new reference space and triggers the observable\r\n */\r\n public set referenceSpace(newReferenceSpace: XRReferenceSpace) {\r\n this._referenceSpace = newReferenceSpace;\r\n this.onXRReferenceSpaceChanged.notifyObservers(this._referenceSpace);\r\n }\r\n\r\n /**\r\n * The mode for the managed XR session\r\n */\r\n public get sessionMode(): XRSessionMode {\r\n return this._sessionMode;\r\n }\r\n\r\n /**\r\n * Disposes of the session manager\r\n * This should be called explicitly by the dev, if required.\r\n */\r\n public dispose() {\r\n // disposing without leaving XR? Exit XR first\r\n if (this.inXRSession) {\r\n this.exitXRAsync();\r\n }\r\n this.onXRFrameObservable.clear();\r\n this.onXRSessionEnded.clear();\r\n this.onXRReferenceSpaceChanged.clear();\r\n this.onXRSessionInit.clear();\r\n this._engine?.onDisposeObservable.remove(this._onEngineDisposedObserver);\r\n this._engine = null;\r\n }\r\n\r\n /**\r\n * Stops the xrSession and restores the render loop\r\n * @returns Promise which resolves after it exits XR\r\n */\r\n public exitXRAsync() {\r\n if (this.session && this.inXRSession) {\r\n this.inXRSession = false;\r\n return this.session.end().catch(() => {\r\n Logger.Warn(\"Could not end XR session.\");\r\n });\r\n }\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Attempts to set the framebuffer-size-normalized viewport to be rendered this frame for this view.\r\n * In the event of a failure, the supplied viewport is not updated.\r\n * @param viewport the viewport to which the view will be rendered\r\n * @param view the view for which to set the viewport\r\n * @returns whether the operation was successful\r\n */\r\n public trySetViewportForView(viewport: Viewport, view: XRView): boolean {\r\n return this._baseLayerRTTProvider?.trySetViewportForView(viewport, view) || false;\r\n }\r\n\r\n /**\r\n * Gets the correct render target texture to be rendered this frame for this eye\r\n * @param eye the eye for which to get the render target\r\n * @returns the render target for the specified eye or null if not available\r\n */\r\n public getRenderTargetTextureForEye(eye: XREye): Nullable<RenderTargetTexture> {\r\n return this._baseLayerRTTProvider?.getRenderTargetTextureForEye(eye) || null;\r\n }\r\n\r\n /**\r\n * Gets the correct render target texture to be rendered this frame for this view\r\n * @param view the view for which to get the render target\r\n * @returns the render target for the specified view or null if not available\r\n */\r\n public getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture> {\r\n return this._baseLayerRTTProvider?.getRenderTargetTextureForView(view) || null;\r\n }\r\n\r\n /**\r\n * Creates a WebXRRenderTarget object for the XR session\r\n * @param options optional options to provide when creating a new render target\r\n * @returns a WebXR render target to which the session can render\r\n */\r\n public getWebXRRenderTarget(options?: WebXRManagedOutputCanvasOptions): WebXRRenderTarget {\r\n const engine = this.scene.getEngine();\r\n if (this._xrNavigator.xr.native) {\r\n return new NativeXRRenderTarget(this);\r\n } else {\r\n options = options || WebXRManagedOutputCanvasOptions.GetDefaults(engine);\r\n options.canvasElement = options.canvasElement || engine.getRenderingCanvas() || undefined;\r\n return new WebXRManagedOutputCanvas(this, options);\r\n }\r\n }\r\n\r\n /**\r\n * Initializes the manager\r\n * After initialization enterXR can be called to start an XR session\r\n * @returns Promise which resolves after it is initialized\r\n */\r\n public initializeAsync(): Promise<void> {\r\n // Check if the browser supports webXR\r\n this._xrNavigator = navigator;\r\n if (!this._xrNavigator.xr) {\r\n return Promise.reject(\"WebXR not available\");\r\n }\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Initializes an xr session\r\n * @param xrSessionMode mode to initialize\r\n * @param xrSessionInit defines optional and required values to pass to the session builder\r\n * @returns a promise which will resolve once the session has been initialized\r\n */\r\n public initializeSessionAsync(xrSessionMode: XRSessionMode = \"immersive-vr\", xrSessionInit: XRSessionInit = {}): Promise<XRSession> {\r\n return this._xrNavigator.xr.requestSession(xrSessionMode, xrSessionInit).then((session: XRSession) => {\r\n this.session = session;\r\n this._sessionMode = xrSessionMode;\r\n this.onXRSessionInit.notifyObservers(session);\r\n this.inXRSession = true;\r\n\r\n // handle when the session is ended (By calling session.end or device ends its own session eg. pressing home button on phone)\r\n this.session.addEventListener(\r\n \"end\",\r\n () => {\r\n this.inXRSession = false;\r\n\r\n // Notify frame observers\r\n this.onXRSessionEnded.notifyObservers(null);\r\n\r\n if (this._engine) {\r\n // make sure dimensions object is restored\r\n this._engine.framebufferDimensionsObject = null;\r\n\r\n // Restore frame buffer to avoid clear on xr framebuffer after session end\r\n this._engine.restoreDefaultFramebuffer();\r\n\r\n // Need to restart render loop as after the session is ended the last request for new frame will never call callback\r\n this._engine.customAnimationFrameRequester = null;\r\n this._engine._renderLoop();\r\n }\r\n\r\n // Dispose render target textures.\r\n // Only dispose on native because we can't destroy opaque textures on browser.\r\n if (this.isNative) {\r\n this._baseLayerRTTProvider?.dispose();\r\n }\r\n this._baseLayerRTTProvider = null;\r\n this._baseLayerWrapper = null;\r\n },\r\n { once: true }\r\n );\r\n\r\n return this.session;\r\n });\r\n }\r\n\r\n /**\r\n * Checks if a session would be supported for the creation options specified\r\n * @param sessionMode session mode to check if supported eg. immersive-vr\r\n * @returns A Promise that resolves to true if supported and false if not\r\n */\r\n public isSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean> {\r\n return WebXRSessionManager.IsSessionSupportedAsync(sessionMode);\r\n }\r\n\r\n /**\r\n * Resets the reference space to the one started the session\r\n */\r\n public resetReferenceSpace() {\r\n this.referenceSpace = this.baseReferenceSpace;\r\n }\r\n\r\n /**\r\n * Starts rendering to the xr layer\r\n */\r\n public runXRRenderLoop() {\r\n if (!this.inXRSession || !this._engine) {\r\n return;\r\n }\r\n\r\n // Tell the engine's render loop to be driven by the xr session's refresh rate and provide xr pose information\r\n this._engine.customAnimationFrameRequester = {\r\n requestAnimationFrame: this.session.requestAnimationFrame.bind(this.session),\r\n renderFunction: (timestamp: number, xrFrame: Nullable<XRFrame>) => {\r\n if (!this.inXRSession || !this._engine) {\r\n return;\r\n }\r\n // Store the XR frame and timestamp in the session manager\r\n this.currentFrame = xrFrame;\r\n this.currentTimestamp = timestamp;\r\n if (xrFrame) {\r\n this.inXRFrameLoop = true;\r\n this._engine.framebufferDimensionsObject = this._baseLayerRTTProvider?.getFramebufferDimensions() || null;\r\n this.onXRFrameObservable.notifyObservers(xrFrame);\r\n this._engine._renderLoop();\r\n this._engine.framebufferDimensionsObject = null;\r\n this.inXRFrameLoop = false;\r\n }\r\n },\r\n };\r\n\r\n this._engine.framebufferDimensionsObject = this._baseLayerRTTProvider?.getFramebufferDimensions() || null;\r\n\r\n // Stop window's animation frame and trigger sessions animation frame\r\n if (typeof window !== \"undefined\" && window.cancelAnimationFrame) {\r\n window.cancelAnimationFrame(this._engine._frameHandler);\r\n }\r\n this._engine._renderLoop();\r\n }\r\n\r\n /**\r\n * Sets the reference space on the xr session\r\n * @param referenceSpaceType space to set\r\n * @returns a promise that will resolve once the reference space has been set\r\n */\r\n public setReferenceSpaceTypeAsync(referenceSpaceType: XRReferenceSpaceType = \"local-floor\"): Promise<XRReferenceSpace> {\r\n return this.session\r\n .requestReferenceSpace(referenceSpaceType)\r\n .then(\r\n (referenceSpace) => {\r\n return referenceSpace as XRReferenceSpace;\r\n },\r\n (rejectionReason) => {\r\n Logger.Error(\"XR.requestReferenceSpace failed for the following reason: \");\r\n Logger.Error(rejectionReason);\r\n Logger.Log('Defaulting to universally-supported \"viewer\" reference space type.');\r\n\r\n return this.session.requestReferenceSpace(\"viewer\").then(\r\n (referenceSpace) => {\r\n const heightCompensation = new XRRigidTransform({ x: 0, y: -this.defaultHeightCompensation, z: 0 });\r\n return (referenceSpace as XRReferenceSpace).getOffsetReferenceSpace(heightCompensation);\r\n },\r\n (rejectionReason) => {\r\n Logger.Error(rejectionReason);\r\n throw 'XR initialization failed: required \"viewer\" reference space type not supported.';\r\n }\r\n );\r\n }\r\n )\r\n .then((referenceSpace) => {\r\n // create viewer reference space before setting the first reference space\r\n return this.session.requestReferenceSpace(\"viewer\").then((viewerReferenceSpace) => {\r\n this.viewerReferenceSpace = viewerReferenceSpace as XRReferenceSpace;\r\n return referenceSpace;\r\n });\r\n })\r\n .then((referenceSpace) => {\r\n // initialize the base and offset (currently the same)\r\n this.referenceSpace = this.baseReferenceSpace = referenceSpace;\r\n return this.referenceSpace;\r\n });\r\n }\r\n\r\n /**\r\n * Updates the render state of the session.\r\n * Note that this is deprecated in favor of WebXRSessionManager.updateRenderState().\r\n * @param state state to set\r\n * @returns a promise that resolves once the render state has been updated\r\n * @deprecated\r\n */\r\n public updateRenderStateAsync(state: XRRenderState): Promise<void> {\r\n return Promise.resolve(this.session.updateRenderState(state));\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _setBaseLayerWrapper(baseLayerWrapper: Nullable<WebXRLayerWrapper>): void {\r\n if (this.isNative) {\r\n this._baseLayerRTTProvider?.dispose();\r\n }\r\n this._baseLayerWrapper = baseLayerWrapper;\r\n this._baseLayerRTTProvider = this._baseLayerWrapper?.createRenderTargetTextureProvider(this) || null;\r\n }\r\n\r\n /**\r\n * Updates the render state of the session\r\n * @param state state to set\r\n */\r\n public updateRenderState(state: XRRenderStateInit): void {\r\n if (state.baseLayer) {\r\n this._setBaseLayerWrapper(this.isNative ? new NativeXRLayerWrapper(state.baseLayer) : new WebXRWebGLLayerWrapper(state.baseLayer));\r\n }\r\n\r\n this.session.updateRenderState(state);\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves with a boolean indicating if the provided session mode is supported by this browser\r\n * @param sessionMode defines the session to test\r\n * @returns a promise with boolean as final value\r\n */\r\n public static IsSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean> {\r\n if (!(navigator as any).xr) {\r\n return Promise.resolve(false);\r\n }\r\n // When the specs are final, remove supportsSession!\r\n const functionToUse = (navigator as any).xr.isSessionSupported || (navigator as any).xr.supportsSession;\r\n if (!functionToUse) {\r\n return Promise.resolve(false);\r\n } else {\r\n return functionToUse\r\n .call((navigator as any).xr, sessionMode)\r\n .then((result: boolean) => {\r\n const returnValue = typeof result === \"undefined\" ? true : result;\r\n return Promise.resolve(returnValue);\r\n })\r\n .catch((e: any) => {\r\n Logger.Warn(e);\r\n return Promise.resolve(false);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if Babylon.js is using the BabylonNative backend, otherwise false\r\n */\r\n public get isNative(): boolean {\r\n return this._xrNavigator.xr.native ?? false;\r\n }\r\n\r\n /**\r\n * The current frame rate as reported by the device\r\n */\r\n public get currentFrameRate(): number | undefined {\r\n return this.session?.frameRate;\r\n }\r\n\r\n /**\r\n * A list of supported frame rates (only available in-session!\r\n */\r\n public get supportedFrameRates(): Float32Array | undefined {\r\n return this.session?.supportedFrameRates;\r\n }\r\n\r\n /**\r\n * Set the framerate of the session.\r\n * @param rate the new framerate. This value needs to be in the supportedFrameRates array\r\n * @returns a promise that resolves once the framerate has been set\r\n */\r\n public updateTargetFrameRate(rate: number): Promise<void> {\r\n return this.session.updateTargetFrameRate(rate);\r\n }\r\n\r\n /**\r\n * Run a callback in the xr render loop\r\n * @param callback the callback to call when in XR Frame\r\n * @param ignoreIfNotInSession if no session is currently running, run it first thing on the next session\r\n */\r\n public runInXRFrame(callback: () => void, ignoreIfNotInSession = true): void {\r\n if (this.inXRFrameLoop) {\r\n callback();\r\n } else if (this.inXRSession || !ignoreIfNotInSession) {\r\n this.onXRFrameObservable.addOnce(callback);\r\n }\r\n }\r\n\r\n /**\r\n * Check if fixed foveation is supported on this device\r\n */\r\n public get isFixedFoveationSupported(): boolean {\r\n return this._baseLayerWrapper?.isFixedFoveationSupported || false;\r\n }\r\n\r\n /**\r\n * Get the fixed foveation currently set, as specified by the webxr specs\r\n * If this returns null, then fixed foveation is not supported\r\n */\r\n public get fixedFoveation(): Nullable<number> {\r\n return this._baseLayerWrapper?.fixedFoveation || null;\r\n }\r\n\r\n /**\r\n * Set the fixed foveation to the specified value, as specified by the webxr specs\r\n * This value will be normalized to be between 0 and 1, 1 being max foveation, 0 being no foveation\r\n */\r\n public set fixedFoveation(value: Nullable<number>) {\r\n const val = Math.max(0, Math.min(1, value || 0));\r\n if (this._baseLayerWrapper) {\r\n this._baseLayerWrapper.fixedFoveation = val;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webXRSessionManager.js","sourceRoot":"","sources":["../../../../../lts/core/generated/XR/webXRSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKhD,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAKvG,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAG3D;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IA2D5B;;;OAGG;IACH;IACI,wDAAwD;IACjD,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;QA/CvB,0CAA0C;QACnC,qBAAgB,GAAW,CAAC,CAAC,CAAC;QACrC;;;WAGG;QACI,8BAAyB,GAAG,GAAG,CAAC;QACvC;;WAEG;QACI,wBAAmB,GAAwB,IAAI,UAAU,EAAW,CAAC;QAC5E;;WAEG;QACI,8BAAyB,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AI,IAAI,CAAC,iBAAiB,EAAE;YACxB,IAAI,CAAC,iBAAiB,CAAC,cAAc,GAAG,GAAG,CAAC;SAC/C;IACL,CAAC;CACJ","sourcesContent":["import { Logger } from \"../Misc/logger\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { IDisposable, Scene } from \"../scene\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { WebXRRenderTarget } from \"./webXRTypes\";\r\nimport { WebXRManagedOutputCanvas, WebXRManagedOutputCanvasOptions } from \"./webXRManagedOutputCanvas\";\r\nimport type { Engine } from \"../Engines/engine\";\r\nimport type { IWebXRRenderTargetTextureProvider, WebXRLayerRenderTargetTextureProvider } from \"./webXRRenderTargetTextureProvider\";\r\nimport type { Viewport } from \"../Maths/math.viewport\";\r\nimport type { WebXRLayerWrapper } from \"./webXRLayerWrapper\";\r\nimport { NativeXRLayerWrapper, NativeXRRenderTarget } from \"./native/nativeXRRenderTarget\";\r\nimport { WebXRWebGLLayerWrapper } from \"./webXRWebGLLayer\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\n\r\n/**\r\n * Manages an XRSession to work with Babylon's engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRSessionManagers\r\n */\r\nexport class WebXRSessionManager implements IDisposable, IWebXRRenderTargetTextureProvider {\r\n private _engine: Nullable<Engine>;\r\n private _referenceSpace: XRReferenceSpace;\r\n private _baseLayerWrapper: Nullable<WebXRLayerWrapper>;\r\n private _baseLayerRTTProvider: Nullable<WebXRLayerRenderTargetTextureProvider>;\r\n private _xrNavigator: any;\r\n private _sessionMode: XRSessionMode;\r\n private _onEngineDisposedObserver: Nullable<Observer<ThinEngine>>;\r\n\r\n /**\r\n * The base reference space from which the session started. good if you want to reset your\r\n * reference space\r\n */\r\n public baseReferenceSpace: XRReferenceSpace;\r\n /**\r\n * Current XR frame\r\n */\r\n public currentFrame: Nullable<XRFrame>;\r\n /** WebXR timestamp updated every frame */\r\n public currentTimestamp: number = -1;\r\n /**\r\n * Used just in case of a failure to initialize an immersive session.\r\n * The viewer reference space is compensated using this height, creating a kind of \"viewer-floor\" reference space\r\n */\r\n public defaultHeightCompensation = 1.7;\r\n /**\r\n * Fires every time a new xrFrame arrives which can be used to update the camera\r\n */\r\n public onXRFrameObservable: Observable<XRFrame> = new Observable<XRFrame>();\r\n /**\r\n * Fires when the reference space changed\r\n */\r\n public onXRReferenceSpaceChanged: Observable<XRReferenceSpace> = new Observable();\r\n /**\r\n * Fires when the xr session is ended either by the device or manually done\r\n */\r\n public onXRSessionEnded: Observable<any> = new Observable<any>();\r\n /**\r\n * Fires when the xr session is initialized: right after requestSession was called and returned with a successful result\r\n */\r\n public onXRSessionInit: Observable<XRSession> = new Observable<XRSession>();\r\n /**\r\n * Underlying xr session\r\n */\r\n public session: XRSession;\r\n /**\r\n * The viewer (head position) reference space. This can be used to get the XR world coordinates\r\n * or get the offset the player is currently at.\r\n */\r\n public viewerReferenceSpace: XRReferenceSpace;\r\n /**\r\n * Are we currently in the XR loop?\r\n */\r\n public inXRFrameLoop: boolean = false;\r\n /**\r\n * Are we in an XR session?\r\n */\r\n public inXRSession: boolean = false;\r\n\r\n /**\r\n * Constructs a WebXRSessionManager, this must be initialized within a user action before usage\r\n * @param scene The scene which the session should be created for\r\n */\r\n constructor(\r\n /** The scene which the session should be created for */\r\n public scene: Scene\r\n ) {\r\n this._engine = scene.getEngine();\r\n this._onEngineDisposedObserver = this._engine.onDisposeObservable.addOnce(() => {\r\n this._engine = null;\r\n });\r\n scene.onDisposeObservable.addOnce(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * The current reference space used in this session. This reference space can constantly change!\r\n * It is mainly used to offset the camera's position.\r\n */\r\n public get referenceSpace(): XRReferenceSpace {\r\n return this._referenceSpace;\r\n }\r\n\r\n /**\r\n * Set a new reference space and triggers the observable\r\n */\r\n public set referenceSpace(newReferenceSpace: XRReferenceSpace) {\r\n this._referenceSpace = newReferenceSpace;\r\n this.onXRReferenceSpaceChanged.notifyObservers(this._referenceSpace);\r\n }\r\n\r\n /**\r\n * The mode for the managed XR session\r\n */\r\n public get sessionMode(): XRSessionMode {\r\n return this._sessionMode;\r\n }\r\n\r\n /**\r\n * Disposes of the session manager\r\n * This should be called explicitly by the dev, if required.\r\n */\r\n public dispose() {\r\n // disposing without leaving XR? Exit XR first\r\n if (this.inXRSession) {\r\n this.exitXRAsync();\r\n }\r\n this.onXRFrameObservable.clear();\r\n this.onXRSessionEnded.clear();\r\n this.onXRReferenceSpaceChanged.clear();\r\n this.onXRSessionInit.clear();\r\n this._engine?.onDisposeObservable.remove(this._onEngineDisposedObserver);\r\n this._engine = null;\r\n }\r\n\r\n /**\r\n * Stops the xrSession and restores the render loop\r\n * @returns Promise which resolves after it exits XR\r\n */\r\n public exitXRAsync() {\r\n if (this.session && this.inXRSession) {\r\n this.inXRSession = false;\r\n return this.session.end().catch(() => {\r\n Logger.Warn(\"Could not end XR session.\");\r\n });\r\n }\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Attempts to set the framebuffer-size-normalized viewport to be rendered this frame for this view.\r\n * In the event of a failure, the supplied viewport is not updated.\r\n * @param viewport the viewport to which the view will be rendered\r\n * @param view the view for which to set the viewport\r\n * @returns whether the operation was successful\r\n */\r\n public trySetViewportForView(viewport: Viewport, view: XRView): boolean {\r\n return this._baseLayerRTTProvider?.trySetViewportForView(viewport, view) || false;\r\n }\r\n\r\n /**\r\n * Gets the correct render target texture to be rendered this frame for this eye\r\n * @param eye the eye for which to get the render target\r\n * @returns the render target for the specified eye or null if not available\r\n */\r\n public getRenderTargetTextureForEye(eye: XREye): Nullable<RenderTargetTexture> {\r\n return this._baseLayerRTTProvider?.getRenderTargetTextureForEye(eye) || null;\r\n }\r\n\r\n /**\r\n * Gets the correct render target texture to be rendered this frame for this view\r\n * @param view the view for which to get the render target\r\n * @returns the render target for the specified view or null if not available\r\n */\r\n public getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture> {\r\n return this._baseLayerRTTProvider?.getRenderTargetTextureForView(view) || null;\r\n }\r\n\r\n /**\r\n * Creates a WebXRRenderTarget object for the XR session\r\n * @param options optional options to provide when creating a new render target\r\n * @returns a WebXR render target to which the session can render\r\n */\r\n public getWebXRRenderTarget(options?: WebXRManagedOutputCanvasOptions): WebXRRenderTarget {\r\n const engine = this.scene.getEngine();\r\n if (this._xrNavigator.xr.native) {\r\n return new NativeXRRenderTarget(this);\r\n } else {\r\n options = options || WebXRManagedOutputCanvasOptions.GetDefaults(engine);\r\n options.canvasElement = options.canvasElement || engine.getRenderingCanvas() || undefined;\r\n return new WebXRManagedOutputCanvas(this, options);\r\n }\r\n }\r\n\r\n /**\r\n * Initializes the manager\r\n * After initialization enterXR can be called to start an XR session\r\n * @returns Promise which resolves after it is initialized\r\n */\r\n public initializeAsync(): Promise<void> {\r\n // Check if the browser supports webXR\r\n this._xrNavigator = navigator;\r\n if (!this._xrNavigator.xr) {\r\n return Promise.reject(\"WebXR not available\");\r\n }\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Initializes an xr session\r\n * @param xrSessionMode mode to initialize\r\n * @param xrSessionInit defines optional and required values to pass to the session builder\r\n * @returns a promise which will resolve once the session has been initialized\r\n */\r\n public initializeSessionAsync(xrSessionMode: XRSessionMode = \"immersive-vr\", xrSessionInit: XRSessionInit = {}): Promise<XRSession> {\r\n return this._xrNavigator.xr.requestSession(xrSessionMode, xrSessionInit).then((session: XRSession) => {\r\n this.session = session;\r\n this._sessionMode = xrSessionMode;\r\n this.onXRSessionInit.notifyObservers(session);\r\n this.inXRSession = true;\r\n\r\n // handle when the session is ended (By calling session.end or device ends its own session eg. pressing home button on phone)\r\n this.session.addEventListener(\r\n \"end\",\r\n () => {\r\n this.inXRSession = false;\r\n\r\n // Notify frame observers\r\n this.onXRSessionEnded.notifyObservers(null);\r\n\r\n if (this._engine) {\r\n // make sure dimensions object is restored\r\n this._engine.framebufferDimensionsObject = null;\r\n\r\n // Restore frame buffer to avoid clear on xr framebuffer after session end\r\n this._engine.restoreDefaultFramebuffer();\r\n\r\n // Need to restart render loop as after the session is ended the last request for new frame will never call callback\r\n this._engine.customAnimationFrameRequester = null;\r\n this._engine._renderLoop();\r\n }\r\n\r\n // Dispose render target textures.\r\n // Only dispose on native because we can't destroy opaque textures on browser.\r\n if (this.isNative) {\r\n this._baseLayerRTTProvider?.dispose();\r\n }\r\n this._baseLayerRTTProvider = null;\r\n this._baseLayerWrapper = null;\r\n },\r\n { once: true }\r\n );\r\n\r\n return this.session;\r\n });\r\n }\r\n\r\n /**\r\n * Checks if a session would be supported for the creation options specified\r\n * @param sessionMode session mode to check if supported eg. immersive-vr\r\n * @returns A Promise that resolves to true if supported and false if not\r\n */\r\n public isSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean> {\r\n return WebXRSessionManager.IsSessionSupportedAsync(sessionMode);\r\n }\r\n\r\n /**\r\n * Resets the reference space to the one started the session\r\n */\r\n public resetReferenceSpace() {\r\n this.referenceSpace = this.baseReferenceSpace;\r\n }\r\n\r\n /**\r\n * Starts rendering to the xr layer\r\n */\r\n public runXRRenderLoop() {\r\n if (!this.inXRSession || !this._engine) {\r\n return;\r\n }\r\n\r\n // Tell the engine's render loop to be driven by the xr session's refresh rate and provide xr pose information\r\n this._engine.customAnimationFrameRequester = {\r\n requestAnimationFrame: this.session.requestAnimationFrame.bind(this.session),\r\n renderFunction: (timestamp: number, xrFrame: Nullable<XRFrame>) => {\r\n if (!this.inXRSession || !this._engine) {\r\n return;\r\n }\r\n // Store the XR frame and timestamp in the session manager\r\n this.currentFrame = xrFrame;\r\n this.currentTimestamp = timestamp;\r\n if (xrFrame) {\r\n this.inXRFrameLoop = true;\r\n this._engine.framebufferDimensionsObject = this._baseLayerRTTProvider?.getFramebufferDimensions() || null;\r\n this.onXRFrameObservable.notifyObservers(xrFrame);\r\n this._engine._renderLoop();\r\n this._engine.framebufferDimensionsObject = null;\r\n this.inXRFrameLoop = false;\r\n }\r\n },\r\n };\r\n\r\n this._engine.framebufferDimensionsObject = this._baseLayerRTTProvider?.getFramebufferDimensions() || null;\r\n\r\n // Stop window's animation frame and trigger sessions animation frame\r\n if (typeof window !== \"undefined\" && window.cancelAnimationFrame) {\r\n window.cancelAnimationFrame(this._engine._frameHandler);\r\n }\r\n this._engine._renderLoop();\r\n }\r\n\r\n /**\r\n * Sets the reference space on the xr session\r\n * @param referenceSpaceType space to set\r\n * @returns a promise that will resolve once the reference space has been set\r\n */\r\n public setReferenceSpaceTypeAsync(referenceSpaceType: XRReferenceSpaceType = \"local-floor\"): Promise<XRReferenceSpace> {\r\n return this.session\r\n .requestReferenceSpace(referenceSpaceType)\r\n .then(\r\n (referenceSpace) => {\r\n return referenceSpace as XRReferenceSpace;\r\n },\r\n (rejectionReason) => {\r\n Logger.Error(\"XR.requestReferenceSpace failed for the following reason: \");\r\n Logger.Error(rejectionReason);\r\n Logger.Log('Defaulting to universally-supported \"viewer\" reference space type.');\r\n\r\n return this.session.requestReferenceSpace(\"viewer\").then(\r\n (referenceSpace) => {\r\n const heightCompensation = new XRRigidTransform({ x: 0, y: -this.defaultHeightCompensation, z: 0 });\r\n return (referenceSpace as XRReferenceSpace).getOffsetReferenceSpace(heightCompensation);\r\n },\r\n (rejectionReason) => {\r\n Logger.Error(rejectionReason);\r\n throw 'XR initialization failed: required \"viewer\" reference space type not supported.';\r\n }\r\n );\r\n }\r\n )\r\n .then((referenceSpace) => {\r\n // create viewer reference space before setting the first reference space\r\n return this.session.requestReferenceSpace(\"viewer\").then((viewerReferenceSpace) => {\r\n this.viewerReferenceSpace = viewerReferenceSpace as XRReferenceSpace;\r\n return referenceSpace;\r\n });\r\n })\r\n .then((referenceSpace) => {\r\n // initialize the base and offset (currently the same)\r\n this.referenceSpace = this.baseReferenceSpace = referenceSpace;\r\n return this.referenceSpace;\r\n });\r\n }\r\n\r\n /**\r\n * Updates the render state of the session.\r\n * Note that this is deprecated in favor of WebXRSessionManager.updateRenderState().\r\n * @param state state to set\r\n * @returns a promise that resolves once the render state has been updated\r\n * @deprecated\r\n */\r\n public updateRenderStateAsync(state: XRRenderState): Promise<void> {\r\n return Promise.resolve(this.session.updateRenderState(state));\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _setBaseLayerWrapper(baseLayerWrapper: Nullable<WebXRLayerWrapper>): void {\r\n if (this.isNative) {\r\n this._baseLayerRTTProvider?.dispose();\r\n }\r\n this._baseLayerWrapper = baseLayerWrapper;\r\n this._baseLayerRTTProvider = this._baseLayerWrapper?.createRenderTargetTextureProvider(this) || null;\r\n }\r\n\r\n /**\r\n * Updates the render state of the session\r\n * @param state state to set\r\n */\r\n public updateRenderState(state: XRRenderStateInit): void {\r\n if (state.baseLayer) {\r\n this._setBaseLayerWrapper(this.isNative ? new NativeXRLayerWrapper(state.baseLayer) : new WebXRWebGLLayerWrapper(state.baseLayer));\r\n }\r\n\r\n this.session.updateRenderState(state);\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves with a boolean indicating if the provided session mode is supported by this browser\r\n * @param sessionMode defines the session to test\r\n * @returns a promise with boolean as final value\r\n */\r\n public static IsSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean> {\r\n if (!(navigator as any).xr) {\r\n return Promise.resolve(false);\r\n }\r\n // When the specs are final, remove supportsSession!\r\n const functionToUse = (navigator as any).xr.isSessionSupported || (navigator as any).xr.supportsSession;\r\n if (!functionToUse) {\r\n return Promise.resolve(false);\r\n } else {\r\n return functionToUse\r\n .call((navigator as any).xr, sessionMode)\r\n .then((result: boolean) => {\r\n const returnValue = typeof result === \"undefined\" ? true : result;\r\n return Promise.resolve(returnValue);\r\n })\r\n .catch((e: any) => {\r\n Logger.Warn(e);\r\n return Promise.resolve(false);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if Babylon.js is using the BabylonNative backend, otherwise false\r\n */\r\n public get isNative(): boolean {\r\n return this._xrNavigator.xr.native ?? false;\r\n }\r\n\r\n /**\r\n * The current frame rate as reported by the device\r\n */\r\n public get currentFrameRate(): number | undefined {\r\n return this.session?.frameRate;\r\n }\r\n\r\n /**\r\n * A list of supported frame rates (only available in-session!\r\n */\r\n public get supportedFrameRates(): Float32Array | undefined {\r\n return this.session?.supportedFrameRates;\r\n }\r\n\r\n /**\r\n * Set the framerate of the session.\r\n * @param rate the new framerate. This value needs to be in the supportedFrameRates array\r\n * @returns a promise that resolves once the framerate has been set\r\n */\r\n public updateTargetFrameRate(rate: number): Promise<void> {\r\n return this.session.updateTargetFrameRate(rate);\r\n }\r\n\r\n /**\r\n * Run a callback in the xr render loop\r\n * @param callback the callback to call when in XR Frame\r\n * @param ignoreIfNotInSession if no session is currently running, run it first thing on the next session\r\n */\r\n public runInXRFrame(callback: () => void, ignoreIfNotInSession = true): void {\r\n if (this.inXRFrameLoop) {\r\n callback();\r\n } else if (this.inXRSession || !ignoreIfNotInSession) {\r\n this.onXRFrameObservable.addOnce(callback);\r\n }\r\n }\r\n\r\n /**\r\n * Check if fixed foveation is supported on this device\r\n */\r\n public get isFixedFoveationSupported(): boolean {\r\n return this._baseLayerWrapper?.isFixedFoveationSupported || false;\r\n }\r\n\r\n /**\r\n * Get the fixed foveation currently set, as specified by the webxr specs\r\n * If this returns null, then fixed foveation is not supported\r\n */\r\n public get fixedFoveation(): Nullable<number> {\r\n return this._baseLayerWrapper?.fixedFoveation || null;\r\n }\r\n\r\n /**\r\n * Set the fixed foveation to the specified value, as specified by the webxr specs\r\n * This value will be normalized to be between 0 and 1, 1 being max foveation, 0 being no foveation\r\n */\r\n public set fixedFoveation(value: Nullable<number>) {\r\n const val = Math.max(0, Math.min(1, value || 0));\r\n if (this._baseLayerWrapper) {\r\n this._baseLayerWrapper.fixedFoveation = val;\r\n }\r\n }\r\n}\r\n"]}
|
package/abstractScene.d.ts
CHANGED
|
@@ -77,12 +77,12 @@ export declare abstract class AbstractScene {
|
|
|
77
77
|
*/
|
|
78
78
|
rootNodes: Node[];
|
|
79
79
|
/** All of the cameras added to this scene
|
|
80
|
-
* @see https://doc.babylonjs.com/
|
|
80
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
|
|
81
81
|
*/
|
|
82
82
|
cameras: Camera[];
|
|
83
83
|
/**
|
|
84
84
|
* All of the lights added to this scene
|
|
85
|
-
* @see https://doc.babylonjs.com/
|
|
85
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
|
|
86
86
|
*/
|
|
87
87
|
lights: Light[];
|
|
88
88
|
/**
|
|
@@ -91,12 +91,12 @@ export declare abstract class AbstractScene {
|
|
|
91
91
|
meshes: AbstractMesh[];
|
|
92
92
|
/**
|
|
93
93
|
* The list of skeletons added to the scene
|
|
94
|
-
* @see https://doc.babylonjs.com/
|
|
94
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
|
|
95
95
|
*/
|
|
96
96
|
skeletons: Skeleton[];
|
|
97
97
|
/**
|
|
98
98
|
* All of the particle systems added to this scene
|
|
99
|
-
* @see https://doc.babylonjs.com/
|
|
99
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro
|
|
100
100
|
*/
|
|
101
101
|
particleSystems: IParticleSystem[];
|
|
102
102
|
/**
|
|
@@ -105,12 +105,12 @@ export declare abstract class AbstractScene {
|
|
|
105
105
|
animations: Animation[];
|
|
106
106
|
/**
|
|
107
107
|
* All of the animation groups added to this scene
|
|
108
|
-
* @see https://doc.babylonjs.com/
|
|
108
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
|
|
109
109
|
*/
|
|
110
110
|
animationGroups: AnimationGroup[];
|
|
111
111
|
/**
|
|
112
112
|
* All of the multi-materials added to this scene
|
|
113
|
-
* @see https://doc.babylonjs.com/
|
|
113
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials
|
|
114
114
|
*/
|
|
115
115
|
multiMaterials: MultiMaterial[];
|
|
116
116
|
/**
|
|
@@ -118,12 +118,12 @@ export declare abstract class AbstractScene {
|
|
|
118
118
|
* In the context of a Scene, it is not supposed to be modified manually.
|
|
119
119
|
* Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.
|
|
120
120
|
* Note also that the order of the Material within the array is not significant and might change.
|
|
121
|
-
* @see https://doc.babylonjs.com/
|
|
121
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
|
|
122
122
|
*/
|
|
123
123
|
materials: Material[];
|
|
124
124
|
/**
|
|
125
125
|
* The list of morph target managers added to the scene
|
|
126
|
-
* @see https://doc.babylonjs.com/
|
|
126
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph
|
|
127
127
|
*/
|
|
128
128
|
morphTargetManagers: MorphTargetManager[];
|
|
129
129
|
/**
|
|
@@ -135,7 +135,7 @@ export declare abstract class AbstractScene {
|
|
|
135
135
|
* In the context of a Scene, it is not supposed to be modified manually.
|
|
136
136
|
* Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.
|
|
137
137
|
* Note also that the order of the TransformNode within the array is not significant and might change.
|
|
138
|
-
* @see https://doc.babylonjs.com/
|
|
138
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node
|
|
139
139
|
*/
|
|
140
140
|
transformNodes: TransformNode[];
|
|
141
141
|
/**
|
package/abstractScene.js
CHANGED
|
@@ -10,12 +10,12 @@ export class AbstractScene {
|
|
|
10
10
|
*/
|
|
11
11
|
this.rootNodes = new Array();
|
|
12
12
|
/** All of the cameras added to this scene
|
|
13
|
-
* @see https://doc.babylonjs.com/
|
|
13
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
|
|
14
14
|
*/
|
|
15
15
|
this.cameras = new Array();
|
|
16
16
|
/**
|
|
17
17
|
* All of the lights added to this scene
|
|
18
|
-
* @see https://doc.babylonjs.com/
|
|
18
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
|
|
19
19
|
*/
|
|
20
20
|
this.lights = new Array();
|
|
21
21
|
/**
|
|
@@ -24,12 +24,12 @@ export class AbstractScene {
|
|
|
24
24
|
this.meshes = new Array();
|
|
25
25
|
/**
|
|
26
26
|
* The list of skeletons added to the scene
|
|
27
|
-
* @see https://doc.babylonjs.com/
|
|
27
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
|
|
28
28
|
*/
|
|
29
29
|
this.skeletons = new Array();
|
|
30
30
|
/**
|
|
31
31
|
* All of the particle systems added to this scene
|
|
32
|
-
* @see https://doc.babylonjs.com/
|
|
32
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro
|
|
33
33
|
*/
|
|
34
34
|
this.particleSystems = new Array();
|
|
35
35
|
/**
|
|
@@ -38,12 +38,12 @@ export class AbstractScene {
|
|
|
38
38
|
this.animations = [];
|
|
39
39
|
/**
|
|
40
40
|
* All of the animation groups added to this scene
|
|
41
|
-
* @see https://doc.babylonjs.com/
|
|
41
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
|
|
42
42
|
*/
|
|
43
43
|
this.animationGroups = new Array();
|
|
44
44
|
/**
|
|
45
45
|
* All of the multi-materials added to this scene
|
|
46
|
-
* @see https://doc.babylonjs.com/
|
|
46
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials
|
|
47
47
|
*/
|
|
48
48
|
this.multiMaterials = new Array();
|
|
49
49
|
/**
|
|
@@ -51,12 +51,12 @@ export class AbstractScene {
|
|
|
51
51
|
* In the context of a Scene, it is not supposed to be modified manually.
|
|
52
52
|
* Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.
|
|
53
53
|
* Note also that the order of the Material within the array is not significant and might change.
|
|
54
|
-
* @see https://doc.babylonjs.com/
|
|
54
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
|
|
55
55
|
*/
|
|
56
56
|
this.materials = new Array();
|
|
57
57
|
/**
|
|
58
58
|
* The list of morph target managers added to the scene
|
|
59
|
-
* @see https://doc.babylonjs.com/
|
|
59
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph
|
|
60
60
|
*/
|
|
61
61
|
this.morphTargetManagers = new Array();
|
|
62
62
|
/**
|
|
@@ -68,7 +68,7 @@ export class AbstractScene {
|
|
|
68
68
|
* In the context of a Scene, it is not supposed to be modified manually.
|
|
69
69
|
* Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.
|
|
70
70
|
* Note also that the order of the TransformNode within the array is not significant and might change.
|
|
71
|
-
* @see https://doc.babylonjs.com/
|
|
71
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node
|
|
72
72
|
*/
|
|
73
73
|
this.transformNodes = new Array();
|
|
74
74
|
/**
|
package/abstractScene.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractScene.js","sourceRoot":"","sources":["../../../../lts/core/generated/abstractScene.ts"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH,MAAM,OAAgB,aAAa;IAAnC;QAsEI;;WAEG;QACI,cAAS,GAAG,IAAI,KAAK,EAAQ,CAAC;QAErC;;WAEG;QACI,YAAO,GAAG,IAAI,KAAK,EAAU,CAAC;QAErC;;;WAGG;QACI,WAAM,GAAG,IAAI,KAAK,EAAS,CAAC;QAEnC;;WAEG;QACI,WAAM,GAAG,IAAI,KAAK,EAAgB,CAAC;QAE1C;;;WAGG;QACI,cAAS,GAAG,IAAI,KAAK,EAAY,CAAC;QAEzC;;;WAGG;QACI,oBAAe,GAAG,IAAI,KAAK,EAAmB,CAAC;QAEtD;;WAEG;QACI,eAAU,GAAgB,EAAE,CAAC;QAEpC;;;WAGG;QACI,oBAAe,GAAG,IAAI,KAAK,EAAkB,CAAC;QAErD;;;WAGG;QACI,mB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Nullable } from \"./types\";\r\nimport type { AbstractMesh } from \"./Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"./Meshes/transformNode\";\r\nimport type { Geometry } from \"./Meshes/geometry\";\r\nimport type { Skeleton } from \"./Bones/skeleton\";\r\nimport type { MorphTargetManager } from \"./Morph/morphTargetManager\";\r\nimport type { AssetContainer } from \"./assetContainer\";\r\nimport type { IParticleSystem } from \"./Particles/IParticleSystem\";\r\nimport type { AnimationGroup } from \"./Animations/animationGroup\";\r\nimport type { BaseTexture } from \"./Materials/Textures/baseTexture\";\r\nimport type { Material } from \"./Materials/material\";\r\nimport type { MultiMaterial } from \"./Materials/multiMaterial\";\r\nimport type { AbstractActionManager } from \"./Actions/abstractActionManager\";\r\nimport type { Camera } from \"./Cameras/camera\";\r\nimport type { Light } from \"./Lights/light\";\r\nimport type { Node } from \"./node\";\r\n\r\ndeclare type Animation = import(\"./Animations/animation\").Animation;\r\ndeclare type PostProcess = import(\"./PostProcesses/postProcess\").PostProcess;\r\n\r\n/**\r\n * Defines how the parser contract is defined.\r\n * These parsers are used to parse a list of specific assets (like particle systems, etc..)\r\n */\r\nexport type BabylonFileParser = (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => void;\r\n\r\n/**\r\n * Defines how the individual parser contract is defined.\r\n * These parser can parse an individual asset\r\n */\r\nexport type IndividualBabylonFileParser = (parsedData: any, scene: Scene, rootUrl: string) => any;\r\n\r\n/**\r\n * Base class of the scene acting as a container for the different elements composing a scene.\r\n * This class is dynamically extended by the different components of the scene increasing\r\n * flexibility and reducing coupling\r\n */\r\nexport abstract class AbstractScene {\r\n /**\r\n * Stores the list of available parsers in the application.\r\n */\r\n private static _BabylonFileParsers: { [key: string]: BabylonFileParser } = {};\r\n\r\n /**\r\n * Stores the list of available individual parsers in the application.\r\n */\r\n private static _IndividualBabylonFileParsers: { [key: string]: IndividualBabylonFileParser } = {};\r\n\r\n /**\r\n * Adds a parser in the list of available ones\r\n * @param name Defines the name of the parser\r\n * @param parser Defines the parser to add\r\n */\r\n public static AddParser(name: string, parser: BabylonFileParser): void {\r\n this._BabylonFileParsers[name] = parser;\r\n }\r\n\r\n /**\r\n * Gets a general parser from the list of available ones\r\n * @param name Defines the name of the parser\r\n * @returns the requested parser or null\r\n */\r\n public static GetParser(name: string): Nullable<BabylonFileParser> {\r\n if (this._BabylonFileParsers[name]) {\r\n return this._BabylonFileParsers[name];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Adds n individual parser in the list of available ones\r\n * @param name Defines the name of the parser\r\n * @param parser Defines the parser to add\r\n */\r\n public static AddIndividualParser(name: string, parser: IndividualBabylonFileParser): void {\r\n this._IndividualBabylonFileParsers[name] = parser;\r\n }\r\n\r\n /**\r\n * Gets an individual parser from the list of available ones\r\n * @param name Defines the name of the parser\r\n * @returns the requested parser or null\r\n */\r\n public static GetIndividualParser(name: string): Nullable<IndividualBabylonFileParser> {\r\n if (this._IndividualBabylonFileParsers[name]) {\r\n return this._IndividualBabylonFileParsers[name];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Parser json data and populate both a scene and its associated container object\r\n * @param jsonData Defines the data to parse\r\n * @param scene Defines the scene to parse the data for\r\n * @param container Defines the container attached to the parsing sequence\r\n * @param rootUrl Defines the root url of the data\r\n */\r\n public static Parse(jsonData: any, scene: Scene, container: AssetContainer, rootUrl: string): void {\r\n for (const parserName in this._BabylonFileParsers) {\r\n if (Object.prototype.hasOwnProperty.call(this._BabylonFileParsers, parserName)) {\r\n this._BabylonFileParsers[parserName](jsonData, scene, container, rootUrl);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the list of root nodes (ie. nodes with no parent)\r\n */\r\n public rootNodes = new Array<Node>();\r\n\r\n /** All of the cameras added to this scene\r\n * @see https://doc.babylonjs.com/babylon101/cameras\r\n */\r\n public cameras = new Array<Camera>();\r\n\r\n /**\r\n * All of the lights added to this scene\r\n * @see https://doc.babylonjs.com/babylon101/lights\r\n */\r\n public lights = new Array<Light>();\r\n\r\n /**\r\n * All of the (abstract) meshes added to this scene\r\n */\r\n public meshes = new Array<AbstractMesh>();\r\n\r\n /**\r\n * The list of skeletons added to the scene\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons\r\n */\r\n public skeletons = new Array<Skeleton>();\r\n\r\n /**\r\n * All of the particle systems added to this scene\r\n * @see https://doc.babylonjs.com/babylon101/particles\r\n */\r\n public particleSystems = new Array<IParticleSystem>();\r\n\r\n /**\r\n * Gets a list of Animations associated with the scene\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * All of the animation groups added to this scene\r\n * @see https://doc.babylonjs.com/divingDeeper/animation/groupAnimations\r\n */\r\n public animationGroups = new Array<AnimationGroup>();\r\n\r\n /**\r\n * All of the multi-materials added to this scene\r\n * @see https://doc.babylonjs.com/how_to/multi_materials\r\n */\r\n public multiMaterials = new Array<MultiMaterial>();\r\n\r\n /**\r\n * All of the materials added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\r\n * Note also that the order of the Material within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/babylon101/materials\r\n */\r\n public materials = new Array<Material>();\r\n\r\n /**\r\n * The list of morph target managers added to the scene\r\n * @see https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh\r\n */\r\n public morphTargetManagers = new Array<MorphTargetManager>();\r\n\r\n /**\r\n * The list of geometries used in the scene.\r\n */\r\n public geometries = new Array<Geometry>();\r\n\r\n /**\r\n * All of the transform nodes added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\r\n * Note also that the order of the TransformNode within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/how_to/transformnode\r\n */\r\n public transformNodes = new Array<TransformNode>();\r\n\r\n /**\r\n * ActionManagers available on the scene.\r\n * @deprecated\r\n */\r\n public actionManagers = new Array<AbstractActionManager>();\r\n\r\n /**\r\n * Textures to keep.\r\n */\r\n public textures = new Array<BaseTexture>();\r\n\r\n /** @internal */\r\n protected _environmentTexture: Nullable<BaseTexture> = null;\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n public get environmentTexture(): Nullable<BaseTexture> {\r\n return this._environmentTexture;\r\n }\r\n\r\n public set environmentTexture(value: Nullable<BaseTexture>) {\r\n this._environmentTexture = value;\r\n }\r\n\r\n /**\r\n * The list of postprocesses added to the scene\r\n */\r\n public postProcesses = new Array<PostProcess>();\r\n\r\n /**\r\n * @returns all meshes, lights, cameras, transformNodes and bones\r\n */\r\n public getNodes(): Array<Node> {\r\n let nodes = new Array<Node>();\r\n nodes = nodes.concat(this.meshes);\r\n nodes = nodes.concat(this.lights);\r\n nodes = nodes.concat(this.cameras);\r\n nodes = nodes.concat(this.transformNodes); // dummies\r\n this.skeletons.forEach((skeleton) => (nodes = nodes.concat(skeleton.bones)));\r\n return nodes;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"abstractScene.js","sourceRoot":"","sources":["../../../../lts/core/generated/abstractScene.ts"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH,MAAM,OAAgB,aAAa;IAAnC;QAsEI;;WAEG;QACI,cAAS,GAAG,IAAI,KAAK,EAAQ,CAAC;QAErC;;WAEG;QACI,YAAO,GAAG,IAAI,KAAK,EAAU,CAAC;QAErC;;;WAGG;QACI,WAAM,GAAG,IAAI,KAAK,EAAS,CAAC;QAEnC;;WAEG;QACI,WAAM,GAAG,IAAI,KAAK,EAAgB,CAAC;QAE1C;;;WAGG;QACI,cAAS,GAAG,IAAI,KAAK,EAAY,CAAC;QAEzC;;;WAGG;QACI,oBAAe,GAAG,IAAI,KAAK,EAAmB,CAAC;QAEtD;;WAEG;QACI,eAAU,GAAgB,EAAE,CAAC;QAEpC;;;WAGG;QACI,oBAAe,GAA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EAAE,CAAC","sourcesContent":["import type { Scene } from \"./scene\";\r\nimport type { Nullable } from \"./types\";\r\nimport type { AbstractMesh } from \"./Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"./Meshes/transformNode\";\r\nimport type { Geometry } from \"./Meshes/geometry\";\r\nimport type { Skeleton } from \"./Bones/skeleton\";\r\nimport type { MorphTargetManager } from \"./Morph/morphTargetManager\";\r\nimport type { AssetContainer } from \"./assetContainer\";\r\nimport type { IParticleSystem } from \"./Particles/IParticleSystem\";\r\nimport type { AnimationGroup } from \"./Animations/animationGroup\";\r\nimport type { BaseTexture } from \"./Materials/Textures/baseTexture\";\r\nimport type { Material } from \"./Materials/material\";\r\nimport type { MultiMaterial } from \"./Materials/multiMaterial\";\r\nimport type { AbstractActionManager } from \"./Actions/abstractActionManager\";\r\nimport type { Camera } from \"./Cameras/camera\";\r\nimport type { Light } from \"./Lights/light\";\r\nimport type { Node } from \"./node\";\r\n\r\ndeclare type Animation = import(\"./Animations/animation\").Animation;\r\ndeclare type PostProcess = import(\"./PostProcesses/postProcess\").PostProcess;\r\n\r\n/**\r\n * Defines how the parser contract is defined.\r\n * These parsers are used to parse a list of specific assets (like particle systems, etc..)\r\n */\r\nexport type BabylonFileParser = (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => void;\r\n\r\n/**\r\n * Defines how the individual parser contract is defined.\r\n * These parser can parse an individual asset\r\n */\r\nexport type IndividualBabylonFileParser = (parsedData: any, scene: Scene, rootUrl: string) => any;\r\n\r\n/**\r\n * Base class of the scene acting as a container for the different elements composing a scene.\r\n * This class is dynamically extended by the different components of the scene increasing\r\n * flexibility and reducing coupling\r\n */\r\nexport abstract class AbstractScene {\r\n /**\r\n * Stores the list of available parsers in the application.\r\n */\r\n private static _BabylonFileParsers: { [key: string]: BabylonFileParser } = {};\r\n\r\n /**\r\n * Stores the list of available individual parsers in the application.\r\n */\r\n private static _IndividualBabylonFileParsers: { [key: string]: IndividualBabylonFileParser } = {};\r\n\r\n /**\r\n * Adds a parser in the list of available ones\r\n * @param name Defines the name of the parser\r\n * @param parser Defines the parser to add\r\n */\r\n public static AddParser(name: string, parser: BabylonFileParser): void {\r\n this._BabylonFileParsers[name] = parser;\r\n }\r\n\r\n /**\r\n * Gets a general parser from the list of available ones\r\n * @param name Defines the name of the parser\r\n * @returns the requested parser or null\r\n */\r\n public static GetParser(name: string): Nullable<BabylonFileParser> {\r\n if (this._BabylonFileParsers[name]) {\r\n return this._BabylonFileParsers[name];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Adds n individual parser in the list of available ones\r\n * @param name Defines the name of the parser\r\n * @param parser Defines the parser to add\r\n */\r\n public static AddIndividualParser(name: string, parser: IndividualBabylonFileParser): void {\r\n this._IndividualBabylonFileParsers[name] = parser;\r\n }\r\n\r\n /**\r\n * Gets an individual parser from the list of available ones\r\n * @param name Defines the name of the parser\r\n * @returns the requested parser or null\r\n */\r\n public static GetIndividualParser(name: string): Nullable<IndividualBabylonFileParser> {\r\n if (this._IndividualBabylonFileParsers[name]) {\r\n return this._IndividualBabylonFileParsers[name];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Parser json data and populate both a scene and its associated container object\r\n * @param jsonData Defines the data to parse\r\n * @param scene Defines the scene to parse the data for\r\n * @param container Defines the container attached to the parsing sequence\r\n * @param rootUrl Defines the root url of the data\r\n */\r\n public static Parse(jsonData: any, scene: Scene, container: AssetContainer, rootUrl: string): void {\r\n for (const parserName in this._BabylonFileParsers) {\r\n if (Object.prototype.hasOwnProperty.call(this._BabylonFileParsers, parserName)) {\r\n this._BabylonFileParsers[parserName](jsonData, scene, container, rootUrl);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the list of root nodes (ie. nodes with no parent)\r\n */\r\n public rootNodes = new Array<Node>();\r\n\r\n /** All of the cameras added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\r\n */\r\n public cameras = new Array<Camera>();\r\n\r\n /**\r\n * All of the lights added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\n public lights = new Array<Light>();\r\n\r\n /**\r\n * All of the (abstract) meshes added to this scene\r\n */\r\n public meshes = new Array<AbstractMesh>();\r\n\r\n /**\r\n * The list of skeletons added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\r\n */\r\n public skeletons = new Array<Skeleton>();\r\n\r\n /**\r\n * All of the particle systems added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\r\n */\r\n public particleSystems = new Array<IParticleSystem>();\r\n\r\n /**\r\n * Gets a list of Animations associated with the scene\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * All of the animation groups added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\r\n */\r\n public animationGroups = new Array<AnimationGroup>();\r\n\r\n /**\r\n * All of the multi-materials added to this scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\r\n */\r\n public multiMaterials = new Array<MultiMaterial>();\r\n\r\n /**\r\n * All of the materials added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\r\n * Note also that the order of the Material within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\r\n */\r\n public materials = new Array<Material>();\r\n\r\n /**\r\n * The list of morph target managers added to the scene\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph\r\n */\r\n public morphTargetManagers = new Array<MorphTargetManager>();\r\n\r\n /**\r\n * The list of geometries used in the scene.\r\n */\r\n public geometries = new Array<Geometry>();\r\n\r\n /**\r\n * All of the transform nodes added to this scene\r\n * In the context of a Scene, it is not supposed to be modified manually.\r\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\r\n * Note also that the order of the TransformNode within the array is not significant and might change.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\r\n */\r\n public transformNodes = new Array<TransformNode>();\r\n\r\n /**\r\n * ActionManagers available on the scene.\r\n * @deprecated\r\n */\r\n public actionManagers = new Array<AbstractActionManager>();\r\n\r\n /**\r\n * Textures to keep.\r\n */\r\n public textures = new Array<BaseTexture>();\r\n\r\n /** @internal */\r\n protected _environmentTexture: Nullable<BaseTexture> = null;\r\n /**\r\n * Texture used in all pbr material as the reflection texture.\r\n * As in the majority of the scene they are the same (exception for multi room and so on),\r\n * this is easier to reference from here than from all the materials.\r\n */\r\n public get environmentTexture(): Nullable<BaseTexture> {\r\n return this._environmentTexture;\r\n }\r\n\r\n public set environmentTexture(value: Nullable<BaseTexture>) {\r\n this._environmentTexture = value;\r\n }\r\n\r\n /**\r\n * The list of postprocesses added to the scene\r\n */\r\n public postProcesses = new Array<PostProcess>();\r\n\r\n /**\r\n * @returns all meshes, lights, cameras, transformNodes and bones\r\n */\r\n public getNodes(): Array<Node> {\r\n let nodes = new Array<Node>();\r\n nodes = nodes.concat(this.meshes);\r\n nodes = nodes.concat(this.lights);\r\n nodes = nodes.concat(this.cameras);\r\n nodes = nodes.concat(this.transformNodes); // dummies\r\n this.skeletons.forEach((skeleton) => (nodes = nodes.concat(skeleton.bones)));\r\n return nodes;\r\n }\r\n}\r\n"]}
|
package/node.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export declare class Node implements IBehaviorAware<Node> {
|
|
|
69
69
|
reservedDataStore: any;
|
|
70
70
|
/**
|
|
71
71
|
* List of inspectable custom properties (used by the Inspector)
|
|
72
|
-
* @see https://doc.babylonjs.com/
|
|
72
|
+
* @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility
|
|
73
73
|
*/
|
|
74
74
|
inspectableCustomProperties: IInspectable[];
|
|
75
75
|
/**
|
|
@@ -128,7 +128,7 @@ export declare class Node implements IBehaviorAware<Node> {
|
|
|
128
128
|
isDisposed(): boolean;
|
|
129
129
|
/**
|
|
130
130
|
* Gets or sets the parent of the node (without keeping the current position in the scene)
|
|
131
|
-
* @see https://doc.babylonjs.com/
|
|
131
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/parent
|
|
132
132
|
*/
|
|
133
133
|
set parent(parent: Nullable<Node>);
|
|
134
134
|
get parent(): Nullable<Node>;
|
|
@@ -189,7 +189,7 @@ export declare class Node implements IBehaviorAware<Node> {
|
|
|
189
189
|
private _behaviors;
|
|
190
190
|
/**
|
|
191
191
|
* Attach a behavior to the node
|
|
192
|
-
* @see https://doc.babylonjs.com/features/
|
|
192
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors
|
|
193
193
|
* @param behavior defines the behavior to attach
|
|
194
194
|
* @param attachImmediately defines that the behavior must be attached even if the scene is still loading
|
|
195
195
|
* @returns the current Node
|
|
@@ -197,20 +197,20 @@ export declare class Node implements IBehaviorAware<Node> {
|
|
|
197
197
|
addBehavior(behavior: Behavior<Node>, attachImmediately?: boolean): Node;
|
|
198
198
|
/**
|
|
199
199
|
* Remove an attached behavior
|
|
200
|
-
* @see https://doc.babylonjs.com/features/
|
|
200
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors
|
|
201
201
|
* @param behavior defines the behavior to attach
|
|
202
202
|
* @returns the current Node
|
|
203
203
|
*/
|
|
204
204
|
removeBehavior(behavior: Behavior<Node>): Node;
|
|
205
205
|
/**
|
|
206
206
|
* Gets the list of attached behaviors
|
|
207
|
-
* @see https://doc.babylonjs.com/features/
|
|
207
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors
|
|
208
208
|
*/
|
|
209
209
|
get behaviors(): Behavior<Node>[];
|
|
210
210
|
/**
|
|
211
211
|
* Gets an attached behavior by name
|
|
212
212
|
* @param name defines the name of the behavior to look for
|
|
213
|
-
* @see https://doc.babylonjs.com/features/
|
|
213
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors
|
|
214
214
|
* @returns null if behavior was not found else the requested behavior
|
|
215
215
|
*/
|
|
216
216
|
getBehaviorByName(name: string): Nullable<Behavior<Node>>;
|
package/node.js
CHANGED
|
@@ -149,7 +149,7 @@ export class Node {
|
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* Gets or sets the parent of the node (without keeping the current position in the scene)
|
|
152
|
-
* @see https://doc.babylonjs.com/
|
|
152
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/parent
|
|
153
153
|
*/
|
|
154
154
|
set parent(parent) {
|
|
155
155
|
if (this._parentNode === parent) {
|
|
@@ -264,7 +264,7 @@ export class Node {
|
|
|
264
264
|
}
|
|
265
265
|
/**
|
|
266
266
|
* Attach a behavior to the node
|
|
267
|
-
* @see https://doc.babylonjs.com/features/
|
|
267
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors
|
|
268
268
|
* @param behavior defines the behavior to attach
|
|
269
269
|
* @param attachImmediately defines that the behavior must be attached even if the scene is still loading
|
|
270
270
|
* @returns the current Node
|
|
@@ -289,7 +289,7 @@ export class Node {
|
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
291
291
|
* Remove an attached behavior
|
|
292
|
-
* @see https://doc.babylonjs.com/features/
|
|
292
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors
|
|
293
293
|
* @param behavior defines the behavior to attach
|
|
294
294
|
* @returns the current Node
|
|
295
295
|
*/
|
|
@@ -304,7 +304,7 @@ export class Node {
|
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
306
|
* Gets the list of attached behaviors
|
|
307
|
-
* @see https://doc.babylonjs.com/features/
|
|
307
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors
|
|
308
308
|
*/
|
|
309
309
|
get behaviors() {
|
|
310
310
|
return this._behaviors;
|
|
@@ -312,7 +312,7 @@ export class Node {
|
|
|
312
312
|
/**
|
|
313
313
|
* Gets an attached behavior by name
|
|
314
314
|
* @param name defines the name of the behavior to look for
|
|
315
|
-
* @see https://doc.babylonjs.com/features/
|
|
315
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors
|
|
316
316
|
* @returns null if behavior was not found else the requested behavior
|
|
317
317
|
*/
|
|
318
318
|
getBehaviorByName(name) {
|