@onerjs/core 8.53.5 → 8.53.6
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/Animations/animationGroup.d.ts +0 -1
- package/Animations/animationGroup.js +0 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animationGroup.pure.js +2 -0
- package/Animations/animationGroup.pure.js.map +1 -1
- package/Animations/runtimeAnimation.js +11 -0
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.pure.js +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +2 -1
- package/AudioV2/abstractAudio/abstractSound.js +7 -2
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +3 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +6 -0
- package/AudioV2/abstractAudio/staticSound.js +17 -1
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/staticSoundInstance.d.ts +4 -2
- package/AudioV2/abstractAudio/staticSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +6 -0
- package/AudioV2/abstractAudio/streamingSound.js +9 -1
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +7 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +56 -8
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +16 -4
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.d.ts +2 -2
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +151 -121
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Behaviors/Cameras/interpolatingBehavior.d.ts +17 -2
- package/Behaviors/Cameras/interpolatingBehavior.js +53 -23
- package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
- package/Bones/bone.pure.js +3 -3
- package/Buffers/buffer.pure.js +0 -12
- package/Buffers/buffer.pure.js.map +1 -1
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js +141 -126
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.d.ts +2 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +290 -277
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraGamepadInput.js +115 -102
- package/Cameras/Inputs/arcRotateCameraGamepadInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.d.ts +3 -0
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +334 -273
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +273 -258
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraPointersInput.js +237 -213
- package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.js +199 -168
- package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +243 -229
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js +311 -266
- package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/followCameraMouseWheelInput.js +139 -119
- package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/followCameraPointersInput.js +239 -203
- package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraGamepadInput.js +127 -114
- package/Cameras/Inputs/freeCameraGamepadInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +278 -244
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +216 -202
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseWheelInput.js +368 -353
- package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraTouchInput.js +185 -172
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +2 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js +291 -246
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +11 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.js +18 -2
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/orbitCameraPointersInput.js +112 -96
- package/Cameras/Inputs/orbitCameraPointersInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +0 -2
- package/Cameras/VR/vrExperienceHelper.js +0 -2
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.pure.js +5 -0
- package/Cameras/VR/vrExperienceHelper.pure.js.map +1 -1
- package/Cameras/arcRotateCamera.pure.js +1559 -1479
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Cameras/camera.pure.js +1225 -1178
- package/Cameras/camera.pure.js.map +1 -1
- package/Cameras/flyCamera.pure.js +369 -351
- package/Cameras/flyCamera.pure.js.map +1 -1
- package/Cameras/followCamera.pure.js +229 -192
- package/Cameras/followCamera.pure.js.map +1 -1
- package/Cameras/freeCamera.pure.js +373 -351
- package/Cameras/freeCamera.pure.js.map +1 -1
- package/Cameras/geospatialCamera.pure.d.ts +30 -7
- package/Cameras/geospatialCamera.pure.js +502 -457
- package/Cameras/geospatialCamera.pure.js.map +1 -1
- package/Cameras/geospatialCameraMovement.js +2 -2
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Cameras/targetCamera.pure.d.ts +7 -0
- package/Cameras/targetCamera.pure.js +550 -509
- package/Cameras/targetCamera.pure.js.map +1 -1
- package/Cameras/universalCamera.pure.js +98 -85
- package/Cameras/universalCamera.pure.js.map +1 -1
- package/Collisions/gpuPicker.d.ts +111 -4
- package/Collisions/gpuPicker.js +696 -119
- package/Collisions/gpuPicker.js.map +1 -1
- package/Compute/computeShader.pure.js +372 -355
- package/Compute/computeShader.pure.js.map +1 -1
- package/Culling/Helper/transformFeedbackBoundingHelper.pure.js +2 -2
- package/Decorators/nodeDecorator.d.ts +11 -1
- package/Decorators/nodeDecorator.js +43 -6
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.loadFile.pure.js +8 -0
- package/Engines/AbstractEngine/abstractEngine.loadFile.pure.js.map +1 -1
- package/Engines/Native/nativeHelpers.js +15 -0
- package/Engines/Native/nativeHelpers.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +7 -2
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +5 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +35 -1
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +5 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js +16 -3
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.pure.js +7 -1
- package/Engines/WebGPU/webgpuClearQuad.pure.js.map +1 -1
- package/Engines/abstractEngine.functions.d.ts +8 -2
- package/Engines/abstractEngine.functions.js +12 -4
- package/Engines/abstractEngine.functions.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +20 -1
- package/Engines/abstractEngine.pure.js +21 -134
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engine.d.ts +208 -0
- package/Engines/engine.pure.js +0 -15
- package/Engines/engine.pure.js.map +1 -1
- package/Engines/nullEngine.pure.d.ts +66 -0
- package/Engines/nullEngine.pure.js +97 -0
- package/Engines/nullEngine.pure.js.map +1 -1
- package/Engines/thinEngine.pure.d.ts +0 -13
- package/Engines/thinEngine.pure.js +4 -23
- package/Engines/thinEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.d.ts +0 -1
- package/Engines/thinNativeEngine.js +0 -1
- package/Engines/thinNativeEngine.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +27 -0
- package/Engines/thinNativeEngine.pure.js +383 -17
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -0
- package/Engines/webgpuEngine.js +1 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +9 -0
- package/Engines/webgpuEngine.pure.js +7 -0
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FlowGraph/flowGraph.js +9 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphContext.js +597 -584
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.pure.d.ts +14 -0
- package/FlowGraph/flowGraphDataConnection.pure.js +38 -1
- package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
- package/FlowGraph/serialization.d.ts +11 -0
- package/FlowGraph/serialization.js +11 -1
- package/FlowGraph/serialization.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.pure.js +182 -170
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.pure.js +196 -184
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js +222 -210
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +123 -111
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +158 -146
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.pure.js +63 -51
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.pure.js +122 -110
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.pure.js +76 -64
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.pure.js +89 -77
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.pure.js +134 -122
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.pure.js +58 -46
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.pure.js +107 -95
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.pure.js +181 -169
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.pure.js +63 -51
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.pure.js +63 -51
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.pure.js +76 -64
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.pure.js +246 -234
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.pure.js +108 -96
- package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.pure.js +87 -75
- package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.pure.js +76 -64
- package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.pure.js +313 -301
- package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.pure.js +502 -490
- package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.pure.js +147 -135
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.pure.js +90 -78
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.pure.js +179 -167
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +462 -451
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js +265 -253
- package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.pure.js +204 -192
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js +611 -550
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.pure.js +320 -308
- package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.pure.js +87 -75
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.pure.js +154 -142
- package/FrameGraph/Node/Blocks/Textures/clearBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.pure.js +150 -138
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.pure.js +270 -256
- package/FrameGraph/Node/Blocks/inputBlock.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.pure.js +95 -83
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.pure.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +715 -693
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +548 -533
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +43 -51
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +66 -35
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
- package/Helpers/environmentHelper.js +2 -2
- package/Helpers/environmentHelper.js.map +1 -1
- package/Layers/effectLayer.js +529 -519
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.pure.js +428 -413
- package/Layers/glowLayer.pure.js.map +1 -1
- package/Layers/highlightLayer.pure.js +473 -458
- package/Layers/highlightLayer.pure.js.map +1 -1
- package/Layers/selectionOutlineLayer.pure.js +360 -345
- package/Layers/selectionOutlineLayer.pure.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.d.ts +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.js +583 -558
- package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +6 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/areaLight.pure.js +61 -39
- package/Lights/areaLight.pure.js.map +1 -1
- package/Lights/directionalLight.pure.js +308 -284
- package/Lights/directionalLight.pure.js.map +1 -1
- package/Lights/hemisphericLight.pure.js +123 -104
- package/Lights/hemisphericLight.pure.js.map +1 -1
- package/Lights/light.d.ts +5 -3
- package/Lights/light.js +869 -827
- package/Lights/light.js.map +1 -1
- package/Lights/pointLight.pure.js +185 -174
- package/Lights/pointLight.pure.js.map +1 -1
- package/Lights/rectAreaLight.pure.d.ts +17 -0
- package/Lights/rectAreaLight.pure.js +238 -159
- package/Lights/rectAreaLight.pure.js.map +1 -1
- package/Lights/shadowLight.js +280 -268
- package/Lights/shadowLight.js.map +1 -1
- package/Lights/spotLight.pure.js +460 -427
- package/Lights/spotLight.pure.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.pure.js +17 -5
- package/Loading/Plugins/babylonFileLoader.pure.js.map +1 -1
- package/Loading/sceneLoader.d.ts +5 -1
- package/Loading/sceneLoader.js +299 -402
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.pure.d.ts +18 -18
- package/Materials/Background/backgroundMaterial.pure.js +949 -794
- package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.d.ts +15 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +34 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +9 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +26 -2
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.d.ts +2 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js +169 -149
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.pure.js +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.pure.js +442 -429
- package/Materials/Node/Blocks/Dual/lightBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js +396 -383
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.pure.js +237 -220
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.pure.js +1 -1
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.pure.js +150 -133
- package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js +265 -250
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.pure.js +159 -142
- package/Materials/Node/Blocks/Fragment/heightToNormalBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js +214 -201
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.pure.js +419 -400
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +3 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.pure.js +302 -289
- package/Materials/Node/Blocks/PBR/clearCoatBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +1327 -1272
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.pure.js +352 -337
- package/Materials/Node/Blocks/PBR/reflectionBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.pure.js +297 -277
- package/Materials/Node/Blocks/PBR/refractionBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.pure.js +146 -131
- package/Materials/Node/Blocks/PBR/sheenBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.pure.js +158 -145
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/clampBlock.pure.js +92 -77
- package/Materials/Node/Blocks/clampBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.pure.js +145 -132
- package/Materials/Node/Blocks/cloudBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.pure.js +182 -169
- package/Materials/Node/Blocks/conditionalBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.pure.js +259 -246
- package/Materials/Node/Blocks/curveBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/debugBlock.pure.js +119 -106
- package/Materials/Node/Blocks/debugBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/loopBlock.pure.js +123 -110
- package/Materials/Node/Blocks/loopBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.pure.js +185 -172
- package/Materials/Node/Blocks/meshAttributeExistsBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/remapBlock.pure.js +127 -112
- package/Materials/Node/Blocks/remapBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/transformBlock.pure.js +196 -185
- package/Materials/Node/Blocks/transformBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.pure.js +451 -438
- package/Materials/Node/Blocks/triPlanarBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/trigonometryBlock.pure.js +184 -171
- package/Materials/Node/Blocks/trigonometryBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/waveBlock.pure.js +97 -84
- package/Materials/Node/Blocks/waveBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/worleyNoise3DBlock.pure.js +276 -263
- package/Materials/Node/Blocks/worleyNoise3DBlock.pure.js.map +1 -1
- package/Materials/Node/nodeMaterial.pure.js +1765 -1737
- package/Materials/Node/nodeMaterial.pure.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
- package/Materials/PBR/openpbrMaterial.pure.d.ts +102 -102
- package/Materials/PBR/openpbrMaterial.pure.js +3115 -2243
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.d.ts +3 -3
- package/Materials/PBR/pbrAnisotropicConfiguration.js +255 -227
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBRDFConfiguration.d.ts +9 -9
- package/Materials/PBR/pbrBRDFConfiguration.js +203 -155
- package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.pure.d.ts +1 -1
- package/Materials/PBR/pbrBaseMaterial.pure.js +1751 -1736
- package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +13 -13
- package/Materials/PBR/pbrBaseSimpleMaterial.js +205 -117
- package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.d.ts +9 -9
- package/Materials/PBR/pbrClearCoatConfiguration.js +464 -406
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.d.ts +3 -3
- package/Materials/PBR/pbrIridescenceConfiguration.js +271 -239
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrMaterial.pure.d.ts +66 -66
- package/Materials/PBR/pbrMaterial.pure.js +1041 -685
- package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.d.ts +5 -5
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js +176 -115
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.d.ts +7 -7
- package/Materials/PBR/pbrSheenConfiguration.js +314 -270
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.d.ts +5 -5
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js +172 -117
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +16 -16
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +864 -764
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +43 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +64 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -0
- package/Materials/Textures/HTML/htmlInteractionManager.d.ts +69 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js +130 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.d.ts +84 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js +246 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlTexture.d.ts +148 -0
- package/Materials/Textures/HTML/htmlTexture.js +455 -0
- package/Materials/Textures/HTML/htmlTexture.js.map +1 -0
- package/Materials/Textures/HTML/index.d.ts +4 -0
- package/Materials/Textures/HTML/index.js +5 -0
- package/Materials/Textures/HTML/index.js.map +1 -0
- package/Materials/Textures/HTML/pure.d.ts +5 -0
- package/Materials/Textures/HTML/pure.js +6 -0
- package/Materials/Textures/HTML/pure.js.map +1 -0
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js +671 -643
- package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
- package/Materials/Textures/baseTexture.pure.js +880 -825
- package/Materials/Textures/baseTexture.pure.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +0 -1
- package/Materials/Textures/cubeTexture.js +0 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.pure.js +368 -333
- package/Materials/Textures/cubeTexture.pure.js.map +1 -1
- package/Materials/Textures/dynamicTexture.d.ts +0 -1
- package/Materials/Textures/dynamicTexture.js +0 -1
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/dynamicTexture.pure.js +2 -0
- package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +0 -2
- package/Materials/Textures/htmlElementTexture.js +0 -2
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.pure.js +4 -0
- package/Materials/Textures/htmlElementTexture.pure.js.map +1 -1
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -1
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +0 -1
- package/Materials/Textures/multiRenderTarget.js +0 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.pure.js +2 -0
- package/Materials/Textures/multiRenderTarget.pure.js.map +1 -1
- package/Materials/Textures/pure.d.ts +1 -0
- package/Materials/Textures/pure.js +1 -0
- package/Materials/Textures/pure.js.map +1 -1
- package/Materials/Textures/texture.pure.js +961 -923
- package/Materials/Textures/texture.pure.js.map +1 -1
- package/Materials/Textures/videoTexture.pure.d.ts +3 -0
- package/Materials/Textures/videoTexture.pure.js +450 -401
- package/Materials/Textures/videoTexture.pure.js.map +1 -1
- package/Materials/colorCurves.pure.js +510 -477
- package/Materials/colorCurves.pure.js.map +1 -1
- package/Materials/effect.pure.js +0 -7
- package/Materials/effect.pure.js.map +1 -1
- package/Materials/imageProcessing.js +12 -4
- package/Materials/imageProcessing.js.map +1 -1
- package/Materials/imageProcessingConfiguration.pure.js +647 -587
- package/Materials/imageProcessingConfiguration.pure.js.map +1 -1
- package/Materials/material.decalMapConfiguration.pure.d.ts +2 -2
- package/Materials/material.decalMapConfiguration.pure.js +149 -130
- package/Materials/material.decalMapConfiguration.pure.js.map +1 -1
- package/Materials/material.detailMapConfiguration.d.ts +3 -3
- package/Materials/material.detailMapConfiguration.js +213 -175
- package/Materials/material.detailMapConfiguration.js.map +1 -1
- package/Materials/material.pure.js +1815 -1721
- package/Materials/material.pure.js.map +1 -1
- package/Materials/materialPluginBase.pure.js +270 -249
- package/Materials/materialPluginBase.pure.js.map +1 -1
- package/Materials/materialPluginManager.pure.js +18 -8
- package/Materials/materialPluginManager.pure.js.map +1 -1
- package/Materials/materialStencilState.js +211 -200
- package/Materials/materialStencilState.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.pure.d.ts +2 -2
- package/Materials/meshDebugPluginMaterial.pure.js +397 -275
- package/Materials/meshDebugPluginMaterial.pure.js.map +1 -1
- package/Materials/standardMaterial.pure.d.ts +32 -32
- package/Materials/standardMaterial.pure.js +1804 -1394
- package/Materials/standardMaterial.pure.js.map +1 -1
- package/Maths/math.color.pure.js +5 -5
- package/Maths/math.functions.js +38 -30
- package/Maths/math.functions.js.map +1 -1
- package/Maths/math.vector.pure.js +25 -25
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +18 -8
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +86 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +255 -104
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +39 -0
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +322 -0
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -0
- package/Meshes/GreasedLine/greasedLineMesh.pure.js +4 -4
- package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +3 -3
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +107 -94
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.pure.js +276 -263
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.pure.js +247 -232
- package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js +299 -284
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/aggregatorBlock.pure.js +196 -181
- package/Meshes/Node/Blocks/Set/aggregatorBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.pure.js +198 -179
- package/Meshes/Node/Blocks/Set/latticeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setColorsBlock.pure.js +151 -138
- package/Meshes/Node/Blocks/Set/setColorsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.pure.js +107 -94
- package/Meshes/Node/Blocks/Set/setMaterialIDBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setNormalsBlock.pure.js +138 -125
- package/Meshes/Node/Blocks/Set/setNormalsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setPositionsBlock.pure.js +213 -200
- package/Meshes/Node/Blocks/Set/setPositionsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setTangentsBlock.pure.js +138 -125
- package/Meshes/Node/Blocks/Set/setTangentsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Set/setUVsBlock.pure.js +179 -164
- package/Meshes/Node/Blocks/Set/setUVsBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/boxBlock.pure.js +183 -170
- package/Meshes/Node/Blocks/Sources/boxBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/capsuleBlock.pure.js +125 -112
- package/Meshes/Node/Blocks/Sources/capsuleBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/cylinderBlock.pure.js +153 -140
- package/Meshes/Node/Blocks/Sources/cylinderBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/discBlock.pure.js +112 -99
- package/Meshes/Node/Blocks/Sources/discBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/gridBlock.pure.js +133 -120
- package/Meshes/Node/Blocks/Sources/gridBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.pure.js +128 -115
- package/Meshes/Node/Blocks/Sources/icoSphereBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/meshBlock.pure.js +116 -103
- package/Meshes/Node/Blocks/Sources/meshBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/planeBlock.pure.js +160 -147
- package/Meshes/Node/Blocks/Sources/planeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/sphereBlock.pure.js +144 -131
- package/Meshes/Node/Blocks/Sources/sphereBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Sources/torusBlock.pure.js +112 -99
- package/Meshes/Node/Blocks/Sources/torusBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.pure.js +200 -185
- package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/bevelBlock.pure.js +111 -98
- package/Meshes/Node/Blocks/bevelBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/booleanGeometryBlock.pure.js +182 -165
- package/Meshes/Node/Blocks/booleanGeometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/cleanGeometryBlock.pure.js +89 -76
- package/Meshes/Node/Blocks/cleanGeometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.pure.js +184 -169
- package/Meshes/Node/Blocks/conditionBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/extrudeGeometryBlock.pure.js +270 -255
- package/Meshes/Node/Blocks/extrudeGeometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCollectionBlock.pure.js +172 -159
- package/Meshes/Node/Blocks/geometryCollectionBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryCurveBlock.pure.js +230 -217
- package/Meshes/Node/Blocks/geometryCurveBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryEaseBlock.pure.js +256 -245
- package/Meshes/Node/Blocks/geometryEaseBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js +206 -189
- package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTransformBlock.pure.js +166 -153
- package/Meshes/Node/Blocks/geometryTransformBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.pure.js +221 -208
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/mappingBlock.pure.js +150 -137
- package/Meshes/Node/Blocks/mappingBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/mathBlock.pure.js +269 -256
- package/Meshes/Node/Blocks/mathBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/mergeGeometryBlock.pure.js +141 -128
- package/Meshes/Node/Blocks/mergeGeometryBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.pure.js +161 -148
- package/Meshes/Node/Blocks/randomBlock.pure.js.map +1 -1
- package/Meshes/Node/Blocks/subdivideBlock.pure.js +102 -87
- package/Meshes/Node/Blocks/subdivideBlock.pure.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +560 -538
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.js +473 -458
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/abstractMesh.pure.js +2218 -2207
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/geometry.js +30 -15
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/mesh.pure.js +26 -14
- package/Meshes/mesh.pure.js.map +1 -1
- package/Meshes/mesh.vertexData.js +1665 -1655
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/transformNode.pure.js +1400 -1372
- package/Meshes/transformNode.pure.js.map +1 -1
- package/Misc/decorators.d.ts +34 -19
- package/Misc/decorators.functions.d.ts +33 -2
- package/Misc/decorators.functions.js +114 -35
- package/Misc/decorators.functions.js.map +1 -1
- package/Misc/decorators.js +96 -68
- package/Misc/decorators.js.map +1 -1
- package/Misc/decorators.serialization.js +47 -40
- package/Misc/decorators.serialization.js.map +1 -1
- package/Misc/decorators.serializationUtilities.d.ts +24 -0
- package/Misc/decorators.serializationUtilities.js +20 -0
- package/Misc/decorators.serializationUtilities.js.map +1 -0
- package/Misc/dumpTools.pure.js +43 -33
- package/Misc/dumpTools.pure.js.map +1 -1
- package/Misc/fileTools.pure.js +8 -0
- package/Misc/fileTools.pure.js.map +1 -1
- package/Misc/observable.pure.js +0 -7
- package/Misc/observable.pure.js.map +1 -1
- package/Misc/snapshotRenderingHelper.d.ts +4 -1
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/symbolMetadataPolyfill.d.ts +11 -0
- package/Misc/symbolMetadataPolyfill.js +22 -0
- package/Misc/symbolMetadataPolyfill.js.map +1 -0
- package/Misc/tools.pure.js +2 -2
- package/Misc/tools.pure.js.map +1 -1
- package/Morph/morphTarget.js +382 -365
- package/Morph/morphTarget.js.map +1 -1
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.pure.js +160 -145
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.pure.js +187 -174
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.pure.js +238 -219
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.pure.js +140 -115
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.pure.js +157 -144
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Triggers/particleTriggerBlock.pure.js +133 -119
- package/Particles/Node/Blocks/Triggers/particleTriggerBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/Update/alignAngleBlock.pure.js +93 -80
- package/Particles/Node/Blocks/Update/alignAngleBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleDebugBlock.pure.js +117 -105
- package/Particles/Node/Blocks/particleDebugBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleFloatToIntBlock.pure.js +105 -92
- package/Particles/Node/Blocks/particleFloatToIntBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleGradientValueBlock.pure.js +82 -69
- package/Particles/Node/Blocks/particleGradientValueBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleLocalVariableBlock.pure.js +113 -101
- package/Particles/Node/Blocks/particleLocalVariableBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleMathBlock.pure.js +278 -265
- package/Particles/Node/Blocks/particleMathBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleNumberMathBlock.pure.js +155 -142
- package/Particles/Node/Blocks/particleNumberMathBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleRandomBlock.pure.js +156 -143
- package/Particles/Node/Blocks/particleRandomBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleTrigonometryBlock.pure.js +217 -204
- package/Particles/Node/Blocks/particleTrigonometryBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/particleVectorMathBlock.pure.js +106 -93
- package/Particles/Node/Blocks/particleVectorMathBlock.pure.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.pure.js +366 -330
- package/Particles/Node/Blocks/systemBlock.pure.js.map +1 -1
- package/Particles/Node/nodeParticleBlock.js +339 -324
- package/Particles/Node/nodeParticleBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +494 -473
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +0 -1
- package/Particles/gpuParticleSystem.js +0 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.pure.d.ts +4 -3
- package/Particles/gpuParticleSystem.pure.js +27 -16
- package/Particles/gpuParticleSystem.pure.js.map +1 -1
- package/Particles/particleSystem.pure.js +57 -2
- package/Particles/particleSystem.pure.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +0 -1
- package/Particles/thinParticleSystem.js +0 -1
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.pure.js +2 -0
- package/Particles/thinParticleSystem.pure.js.map +1 -1
- package/Particles/webgl2ParticleSystem.pure.js +2 -0
- package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
- package/Physics/v1/physicsImpostor.pure.js +4 -4
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js +675 -656
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.d.ts +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js +521 -486
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.pure.js +241 -220
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.pure.js +852 -835
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.pure.js +1135 -1073
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.pure.js +319 -303
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +212 -199
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.pure.js +67 -55
- package/PostProcesses/blackAndWhitePostProcess.pure.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.pure.js +74 -62
- package/PostProcesses/bloomMergePostProcess.pure.js.map +1 -1
- package/PostProcesses/blurPostProcess.pure.js +127 -115
- package/PostProcesses/blurPostProcess.pure.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.pure.js +130 -118
- package/PostProcesses/chromaticAberrationPostProcess.pure.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.pure.js +115 -104
- package/PostProcesses/circleOfConfusionPostProcess.pure.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.pure.js +55 -43
- package/PostProcesses/colorCorrectionPostProcess.pure.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.pure.js +96 -84
- package/PostProcesses/convolutionPostProcess.pure.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.pure.js +68 -57
- package/PostProcesses/extractHighlightsPostProcess.pure.js.map +1 -1
- package/PostProcesses/filterPostProcess.pure.js +66 -54
- package/PostProcesses/filterPostProcess.pure.js.map +1 -1
- package/PostProcesses/fxaaPostProcess.pure.js.map +1 -1
- package/PostProcesses/grainPostProcess.pure.js +82 -70
- package/PostProcesses/grainPostProcess.pure.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js +334 -322
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.pure.js +246 -235
- package/PostProcesses/motionBlurPostProcess.pure.js.map +1 -1
- package/PostProcesses/passPostProcess.pure.js +75 -63
- package/PostProcesses/passPostProcess.pure.js.map +1 -1
- package/PostProcesses/postProcess.pure.js +899 -835
- package/PostProcesses/postProcess.pure.js.map +1 -1
- package/PostProcesses/refractionPostProcess.pure.js +114 -87
- package/PostProcesses/refractionPostProcess.pure.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js +108 -96
- package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.pure.js +241 -220
- package/PostProcesses/screenSpaceReflectionPostProcess.pure.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.pure.js +86 -74
- package/PostProcesses/sharpenPostProcess.pure.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.pure.js +82 -70
- package/PostProcesses/tonemapPostProcess.pure.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.js +500 -465
- package/PostProcesses/volumetricLightScatteringPostProcess.pure.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.d.ts +0 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +0 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js +2 -0
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js.map +1 -1
- package/Probes/reflectionProbe.pure.js +238 -224
- package/Probes/reflectionProbe.pure.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.pure.d.ts +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.pure.js +138 -105
- package/Rendering/GlobalIllumination/giRSMManager.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.d.ts +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js +155 -138
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +0 -2
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +0 -2
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +5 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +0 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +0 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +1 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +34 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
- package/Rendering/edgesRenderer.pure.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +0 -2
- package/Rendering/prePassRenderer.js +0 -2
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.pure.js +2 -0
- package/Rendering/prePassRenderer.pure.js.map +1 -1
- package/Rendering/reflectiveShadowMap.pure.d.ts +1 -1
- package/Rendering/reflectiveShadowMap.pure.js +151 -130
- package/Rendering/reflectiveShadowMap.pure.js.map +1 -1
- package/Rendering/thinDepthPeelingRenderer.d.ts +0 -1
- package/Rendering/thinDepthPeelingRenderer.js +0 -1
- package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +1 -0
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +35 -5
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/Shaders/gaussianSplatting.fragment.js +17 -1
- package/Shaders/gaussianSplatting.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +1 -1
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingDepth.vertex.js +1 -1
- package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
- package/Shaders/picking.fragment.js +39 -3
- package/Shaders/picking.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +3 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
- package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +39 -7
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +4 -3
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js +14 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +2 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
- package/ShadersWGSL/lightingVolume.compute.js +2 -2
- package/ShadersWGSL/lightingVolume.compute.js.map +1 -1
- package/ShadersWGSL/picking.fragment.js +22 -1
- package/ShadersWGSL/picking.fragment.js.map +1 -1
- package/XR/features/Layers/WebXRCompositionLayer.d.ts +3 -2
- package/XR/features/Layers/WebXRCompositionLayer.js +2 -2
- package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -1
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +59 -0
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +120 -0
- package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -0
- package/XR/features/Layers/WebXRWebGPUProjectionLayer.d.ts +25 -0
- package/XR/features/Layers/WebXRWebGPUProjectionLayer.js +69 -0
- package/XR/features/Layers/WebXRWebGPUProjectionLayer.js.map +1 -0
- package/XR/features/WebXRLayers.pure.d.ts +8 -0
- package/XR/features/WebXRLayers.pure.js +43 -6
- package/XR/features/WebXRLayers.pure.js.map +1 -1
- package/XR/native/nativeXRRenderTarget.d.ts +2 -2
- package/XR/native/nativeXRRenderTarget.js +2 -2
- package/XR/native/nativeXRRenderTarget.js.map +1 -1
- package/XR/webXRExperienceHelper.js +10 -1
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRGraphicsBinding.d.ts +90 -0
- package/XR/webXRGraphicsBinding.js +85 -0
- package/XR/webXRGraphicsBinding.js.map +1 -0
- package/XR/webXRLayerRenderTargetTexture.d.ts +24 -0
- package/XR/webXRLayerRenderTargetTexture.js +30 -0
- package/XR/webXRLayerRenderTargetTexture.js.map +1 -0
- package/XR/webXRManagedOutputCanvas.d.ts +14 -0
- package/XR/webXRManagedOutputCanvas.js +24 -5
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/XR/webXRRenderTargetTextureProvider.d.ts +25 -4
- package/XR/webXRRenderTargetTextureProvider.js +33 -35
- package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
- package/XR/webXRSessionManager.d.ts +11 -0
- package/XR/webXRSessionManager.js +37 -0
- package/XR/webXRSessionManager.js.map +1 -1
- package/XR/webXRTypes.d.ts +9 -6
- package/XR/webXRTypes.js.map +1 -1
- package/XR/webXRWebGLLayer.d.ts +2 -2
- package/XR/webXRWebGLLayer.js +2 -2
- package/XR/webXRWebGLLayer.js.map +1 -1
- package/XR/webXRWebGLRenderTargetTextureProvider.d.ts +12 -0
- package/XR/webXRWebGLRenderTargetTextureProvider.js +58 -0
- package/XR/webXRWebGLRenderTargetTextureProvider.js.map +1 -0
- package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +69 -0
- package/XR/webXRWebGPURenderTargetTextureProvider.js +148 -0
- package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/node.js +878 -845
- package/node.js.map +1 -1
- package/package.json +8 -14
- package/scene.pure.d.ts +12 -0
- package/scene.pure.js +36 -0
- package/scene.pure.js.map +1 -1
- package/tslib.es6.js +304 -150
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** This file must only contain pure code and pure imports */
|
|
2
2
|
var _a, _b, _c, _d;
|
|
3
|
-
import {
|
|
3
|
+
import { __esDecorate, __runInitializers } from "../tslib.es6.js";
|
|
4
4
|
import { serialize, serializeAsVector3, serializeAsQuaternion } from "../Misc/decorators.js";
|
|
5
5
|
import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
6
6
|
import { Observable } from "../Misc/observable.pure.js";
|
|
@@ -11,1420 +11,1448 @@ import { GetClass } from "../Misc/typeStore.js";
|
|
|
11
11
|
* A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix.
|
|
12
12
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
14
|
+
let TransformNode = (() => {
|
|
15
|
+
var _a;
|
|
16
|
+
let _classSuper = Node;
|
|
17
|
+
let __position_decorators;
|
|
18
|
+
let __position_initializers = [];
|
|
19
|
+
let __position_extraInitializers = [];
|
|
20
|
+
let __rotation_decorators;
|
|
21
|
+
let __rotation_initializers = [];
|
|
22
|
+
let __rotation_extraInitializers = [];
|
|
23
|
+
let __rotationQuaternion_decorators;
|
|
24
|
+
let __rotationQuaternion_initializers = [];
|
|
25
|
+
let __rotationQuaternion_extraInitializers = [];
|
|
26
|
+
let __scaling_decorators;
|
|
27
|
+
let __scaling_initializers = [];
|
|
28
|
+
let __scaling_extraInitializers = [];
|
|
29
|
+
let __billboardMode_decorators;
|
|
30
|
+
let __billboardMode_initializers = [];
|
|
31
|
+
let __billboardMode_extraInitializers = [];
|
|
32
|
+
let _scalingDeterminant_decorators;
|
|
33
|
+
let _scalingDeterminant_initializers = [];
|
|
34
|
+
let _scalingDeterminant_extraInitializers = [];
|
|
35
|
+
let __infiniteDistance_decorators;
|
|
36
|
+
let __infiniteDistance_initializers = [];
|
|
37
|
+
let __infiniteDistance_extraInitializers = [];
|
|
38
|
+
let _ignoreNonUniformScaling_decorators;
|
|
39
|
+
let _ignoreNonUniformScaling_initializers = [];
|
|
40
|
+
let _ignoreNonUniformScaling_extraInitializers = [];
|
|
41
|
+
let _reIntegrateRotationIntoRotationQuaternion_decorators;
|
|
42
|
+
let _reIntegrateRotationIntoRotationQuaternion_initializers = [];
|
|
43
|
+
let _reIntegrateRotationIntoRotationQuaternion_extraInitializers = [];
|
|
44
|
+
return _a = class TransformNode extends _classSuper {
|
|
45
|
+
/**
|
|
46
|
+
* Gets or sets the billboard mode. Default is 0.
|
|
47
|
+
*
|
|
48
|
+
* | Value | Type | Description |
|
|
49
|
+
* | --- | --- | --- |
|
|
50
|
+
* | 0 | BILLBOARDMODE_NONE | |
|
|
51
|
+
* | 1 | BILLBOARDMODE_X | |
|
|
52
|
+
* | 2 | BILLBOARDMODE_Y | |
|
|
53
|
+
* | 4 | BILLBOARDMODE_Z | |
|
|
54
|
+
* | 7 | BILLBOARDMODE_ALL | |
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
get billboardMode() {
|
|
58
|
+
return this._billboardMode;
|
|
59
|
+
}
|
|
60
|
+
set billboardMode(value) {
|
|
61
|
+
if (this._billboardMode === value) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this._billboardMode = value;
|
|
65
|
+
this._cache.useBillboardPosition = (this._billboardMode & _a.BILLBOARDMODE_USE_POSITION) !== 0;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Gets or sets the distance of the object to max, often used by skybox
|
|
69
|
+
*/
|
|
70
|
+
get infiniteDistance() {
|
|
71
|
+
return this._infiniteDistance;
|
|
72
|
+
}
|
|
73
|
+
set infiniteDistance(value) {
|
|
74
|
+
if (this._infiniteDistance === value) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this._infiniteDistance = value;
|
|
78
|
+
}
|
|
79
|
+
/** @internal */
|
|
80
|
+
constructor(name, scene = null, isPure = true) {
|
|
81
|
+
super(name, scene, false);
|
|
82
|
+
this._forward = new Vector3(0, 0, 1);
|
|
83
|
+
this._up = new Vector3(0, 1, 0);
|
|
84
|
+
this._right = new Vector3(1, 0, 0);
|
|
85
|
+
// Properties
|
|
86
|
+
this._position = __runInitializers(this, __position_initializers, Vector3.Zero());
|
|
87
|
+
this._rotation = (__runInitializers(this, __position_extraInitializers), __runInitializers(this, __rotation_initializers, Vector3.Zero()));
|
|
88
|
+
this._rotationQuaternion = (__runInitializers(this, __rotation_extraInitializers), __runInitializers(this, __rotationQuaternion_initializers, null));
|
|
89
|
+
this._scaling = (__runInitializers(this, __rotationQuaternion_extraInitializers), __runInitializers(this, __scaling_initializers, Vector3.One()));
|
|
90
|
+
this._transformToBoneReferal = (__runInitializers(this, __scaling_extraInitializers), null);
|
|
91
|
+
this._isAbsoluteSynced = false;
|
|
92
|
+
this._billboardMode = __runInitializers(this, __billboardMode_initializers, _a.BILLBOARDMODE_NONE);
|
|
93
|
+
/**
|
|
94
|
+
* Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube
|
|
95
|
+
*/
|
|
96
|
+
this.scalingDeterminant = (__runInitializers(this, __billboardMode_extraInitializers), __runInitializers(this, _scalingDeterminant_initializers, 1));
|
|
97
|
+
this._infiniteDistance = (__runInitializers(this, _scalingDeterminant_extraInitializers), __runInitializers(this, __infiniteDistance_initializers, false));
|
|
98
|
+
/**
|
|
99
|
+
* Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored.
|
|
100
|
+
* By default the system will update normals to compensate
|
|
101
|
+
*/
|
|
102
|
+
this.ignoreNonUniformScaling = (__runInitializers(this, __infiniteDistance_extraInitializers), __runInitializers(this, _ignoreNonUniformScaling_initializers, false));
|
|
103
|
+
/**
|
|
104
|
+
* Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both
|
|
105
|
+
*/
|
|
106
|
+
this.reIntegrateRotationIntoRotationQuaternion = (__runInitializers(this, _ignoreNonUniformScaling_extraInitializers), __runInitializers(this, _reIntegrateRotationIntoRotationQuaternion_initializers, false));
|
|
107
|
+
// Cache
|
|
108
|
+
/** @internal */
|
|
109
|
+
this._poseMatrix = (__runInitializers(this, _reIntegrateRotationIntoRotationQuaternion_extraInitializers), null);
|
|
110
|
+
/** @internal */
|
|
111
|
+
this._localMatrix = Matrix.Zero();
|
|
112
|
+
this._usePivotMatrix = false;
|
|
113
|
+
this._absolutePosition = Vector3.Zero();
|
|
114
|
+
this._absoluteScaling = Vector3.Zero();
|
|
115
|
+
this._absoluteRotationQuaternion = Quaternion.Identity();
|
|
116
|
+
this._pivotMatrix = Matrix.Identity();
|
|
117
|
+
/** @internal */
|
|
118
|
+
this._eulerCacheRotation = new Vector3(0, 0, 0, (res, vector) => {
|
|
119
|
+
if (this._rotationQuaternion) {
|
|
120
|
+
if ("x" in res) {
|
|
121
|
+
vector._x = res.x;
|
|
122
|
+
}
|
|
123
|
+
if ("y" in res) {
|
|
124
|
+
vector._y = res.y;
|
|
125
|
+
}
|
|
126
|
+
if ("z" in res) {
|
|
127
|
+
vector._z = res.z;
|
|
128
|
+
}
|
|
129
|
+
Quaternion.FromEulerVectorToRef(vector, this._rotationQuaternion);
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
});
|
|
134
|
+
/** @internal */
|
|
135
|
+
this._postMultiplyPivotMatrix = false;
|
|
136
|
+
this._isWorldMatrixFrozen = false;
|
|
137
|
+
/** @internal */
|
|
138
|
+
this._indexInSceneTransformNodesArray = -1;
|
|
139
|
+
/**
|
|
140
|
+
* An event triggered after the world matrix is updated
|
|
141
|
+
*/
|
|
142
|
+
this.onAfterWorldMatrixUpdateObservable = new Observable();
|
|
143
|
+
this._nonUniformScaling = false;
|
|
144
|
+
if (isPure) {
|
|
145
|
+
this.getScene().addTransformNode(this);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Gets a string identifying the name of the class
|
|
150
|
+
* @returns "TransformNode" string
|
|
151
|
+
*/
|
|
152
|
+
getClassName() {
|
|
153
|
+
return "TransformNode";
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Gets or set the node position (default is (0.0, 0.0, 0.0))
|
|
157
|
+
*/
|
|
158
|
+
get position() {
|
|
159
|
+
return this._position;
|
|
160
|
+
}
|
|
161
|
+
set position(newPosition) {
|
|
162
|
+
this._position = newPosition;
|
|
163
|
+
this._markAsDirtyInternal();
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* return true if a pivot has been set
|
|
167
|
+
* @returns true if a pivot matrix is used
|
|
168
|
+
*/
|
|
169
|
+
isUsingPivotMatrix() {
|
|
170
|
+
return this._usePivotMatrix;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* @returns true if pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect.
|
|
174
|
+
*/
|
|
175
|
+
isUsingPostMultiplyPivotMatrix() {
|
|
176
|
+
return this._postMultiplyPivotMatrix;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).
|
|
180
|
+
* If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion
|
|
181
|
+
*/
|
|
182
|
+
get rotation() {
|
|
183
|
+
if (this._rotationQuaternion) {
|
|
184
|
+
this._rotationQuaternion.toEulerAnglesToRef(this._eulerCacheRotation);
|
|
185
|
+
return this._eulerCacheRotation;
|
|
186
|
+
}
|
|
187
|
+
return this._rotation;
|
|
188
|
+
}
|
|
189
|
+
set rotation(newRotation) {
|
|
190
|
+
if (this._rotationQuaternion) {
|
|
191
|
+
Quaternion.FromEulerVectorToRef(newRotation, this._rotationQuaternion);
|
|
192
|
+
this._eulerCacheRotation.copyFrom(newRotation);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this._rotation = newRotation;
|
|
196
|
+
this._rotationQuaternion = null;
|
|
197
|
+
this._markAsDirtyInternal();
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (1.0, 1.0, 1.0)).
|
|
201
|
+
*/
|
|
202
|
+
get scaling() {
|
|
203
|
+
return this._scaling;
|
|
204
|
+
}
|
|
205
|
+
set scaling(newScaling) {
|
|
206
|
+
this._scaling = newScaling;
|
|
207
|
+
this._markAsDirtyInternal();
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).
|
|
211
|
+
* If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)
|
|
212
|
+
*/
|
|
213
|
+
get rotationQuaternion() {
|
|
214
|
+
return this._rotationQuaternion;
|
|
215
|
+
}
|
|
216
|
+
set rotationQuaternion(quaternion) {
|
|
217
|
+
this._rotationQuaternion = quaternion;
|
|
218
|
+
//reset the rotation vector.
|
|
219
|
+
if (quaternion) {
|
|
220
|
+
this._rotation.setAll(0.0);
|
|
221
|
+
quaternion.toEulerAnglesToRef(this._eulerCacheRotation);
|
|
222
|
+
this._eulerCacheRotation._isDirty = false;
|
|
223
|
+
}
|
|
224
|
+
this._markAsDirtyInternal();
|
|
225
|
+
}
|
|
226
|
+
_markAsDirtyInternal() {
|
|
227
|
+
if (this._isDirty) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this._isDirty = true;
|
|
231
|
+
if (this.customMarkAsDirty) {
|
|
232
|
+
this.customMarkAsDirty();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The forward direction of that transform in world space.
|
|
237
|
+
*/
|
|
238
|
+
get forward() {
|
|
239
|
+
Vector3.TransformNormalFromFloatsToRef(0, 0, this.getScene().useRightHandedSystem ? -1.0 : 1.0, this.getWorldMatrix(), this._forward);
|
|
240
|
+
return this._forward.normalize();
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The up direction of that transform in world space.
|
|
244
|
+
*/
|
|
245
|
+
get up() {
|
|
246
|
+
Vector3.TransformNormalFromFloatsToRef(0, 1, 0, this.getWorldMatrix(), this._up);
|
|
247
|
+
return this._up.normalize();
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The right direction of that transform in world space.
|
|
251
|
+
*/
|
|
252
|
+
get right() {
|
|
253
|
+
Vector3.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem ? -1.0 : 1.0, 0, 0, this.getWorldMatrix(), this._right);
|
|
254
|
+
return this._right.normalize();
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Copies the parameter passed Matrix into the mesh Pose matrix.
|
|
258
|
+
* @param matrix the matrix to copy the pose from
|
|
259
|
+
* @returns this TransformNode.
|
|
260
|
+
*/
|
|
261
|
+
updatePoseMatrix(matrix) {
|
|
262
|
+
if (!this._poseMatrix) {
|
|
263
|
+
this._poseMatrix = matrix.clone();
|
|
264
|
+
return this;
|
|
265
|
+
}
|
|
266
|
+
this._poseMatrix.copyFrom(matrix);
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Returns the mesh Pose matrix.
|
|
271
|
+
* @returns the pose matrix
|
|
272
|
+
*/
|
|
273
|
+
getPoseMatrix() {
|
|
274
|
+
if (!this._poseMatrix) {
|
|
275
|
+
this._poseMatrix = Matrix.Identity();
|
|
276
|
+
}
|
|
277
|
+
return this._poseMatrix;
|
|
278
|
+
}
|
|
279
|
+
/** @internal */
|
|
280
|
+
_isSynchronized() {
|
|
281
|
+
const cache = this._cache;
|
|
282
|
+
if (this._billboardMode !== cache.billboardMode || this._billboardMode !== _a.BILLBOARDMODE_NONE) {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
if (cache.pivotMatrixUpdated) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
if (this._infiniteDistance) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
if (this._position._isDirty) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
if (this._scaling._isDirty) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
if ((this._rotationQuaternion && this._rotationQuaternion._isDirty) || this._rotation._isDirty) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
100
300
|
return true;
|
|
101
301
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
* An event triggered after the world matrix is updated
|
|
111
|
-
*/
|
|
112
|
-
this.onAfterWorldMatrixUpdateObservable = new Observable();
|
|
113
|
-
this._nonUniformScaling = false;
|
|
114
|
-
if (isPure) {
|
|
115
|
-
this.getScene().addTransformNode(this);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Gets a string identifying the name of the class
|
|
120
|
-
* @returns "TransformNode" string
|
|
121
|
-
*/
|
|
122
|
-
getClassName() {
|
|
123
|
-
return "TransformNode";
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Gets or set the node position (default is (0.0, 0.0, 0.0))
|
|
127
|
-
*/
|
|
128
|
-
get position() {
|
|
129
|
-
return this._position;
|
|
130
|
-
}
|
|
131
|
-
set position(newPosition) {
|
|
132
|
-
this._position = newPosition;
|
|
133
|
-
this._markAsDirtyInternal();
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* return true if a pivot has been set
|
|
137
|
-
* @returns true if a pivot matrix is used
|
|
138
|
-
*/
|
|
139
|
-
isUsingPivotMatrix() {
|
|
140
|
-
return this._usePivotMatrix;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* @returns true if pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect.
|
|
144
|
-
*/
|
|
145
|
-
isUsingPostMultiplyPivotMatrix() {
|
|
146
|
-
return this._postMultiplyPivotMatrix;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).
|
|
150
|
-
* If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion
|
|
151
|
-
*/
|
|
152
|
-
get rotation() {
|
|
153
|
-
if (this._rotationQuaternion) {
|
|
154
|
-
this._rotationQuaternion.toEulerAnglesToRef(this._eulerCacheRotation);
|
|
155
|
-
return this._eulerCacheRotation;
|
|
156
|
-
}
|
|
157
|
-
return this._rotation;
|
|
158
|
-
}
|
|
159
|
-
set rotation(newRotation) {
|
|
160
|
-
if (this._rotationQuaternion) {
|
|
161
|
-
Quaternion.FromEulerVectorToRef(newRotation, this._rotationQuaternion);
|
|
162
|
-
this._eulerCacheRotation.copyFrom(newRotation);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
this._rotation = newRotation;
|
|
166
|
-
this._rotationQuaternion = null;
|
|
167
|
-
this._markAsDirtyInternal();
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (1.0, 1.0, 1.0)).
|
|
171
|
-
*/
|
|
172
|
-
get scaling() {
|
|
173
|
-
return this._scaling;
|
|
174
|
-
}
|
|
175
|
-
set scaling(newScaling) {
|
|
176
|
-
this._scaling = newScaling;
|
|
177
|
-
this._markAsDirtyInternal();
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).
|
|
181
|
-
* If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)
|
|
182
|
-
*/
|
|
183
|
-
get rotationQuaternion() {
|
|
184
|
-
return this._rotationQuaternion;
|
|
185
|
-
}
|
|
186
|
-
set rotationQuaternion(quaternion) {
|
|
187
|
-
this._rotationQuaternion = quaternion;
|
|
188
|
-
//reset the rotation vector.
|
|
189
|
-
if (quaternion) {
|
|
190
|
-
this._rotation.setAll(0.0);
|
|
191
|
-
quaternion.toEulerAnglesToRef(this._eulerCacheRotation);
|
|
192
|
-
this._eulerCacheRotation._isDirty = false;
|
|
193
|
-
}
|
|
194
|
-
this._markAsDirtyInternal();
|
|
195
|
-
}
|
|
196
|
-
_markAsDirtyInternal() {
|
|
197
|
-
if (this._isDirty) {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
this._isDirty = true;
|
|
201
|
-
if (this.customMarkAsDirty) {
|
|
202
|
-
this.customMarkAsDirty();
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* The forward direction of that transform in world space.
|
|
207
|
-
*/
|
|
208
|
-
get forward() {
|
|
209
|
-
Vector3.TransformNormalFromFloatsToRef(0, 0, this.getScene().useRightHandedSystem ? -1.0 : 1.0, this.getWorldMatrix(), this._forward);
|
|
210
|
-
return this._forward.normalize();
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* The up direction of that transform in world space.
|
|
214
|
-
*/
|
|
215
|
-
get up() {
|
|
216
|
-
Vector3.TransformNormalFromFloatsToRef(0, 1, 0, this.getWorldMatrix(), this._up);
|
|
217
|
-
return this._up.normalize();
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* The right direction of that transform in world space.
|
|
221
|
-
*/
|
|
222
|
-
get right() {
|
|
223
|
-
Vector3.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem ? -1.0 : 1.0, 0, 0, this.getWorldMatrix(), this._right);
|
|
224
|
-
return this._right.normalize();
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Copies the parameter passed Matrix into the mesh Pose matrix.
|
|
228
|
-
* @param matrix the matrix to copy the pose from
|
|
229
|
-
* @returns this TransformNode.
|
|
230
|
-
*/
|
|
231
|
-
updatePoseMatrix(matrix) {
|
|
232
|
-
if (!this._poseMatrix) {
|
|
233
|
-
this._poseMatrix = matrix.clone();
|
|
234
|
-
return this;
|
|
235
|
-
}
|
|
236
|
-
this._poseMatrix.copyFrom(matrix);
|
|
237
|
-
return this;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Returns the mesh Pose matrix.
|
|
241
|
-
* @returns the pose matrix
|
|
242
|
-
*/
|
|
243
|
-
getPoseMatrix() {
|
|
244
|
-
if (!this._poseMatrix) {
|
|
245
|
-
this._poseMatrix = Matrix.Identity();
|
|
246
|
-
}
|
|
247
|
-
return this._poseMatrix;
|
|
248
|
-
}
|
|
249
|
-
/** @internal */
|
|
250
|
-
_isSynchronized() {
|
|
251
|
-
const cache = this._cache;
|
|
252
|
-
if (this._billboardMode !== cache.billboardMode || this._billboardMode !== TransformNode.BILLBOARDMODE_NONE) {
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
if (cache.pivotMatrixUpdated) {
|
|
256
|
-
return false;
|
|
257
|
-
}
|
|
258
|
-
if (this._infiniteDistance) {
|
|
259
|
-
return false;
|
|
260
|
-
}
|
|
261
|
-
if (this._position._isDirty) {
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
if (this._scaling._isDirty) {
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
if ((this._rotationQuaternion && this._rotationQuaternion._isDirty) || this._rotation._isDirty) {
|
|
268
|
-
return false;
|
|
269
|
-
}
|
|
270
|
-
return true;
|
|
271
|
-
}
|
|
272
|
-
/** @internal */
|
|
273
|
-
_initCache() {
|
|
274
|
-
super._initCache();
|
|
275
|
-
const cache = this._cache;
|
|
276
|
-
cache.localMatrixUpdated = false;
|
|
277
|
-
cache.billboardMode = -1;
|
|
278
|
-
cache.infiniteDistance = false;
|
|
279
|
-
cache.useBillboardPosition = false;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Returns the current mesh absolute position.
|
|
283
|
-
* Returns a Vector3.
|
|
284
|
-
*/
|
|
285
|
-
get absolutePosition() {
|
|
286
|
-
return this.getAbsolutePosition();
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Returns the current mesh absolute scaling.
|
|
290
|
-
* Returns a Vector3.
|
|
291
|
-
*/
|
|
292
|
-
get absoluteScaling() {
|
|
293
|
-
this._syncAbsoluteScalingAndRotation();
|
|
294
|
-
return this._absoluteScaling;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Returns the current mesh absolute rotation.
|
|
298
|
-
* Returns a Quaternion.
|
|
299
|
-
*/
|
|
300
|
-
get absoluteRotationQuaternion() {
|
|
301
|
-
this._syncAbsoluteScalingAndRotation();
|
|
302
|
-
return this._absoluteRotationQuaternion;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Sets a new matrix to apply before all other transformation
|
|
306
|
-
* @param matrix defines the transform matrix
|
|
307
|
-
* @returns the current TransformNode
|
|
308
|
-
*/
|
|
309
|
-
setPreTransformMatrix(matrix) {
|
|
310
|
-
return this.setPivotMatrix(matrix, false);
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Sets a new pivot matrix to the current node
|
|
314
|
-
* @param matrix defines the new pivot matrix to use
|
|
315
|
-
* @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
|
|
316
|
-
* @returns the current TransformNode
|
|
317
|
-
*/
|
|
318
|
-
setPivotMatrix(matrix, postMultiplyPivotMatrix = true) {
|
|
319
|
-
this._pivotMatrix.copyFrom(matrix);
|
|
320
|
-
this._usePivotMatrix = !this._pivotMatrix.isIdentity();
|
|
321
|
-
this._cache.pivotMatrixUpdated = true;
|
|
322
|
-
this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
|
|
323
|
-
if (this._postMultiplyPivotMatrix) {
|
|
324
|
-
if (!this._pivotMatrixInverse) {
|
|
325
|
-
this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
|
|
302
|
+
/** @internal */
|
|
303
|
+
_initCache() {
|
|
304
|
+
super._initCache();
|
|
305
|
+
const cache = this._cache;
|
|
306
|
+
cache.localMatrixUpdated = false;
|
|
307
|
+
cache.billboardMode = -1;
|
|
308
|
+
cache.infiniteDistance = false;
|
|
309
|
+
cache.useBillboardPosition = false;
|
|
329
310
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
* @returns the matrix
|
|
337
|
-
*/
|
|
338
|
-
getPivotMatrix() {
|
|
339
|
-
return this._pivotMatrix;
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Instantiate (when possible) or clone that node with its hierarchy
|
|
343
|
-
* @param newParent defines the new parent to use for the instance (or clone)
|
|
344
|
-
* @param options defines options to configure how copy is done
|
|
345
|
-
* @param onNewNodeCreated defines an option callback to call when a clone or an instance is created
|
|
346
|
-
* @returns an instance (or a clone) of the current node with its hierarchy
|
|
347
|
-
*/
|
|
348
|
-
instantiateHierarchy(newParent = null, options, onNewNodeCreated) {
|
|
349
|
-
const clone = this.clone("Clone of " + (this.name || this.id), newParent || this.parent, true);
|
|
350
|
-
if (clone) {
|
|
351
|
-
if (onNewNodeCreated) {
|
|
352
|
-
onNewNodeCreated(this, clone);
|
|
311
|
+
/**
|
|
312
|
+
* Returns the current mesh absolute position.
|
|
313
|
+
* Returns a Vector3.
|
|
314
|
+
*/
|
|
315
|
+
get absolutePosition() {
|
|
316
|
+
return this.getAbsolutePosition();
|
|
353
317
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Returns the current mesh absolute scaling.
|
|
320
|
+
* Returns a Vector3.
|
|
321
|
+
*/
|
|
322
|
+
get absoluteScaling() {
|
|
323
|
+
this._syncAbsoluteScalingAndRotation();
|
|
324
|
+
return this._absoluteScaling;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Returns the current mesh absolute rotation.
|
|
328
|
+
* Returns a Quaternion.
|
|
329
|
+
*/
|
|
330
|
+
get absoluteRotationQuaternion() {
|
|
331
|
+
this._syncAbsoluteScalingAndRotation();
|
|
332
|
+
return this._absoluteRotationQuaternion;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Sets a new matrix to apply before all other transformation
|
|
336
|
+
* @param matrix defines the transform matrix
|
|
337
|
+
* @returns the current TransformNode
|
|
338
|
+
*/
|
|
339
|
+
setPreTransformMatrix(matrix) {
|
|
340
|
+
return this.setPivotMatrix(matrix, false);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Sets a new pivot matrix to the current node
|
|
344
|
+
* @param matrix defines the new pivot matrix to use
|
|
345
|
+
* @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
|
|
346
|
+
* @returns the current TransformNode
|
|
347
|
+
*/
|
|
348
|
+
setPivotMatrix(matrix, postMultiplyPivotMatrix = true) {
|
|
349
|
+
this._pivotMatrix.copyFrom(matrix);
|
|
350
|
+
this._usePivotMatrix = !this._pivotMatrix.isIdentity();
|
|
351
|
+
this._cache.pivotMatrixUpdated = true;
|
|
352
|
+
this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
|
|
353
|
+
if (this._postMultiplyPivotMatrix) {
|
|
354
|
+
if (!this._pivotMatrixInverse) {
|
|
355
|
+
this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return this;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Returns the mesh pivot matrix.
|
|
365
|
+
* Default : Identity.
|
|
366
|
+
* @returns the matrix
|
|
367
|
+
*/
|
|
368
|
+
getPivotMatrix() {
|
|
369
|
+
return this._pivotMatrix;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Instantiate (when possible) or clone that node with its hierarchy
|
|
373
|
+
* @param newParent defines the new parent to use for the instance (or clone)
|
|
374
|
+
* @param options defines options to configure how copy is done
|
|
375
|
+
* @param onNewNodeCreated defines an option callback to call when a clone or an instance is created
|
|
376
|
+
* @returns an instance (or a clone) of the current node with its hierarchy
|
|
377
|
+
*/
|
|
378
|
+
instantiateHierarchy(newParent = null, options, onNewNodeCreated) {
|
|
379
|
+
const clone = this.clone("Clone of " + (this.name || this.id), newParent || this.parent, true);
|
|
380
|
+
if (clone) {
|
|
381
|
+
if (onNewNodeCreated) {
|
|
382
|
+
onNewNodeCreated(this, clone);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
for (const child of this.getChildTransformNodes(true)) {
|
|
386
|
+
child.instantiateHierarchy(clone, options, onNewNodeCreated);
|
|
387
|
+
}
|
|
388
|
+
return clone;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Prevents the World matrix to be computed any longer.
|
|
392
|
+
* Please note that the "moral" contract is that the world matrix is not going to be updated anymore. It is up to the developer to force updates.
|
|
393
|
+
* You trade flexibility for performance. If you want to update it, you have to unfreeze it first.
|
|
394
|
+
* @param newWorldMatrix defines an optional matrix to use as world matrix
|
|
395
|
+
* @param decompose defines whether to decompose the given newWorldMatrix or directly assign
|
|
396
|
+
* @returns the TransformNode.
|
|
397
|
+
*/
|
|
398
|
+
freezeWorldMatrix(newWorldMatrix = null, decompose = false) {
|
|
399
|
+
if (newWorldMatrix) {
|
|
400
|
+
if (decompose) {
|
|
401
|
+
this._rotation.setAll(0);
|
|
402
|
+
this._rotationQuaternion = this._rotationQuaternion || Quaternion.Identity();
|
|
403
|
+
newWorldMatrix.decompose(this._scaling, this._rotationQuaternion, this._position);
|
|
404
|
+
this.computeWorldMatrix(true);
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
this._worldMatrix = newWorldMatrix;
|
|
408
|
+
this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
|
|
409
|
+
this._afterComputeWorldMatrix();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
this._isWorldMatrixFrozen = false; // no guarantee world is not already frozen, switch off temporarily
|
|
414
|
+
this.computeWorldMatrix(true);
|
|
415
|
+
}
|
|
416
|
+
this._isDirty = false;
|
|
417
|
+
this._isWorldMatrixFrozen = true;
|
|
418
|
+
return this;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Allows back the World matrix computation.
|
|
422
|
+
* @returns the TransformNode.
|
|
423
|
+
*/
|
|
424
|
+
unfreezeWorldMatrix() {
|
|
425
|
+
this._isWorldMatrixFrozen = false;
|
|
374
426
|
this.computeWorldMatrix(true);
|
|
427
|
+
return this;
|
|
375
428
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
429
|
+
/**
|
|
430
|
+
* True if the World matrix has been frozen.
|
|
431
|
+
*/
|
|
432
|
+
get isWorldMatrixFrozen() {
|
|
433
|
+
return this._isWorldMatrixFrozen;
|
|
380
434
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
if (absolutePosition.x === undefined) {
|
|
426
|
-
if (arguments.length < 3) {
|
|
435
|
+
/**
|
|
436
|
+
* Returns the mesh absolute position in the World.
|
|
437
|
+
* @returns a Vector3.
|
|
438
|
+
*/
|
|
439
|
+
getAbsolutePosition() {
|
|
440
|
+
this.computeWorldMatrix();
|
|
441
|
+
return this._absolutePosition;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Sets the mesh absolute position in the World from a Vector3 or an Array(3).
|
|
445
|
+
* @param absolutePosition the absolute position to set
|
|
446
|
+
* @returns the TransformNode.
|
|
447
|
+
*/
|
|
448
|
+
setAbsolutePosition(absolutePosition) {
|
|
449
|
+
if (!absolutePosition) {
|
|
450
|
+
return this;
|
|
451
|
+
}
|
|
452
|
+
let absolutePositionX;
|
|
453
|
+
let absolutePositionY;
|
|
454
|
+
let absolutePositionZ;
|
|
455
|
+
if (absolutePosition.x === undefined) {
|
|
456
|
+
if (arguments.length < 3) {
|
|
457
|
+
return this;
|
|
458
|
+
}
|
|
459
|
+
absolutePositionX = arguments[0];
|
|
460
|
+
absolutePositionY = arguments[1];
|
|
461
|
+
absolutePositionZ = arguments[2];
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
absolutePositionX = absolutePosition.x;
|
|
465
|
+
absolutePositionY = absolutePosition.y;
|
|
466
|
+
absolutePositionZ = absolutePosition.z;
|
|
467
|
+
}
|
|
468
|
+
if (this.parent) {
|
|
469
|
+
const invertParentWorldMatrix = TmpVectors.Matrix[0];
|
|
470
|
+
this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);
|
|
471
|
+
Vector3.TransformCoordinatesFromFloatsToRef(absolutePositionX, absolutePositionY, absolutePositionZ, invertParentWorldMatrix, this.position);
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
this.position.x = absolutePositionX;
|
|
475
|
+
this.position.y = absolutePositionY;
|
|
476
|
+
this.position.z = absolutePositionZ;
|
|
477
|
+
}
|
|
478
|
+
this._absolutePosition.copyFrom(absolutePosition);
|
|
427
479
|
return this;
|
|
428
480
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
if (this.parent) {
|
|
439
|
-
const invertParentWorldMatrix = TmpVectors.Matrix[0];
|
|
440
|
-
this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);
|
|
441
|
-
Vector3.TransformCoordinatesFromFloatsToRef(absolutePositionX, absolutePositionY, absolutePositionZ, invertParentWorldMatrix, this.position);
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
this.position.x = absolutePositionX;
|
|
445
|
-
this.position.y = absolutePositionY;
|
|
446
|
-
this.position.z = absolutePositionZ;
|
|
447
|
-
}
|
|
448
|
-
this._absolutePosition.copyFrom(absolutePosition);
|
|
449
|
-
return this;
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* Sets the mesh position in its local space.
|
|
453
|
-
* @param vector3 the position to set in localspace
|
|
454
|
-
* @returns the TransformNode.
|
|
455
|
-
*/
|
|
456
|
-
setPositionWithLocalVector(vector3) {
|
|
457
|
-
this.computeWorldMatrix();
|
|
458
|
-
this.position = Vector3.TransformNormal(vector3, this._localMatrix);
|
|
459
|
-
return this;
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Returns the mesh position in the local space from the current World matrix values.
|
|
463
|
-
* @returns a new Vector3.
|
|
464
|
-
*/
|
|
465
|
-
getPositionExpressedInLocalSpace() {
|
|
466
|
-
this.computeWorldMatrix();
|
|
467
|
-
const invLocalWorldMatrix = TmpVectors.Matrix[0];
|
|
468
|
-
this._localMatrix.invertToRef(invLocalWorldMatrix);
|
|
469
|
-
return Vector3.TransformNormal(this.position, invLocalWorldMatrix);
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Translates the mesh along the passed Vector3 in its local space.
|
|
473
|
-
* @param vector3 the distance to translate in localspace
|
|
474
|
-
* @returns the TransformNode.
|
|
475
|
-
*/
|
|
476
|
-
locallyTranslate(vector3) {
|
|
477
|
-
this.computeWorldMatrix(true);
|
|
478
|
-
this.position = Vector3.TransformCoordinates(vector3, this._localMatrix);
|
|
479
|
-
return this;
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Orients a mesh towards a target point. Mesh must be drawn facing user.
|
|
483
|
-
* @param targetPoint the position (must be in same space as current mesh) to look at
|
|
484
|
-
* @param yawCor optional yaw (y-axis) correction in radians
|
|
485
|
-
* @param pitchCor optional pitch (x-axis) correction in radians
|
|
486
|
-
* @param rollCor optional roll (z-axis) correction in radians
|
|
487
|
-
* @param space the chosen space of the target
|
|
488
|
-
* @returns the TransformNode.
|
|
489
|
-
*/
|
|
490
|
-
lookAt(targetPoint, yawCor = 0, pitchCor = 0, rollCor = 0, space = 0 /* Space.LOCAL */) {
|
|
491
|
-
const dv = TransformNode._LookAtVectorCache;
|
|
492
|
-
const pos = space === 0 /* Space.LOCAL */ ? this.position : this.getAbsolutePosition();
|
|
493
|
-
targetPoint.subtractToRef(pos, dv);
|
|
494
|
-
this.setDirection(dv, yawCor, pitchCor, rollCor);
|
|
495
|
-
// Correct for parent's rotation offset
|
|
496
|
-
if (space === 1 /* Space.WORLD */ && this.parent) {
|
|
497
|
-
if (this.rotationQuaternion) {
|
|
498
|
-
// Get local rotation matrix of the looking object
|
|
499
|
-
const rotationMatrix = TmpVectors.Matrix[0];
|
|
500
|
-
this.rotationQuaternion.toRotationMatrix(rotationMatrix);
|
|
501
|
-
// Offset rotation by parent's inverted rotation matrix to correct in world space
|
|
502
|
-
const parentRotationMatrix = TmpVectors.Matrix[1];
|
|
503
|
-
this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);
|
|
504
|
-
parentRotationMatrix.invert();
|
|
505
|
-
rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);
|
|
506
|
-
this.rotationQuaternion.fromRotationMatrix(rotationMatrix);
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
// Get local rotation matrix of the looking object
|
|
510
|
-
const quaternionRotation = TmpVectors.Quaternion[0];
|
|
511
|
-
Quaternion.FromEulerVectorToRef(this.rotation, quaternionRotation);
|
|
512
|
-
const rotationMatrix = TmpVectors.Matrix[0];
|
|
513
|
-
quaternionRotation.toRotationMatrix(rotationMatrix);
|
|
514
|
-
// Offset rotation by parent's inverted rotation matrix to correct in world space
|
|
515
|
-
const parentRotationMatrix = TmpVectors.Matrix[1];
|
|
516
|
-
this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);
|
|
517
|
-
parentRotationMatrix.invert();
|
|
518
|
-
rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);
|
|
519
|
-
quaternionRotation.fromRotationMatrix(rotationMatrix);
|
|
520
|
-
quaternionRotation.toEulerAnglesToRef(this.rotation);
|
|
481
|
+
/**
|
|
482
|
+
* Sets the mesh position in its local space.
|
|
483
|
+
* @param vector3 the position to set in localspace
|
|
484
|
+
* @returns the TransformNode.
|
|
485
|
+
*/
|
|
486
|
+
setPositionWithLocalVector(vector3) {
|
|
487
|
+
this.computeWorldMatrix();
|
|
488
|
+
this.position = Vector3.TransformNormal(vector3, this._localMatrix);
|
|
489
|
+
return this;
|
|
521
490
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
getDirection(localAxis) {
|
|
532
|
-
const result = Vector3.Zero();
|
|
533
|
-
this.getDirectionToRef(localAxis, result);
|
|
534
|
-
return result;
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh.
|
|
538
|
-
* localAxis is expressed in the mesh local space.
|
|
539
|
-
* result is computed in the World space from the mesh World matrix.
|
|
540
|
-
* @param localAxis axis to rotate
|
|
541
|
-
* @param result the resulting transformnode
|
|
542
|
-
* @returns this TransformNode.
|
|
543
|
-
*/
|
|
544
|
-
getDirectionToRef(localAxis, result) {
|
|
545
|
-
Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
|
|
546
|
-
return this;
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Sets this transform node rotation to the given local axis.
|
|
550
|
-
* @param localAxis the axis in local space
|
|
551
|
-
* @param yawCor optional yaw (y-axis) correction in radians
|
|
552
|
-
* @param pitchCor optional pitch (x-axis) correction in radians
|
|
553
|
-
* @param rollCor optional roll (z-axis) correction in radians
|
|
554
|
-
* @returns this TransformNode
|
|
555
|
-
*/
|
|
556
|
-
setDirection(localAxis, yawCor = 0, pitchCor = 0, rollCor = 0) {
|
|
557
|
-
const yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;
|
|
558
|
-
const len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
|
|
559
|
-
const pitch = -Math.atan2(localAxis.y, len);
|
|
560
|
-
if (this.rotationQuaternion) {
|
|
561
|
-
Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
|
|
562
|
-
}
|
|
563
|
-
else {
|
|
564
|
-
this.rotation.x = pitch + pitchCor;
|
|
565
|
-
this.rotation.y = yaw + yawCor;
|
|
566
|
-
this.rotation.z = rollCor;
|
|
567
|
-
}
|
|
568
|
-
return this;
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Sets a new pivot point to the current node
|
|
572
|
-
* @param point defines the new pivot point to use
|
|
573
|
-
* @param space defines if the point is in world or local space (local by default)
|
|
574
|
-
* @returns the current TransformNode
|
|
575
|
-
*/
|
|
576
|
-
setPivotPoint(point, space = 0 /* Space.LOCAL */) {
|
|
577
|
-
if (this.getScene().getRenderId() == 0) {
|
|
578
|
-
this.computeWorldMatrix(true);
|
|
579
|
-
}
|
|
580
|
-
const wm = this.getWorldMatrix();
|
|
581
|
-
if (space == 1 /* Space.WORLD */) {
|
|
582
|
-
const tmat = TmpVectors.Matrix[0];
|
|
583
|
-
wm.invertToRef(tmat);
|
|
584
|
-
point = Vector3.TransformCoordinates(point, tmat);
|
|
585
|
-
}
|
|
586
|
-
return this.setPivotMatrix(Matrix.Translation(-point.x, -point.y, -point.z), true);
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* Returns a new Vector3 set with the mesh pivot point coordinates in the local space.
|
|
590
|
-
* @returns the pivot point
|
|
591
|
-
*/
|
|
592
|
-
getPivotPoint() {
|
|
593
|
-
const point = Vector3.Zero();
|
|
594
|
-
this.getPivotPointToRef(point);
|
|
595
|
-
return point;
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space.
|
|
599
|
-
* @param result the vector3 to store the result
|
|
600
|
-
* @returns this TransformNode.
|
|
601
|
-
*/
|
|
602
|
-
getPivotPointToRef(result) {
|
|
603
|
-
result.x = -this._pivotMatrix.m[12];
|
|
604
|
-
result.y = -this._pivotMatrix.m[13];
|
|
605
|
-
result.z = -this._pivotMatrix.m[14];
|
|
606
|
-
return this;
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* Returns a new Vector3 set with the mesh pivot point World coordinates.
|
|
610
|
-
* @returns a new Vector3 set with the mesh pivot point World coordinates.
|
|
611
|
-
*/
|
|
612
|
-
getAbsolutePivotPoint() {
|
|
613
|
-
const point = Vector3.Zero();
|
|
614
|
-
this.getAbsolutePivotPointToRef(point);
|
|
615
|
-
return point;
|
|
616
|
-
}
|
|
617
|
-
/**
|
|
618
|
-
* Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates.
|
|
619
|
-
* @param result vector3 to store the result
|
|
620
|
-
* @returns this TransformNode.
|
|
621
|
-
*/
|
|
622
|
-
getAbsolutePivotPointToRef(result) {
|
|
623
|
-
this.getPivotPointToRef(result);
|
|
624
|
-
Vector3.TransformCoordinatesToRef(result, this.getWorldMatrix(), result);
|
|
625
|
-
return this;
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Flag the transform node as dirty (Forcing it to update everything)
|
|
629
|
-
* @param property if set to "rotation" the objects rotationQuaternion will be set to null
|
|
630
|
-
* @returns this node
|
|
631
|
-
*/
|
|
632
|
-
markAsDirty(property) {
|
|
633
|
-
if (this._isDirty) {
|
|
634
|
-
return this;
|
|
635
|
-
}
|
|
636
|
-
// We need to explicitly update the children
|
|
637
|
-
// as the scene.evaluateActiveMeshes will not poll the transform nodes
|
|
638
|
-
if (this._children) {
|
|
639
|
-
for (const child of this._children) {
|
|
640
|
-
child.markAsDirty(property);
|
|
491
|
+
/**
|
|
492
|
+
* Returns the mesh position in the local space from the current World matrix values.
|
|
493
|
+
* @returns a new Vector3.
|
|
494
|
+
*/
|
|
495
|
+
getPositionExpressedInLocalSpace() {
|
|
496
|
+
this.computeWorldMatrix();
|
|
497
|
+
const invLocalWorldMatrix = TmpVectors.Matrix[0];
|
|
498
|
+
this._localMatrix.invertToRef(invLocalWorldMatrix);
|
|
499
|
+
return Vector3.TransformNormal(this.position, invLocalWorldMatrix);
|
|
641
500
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
* To avoid this, you can set updatePivot to true and the pivot will be updated to identity
|
|
652
|
-
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/parent
|
|
653
|
-
* @param node the node ot set as the parent
|
|
654
|
-
* @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.
|
|
655
|
-
* @param updatePivot if true, update the pivot matrix to keep the node in the same space as before
|
|
656
|
-
* @param useAbsoluteScaling if false,will keep the node original scaling
|
|
657
|
-
* @returns this TransformNode.
|
|
658
|
-
*/
|
|
659
|
-
setParent(node, preserveScalingSign = false, updatePivot = false, useAbsoluteScaling = true) {
|
|
660
|
-
if (!node && !this.parent) {
|
|
661
|
-
return this;
|
|
662
|
-
}
|
|
663
|
-
const quatRotation = TmpVectors.Quaternion[0];
|
|
664
|
-
const position = TmpVectors.Vector3[0];
|
|
665
|
-
const scale = TmpVectors.Vector3[1];
|
|
666
|
-
const invParentMatrix = TmpVectors.Matrix[1];
|
|
667
|
-
Matrix.IdentityToRef(invParentMatrix);
|
|
668
|
-
const composedMatrix = TmpVectors.Matrix[0];
|
|
669
|
-
this.computeWorldMatrix(true);
|
|
670
|
-
let currentRotation = this.rotationQuaternion;
|
|
671
|
-
if (!currentRotation) {
|
|
672
|
-
currentRotation = TransformNode._TmpRotation;
|
|
673
|
-
Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, currentRotation);
|
|
674
|
-
}
|
|
675
|
-
// current global transformation without pivot
|
|
676
|
-
Matrix.ComposeToRef(this.scaling, currentRotation, this.position, composedMatrix);
|
|
677
|
-
if (this.parent) {
|
|
678
|
-
composedMatrix.multiplyToRef(this.parent.computeWorldMatrix(true), composedMatrix);
|
|
679
|
-
}
|
|
680
|
-
// is a node was set, calculate the difference between this and the node
|
|
681
|
-
if (node) {
|
|
682
|
-
node.computeWorldMatrix(true).invertToRef(invParentMatrix);
|
|
683
|
-
composedMatrix.multiplyToRef(invParentMatrix, composedMatrix);
|
|
684
|
-
}
|
|
685
|
-
composedMatrix.decompose(scale, quatRotation, position, preserveScalingSign ? this : undefined, useAbsoluteScaling);
|
|
686
|
-
if (this.rotationQuaternion) {
|
|
687
|
-
this.rotationQuaternion.copyFrom(quatRotation);
|
|
688
|
-
}
|
|
689
|
-
else {
|
|
690
|
-
quatRotation.toEulerAnglesToRef(this.rotation);
|
|
691
|
-
}
|
|
692
|
-
this.scaling.copyFrom(scale);
|
|
693
|
-
this.position.copyFrom(position);
|
|
694
|
-
this.parent = node;
|
|
695
|
-
if (updatePivot) {
|
|
696
|
-
this.setPivotMatrix(Matrix.Identity());
|
|
697
|
-
}
|
|
698
|
-
return this;
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Adds the passed mesh as a child to the current mesh.
|
|
702
|
-
* The node will remain exactly where it is and its position / rotation will be updated accordingly.
|
|
703
|
-
* This method is equivalent to calling setParent().
|
|
704
|
-
* @param mesh defines the child mesh
|
|
705
|
-
* @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.
|
|
706
|
-
* @returns the current mesh
|
|
707
|
-
*/
|
|
708
|
-
addChild(mesh, preserveScalingSign = false) {
|
|
709
|
-
mesh.setParent(this, preserveScalingSign);
|
|
710
|
-
return this;
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* Removes the passed mesh from the current mesh children list
|
|
714
|
-
* @param mesh defines the child mesh
|
|
715
|
-
* @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.
|
|
716
|
-
* @returns the current mesh
|
|
717
|
-
*/
|
|
718
|
-
removeChild(mesh, preserveScalingSign = false) {
|
|
719
|
-
if (mesh.parent !== this) {
|
|
720
|
-
return this;
|
|
721
|
-
}
|
|
722
|
-
mesh.setParent(null, preserveScalingSign);
|
|
723
|
-
return this;
|
|
724
|
-
}
|
|
725
|
-
/**
|
|
726
|
-
* True if the scaling property of this object is non uniform eg. (1,2,1)
|
|
727
|
-
*/
|
|
728
|
-
get nonUniformScaling() {
|
|
729
|
-
return this._nonUniformScaling;
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* @internal
|
|
733
|
-
*/
|
|
734
|
-
_updateNonUniformScalingState(value) {
|
|
735
|
-
if (this._nonUniformScaling === value) {
|
|
736
|
-
return false;
|
|
737
|
-
}
|
|
738
|
-
this._nonUniformScaling = value;
|
|
739
|
-
return true;
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* Attach the current TransformNode to another TransformNode associated with a bone
|
|
743
|
-
* @param bone Bone affecting the TransformNode
|
|
744
|
-
* @param affectedTransformNode TransformNode associated with the bone
|
|
745
|
-
* @returns this object
|
|
746
|
-
*/
|
|
747
|
-
attachToBone(bone, affectedTransformNode) {
|
|
748
|
-
this._currentParentWhenAttachingToBone = this.parent;
|
|
749
|
-
this._transformToBoneReferal = affectedTransformNode;
|
|
750
|
-
this.parent = bone;
|
|
751
|
-
bone.getSkeleton().prepare(true); // make sure bone.getFinalMatrix() is up to date
|
|
752
|
-
if (bone.getFinalMatrix().determinant() < 0) {
|
|
753
|
-
this.scalingDeterminant *= -1;
|
|
754
|
-
}
|
|
755
|
-
return this;
|
|
756
|
-
}
|
|
757
|
-
/**
|
|
758
|
-
* Detach the transform node if its associated with a bone
|
|
759
|
-
* @param resetToPreviousParent Indicates if the parent that was in effect when attachToBone was called should be set back or if we should set parent to null instead (defaults to the latter)
|
|
760
|
-
* @returns this object
|
|
761
|
-
*/
|
|
762
|
-
detachFromBone(resetToPreviousParent = false) {
|
|
763
|
-
if (!this.parent) {
|
|
764
|
-
if (resetToPreviousParent) {
|
|
765
|
-
this.parent = this._currentParentWhenAttachingToBone;
|
|
766
|
-
}
|
|
767
|
-
return this;
|
|
768
|
-
}
|
|
769
|
-
if (this.parent.getWorldMatrix().determinant() < 0) {
|
|
770
|
-
this.scalingDeterminant *= -1;
|
|
771
|
-
}
|
|
772
|
-
this._transformToBoneReferal = null;
|
|
773
|
-
if (resetToPreviousParent) {
|
|
774
|
-
this.parent = this._currentParentWhenAttachingToBone;
|
|
775
|
-
}
|
|
776
|
-
else {
|
|
777
|
-
this.parent = null;
|
|
778
|
-
}
|
|
779
|
-
return this;
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.
|
|
783
|
-
* space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.
|
|
784
|
-
* Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
|
|
785
|
-
* The passed axis is also normalized.
|
|
786
|
-
* @param axis the axis to rotate around
|
|
787
|
-
* @param amount the amount to rotate in radians
|
|
788
|
-
* @param space Space to rotate in (Default: local)
|
|
789
|
-
* @returns the TransformNode.
|
|
790
|
-
*/
|
|
791
|
-
rotate(axis, amount, space) {
|
|
792
|
-
axis.normalize();
|
|
793
|
-
if (!this.rotationQuaternion) {
|
|
794
|
-
this.rotationQuaternion = this.rotation.toQuaternion();
|
|
795
|
-
this.rotation.setAll(0);
|
|
796
|
-
}
|
|
797
|
-
let rotationQuaternion;
|
|
798
|
-
if (!space || space === 0 /* Space.LOCAL */) {
|
|
799
|
-
rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._RotationAxisCache);
|
|
800
|
-
this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);
|
|
801
|
-
}
|
|
802
|
-
else {
|
|
803
|
-
if (this.parent) {
|
|
804
|
-
const parentWorldMatrix = this.parent.getWorldMatrix();
|
|
805
|
-
const invertParentWorldMatrix = TmpVectors.Matrix[0];
|
|
806
|
-
parentWorldMatrix.invertToRef(invertParentWorldMatrix);
|
|
807
|
-
axis = Vector3.TransformNormal(axis, invertParentWorldMatrix);
|
|
808
|
-
if (parentWorldMatrix.determinant() < 0) {
|
|
809
|
-
amount *= -1;
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._RotationAxisCache);
|
|
813
|
-
rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
|
|
814
|
-
}
|
|
815
|
-
return this;
|
|
816
|
-
}
|
|
817
|
-
/**
|
|
818
|
-
* Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.
|
|
819
|
-
* Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
|
|
820
|
-
* The passed axis is also normalized. .
|
|
821
|
-
* Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm
|
|
822
|
-
* @param point the point to rotate around
|
|
823
|
-
* @param axis the axis to rotate around
|
|
824
|
-
* @param amount the amount to rotate in radians
|
|
825
|
-
* @returns the TransformNode
|
|
826
|
-
*/
|
|
827
|
-
rotateAround(point, axis, amount) {
|
|
828
|
-
axis.normalize();
|
|
829
|
-
if (!this.rotationQuaternion) {
|
|
830
|
-
this.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);
|
|
831
|
-
this.rotation.setAll(0);
|
|
832
|
-
}
|
|
833
|
-
const tmpVector = TmpVectors.Vector3[0];
|
|
834
|
-
const finalScale = TmpVectors.Vector3[1];
|
|
835
|
-
const finalTranslation = TmpVectors.Vector3[2];
|
|
836
|
-
const finalRotation = TmpVectors.Quaternion[0];
|
|
837
|
-
const translationMatrix = TmpVectors.Matrix[0]; // T
|
|
838
|
-
const translationMatrixInv = TmpVectors.Matrix[1]; // T'
|
|
839
|
-
const rotationMatrix = TmpVectors.Matrix[2]; // R
|
|
840
|
-
const finalMatrix = TmpVectors.Matrix[3]; // T' x R x T
|
|
841
|
-
point.subtractToRef(this.position, tmpVector);
|
|
842
|
-
Matrix.TranslationToRef(tmpVector.x, tmpVector.y, tmpVector.z, translationMatrix); // T
|
|
843
|
-
Matrix.TranslationToRef(-tmpVector.x, -tmpVector.y, -tmpVector.z, translationMatrixInv); // T'
|
|
844
|
-
Matrix.RotationAxisToRef(axis, amount, rotationMatrix); // R
|
|
845
|
-
translationMatrixInv.multiplyToRef(rotationMatrix, finalMatrix); // T' x R
|
|
846
|
-
finalMatrix.multiplyToRef(translationMatrix, finalMatrix); // T' x R x T
|
|
847
|
-
finalMatrix.decompose(finalScale, finalRotation, finalTranslation);
|
|
848
|
-
this.position.addInPlace(finalTranslation);
|
|
849
|
-
finalRotation.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
|
|
850
|
-
return this;
|
|
851
|
-
}
|
|
852
|
-
/**
|
|
853
|
-
* Translates the mesh along the axis vector for the passed distance in the given space.
|
|
854
|
-
* space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.
|
|
855
|
-
* @param axis the axis to translate in
|
|
856
|
-
* @param distance the distance to translate
|
|
857
|
-
* @param space Space to rotate in (Default: local)
|
|
858
|
-
* @returns the TransformNode.
|
|
859
|
-
*/
|
|
860
|
-
translate(axis, distance, space) {
|
|
861
|
-
const displacementVector = axis.scale(distance);
|
|
862
|
-
if (!space || space === 0 /* Space.LOCAL */) {
|
|
863
|
-
const tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);
|
|
864
|
-
this.setPositionWithLocalVector(tempV3);
|
|
865
|
-
}
|
|
866
|
-
else {
|
|
867
|
-
this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));
|
|
868
|
-
}
|
|
869
|
-
return this;
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* Adds a rotation step to the mesh current rotation.
|
|
873
|
-
* x, y, z are Euler angles expressed in radians.
|
|
874
|
-
* This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.
|
|
875
|
-
* This means this rotation is made in the mesh local space only.
|
|
876
|
-
* It's useful to set a custom rotation order different from the BJS standard one YXZ.
|
|
877
|
-
* Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.
|
|
878
|
-
* ```javascript
|
|
879
|
-
* mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);
|
|
880
|
-
* ```
|
|
881
|
-
* Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.
|
|
882
|
-
* Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.
|
|
883
|
-
* @param x Rotation to add
|
|
884
|
-
* @param y Rotation to add
|
|
885
|
-
* @param z Rotation to add
|
|
886
|
-
* @returns the TransformNode.
|
|
887
|
-
*/
|
|
888
|
-
addRotation(x, y, z) {
|
|
889
|
-
let rotationQuaternion;
|
|
890
|
-
if (this.rotationQuaternion) {
|
|
891
|
-
rotationQuaternion = this.rotationQuaternion;
|
|
892
|
-
}
|
|
893
|
-
else {
|
|
894
|
-
rotationQuaternion = TmpVectors.Quaternion[1];
|
|
895
|
-
Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, rotationQuaternion);
|
|
896
|
-
}
|
|
897
|
-
const accumulation = TmpVectors.Quaternion[0];
|
|
898
|
-
Quaternion.RotationYawPitchRollToRef(y, x, z, accumulation);
|
|
899
|
-
rotationQuaternion.multiplyInPlace(accumulation);
|
|
900
|
-
if (!this.rotationQuaternion) {
|
|
901
|
-
rotationQuaternion.toEulerAnglesToRef(this.rotation);
|
|
902
|
-
}
|
|
903
|
-
return this;
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* @internal
|
|
907
|
-
*/
|
|
908
|
-
_getEffectiveParent() {
|
|
909
|
-
return this.parent;
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
* Returns whether the transform node world matrix computation needs the camera information to be computed.
|
|
913
|
-
* This is the case when the node is a billboard or has an infinite distance for instance.
|
|
914
|
-
* @returns true if the world matrix computation needs the camera information to be computed
|
|
915
|
-
*/
|
|
916
|
-
isWorldMatrixCameraDependent() {
|
|
917
|
-
return (this._infiniteDistance && !this.parent) || this._billboardMode !== TransformNode.BILLBOARDMODE_NONE;
|
|
918
|
-
}
|
|
919
|
-
/**
|
|
920
|
-
* Computes the world matrix of the node
|
|
921
|
-
* @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
|
|
922
|
-
* @param camera defines the camera used if different from the scene active camera (This is used with modes like Billboard or infinite distance)
|
|
923
|
-
* @returns the world matrix
|
|
924
|
-
*/
|
|
925
|
-
computeWorldMatrix(force = false, camera = null) {
|
|
926
|
-
if (this._isWorldMatrixFrozen && !this._isDirty) {
|
|
927
|
-
return this._worldMatrix;
|
|
928
|
-
}
|
|
929
|
-
const currentRenderId = this.getScene().getRenderId();
|
|
930
|
-
if (!this._isDirty && !force && (this._currentRenderId === currentRenderId || this.isSynchronized())) {
|
|
931
|
-
this._currentRenderId = currentRenderId;
|
|
932
|
-
return this._worldMatrix;
|
|
933
|
-
}
|
|
934
|
-
camera = camera || this.getScene().activeCamera;
|
|
935
|
-
this._updateCache();
|
|
936
|
-
const cache = this._cache;
|
|
937
|
-
cache.pivotMatrixUpdated = false;
|
|
938
|
-
cache.billboardMode = this.billboardMode;
|
|
939
|
-
cache.infiniteDistance = this.infiniteDistance;
|
|
940
|
-
cache.parent = this._parentNode;
|
|
941
|
-
this._currentRenderId = currentRenderId;
|
|
942
|
-
this._childUpdateId += 1;
|
|
943
|
-
this._isDirty = false;
|
|
944
|
-
this._position._isDirty = false;
|
|
945
|
-
this._rotation._isDirty = false;
|
|
946
|
-
this._scaling._isDirty = false;
|
|
947
|
-
const parent = this._getEffectiveParent();
|
|
948
|
-
// Scaling
|
|
949
|
-
const scaling = TransformNode._TmpScaling;
|
|
950
|
-
let translation = this._position;
|
|
951
|
-
// Translation
|
|
952
|
-
if (this._infiniteDistance) {
|
|
953
|
-
if (!this.parent && camera) {
|
|
954
|
-
const cameraWorldMatrix = camera.getWorldMatrix();
|
|
955
|
-
const m = cameraWorldMatrix.m;
|
|
956
|
-
translation = TransformNode._TmpTranslation;
|
|
957
|
-
translation.copyFromFloats(this._position.x + m[12], this._position.y + m[13], this._position.z + m[14]);
|
|
501
|
+
/**
|
|
502
|
+
* Translates the mesh along the passed Vector3 in its local space.
|
|
503
|
+
* @param vector3 the distance to translate in localspace
|
|
504
|
+
* @returns the TransformNode.
|
|
505
|
+
*/
|
|
506
|
+
locallyTranslate(vector3) {
|
|
507
|
+
this.computeWorldMatrix(true);
|
|
508
|
+
this.position = Vector3.TransformCoordinates(vector3, this._localMatrix);
|
|
509
|
+
return this;
|
|
958
510
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
511
|
+
/**
|
|
512
|
+
* Orients a mesh towards a target point. Mesh must be drawn facing user.
|
|
513
|
+
* @param targetPoint the position (must be in same space as current mesh) to look at
|
|
514
|
+
* @param yawCor optional yaw (y-axis) correction in radians
|
|
515
|
+
* @param pitchCor optional pitch (x-axis) correction in radians
|
|
516
|
+
* @param rollCor optional roll (z-axis) correction in radians
|
|
517
|
+
* @param space the chosen space of the target
|
|
518
|
+
* @returns the TransformNode.
|
|
519
|
+
*/
|
|
520
|
+
lookAt(targetPoint, yawCor = 0, pitchCor = 0, rollCor = 0, space = 0 /* Space.LOCAL */) {
|
|
521
|
+
const dv = _a._LookAtVectorCache;
|
|
522
|
+
const pos = space === 0 /* Space.LOCAL */ ? this.position : this.getAbsolutePosition();
|
|
523
|
+
targetPoint.subtractToRef(pos, dv);
|
|
524
|
+
this.setDirection(dv, yawCor, pitchCor, rollCor);
|
|
525
|
+
// Correct for parent's rotation offset
|
|
526
|
+
if (space === 1 /* Space.WORLD */ && this.parent) {
|
|
527
|
+
if (this.rotationQuaternion) {
|
|
528
|
+
// Get local rotation matrix of the looking object
|
|
529
|
+
const rotationMatrix = TmpVectors.Matrix[0];
|
|
530
|
+
this.rotationQuaternion.toRotationMatrix(rotationMatrix);
|
|
531
|
+
// Offset rotation by parent's inverted rotation matrix to correct in world space
|
|
532
|
+
const parentRotationMatrix = TmpVectors.Matrix[1];
|
|
533
|
+
this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);
|
|
534
|
+
parentRotationMatrix.invert();
|
|
535
|
+
rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);
|
|
536
|
+
this.rotationQuaternion.fromRotationMatrix(rotationMatrix);
|
|
537
|
+
}
|
|
538
|
+
else {
|
|
539
|
+
// Get local rotation matrix of the looking object
|
|
540
|
+
const quaternionRotation = TmpVectors.Quaternion[0];
|
|
541
|
+
Quaternion.FromEulerVectorToRef(this.rotation, quaternionRotation);
|
|
542
|
+
const rotationMatrix = TmpVectors.Matrix[0];
|
|
543
|
+
quaternionRotation.toRotationMatrix(rotationMatrix);
|
|
544
|
+
// Offset rotation by parent's inverted rotation matrix to correct in world space
|
|
545
|
+
const parentRotationMatrix = TmpVectors.Matrix[1];
|
|
546
|
+
this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);
|
|
547
|
+
parentRotationMatrix.invert();
|
|
548
|
+
rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);
|
|
549
|
+
quaternionRotation.fromRotationMatrix(rotationMatrix);
|
|
550
|
+
quaternionRotation.toEulerAnglesToRef(this.rotation);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
return this;
|
|
978
554
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
Matrix.ComposeToRef(scaling, rotation, translation, this._localMatrix);
|
|
1002
|
-
}
|
|
1003
|
-
// Parent
|
|
1004
|
-
if (parent && parent.getWorldMatrix) {
|
|
1005
|
-
if (force) {
|
|
1006
|
-
parent.computeWorldMatrix(force);
|
|
555
|
+
/**
|
|
556
|
+
* Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.
|
|
557
|
+
* This Vector3 is expressed in the World space.
|
|
558
|
+
* @param localAxis axis to rotate
|
|
559
|
+
* @returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.
|
|
560
|
+
*/
|
|
561
|
+
getDirection(localAxis) {
|
|
562
|
+
const result = Vector3.Zero();
|
|
563
|
+
this.getDirectionToRef(localAxis, result);
|
|
564
|
+
return result;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh.
|
|
568
|
+
* localAxis is expressed in the mesh local space.
|
|
569
|
+
* result is computed in the World space from the mesh World matrix.
|
|
570
|
+
* @param localAxis axis to rotate
|
|
571
|
+
* @param result the resulting transformnode
|
|
572
|
+
* @returns this TransformNode.
|
|
573
|
+
*/
|
|
574
|
+
getDirectionToRef(localAxis, result) {
|
|
575
|
+
Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
|
|
576
|
+
return this;
|
|
1007
577
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
578
|
+
/**
|
|
579
|
+
* Sets this transform node rotation to the given local axis.
|
|
580
|
+
* @param localAxis the axis in local space
|
|
581
|
+
* @param yawCor optional yaw (y-axis) correction in radians
|
|
582
|
+
* @param pitchCor optional pitch (x-axis) correction in radians
|
|
583
|
+
* @param rollCor optional roll (z-axis) correction in radians
|
|
584
|
+
* @returns this TransformNode
|
|
585
|
+
*/
|
|
586
|
+
setDirection(localAxis, yawCor = 0, pitchCor = 0, rollCor = 0) {
|
|
587
|
+
const yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;
|
|
588
|
+
const len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
|
|
589
|
+
const pitch = -Math.atan2(localAxis.y, len);
|
|
590
|
+
if (this.rotationQuaternion) {
|
|
591
|
+
Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
|
|
1013
592
|
}
|
|
1014
593
|
else {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
if (
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
594
|
+
this.rotation.x = pitch + pitchCor;
|
|
595
|
+
this.rotation.y = yaw + yawCor;
|
|
596
|
+
this.rotation.z = rollCor;
|
|
597
|
+
}
|
|
598
|
+
return this;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Sets a new pivot point to the current node
|
|
602
|
+
* @param point defines the new pivot point to use
|
|
603
|
+
* @param space defines if the point is in world or local space (local by default)
|
|
604
|
+
* @returns the current TransformNode
|
|
605
|
+
*/
|
|
606
|
+
setPivotPoint(point, space = 0 /* Space.LOCAL */) {
|
|
607
|
+
if (this.getScene().getRenderId() == 0) {
|
|
608
|
+
this.computeWorldMatrix(true);
|
|
609
|
+
}
|
|
610
|
+
const wm = this.getWorldMatrix();
|
|
611
|
+
if (space == 1 /* Space.WORLD */) {
|
|
612
|
+
const tmat = TmpVectors.Matrix[0];
|
|
613
|
+
wm.invertToRef(tmat);
|
|
614
|
+
point = Vector3.TransformCoordinates(point, tmat);
|
|
615
|
+
}
|
|
616
|
+
return this.setPivotMatrix(Matrix.Translation(-point.x, -point.y, -point.z), true);
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Returns a new Vector3 set with the mesh pivot point coordinates in the local space.
|
|
620
|
+
* @returns the pivot point
|
|
621
|
+
*/
|
|
622
|
+
getPivotPoint() {
|
|
623
|
+
const point = Vector3.Zero();
|
|
624
|
+
this.getPivotPointToRef(point);
|
|
625
|
+
return point;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space.
|
|
629
|
+
* @param result the vector3 to store the result
|
|
630
|
+
* @returns this TransformNode.
|
|
631
|
+
*/
|
|
632
|
+
getPivotPointToRef(result) {
|
|
633
|
+
result.x = -this._pivotMatrix.m[12];
|
|
634
|
+
result.y = -this._pivotMatrix.m[13];
|
|
635
|
+
result.z = -this._pivotMatrix.m[14];
|
|
636
|
+
return this;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Returns a new Vector3 set with the mesh pivot point World coordinates.
|
|
640
|
+
* @returns a new Vector3 set with the mesh pivot point World coordinates.
|
|
641
|
+
*/
|
|
642
|
+
getAbsolutePivotPoint() {
|
|
643
|
+
const point = Vector3.Zero();
|
|
644
|
+
this.getAbsolutePivotPointToRef(point);
|
|
645
|
+
return point;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates.
|
|
649
|
+
* @param result vector3 to store the result
|
|
650
|
+
* @returns this TransformNode.
|
|
651
|
+
*/
|
|
652
|
+
getAbsolutePivotPointToRef(result) {
|
|
653
|
+
this.getPivotPointToRef(result);
|
|
654
|
+
Vector3.TransformCoordinatesToRef(result, this.getWorldMatrix(), result);
|
|
655
|
+
return this;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Flag the transform node as dirty (Forcing it to update everything)
|
|
659
|
+
* @param property if set to "rotation" the objects rotationQuaternion will be set to null
|
|
660
|
+
* @returns this node
|
|
661
|
+
*/
|
|
662
|
+
markAsDirty(property) {
|
|
663
|
+
if (this._isDirty) {
|
|
664
|
+
return this;
|
|
665
|
+
}
|
|
666
|
+
// We need to explicitly update the children
|
|
667
|
+
// as the scene.evaluateActiveMeshes will not poll the transform nodes
|
|
668
|
+
if (this._children) {
|
|
669
|
+
for (const child of this._children) {
|
|
670
|
+
child.markAsDirty(property);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return super.markAsDirty(property);
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Defines the passed node as the parent of the current node.
|
|
677
|
+
* The node will remain exactly where it is and its position / rotation will be updated accordingly.
|
|
678
|
+
* If you don't want to preserve the current rotation / position, assign the parent through parent accessor.
|
|
679
|
+
* Note that if the mesh has a pivot matrix / point defined it will be applied after the parent was updated.
|
|
680
|
+
* In that case the node will not remain in the same space as it is, as the pivot will be applied.
|
|
681
|
+
* To avoid this, you can set updatePivot to true and the pivot will be updated to identity
|
|
682
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/parent
|
|
683
|
+
* @param node the node ot set as the parent
|
|
684
|
+
* @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.
|
|
685
|
+
* @param updatePivot if true, update the pivot matrix to keep the node in the same space as before
|
|
686
|
+
* @param useAbsoluteScaling if false,will keep the node original scaling
|
|
687
|
+
* @returns this TransformNode.
|
|
688
|
+
*/
|
|
689
|
+
setParent(node, preserveScalingSign = false, updatePivot = false, useAbsoluteScaling = true) {
|
|
690
|
+
if (!node && !this.parent) {
|
|
691
|
+
return this;
|
|
692
|
+
}
|
|
693
|
+
const quatRotation = TmpVectors.Quaternion[0];
|
|
694
|
+
const position = TmpVectors.Vector3[0];
|
|
695
|
+
const scale = TmpVectors.Vector3[1];
|
|
696
|
+
const invParentMatrix = TmpVectors.Matrix[1];
|
|
697
|
+
Matrix.IdentityToRef(invParentMatrix);
|
|
698
|
+
const composedMatrix = TmpVectors.Matrix[0];
|
|
699
|
+
this.computeWorldMatrix(true);
|
|
700
|
+
let currentRotation = this.rotationQuaternion;
|
|
701
|
+
if (!currentRotation) {
|
|
702
|
+
currentRotation = _a._TmpRotation;
|
|
703
|
+
Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, currentRotation);
|
|
704
|
+
}
|
|
705
|
+
// current global transformation without pivot
|
|
706
|
+
Matrix.ComposeToRef(this.scaling, currentRotation, this.position, composedMatrix);
|
|
707
|
+
if (this.parent) {
|
|
708
|
+
composedMatrix.multiplyToRef(this.parent.computeWorldMatrix(true), composedMatrix);
|
|
709
|
+
}
|
|
710
|
+
// is a node was set, calculate the difference between this and the node
|
|
711
|
+
if (node) {
|
|
712
|
+
node.computeWorldMatrix(true).invertToRef(invParentMatrix);
|
|
713
|
+
composedMatrix.multiplyToRef(invParentMatrix, composedMatrix);
|
|
714
|
+
}
|
|
715
|
+
composedMatrix.decompose(scale, quatRotation, position, preserveScalingSign ? this : undefined, useAbsoluteScaling);
|
|
716
|
+
if (this.rotationQuaternion) {
|
|
717
|
+
this.rotationQuaternion.copyFrom(quatRotation);
|
|
1037
718
|
}
|
|
1038
719
|
else {
|
|
1039
|
-
|
|
720
|
+
quatRotation.toEulerAnglesToRef(this.rotation);
|
|
721
|
+
}
|
|
722
|
+
this.scaling.copyFrom(scale);
|
|
723
|
+
this.position.copyFrom(position);
|
|
724
|
+
this.parent = node;
|
|
725
|
+
if (updatePivot) {
|
|
726
|
+
this.setPivotMatrix(Matrix.Identity());
|
|
1040
727
|
}
|
|
728
|
+
return this;
|
|
1041
729
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
730
|
+
/**
|
|
731
|
+
* Adds the passed mesh as a child to the current mesh.
|
|
732
|
+
* The node will remain exactly where it is and its position / rotation will be updated accordingly.
|
|
733
|
+
* This method is equivalent to calling setParent().
|
|
734
|
+
* @param mesh defines the child mesh
|
|
735
|
+
* @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.
|
|
736
|
+
* @returns the current mesh
|
|
737
|
+
*/
|
|
738
|
+
addChild(mesh, preserveScalingSign = false) {
|
|
739
|
+
mesh.setParent(this, preserveScalingSign);
|
|
740
|
+
return this;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Removes the passed mesh from the current mesh children list
|
|
744
|
+
* @param mesh defines the child mesh
|
|
745
|
+
* @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.
|
|
746
|
+
* @returns the current mesh
|
|
747
|
+
*/
|
|
748
|
+
removeChild(mesh, preserveScalingSign = false) {
|
|
749
|
+
if (mesh.parent !== this) {
|
|
750
|
+
return this;
|
|
751
|
+
}
|
|
752
|
+
mesh.setParent(null, preserveScalingSign);
|
|
753
|
+
return this;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* True if the scaling property of this object is non uniform eg. (1,2,1)
|
|
757
|
+
*/
|
|
758
|
+
get nonUniformScaling() {
|
|
759
|
+
return this._nonUniformScaling;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* @internal
|
|
763
|
+
*/
|
|
764
|
+
_updateNonUniformScalingState(value) {
|
|
765
|
+
if (this._nonUniformScaling === value) {
|
|
766
|
+
return false;
|
|
767
|
+
}
|
|
768
|
+
this._nonUniformScaling = value;
|
|
769
|
+
return true;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Attach the current TransformNode to another TransformNode associated with a bone
|
|
773
|
+
* @param bone Bone affecting the TransformNode
|
|
774
|
+
* @param affectedTransformNode TransformNode associated with the bone
|
|
775
|
+
* @returns this object
|
|
776
|
+
*/
|
|
777
|
+
attachToBone(bone, affectedTransformNode) {
|
|
778
|
+
this._currentParentWhenAttachingToBone = this.parent;
|
|
779
|
+
this._transformToBoneReferal = affectedTransformNode;
|
|
780
|
+
this.parent = bone;
|
|
781
|
+
bone.getSkeleton().prepare(true); // make sure bone.getFinalMatrix() is up to date
|
|
782
|
+
if (bone.getFinalMatrix().determinant() < 0) {
|
|
783
|
+
this.scalingDeterminant *= -1;
|
|
784
|
+
}
|
|
785
|
+
return this;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Detach the transform node if its associated with a bone
|
|
789
|
+
* @param resetToPreviousParent Indicates if the parent that was in effect when attachToBone was called should be set back or if we should set parent to null instead (defaults to the latter)
|
|
790
|
+
* @returns this object
|
|
791
|
+
*/
|
|
792
|
+
detachFromBone(resetToPreviousParent = false) {
|
|
793
|
+
if (!this.parent) {
|
|
794
|
+
if (resetToPreviousParent) {
|
|
795
|
+
this.parent = this._currentParentWhenAttachingToBone;
|
|
796
|
+
}
|
|
797
|
+
return this;
|
|
798
|
+
}
|
|
799
|
+
if (this.parent.getWorldMatrix().determinant() < 0) {
|
|
800
|
+
this.scalingDeterminant *= -1;
|
|
801
|
+
}
|
|
802
|
+
this._transformToBoneReferal = null;
|
|
803
|
+
if (resetToPreviousParent) {
|
|
804
|
+
this.parent = this._currentParentWhenAttachingToBone;
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
this.parent = null;
|
|
808
|
+
}
|
|
809
|
+
return this;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.
|
|
813
|
+
* space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.
|
|
814
|
+
* Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
|
|
815
|
+
* The passed axis is also normalized.
|
|
816
|
+
* @param axis the axis to rotate around
|
|
817
|
+
* @param amount the amount to rotate in radians
|
|
818
|
+
* @param space Space to rotate in (Default: local)
|
|
819
|
+
* @returns the TransformNode.
|
|
820
|
+
*/
|
|
821
|
+
rotate(axis, amount, space) {
|
|
822
|
+
axis.normalize();
|
|
823
|
+
if (!this.rotationQuaternion) {
|
|
824
|
+
this.rotationQuaternion = this.rotation.toQuaternion();
|
|
825
|
+
this.rotation.setAll(0);
|
|
826
|
+
}
|
|
827
|
+
let rotationQuaternion;
|
|
828
|
+
if (!space || space === 0 /* Space.LOCAL */) {
|
|
829
|
+
rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, _a._RotationAxisCache);
|
|
830
|
+
this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
if (this.parent) {
|
|
834
|
+
const parentWorldMatrix = this.parent.getWorldMatrix();
|
|
835
|
+
const invertParentWorldMatrix = TmpVectors.Matrix[0];
|
|
836
|
+
parentWorldMatrix.invertToRef(invertParentWorldMatrix);
|
|
837
|
+
axis = Vector3.TransformNormal(axis, invertParentWorldMatrix);
|
|
838
|
+
if (parentWorldMatrix.determinant() < 0) {
|
|
839
|
+
amount *= -1;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, _a._RotationAxisCache);
|
|
843
|
+
rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
|
|
844
|
+
}
|
|
845
|
+
return this;
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.
|
|
849
|
+
* Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.
|
|
850
|
+
* The passed axis is also normalized. .
|
|
851
|
+
* Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm
|
|
852
|
+
* @param point the point to rotate around
|
|
853
|
+
* @param axis the axis to rotate around
|
|
854
|
+
* @param amount the amount to rotate in radians
|
|
855
|
+
* @returns the TransformNode
|
|
856
|
+
*/
|
|
857
|
+
rotateAround(point, axis, amount) {
|
|
858
|
+
axis.normalize();
|
|
859
|
+
if (!this.rotationQuaternion) {
|
|
860
|
+
this.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);
|
|
861
|
+
this.rotation.setAll(0);
|
|
862
|
+
}
|
|
863
|
+
const tmpVector = TmpVectors.Vector3[0];
|
|
864
|
+
const finalScale = TmpVectors.Vector3[1];
|
|
865
|
+
const finalTranslation = TmpVectors.Vector3[2];
|
|
866
|
+
const finalRotation = TmpVectors.Quaternion[0];
|
|
867
|
+
const translationMatrix = TmpVectors.Matrix[0]; // T
|
|
868
|
+
const translationMatrixInv = TmpVectors.Matrix[1]; // T'
|
|
869
|
+
const rotationMatrix = TmpVectors.Matrix[2]; // R
|
|
870
|
+
const finalMatrix = TmpVectors.Matrix[3]; // T' x R x T
|
|
871
|
+
point.subtractToRef(this.position, tmpVector);
|
|
872
|
+
Matrix.TranslationToRef(tmpVector.x, tmpVector.y, tmpVector.z, translationMatrix); // T
|
|
873
|
+
Matrix.TranslationToRef(-tmpVector.x, -tmpVector.y, -tmpVector.z, translationMatrixInv); // T'
|
|
874
|
+
Matrix.RotationAxisToRef(axis, amount, rotationMatrix); // R
|
|
875
|
+
translationMatrixInv.multiplyToRef(rotationMatrix, finalMatrix); // T' x R
|
|
876
|
+
finalMatrix.multiplyToRef(translationMatrix, finalMatrix); // T' x R x T
|
|
877
|
+
finalMatrix.decompose(finalScale, finalRotation, finalTranslation);
|
|
878
|
+
this.position.addInPlace(finalTranslation);
|
|
879
|
+
finalRotation.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
|
|
880
|
+
return this;
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Translates the mesh along the axis vector for the passed distance in the given space.
|
|
884
|
+
* space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.
|
|
885
|
+
* @param axis the axis to translate in
|
|
886
|
+
* @param distance the distance to translate
|
|
887
|
+
* @param space Space to rotate in (Default: local)
|
|
888
|
+
* @returns the TransformNode.
|
|
889
|
+
*/
|
|
890
|
+
translate(axis, distance, space) {
|
|
891
|
+
const displacementVector = axis.scale(distance);
|
|
892
|
+
if (!space || space === 0 /* Space.LOCAL */) {
|
|
893
|
+
const tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);
|
|
894
|
+
this.setPositionWithLocalVector(tempV3);
|
|
895
|
+
}
|
|
896
|
+
else {
|
|
897
|
+
this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));
|
|
898
|
+
}
|
|
899
|
+
return this;
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Adds a rotation step to the mesh current rotation.
|
|
903
|
+
* x, y, z are Euler angles expressed in radians.
|
|
904
|
+
* This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.
|
|
905
|
+
* This means this rotation is made in the mesh local space only.
|
|
906
|
+
* It's useful to set a custom rotation order different from the BJS standard one YXZ.
|
|
907
|
+
* Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.
|
|
908
|
+
* ```javascript
|
|
909
|
+
* mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);
|
|
910
|
+
* ```
|
|
911
|
+
* Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.
|
|
912
|
+
* Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.
|
|
913
|
+
* @param x Rotation to add
|
|
914
|
+
* @param y Rotation to add
|
|
915
|
+
* @param z Rotation to add
|
|
916
|
+
* @returns the TransformNode.
|
|
917
|
+
*/
|
|
918
|
+
addRotation(x, y, z) {
|
|
919
|
+
let rotationQuaternion;
|
|
920
|
+
if (this.rotationQuaternion) {
|
|
921
|
+
rotationQuaternion = this.rotationQuaternion;
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
rotationQuaternion = TmpVectors.Quaternion[1];
|
|
925
|
+
Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, rotationQuaternion);
|
|
926
|
+
}
|
|
927
|
+
const accumulation = TmpVectors.Quaternion[0];
|
|
928
|
+
Quaternion.RotationYawPitchRollToRef(y, x, z, accumulation);
|
|
929
|
+
rotationQuaternion.multiplyInPlace(accumulation);
|
|
930
|
+
if (!this.rotationQuaternion) {
|
|
931
|
+
rotationQuaternion.toEulerAnglesToRef(this.rotation);
|
|
932
|
+
}
|
|
933
|
+
return this;
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* @internal
|
|
937
|
+
*/
|
|
938
|
+
_getEffectiveParent() {
|
|
939
|
+
return this.parent;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Returns whether the transform node world matrix computation needs the camera information to be computed.
|
|
943
|
+
* This is the case when the node is a billboard or has an infinite distance for instance.
|
|
944
|
+
* @returns true if the world matrix computation needs the camera information to be computed
|
|
945
|
+
*/
|
|
946
|
+
isWorldMatrixCameraDependent() {
|
|
947
|
+
return (this._infiniteDistance && !this.parent) || this._billboardMode !== _a.BILLBOARDMODE_NONE;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Computes the world matrix of the node
|
|
951
|
+
* @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
|
|
952
|
+
* @param camera defines the camera used if different from the scene active camera (This is used with modes like Billboard or infinite distance)
|
|
953
|
+
* @returns the world matrix
|
|
954
|
+
*/
|
|
955
|
+
computeWorldMatrix(force = false, camera = null) {
|
|
956
|
+
if (this._isWorldMatrixFrozen && !this._isDirty) {
|
|
957
|
+
return this._worldMatrix;
|
|
958
|
+
}
|
|
959
|
+
const currentRenderId = this.getScene().getRenderId();
|
|
960
|
+
if (!this._isDirty && !force && (this._currentRenderId === currentRenderId || this.isSynchronized())) {
|
|
961
|
+
this._currentRenderId = currentRenderId;
|
|
962
|
+
return this._worldMatrix;
|
|
963
|
+
}
|
|
964
|
+
camera = camera || this.getScene().activeCamera;
|
|
965
|
+
this._updateCache();
|
|
966
|
+
const cache = this._cache;
|
|
967
|
+
cache.pivotMatrixUpdated = false;
|
|
968
|
+
cache.billboardMode = this.billboardMode;
|
|
969
|
+
cache.infiniteDistance = this.infiniteDistance;
|
|
970
|
+
cache.parent = this._parentNode;
|
|
971
|
+
this._currentRenderId = currentRenderId;
|
|
972
|
+
this._childUpdateId += 1;
|
|
973
|
+
this._isDirty = false;
|
|
974
|
+
this._position._isDirty = false;
|
|
975
|
+
this._rotation._isDirty = false;
|
|
976
|
+
this._scaling._isDirty = false;
|
|
977
|
+
const parent = this._getEffectiveParent();
|
|
978
|
+
// Scaling
|
|
979
|
+
const scaling = _a._TmpScaling;
|
|
980
|
+
let translation = this._position;
|
|
981
|
+
// Translation
|
|
982
|
+
if (this._infiniteDistance) {
|
|
983
|
+
if (!this.parent && camera) {
|
|
984
|
+
const cameraWorldMatrix = camera.getWorldMatrix();
|
|
985
|
+
const m = cameraWorldMatrix.m;
|
|
986
|
+
translation = _a._TmpTranslation;
|
|
987
|
+
translation.copyFromFloats(this._position.x + m[12], this._position.y + m[13], this._position.z + m[14]);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
// Scaling
|
|
991
|
+
scaling.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant);
|
|
992
|
+
// Rotation
|
|
993
|
+
let rotation;
|
|
994
|
+
if (this._rotationQuaternion) {
|
|
995
|
+
const isDirty = this._rotationQuaternion._isDirty;
|
|
996
|
+
this._rotationQuaternion._isDirty = false;
|
|
997
|
+
rotation = this._rotationQuaternion;
|
|
998
|
+
if (this.reIntegrateRotationIntoRotationQuaternion) {
|
|
999
|
+
const len = this.rotation.lengthSquared();
|
|
1000
|
+
if (len) {
|
|
1001
|
+
this._rotationQuaternion.multiplyInPlace(Quaternion.RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z));
|
|
1002
|
+
this._rotation.copyFromFloats(0, 0, 0);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
if (isDirty) {
|
|
1006
|
+
this._rotationQuaternion.toEulerAnglesToRef(this._eulerCacheRotation);
|
|
1007
|
+
this._eulerCacheRotation._isDirty = false;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
else {
|
|
1011
|
+
rotation = _a._TmpRotation;
|
|
1012
|
+
Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, rotation);
|
|
1013
|
+
}
|
|
1014
|
+
// Compose
|
|
1015
|
+
if (this._usePivotMatrix) {
|
|
1016
|
+
const scaleMatrix = TmpVectors.Matrix[1];
|
|
1017
|
+
Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, scaleMatrix);
|
|
1018
|
+
// Rotation
|
|
1019
|
+
const rotationMatrix = TmpVectors.Matrix[0];
|
|
1020
|
+
rotation.toRotationMatrix(rotationMatrix);
|
|
1021
|
+
// Composing transformations
|
|
1022
|
+
this._pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);
|
|
1023
|
+
TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, this._localMatrix);
|
|
1024
|
+
// Post multiply inverse of pivotMatrix
|
|
1025
|
+
if (this._postMultiplyPivotMatrix) {
|
|
1026
|
+
this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix);
|
|
1027
|
+
}
|
|
1028
|
+
this._localMatrix.addTranslationFromFloats(translation.x, translation.y, translation.z);
|
|
1029
|
+
}
|
|
1030
|
+
else {
|
|
1031
|
+
Matrix.ComposeToRef(scaling, rotation, translation, this._localMatrix);
|
|
1032
|
+
}
|
|
1033
|
+
// Parent
|
|
1034
|
+
if (parent && parent.getWorldMatrix) {
|
|
1035
|
+
if (force) {
|
|
1036
|
+
parent.computeWorldMatrix(force);
|
|
1069
1037
|
}
|
|
1070
|
-
if (
|
|
1071
|
-
|
|
1038
|
+
if (this.billboardMode) {
|
|
1039
|
+
if (this._transformToBoneReferal) {
|
|
1040
|
+
const bone = this.parent;
|
|
1041
|
+
bone.getSkeleton().prepare();
|
|
1042
|
+
bone.getFinalMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), TmpVectors.Matrix[7]);
|
|
1043
|
+
}
|
|
1044
|
+
else {
|
|
1045
|
+
TmpVectors.Matrix[7].copyFrom(parent.getWorldMatrix());
|
|
1046
|
+
}
|
|
1047
|
+
// Extract scaling and translation from parent
|
|
1048
|
+
const translation = TmpVectors.Vector3[5];
|
|
1049
|
+
const scale = TmpVectors.Vector3[6];
|
|
1050
|
+
const orientation = TmpVectors.Quaternion[0];
|
|
1051
|
+
TmpVectors.Matrix[7].decompose(scale, orientation, translation);
|
|
1052
|
+
Matrix.ScalingToRef(scale.x, scale.y, scale.z, TmpVectors.Matrix[7]);
|
|
1053
|
+
TmpVectors.Matrix[7].setTranslation(translation);
|
|
1054
|
+
if (_a.BillboardUseParentOrientation) {
|
|
1055
|
+
// set localMatrix translation to be transformed against parent's orientation.
|
|
1056
|
+
this._position.applyRotationQuaternionToRef(orientation, translation);
|
|
1057
|
+
this._localMatrix.setTranslation(translation);
|
|
1058
|
+
}
|
|
1059
|
+
this._localMatrix.multiplyToRef(TmpVectors.Matrix[7], this._worldMatrix);
|
|
1072
1060
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1061
|
+
else {
|
|
1062
|
+
if (this._transformToBoneReferal) {
|
|
1063
|
+
const bone = this.parent;
|
|
1064
|
+
bone.getSkeleton().prepare();
|
|
1065
|
+
this._localMatrix.multiplyToRef(bone.getFinalMatrix(), TmpVectors.Matrix[6]);
|
|
1066
|
+
TmpVectors.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix);
|
|
1067
|
+
}
|
|
1068
|
+
else {
|
|
1069
|
+
this._localMatrix.multiplyToRef(parent.getWorldMatrix(), this._worldMatrix);
|
|
1070
|
+
}
|
|
1075
1071
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1072
|
+
this._markSyncedWithParent();
|
|
1073
|
+
}
|
|
1074
|
+
else {
|
|
1075
|
+
this._worldMatrix.copyFrom(this._localMatrix);
|
|
1076
|
+
}
|
|
1077
|
+
if (camera && this.billboardMode) {
|
|
1078
|
+
// Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)
|
|
1079
|
+
if (!cache.useBillboardPosition) {
|
|
1080
|
+
const storedTranslation = TmpVectors.Vector3[0];
|
|
1081
|
+
this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation
|
|
1082
|
+
// Get camera view matrix
|
|
1083
|
+
TmpVectors.Matrix[1].copyFrom(camera.getViewMatrix());
|
|
1084
|
+
const isRH = this.getScene().useRightHandedSystem;
|
|
1085
|
+
if (isRH) {
|
|
1086
|
+
// This operation is necessary to cancel out the scaling component of the matrix without decomposing it.
|
|
1087
|
+
// It's a trick to extract only the rotation part.
|
|
1088
|
+
TmpVectors.Matrix[1].multiplyToRef(_a._TmpRHRestore, TmpVectors.Matrix[1]);
|
|
1089
|
+
}
|
|
1090
|
+
// This will cancel the camera rotation
|
|
1091
|
+
TmpVectors.Matrix[1].setTranslationFromFloats(0, 0, 0);
|
|
1092
|
+
TmpVectors.Matrix[1].invertToRef(TmpVectors.Matrix[0]);
|
|
1093
|
+
if ((this.billboardMode & _a.BILLBOARDMODE_ALL) !== _a.BILLBOARDMODE_ALL) {
|
|
1094
|
+
TmpVectors.Matrix[0].decompose(undefined, TmpVectors.Quaternion[0], undefined);
|
|
1095
|
+
const eulerAngles = TmpVectors.Vector3[1];
|
|
1096
|
+
TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);
|
|
1097
|
+
if ((this.billboardMode & _a.BILLBOARDMODE_X) !== _a.BILLBOARDMODE_X) {
|
|
1098
|
+
eulerAngles.x = 0;
|
|
1099
|
+
}
|
|
1100
|
+
if ((this.billboardMode & _a.BILLBOARDMODE_Y) !== _a.BILLBOARDMODE_Y) {
|
|
1101
|
+
eulerAngles.y = 0;
|
|
1102
|
+
}
|
|
1103
|
+
if ((this.billboardMode & _a.BILLBOARDMODE_Z) !== _a.BILLBOARDMODE_Z) {
|
|
1104
|
+
eulerAngles.z = 0;
|
|
1105
|
+
}
|
|
1106
|
+
if (isRH) {
|
|
1107
|
+
eulerAngles.y += Math.PI; // Yaw correction
|
|
1108
|
+
}
|
|
1109
|
+
Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);
|
|
1110
|
+
}
|
|
1111
|
+
this._worldMatrix.setTranslationFromFloats(0, 0, 0);
|
|
1112
|
+
this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);
|
|
1113
|
+
// Restore translation
|
|
1114
|
+
this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);
|
|
1078
1115
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1116
|
+
// Billboarding based on camera position
|
|
1117
|
+
else {
|
|
1118
|
+
const storedTranslation = TmpVectors.Vector3[0];
|
|
1119
|
+
// Save translation
|
|
1120
|
+
this._worldMatrix.getTranslationToRef(storedTranslation);
|
|
1121
|
+
// Compute camera position in local space
|
|
1122
|
+
const cameraPosition = camera.globalPosition;
|
|
1123
|
+
this._worldMatrix.invertToRef(TmpVectors.Matrix[1]);
|
|
1124
|
+
const camInObjSpace = TmpVectors.Vector3[1];
|
|
1125
|
+
Vector3.TransformCoordinatesToRef(cameraPosition, TmpVectors.Matrix[1], camInObjSpace);
|
|
1126
|
+
camInObjSpace.normalize();
|
|
1127
|
+
// Find the lookAt info in local space
|
|
1128
|
+
const yaw = -Math.atan2(camInObjSpace.z, camInObjSpace.x) + Math.PI / 2;
|
|
1129
|
+
const len = Math.sqrt(camInObjSpace.x * camInObjSpace.x + camInObjSpace.z * camInObjSpace.z);
|
|
1130
|
+
const pitch = -Math.atan2(camInObjSpace.y, len);
|
|
1131
|
+
Quaternion.RotationYawPitchRollToRef(yaw, pitch, 0, TmpVectors.Quaternion[0]);
|
|
1132
|
+
if ((this.billboardMode & _a.BILLBOARDMODE_ALL) !== _a.BILLBOARDMODE_ALL) {
|
|
1133
|
+
const eulerAngles = TmpVectors.Vector3[1];
|
|
1134
|
+
TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);
|
|
1135
|
+
if ((this.billboardMode & _a.BILLBOARDMODE_X) !== _a.BILLBOARDMODE_X) {
|
|
1136
|
+
eulerAngles.x = 0;
|
|
1137
|
+
}
|
|
1138
|
+
if ((this.billboardMode & _a.BILLBOARDMODE_Y) !== _a.BILLBOARDMODE_Y) {
|
|
1139
|
+
eulerAngles.y = 0;
|
|
1140
|
+
}
|
|
1141
|
+
if ((this.billboardMode & _a.BILLBOARDMODE_Z) !== _a.BILLBOARDMODE_Z) {
|
|
1142
|
+
eulerAngles.z = 0;
|
|
1143
|
+
}
|
|
1144
|
+
Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);
|
|
1145
|
+
}
|
|
1146
|
+
else {
|
|
1147
|
+
Matrix.FromQuaternionToRef(TmpVectors.Quaternion[0], TmpVectors.Matrix[0]);
|
|
1148
|
+
}
|
|
1149
|
+
// Cancel translation
|
|
1150
|
+
this._worldMatrix.setTranslationFromFloats(0, 0, 0);
|
|
1151
|
+
// Rotate according to lookat (diff from local to lookat)
|
|
1152
|
+
this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);
|
|
1153
|
+
// Restore translation
|
|
1154
|
+
this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);
|
|
1107
1155
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1156
|
+
}
|
|
1157
|
+
// Normal matrix
|
|
1158
|
+
if (!this.ignoreNonUniformScaling) {
|
|
1159
|
+
if (this._scaling.isNonUniformWithinEpsilon(0.000001)) {
|
|
1160
|
+
this._updateNonUniformScalingState(true);
|
|
1110
1161
|
}
|
|
1111
|
-
if (
|
|
1112
|
-
|
|
1162
|
+
else if (parent && parent._nonUniformScaling) {
|
|
1163
|
+
this._updateNonUniformScalingState(parent._nonUniformScaling);
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
this._updateNonUniformScalingState(false);
|
|
1113
1167
|
}
|
|
1114
|
-
Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);
|
|
1115
1168
|
}
|
|
1116
1169
|
else {
|
|
1117
|
-
|
|
1170
|
+
this._updateNonUniformScalingState(false);
|
|
1171
|
+
}
|
|
1172
|
+
this._afterComputeWorldMatrix();
|
|
1173
|
+
// Absolute position
|
|
1174
|
+
this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
|
|
1175
|
+
this._isAbsoluteSynced = false;
|
|
1176
|
+
// Callbacks
|
|
1177
|
+
this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
|
|
1178
|
+
if (!this._poseMatrix) {
|
|
1179
|
+
this._poseMatrix = Matrix.Invert(this._worldMatrix);
|
|
1118
1180
|
}
|
|
1119
|
-
//
|
|
1120
|
-
this.
|
|
1121
|
-
|
|
1122
|
-
this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);
|
|
1123
|
-
// Restore translation
|
|
1124
|
-
this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);
|
|
1181
|
+
// Cache the determinant
|
|
1182
|
+
this._worldMatrixDeterminantIsDirty = true;
|
|
1183
|
+
return this._worldMatrix;
|
|
1125
1184
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1185
|
+
/**
|
|
1186
|
+
* Resets this nodeTransform's local matrix to Matrix.Identity().
|
|
1187
|
+
* @param independentOfChildren indicates if all child nodeTransform's world-space transform should be preserved.
|
|
1188
|
+
*/
|
|
1189
|
+
resetLocalMatrix(independentOfChildren = true) {
|
|
1190
|
+
this.computeWorldMatrix();
|
|
1191
|
+
if (independentOfChildren) {
|
|
1192
|
+
const children = this.getChildren();
|
|
1193
|
+
for (let i = 0; i < children.length; ++i) {
|
|
1194
|
+
const child = children[i];
|
|
1195
|
+
if (child) {
|
|
1196
|
+
child.computeWorldMatrix();
|
|
1197
|
+
const bakedMatrix = TmpVectors.Matrix[0];
|
|
1198
|
+
child._localMatrix.multiplyToRef(this._localMatrix, bakedMatrix);
|
|
1199
|
+
const tmpRotationQuaternion = TmpVectors.Quaternion[0];
|
|
1200
|
+
bakedMatrix.decompose(child.scaling, tmpRotationQuaternion, child.position);
|
|
1201
|
+
if (child.rotationQuaternion) {
|
|
1202
|
+
child.rotationQuaternion.copyFrom(tmpRotationQuaternion);
|
|
1203
|
+
}
|
|
1204
|
+
else {
|
|
1205
|
+
tmpRotationQuaternion.toEulerAnglesToRef(child.rotation);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
this.scaling.copyFromFloats(1, 1, 1);
|
|
1211
|
+
this.position.copyFromFloats(0, 0, 0);
|
|
1212
|
+
this.rotation.copyFromFloats(0, 0, 0);
|
|
1213
|
+
//only if quaternion is already set
|
|
1214
|
+
if (this.rotationQuaternion) {
|
|
1215
|
+
this.rotationQuaternion = Quaternion.Identity();
|
|
1216
|
+
}
|
|
1217
|
+
this._worldMatrix = Matrix.Identity();
|
|
1131
1218
|
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1219
|
+
_afterComputeWorldMatrix() { }
|
|
1220
|
+
/**
|
|
1221
|
+
* If you'd like to be called back after the mesh position, rotation or scaling has been updated.
|
|
1222
|
+
* @param func callback function to add
|
|
1223
|
+
*
|
|
1224
|
+
* @returns the TransformNode.
|
|
1225
|
+
*/
|
|
1226
|
+
registerAfterWorldMatrixUpdate(func) {
|
|
1227
|
+
this.onAfterWorldMatrixUpdateObservable.add(func);
|
|
1228
|
+
return this;
|
|
1134
1229
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1230
|
+
/**
|
|
1231
|
+
* Removes a registered callback function.
|
|
1232
|
+
* @param func callback function to remove
|
|
1233
|
+
* @returns the TransformNode.
|
|
1234
|
+
*/
|
|
1235
|
+
unregisterAfterWorldMatrixUpdate(func) {
|
|
1236
|
+
this.onAfterWorldMatrixUpdateObservable.removeCallback(func);
|
|
1237
|
+
return this;
|
|
1137
1238
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1239
|
+
/**
|
|
1240
|
+
* Gets the position of the current mesh in camera space
|
|
1241
|
+
* @param camera defines the camera to use
|
|
1242
|
+
* @returns a position
|
|
1243
|
+
*/
|
|
1244
|
+
getPositionInCameraSpace(camera = null) {
|
|
1245
|
+
if (!camera) {
|
|
1246
|
+
camera = this.getScene().activeCamera;
|
|
1247
|
+
}
|
|
1248
|
+
return Vector3.TransformCoordinates(this.getAbsolutePosition(), camera.getViewMatrix());
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Returns the distance from the mesh to the active camera
|
|
1252
|
+
* @param camera defines the camera to use
|
|
1253
|
+
* @returns the distance
|
|
1254
|
+
*/
|
|
1255
|
+
getDistanceToCamera(camera = null) {
|
|
1256
|
+
if (!camera) {
|
|
1257
|
+
camera = this.getScene().activeCamera;
|
|
1258
|
+
}
|
|
1259
|
+
return this.getAbsolutePosition().subtract(camera.globalPosition).length();
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Clone the current transform node
|
|
1263
|
+
* @param name Name of the new clone
|
|
1264
|
+
* @param newParent New parent for the clone
|
|
1265
|
+
* @param doNotCloneChildren Do not clone children hierarchy
|
|
1266
|
+
* @returns the new transform node
|
|
1267
|
+
*/
|
|
1268
|
+
clone(name, newParent, doNotCloneChildren) {
|
|
1269
|
+
const result = SerializationHelper.Clone(() => new _a(name, this.getScene()), this);
|
|
1270
|
+
result.name = name;
|
|
1271
|
+
result.id = name;
|
|
1272
|
+
if (newParent) {
|
|
1273
|
+
result.parent = newParent;
|
|
1274
|
+
}
|
|
1275
|
+
if (!doNotCloneChildren) {
|
|
1276
|
+
// Children
|
|
1277
|
+
const directDescendants = this.getDescendants(true);
|
|
1278
|
+
for (let index = 0; index < directDescendants.length; index++) {
|
|
1279
|
+
const child = directDescendants[index];
|
|
1280
|
+
if (child.clone) {
|
|
1281
|
+
child.clone(name + "." + child.name, result);
|
|
1282
|
+
}
|
|
1176
1283
|
}
|
|
1177
1284
|
}
|
|
1285
|
+
return result;
|
|
1178
1286
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
registerAfterWorldMatrixUpdate(func) {
|
|
1197
|
-
this.onAfterWorldMatrixUpdateObservable.add(func);
|
|
1198
|
-
return this;
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
* Removes a registered callback function.
|
|
1202
|
-
* @param func callback function to remove
|
|
1203
|
-
* @returns the TransformNode.
|
|
1204
|
-
*/
|
|
1205
|
-
unregisterAfterWorldMatrixUpdate(func) {
|
|
1206
|
-
this.onAfterWorldMatrixUpdateObservable.removeCallback(func);
|
|
1207
|
-
return this;
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* Gets the position of the current mesh in camera space
|
|
1211
|
-
* @param camera defines the camera to use
|
|
1212
|
-
* @returns a position
|
|
1213
|
-
*/
|
|
1214
|
-
getPositionInCameraSpace(camera = null) {
|
|
1215
|
-
if (!camera) {
|
|
1216
|
-
camera = this.getScene().activeCamera;
|
|
1217
|
-
}
|
|
1218
|
-
return Vector3.TransformCoordinates(this.getAbsolutePosition(), camera.getViewMatrix());
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* Returns the distance from the mesh to the active camera
|
|
1222
|
-
* @param camera defines the camera to use
|
|
1223
|
-
* @returns the distance
|
|
1224
|
-
*/
|
|
1225
|
-
getDistanceToCamera(camera = null) {
|
|
1226
|
-
if (!camera) {
|
|
1227
|
-
camera = this.getScene().activeCamera;
|
|
1228
|
-
}
|
|
1229
|
-
return this.getAbsolutePosition().subtract(camera.globalPosition).length();
|
|
1230
|
-
}
|
|
1231
|
-
/**
|
|
1232
|
-
* Clone the current transform node
|
|
1233
|
-
* @param name Name of the new clone
|
|
1234
|
-
* @param newParent New parent for the clone
|
|
1235
|
-
* @param doNotCloneChildren Do not clone children hierarchy
|
|
1236
|
-
* @returns the new transform node
|
|
1237
|
-
*/
|
|
1238
|
-
clone(name, newParent, doNotCloneChildren) {
|
|
1239
|
-
const result = SerializationHelper.Clone(() => new TransformNode(name, this.getScene()), this);
|
|
1240
|
-
result.name = name;
|
|
1241
|
-
result.id = name;
|
|
1242
|
-
if (newParent) {
|
|
1243
|
-
result.parent = newParent;
|
|
1244
|
-
}
|
|
1245
|
-
if (!doNotCloneChildren) {
|
|
1246
|
-
// Children
|
|
1247
|
-
const directDescendants = this.getDescendants(true);
|
|
1248
|
-
for (let index = 0; index < directDescendants.length; index++) {
|
|
1249
|
-
const child = directDescendants[index];
|
|
1250
|
-
if (child.clone) {
|
|
1251
|
-
child.clone(name + "." + child.name, result);
|
|
1287
|
+
/**
|
|
1288
|
+
* Serializes the objects information.
|
|
1289
|
+
* @param currentSerializationObject defines the object to serialize in
|
|
1290
|
+
* @returns the serialized object
|
|
1291
|
+
*/
|
|
1292
|
+
serialize(currentSerializationObject) {
|
|
1293
|
+
const serializationObject = SerializationHelper.Serialize(this, currentSerializationObject);
|
|
1294
|
+
serializationObject.type = this.getClassName();
|
|
1295
|
+
serializationObject.uniqueId = this.uniqueId;
|
|
1296
|
+
// Parent
|
|
1297
|
+
if (this.parent) {
|
|
1298
|
+
this.parent._serializeAsParent(serializationObject);
|
|
1299
|
+
}
|
|
1300
|
+
serializationObject.localMatrix = this.getPivotMatrix().asArray();
|
|
1301
|
+
serializationObject.isEnabled = this.isEnabled();
|
|
1302
|
+
if (this._isWorldMatrixFrozen) {
|
|
1303
|
+
serializationObject.freezeWorldMatrix = true;
|
|
1252
1304
|
}
|
|
1305
|
+
// Animations
|
|
1306
|
+
SerializationHelper.AppendSerializedAnimations(this, serializationObject);
|
|
1307
|
+
serializationObject.ranges = this.serializeAnimationRanges();
|
|
1308
|
+
return serializationObject;
|
|
1253
1309
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
// Parent
|
|
1267
|
-
if (this.parent) {
|
|
1268
|
-
this.parent._serializeAsParent(serializationObject);
|
|
1269
|
-
}
|
|
1270
|
-
serializationObject.localMatrix = this.getPivotMatrix().asArray();
|
|
1271
|
-
serializationObject.isEnabled = this.isEnabled();
|
|
1272
|
-
if (this._isWorldMatrixFrozen) {
|
|
1273
|
-
serializationObject.freezeWorldMatrix = true;
|
|
1274
|
-
}
|
|
1275
|
-
// Animations
|
|
1276
|
-
SerializationHelper.AppendSerializedAnimations(this, serializationObject);
|
|
1277
|
-
serializationObject.ranges = this.serializeAnimationRanges();
|
|
1278
|
-
return serializationObject;
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
|
-
* Get all child-transformNodes of this node
|
|
1282
|
-
* @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
|
|
1283
|
-
* @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
|
|
1284
|
-
* @returns an array of TransformNode
|
|
1285
|
-
*/
|
|
1286
|
-
getChildTransformNodes(directDescendantsOnly, predicate) {
|
|
1287
|
-
const results = [];
|
|
1288
|
-
this._getDescendants(results, directDescendantsOnly, (node) => {
|
|
1289
|
-
return (!predicate || predicate(node)) && node instanceof TransformNode;
|
|
1290
|
-
});
|
|
1291
|
-
return results;
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Releases resources associated with this transform node.
|
|
1295
|
-
* @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
|
|
1296
|
-
* @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
|
|
1297
|
-
*/
|
|
1298
|
-
dispose(doNotRecurse, disposeMaterialAndTextures = false) {
|
|
1299
|
-
// Animations
|
|
1300
|
-
this.getScene().stopAnimation(this);
|
|
1301
|
-
// Remove from scene
|
|
1302
|
-
this.getScene().removeTransformNode(this);
|
|
1303
|
-
if (this._parentContainer) {
|
|
1304
|
-
const index = this._parentContainer.transformNodes.indexOf(this);
|
|
1305
|
-
if (index > -1) {
|
|
1306
|
-
this._parentContainer.transformNodes.splice(index, 1);
|
|
1307
|
-
}
|
|
1308
|
-
this._parentContainer = null;
|
|
1309
|
-
}
|
|
1310
|
-
this.onAfterWorldMatrixUpdateObservable.clear();
|
|
1311
|
-
if (doNotRecurse) {
|
|
1312
|
-
const transformNodes = this.getChildTransformNodes(true);
|
|
1313
|
-
for (const transformNode of transformNodes) {
|
|
1314
|
-
transformNode.parent = null;
|
|
1315
|
-
transformNode.computeWorldMatrix(true);
|
|
1310
|
+
/**
|
|
1311
|
+
* Get all child-transformNodes of this node
|
|
1312
|
+
* @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
|
|
1313
|
+
* @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
|
|
1314
|
+
* @returns an array of TransformNode
|
|
1315
|
+
*/
|
|
1316
|
+
getChildTransformNodes(directDescendantsOnly, predicate) {
|
|
1317
|
+
const results = [];
|
|
1318
|
+
this._getDescendants(results, directDescendantsOnly, (node) => {
|
|
1319
|
+
return (!predicate || predicate(node)) && node instanceof _a;
|
|
1320
|
+
});
|
|
1321
|
+
return results;
|
|
1316
1322
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1323
|
+
/**
|
|
1324
|
+
* Releases resources associated with this transform node.
|
|
1325
|
+
* @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
|
|
1326
|
+
* @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
|
|
1327
|
+
*/
|
|
1328
|
+
dispose(doNotRecurse, disposeMaterialAndTextures = false) {
|
|
1329
|
+
// Animations
|
|
1330
|
+
this.getScene().stopAnimation(this);
|
|
1331
|
+
// Remove from scene
|
|
1332
|
+
this.getScene().removeTransformNode(this);
|
|
1333
|
+
if (this._parentContainer) {
|
|
1334
|
+
const index = this._parentContainer.transformNodes.indexOf(this);
|
|
1335
|
+
if (index > -1) {
|
|
1336
|
+
this._parentContainer.transformNodes.splice(index, 1);
|
|
1337
|
+
}
|
|
1338
|
+
this._parentContainer = null;
|
|
1339
|
+
}
|
|
1340
|
+
this.onAfterWorldMatrixUpdateObservable.clear();
|
|
1341
|
+
if (doNotRecurse) {
|
|
1342
|
+
const transformNodes = this.getChildTransformNodes(true);
|
|
1343
|
+
for (const transformNode of transformNodes) {
|
|
1344
|
+
transformNode.parent = null;
|
|
1345
|
+
transformNode.computeWorldMatrix(true);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
super.dispose(doNotRecurse, disposeMaterialAndTextures);
|
|
1338
1349
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1350
|
+
/**
|
|
1351
|
+
* Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)
|
|
1352
|
+
* @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false
|
|
1353
|
+
* @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false
|
|
1354
|
+
* @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling
|
|
1355
|
+
* @returns the current mesh
|
|
1356
|
+
*/
|
|
1357
|
+
normalizeToUnitCube(includeDescendants = true, ignoreRotation = false, predicate) {
|
|
1358
|
+
let storedRotation = null;
|
|
1359
|
+
let storedRotationQuaternion = null;
|
|
1360
|
+
if (ignoreRotation) {
|
|
1361
|
+
if (this.rotationQuaternion) {
|
|
1362
|
+
storedRotationQuaternion = this.rotationQuaternion.clone();
|
|
1363
|
+
this.rotationQuaternion.copyFromFloats(0, 0, 0, 1);
|
|
1364
|
+
}
|
|
1365
|
+
else if (this.rotation) {
|
|
1366
|
+
storedRotation = this.rotation.clone();
|
|
1367
|
+
this.rotation.copyFromFloats(0, 0, 0);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
const boundingVectors = this.getHierarchyBoundingVectors(includeDescendants, predicate);
|
|
1371
|
+
const sizeVec = boundingVectors.max.subtract(boundingVectors.min);
|
|
1372
|
+
const maxDimension = Math.max(sizeVec.x, sizeVec.y, sizeVec.z);
|
|
1373
|
+
if (maxDimension === 0) {
|
|
1374
|
+
return this;
|
|
1375
|
+
}
|
|
1376
|
+
const scale = 1 / maxDimension;
|
|
1377
|
+
this.scaling.scaleInPlace(scale);
|
|
1378
|
+
if (ignoreRotation) {
|
|
1379
|
+
if (this.rotationQuaternion && storedRotationQuaternion) {
|
|
1380
|
+
this.rotationQuaternion.copyFrom(storedRotationQuaternion);
|
|
1381
|
+
}
|
|
1382
|
+
else if (this.rotation && storedRotation) {
|
|
1383
|
+
this.rotation.copyFrom(storedRotation);
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
return this;
|
|
1351
1387
|
}
|
|
1352
|
-
|
|
1353
|
-
this.
|
|
1388
|
+
_syncAbsoluteScalingAndRotation() {
|
|
1389
|
+
if (!this._isAbsoluteSynced) {
|
|
1390
|
+
this._worldMatrix.decompose(this._absoluteScaling, this._absoluteRotationQuaternion);
|
|
1391
|
+
this._isAbsoluteSynced = true;
|
|
1392
|
+
}
|
|
1354
1393
|
}
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
serialize()
|
|
1418
|
-
], TransformNode.prototype, "scalingDeterminant", void 0);
|
|
1419
|
-
__decorate([
|
|
1420
|
-
serialize("infiniteDistance")
|
|
1421
|
-
], TransformNode.prototype, "_infiniteDistance", void 0);
|
|
1422
|
-
__decorate([
|
|
1423
|
-
serialize()
|
|
1424
|
-
], TransformNode.prototype, "ignoreNonUniformScaling", void 0);
|
|
1425
|
-
__decorate([
|
|
1426
|
-
serialize()
|
|
1427
|
-
], TransformNode.prototype, "reIntegrateRotationIntoRotationQuaternion", void 0);
|
|
1394
|
+
},
|
|
1395
|
+
(() => {
|
|
1396
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1397
|
+
__position_decorators = [serializeAsVector3("position")];
|
|
1398
|
+
__rotation_decorators = [serializeAsVector3("rotation")];
|
|
1399
|
+
__rotationQuaternion_decorators = [serializeAsQuaternion("rotationQuaternion")];
|
|
1400
|
+
__scaling_decorators = [serializeAsVector3("scaling")];
|
|
1401
|
+
__billboardMode_decorators = [serialize("billboardMode")];
|
|
1402
|
+
_scalingDeterminant_decorators = [serialize()];
|
|
1403
|
+
__infiniteDistance_decorators = [serialize("infiniteDistance")];
|
|
1404
|
+
_ignoreNonUniformScaling_decorators = [serialize()];
|
|
1405
|
+
_reIntegrateRotationIntoRotationQuaternion_decorators = [serialize()];
|
|
1406
|
+
__esDecorate(null, null, __position_decorators, { kind: "field", name: "_position", static: false, private: false, access: { has: obj => "_position" in obj, get: obj => obj._position, set: (obj, value) => { obj._position = value; } }, metadata: _metadata }, __position_initializers, __position_extraInitializers);
|
|
1407
|
+
__esDecorate(null, null, __rotation_decorators, { kind: "field", name: "_rotation", static: false, private: false, access: { has: obj => "_rotation" in obj, get: obj => obj._rotation, set: (obj, value) => { obj._rotation = value; } }, metadata: _metadata }, __rotation_initializers, __rotation_extraInitializers);
|
|
1408
|
+
__esDecorate(null, null, __rotationQuaternion_decorators, { kind: "field", name: "_rotationQuaternion", static: false, private: false, access: { has: obj => "_rotationQuaternion" in obj, get: obj => obj._rotationQuaternion, set: (obj, value) => { obj._rotationQuaternion = value; } }, metadata: _metadata }, __rotationQuaternion_initializers, __rotationQuaternion_extraInitializers);
|
|
1409
|
+
__esDecorate(null, null, __scaling_decorators, { kind: "field", name: "_scaling", static: false, private: false, access: { has: obj => "_scaling" in obj, get: obj => obj._scaling, set: (obj, value) => { obj._scaling = value; } }, metadata: _metadata }, __scaling_initializers, __scaling_extraInitializers);
|
|
1410
|
+
__esDecorate(null, null, __billboardMode_decorators, { kind: "field", name: "_billboardMode", static: false, private: false, access: { has: obj => "_billboardMode" in obj, get: obj => obj._billboardMode, set: (obj, value) => { obj._billboardMode = value; } }, metadata: _metadata }, __billboardMode_initializers, __billboardMode_extraInitializers);
|
|
1411
|
+
__esDecorate(null, null, _scalingDeterminant_decorators, { kind: "field", name: "scalingDeterminant", static: false, private: false, access: { has: obj => "scalingDeterminant" in obj, get: obj => obj.scalingDeterminant, set: (obj, value) => { obj.scalingDeterminant = value; } }, metadata: _metadata }, _scalingDeterminant_initializers, _scalingDeterminant_extraInitializers);
|
|
1412
|
+
__esDecorate(null, null, __infiniteDistance_decorators, { kind: "field", name: "_infiniteDistance", static: false, private: false, access: { has: obj => "_infiniteDistance" in obj, get: obj => obj._infiniteDistance, set: (obj, value) => { obj._infiniteDistance = value; } }, metadata: _metadata }, __infiniteDistance_initializers, __infiniteDistance_extraInitializers);
|
|
1413
|
+
__esDecorate(null, null, _ignoreNonUniformScaling_decorators, { kind: "field", name: "ignoreNonUniformScaling", static: false, private: false, access: { has: obj => "ignoreNonUniformScaling" in obj, get: obj => obj.ignoreNonUniformScaling, set: (obj, value) => { obj.ignoreNonUniformScaling = value; } }, metadata: _metadata }, _ignoreNonUniformScaling_initializers, _ignoreNonUniformScaling_extraInitializers);
|
|
1414
|
+
__esDecorate(null, null, _reIntegrateRotationIntoRotationQuaternion_decorators, { kind: "field", name: "reIntegrateRotationIntoRotationQuaternion", static: false, private: false, access: { has: obj => "reIntegrateRotationIntoRotationQuaternion" in obj, get: obj => obj.reIntegrateRotationIntoRotationQuaternion, set: (obj, value) => { obj.reIntegrateRotationIntoRotationQuaternion = value; } }, metadata: _metadata }, _reIntegrateRotationIntoRotationQuaternion_initializers, _reIntegrateRotationIntoRotationQuaternion_extraInitializers);
|
|
1415
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1416
|
+
})(),
|
|
1417
|
+
// Statics
|
|
1418
|
+
/**
|
|
1419
|
+
* Object will not rotate to face the camera
|
|
1420
|
+
*/
|
|
1421
|
+
_a.BILLBOARDMODE_NONE = 0,
|
|
1422
|
+
/**
|
|
1423
|
+
* Object will rotate to face the camera but only on the x axis
|
|
1424
|
+
*/
|
|
1425
|
+
_a.BILLBOARDMODE_X = 1,
|
|
1426
|
+
/**
|
|
1427
|
+
* Object will rotate to face the camera but only on the y axis
|
|
1428
|
+
*/
|
|
1429
|
+
_a.BILLBOARDMODE_Y = 2,
|
|
1430
|
+
/**
|
|
1431
|
+
* Object will rotate to face the camera but only on the z axis
|
|
1432
|
+
*/
|
|
1433
|
+
_a.BILLBOARDMODE_Z = 4,
|
|
1434
|
+
/**
|
|
1435
|
+
* Object will rotate to face the camera
|
|
1436
|
+
*/
|
|
1437
|
+
_a.BILLBOARDMODE_ALL = 7,
|
|
1438
|
+
/**
|
|
1439
|
+
* Object will rotate to face the camera's position instead of orientation
|
|
1440
|
+
*/
|
|
1441
|
+
_a.BILLBOARDMODE_USE_POSITION = 128,
|
|
1442
|
+
/**
|
|
1443
|
+
* Child transform with Billboard flags should or should not apply parent rotation (default if off)
|
|
1444
|
+
*/
|
|
1445
|
+
_a.BillboardUseParentOrientation = false,
|
|
1446
|
+
_a._TmpRotation = Quaternion.Zero(),
|
|
1447
|
+
_a._TmpScaling = Vector3.Zero(),
|
|
1448
|
+
_a._TmpTranslation = Vector3.Zero(),
|
|
1449
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1450
|
+
_a._TmpRHRestore = Matrix.Scaling(1, 1, -1),
|
|
1451
|
+
_a._LookAtVectorCache = new Vector3(0, 0, 0),
|
|
1452
|
+
_a._RotationAxisCache = new Quaternion(),
|
|
1453
|
+
_a;
|
|
1454
|
+
})();
|
|
1455
|
+
export { TransformNode };
|
|
1428
1456
|
/**
|
|
1429
1457
|
* Returns a new TransformNode object parsed from the source provided.
|
|
1430
1458
|
* @param parsedTransformNode is the source.
|