@onerjs/core 8.32.0 → 8.32.2
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/Audio/Interfaces/ISoundOptions.d.ts +1 -1
- package/Audio/Interfaces/ISoundOptions.js.map +1 -1
- package/Audio/audioEngine.d.ts +3 -4
- package/Audio/audioEngine.js +9 -6
- package/Audio/audioEngine.js.map +1 -1
- package/Audio/sound.d.ts +33 -54
- package/Audio/sound.js +450 -718
- package/Audio/sound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.js +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractSound.js +2 -2
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundSource.d.ts +11 -3
- package/AudioV2/abstractAudio/abstractSoundSource.js +37 -1
- package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
- package/AudioV2/abstractAudio/audioBus.d.ts +8 -3
- package/AudioV2/abstractAudio/audioBus.js +24 -1
- package/AudioV2/abstractAudio/audioBus.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +1 -1
- package/AudioV2/abstractAudio/staticSound.js +2 -2
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +1 -1
- package/AudioV2/abstractAudio/streamingSound.js +2 -2
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +1 -1
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +3 -0
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +1 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +1 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +12 -2
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +2 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +25 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/webAudio/components/webAudioParameterComponent.js +2 -2
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +3 -0
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +14 -17
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +1 -0
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
- package/AudioV2/webAudio/subProperties/spatialWebAudio.js +1 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudio.js.map +1 -1
- package/AudioV2/webAudio/webAudioBus.d.ts +2 -7
- package/AudioV2/webAudio/webAudioBus.js +4 -24
- package/AudioV2/webAudio/webAudioBus.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +1 -0
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -7
- package/AudioV2/webAudio/webAudioSoundSource.js +3 -24
- package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +3 -7
- package/AudioV2/webAudio/webAudioStaticSound.js +13 -26
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -7
- package/AudioV2/webAudio/webAudioStreamingSound.js +6 -23
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Cameras/arcRotateCamera.js +4 -5
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Compute/computeEffect.js +5 -1
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.d.ts +4 -0
- package/Compute/computeShader.js +9 -3
- package/Compute/computeShader.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/abstractEngine.d.ts +2 -2
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/thinEngine.js +1 -1
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +8 -9
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.d.ts +74 -0
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js +179 -0
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/index.d.ts +2 -0
- package/FrameGraph/Node/Blocks/index.js +2 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.d.ts +43 -0
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.js +93 -0
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.js.map +1 -0
- package/FrameGraph/Passes/renderPass.js +2 -2
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +2 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +6 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/glowLayerTask.d.ts +1 -0
- package/FrameGraph/Tasks/Layers/glowLayerTask.js +3 -0
- package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.d.ts +1 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js +3 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/computeShaderTask.js +3 -0
- package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js +3 -0
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/executeTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
- package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.d.ts +32 -0
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +63 -0
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/blurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/filterTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/filterTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/filterTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/grainTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/grainTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/grainTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/motionBlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/passTask.d.ts +2 -0
- package/FrameGraph/Tasks/PostProcesses/passTask.js +6 -0
- package/FrameGraph/Tasks/PostProcesses/passTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +3 -2
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/sharpenTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/sharpenTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/sharpenTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/taaTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.d.ts +31 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js +60 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +93 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +183 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +4 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +4 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js +3 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +21 -4
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +3 -2
- package/FrameGraph/frameGraphRenderContext.js +14 -5
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +5 -0
- package/FrameGraph/frameGraphTask.js +11 -2
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/index.d.ts +2 -0
- package/FrameGraph/index.js +2 -0
- package/FrameGraph/index.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +8 -0
- package/Inputs/scene.inputManager.js +33 -2
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Lights/lightingVolume.d.ts +12 -6
- package/Lights/lightingVolume.js +218 -108
- package/Lights/lightingVolume.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +2 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +2 -1
- package/Meshes/geometry.js +6 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -1
- package/Meshes/mesh.js +4 -3
- package/Meshes/mesh.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +9 -1
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +8 -0
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.d.ts +39 -0
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js +102 -0
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -0
- package/Particles/Node/Blocks/index.d.ts +1 -0
- package/Particles/Node/Blocks/index.js +1 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +9 -5
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +31 -13
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +39 -21
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/particle.d.ts +2 -2
- package/Particles/particle.js +4 -2
- package/Particles/particle.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +1 -1
- package/Particles/thinParticleSystem.function.js +2 -2
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/v2/characterController.d.ts +42 -2
- package/Physics/v2/characterController.js +140 -46
- package/Physics/v2/characterController.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +2 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/volumetricLightingBlendVolume.fragment.d.ts +5 -0
- package/Shaders/volumetricLightingBlendVolume.fragment.js +21 -0
- package/Shaders/volumetricLightingBlendVolume.fragment.js.map +1 -0
- package/Shaders/volumetricLightingRenderVolume.fragment.d.ts +7 -0
- package/Shaders/volumetricLightingRenderVolume.fragment.js +25 -0
- package/Shaders/volumetricLightingRenderVolume.fragment.js.map +1 -0
- package/Shaders/volumetricLightingRenderVolume.vertex.d.ts +9 -0
- package/Shaders/volumetricLightingRenderVolume.vertex.js +18 -0
- package/Shaders/volumetricLightingRenderVolume.vertex.js.map +1 -0
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/lightingVolume.compute.js +10 -4
- package/ShadersWGSL/lightingVolume.compute.js.map +1 -1
- package/ShadersWGSL/volumetricLightingBlendVolume.fragment.d.ts +5 -0
- package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js +22 -0
- package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js.map +1 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.fragment.d.ts +7 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js +27 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js.map +1 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.vertex.d.ts +7 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js +17 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js.map +1 -0
- package/States/IStencilState.d.ts +48 -2
- package/States/IStencilState.js.map +1 -1
- package/States/alphaCullingState.d.ts +1 -0
- package/States/alphaCullingState.js +3 -0
- package/States/alphaCullingState.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Vector3, Matrix } from "../../Maths/math.vector.js";
|
|
2
2
|
import type { Scene } from "../../scene.js";
|
|
3
3
|
import type { DeepImmutableObject } from "../../types.js";
|
|
4
|
-
import
|
|
4
|
+
import { PhysicsBody } from "./physicsBody.js";
|
|
5
5
|
import { type PhysicsShape } from "./physicsShape.js";
|
|
6
|
+
import { Observable } from "../../Misc/observable.js";
|
|
6
7
|
/**
|
|
7
8
|
* Shape properties for the character controller
|
|
8
9
|
*/
|
|
@@ -20,6 +21,27 @@ export interface CharacterShapeOptions {
|
|
|
20
21
|
*/
|
|
21
22
|
capsuleRadius?: number;
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Collision event data for the character controller
|
|
26
|
+
*/
|
|
27
|
+
export interface ICharacterControllerCollisionEvent {
|
|
28
|
+
/**
|
|
29
|
+
* The collider physics body
|
|
30
|
+
*/
|
|
31
|
+
collider: PhysicsBody;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
colliderIndex: number;
|
|
36
|
+
/**
|
|
37
|
+
* Separation force applied to the collider
|
|
38
|
+
*/
|
|
39
|
+
impulse: Vector3;
|
|
40
|
+
/**
|
|
41
|
+
* Position where the impulse is applied
|
|
42
|
+
*/
|
|
43
|
+
impulsePosition: Vector3;
|
|
44
|
+
}
|
|
23
45
|
/**
|
|
24
46
|
* State of the character on the surface
|
|
25
47
|
*/
|
|
@@ -158,6 +180,8 @@ export declare class PhysicsCharacterController {
|
|
|
158
180
|
private _velocity;
|
|
159
181
|
private _lastVelocity;
|
|
160
182
|
private _shape;
|
|
183
|
+
private _body;
|
|
184
|
+
private _transformNode;
|
|
161
185
|
private _ownShape;
|
|
162
186
|
private _manifold;
|
|
163
187
|
private _lastDisplacement;
|
|
@@ -229,8 +253,13 @@ export declare class PhysicsCharacterController {
|
|
|
229
253
|
* default 0
|
|
230
254
|
*/
|
|
231
255
|
characterMass: number;
|
|
256
|
+
/**
|
|
257
|
+
* Observable for trigger entered and trigger exited events
|
|
258
|
+
*/
|
|
259
|
+
onTriggerCollisionObservable: Observable<ICharacterControllerCollisionEvent>;
|
|
232
260
|
private _startCollector;
|
|
233
261
|
private _castCollector;
|
|
262
|
+
private _displacementEps;
|
|
234
263
|
/**
|
|
235
264
|
* instanciate a new characterController
|
|
236
265
|
* @param position Initial position
|
|
@@ -238,6 +267,10 @@ export declare class PhysicsCharacterController {
|
|
|
238
267
|
* @param scene Scene
|
|
239
268
|
*/
|
|
240
269
|
constructor(position: Vector3, characterShapeOptions: CharacterShapeOptions, scene: Scene);
|
|
270
|
+
/**
|
|
271
|
+
* Dispose the character controller
|
|
272
|
+
*/
|
|
273
|
+
dispose(): void;
|
|
241
274
|
/**
|
|
242
275
|
* Get shape used for collision
|
|
243
276
|
*/
|
|
@@ -271,7 +304,8 @@ export declare class PhysicsCharacterController {
|
|
|
271
304
|
protected _compareContacts(contactA: IContact, contactB: IContact): number;
|
|
272
305
|
protected _findContact(referenceContact: IContact, contactList: IContact[], threshold: number): number;
|
|
273
306
|
protected _updateManifold(startCollector: any, castCollector: any, castPath: Vector3): number;
|
|
274
|
-
protected
|
|
307
|
+
protected _bodyPositionTracking: Map<any, any>;
|
|
308
|
+
protected _createSurfaceConstraint(dt: number, contact: IContact, timeTravelled: number): ISurfaceConstraintInfo;
|
|
275
309
|
protected _addMaxSlopePlane(maxSlopeCos: number, up: Vector3, index: number, constraints: ISurfaceConstraintInfo[], allowedPenetration: number): boolean;
|
|
276
310
|
protected _resolveConstraintPenetration(constraint: ISurfaceConstraintInfo, penetrationRecoverySpeed: number): void;
|
|
277
311
|
protected _createConstraintsFromManifold(dt: number, timeTravelled: number): ISurfaceConstraintInfo[];
|
|
@@ -310,6 +344,12 @@ export declare class PhysicsCharacterController {
|
|
|
310
344
|
body: PhysicsBody;
|
|
311
345
|
index: number;
|
|
312
346
|
}): number;
|
|
347
|
+
protected _integrateManifolds(deltaTime: number, gravity: Vector3): void;
|
|
348
|
+
/**
|
|
349
|
+
* Move the character with collisions
|
|
350
|
+
* @param displacement defines the requested displacement vector
|
|
351
|
+
*/
|
|
352
|
+
moveWithCollisions(displacement: Vector3): void;
|
|
313
353
|
/**
|
|
314
354
|
* Update internal state. Must be called once per frame
|
|
315
355
|
* @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Vector3, Quaternion, Matrix, TmpVectors } from "../../Maths/math.vector.js";
|
|
2
|
+
import { PhysicsBody } from "./physicsBody.js";
|
|
2
3
|
import { PhysicsShapeCapsule } from "./physicsShape.js";
|
|
3
4
|
import { BuildArray } from "../../Misc/arrayTools.js";
|
|
5
|
+
import { TransformNode } from "../../Meshes/transformNode.js";
|
|
6
|
+
import { Observable } from "../../Misc/observable.js";
|
|
4
7
|
/**
|
|
5
8
|
* State of the character on the surface
|
|
6
9
|
*/
|
|
@@ -72,7 +75,7 @@ export class PhysicsCharacterController {
|
|
|
72
75
|
this._manifold = [];
|
|
73
76
|
this._contactAngleSensitivity = 10.0;
|
|
74
77
|
this._tmpMatrix = new Matrix();
|
|
75
|
-
this._tmpVecs = BuildArray(
|
|
78
|
+
this._tmpVecs = BuildArray(32, Vector3.Zero);
|
|
76
79
|
/**
|
|
77
80
|
* minimum distance to make contact
|
|
78
81
|
* default 0.05
|
|
@@ -136,6 +139,15 @@ export class PhysicsCharacterController {
|
|
|
136
139
|
* default 0
|
|
137
140
|
*/
|
|
138
141
|
this.characterMass = 0;
|
|
142
|
+
/**
|
|
143
|
+
* Observable for trigger entered and trigger exited events
|
|
144
|
+
*/
|
|
145
|
+
this.onTriggerCollisionObservable = new Observable();
|
|
146
|
+
// If the difference between the cast displacement and the simplex solver output position is less than this
|
|
147
|
+
// value (per component), do not do a second cast to check if it's possible to reach the output position.
|
|
148
|
+
this._displacementEps = 1e-4;
|
|
149
|
+
// Store previous positions per body for velocity calculation
|
|
150
|
+
this._bodyPositionTracking = new Map();
|
|
139
151
|
this._position = position.clone();
|
|
140
152
|
this._velocity = Vector3.Zero();
|
|
141
153
|
this._lastVelocity = Vector3.Zero();
|
|
@@ -145,6 +157,12 @@ export class PhysicsCharacterController {
|
|
|
145
157
|
this._tmpVecs[1].set(0, -h * 0.5 + r, 0);
|
|
146
158
|
this._ownShape = !characterShapeOptions.shape;
|
|
147
159
|
this._shape = characterShapeOptions.shape ?? new PhysicsShapeCapsule(this._tmpVecs[0], this._tmpVecs[1], r, scene);
|
|
160
|
+
this._transformNode = new TransformNode("CCTransformNode", scene);
|
|
161
|
+
this._transformNode.position.copyFrom(this._position);
|
|
162
|
+
this._body = new PhysicsBody(this._transformNode, 1 /* PhysicsMotionType.ANIMATED */, false, scene);
|
|
163
|
+
this._body.setMassProperties({ inertia: Vector3.ZeroReadOnly });
|
|
164
|
+
this._body.shape = this._shape;
|
|
165
|
+
this._body.disablePreStep = false;
|
|
148
166
|
this._lastInvDeltaTime = 1.0 / 60.0;
|
|
149
167
|
this._lastDisplacement = Vector3.Zero();
|
|
150
168
|
this._scene = scene;
|
|
@@ -153,6 +171,20 @@ export class PhysicsCharacterController {
|
|
|
153
171
|
this._startCollector = hknp.HP_QueryCollector_Create(16)[1];
|
|
154
172
|
this._castCollector = hknp.HP_QueryCollector_Create(16)[1];
|
|
155
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Dispose the character controller
|
|
176
|
+
*/
|
|
177
|
+
dispose() {
|
|
178
|
+
if (this._ownShape) {
|
|
179
|
+
this._shape.dispose();
|
|
180
|
+
}
|
|
181
|
+
this._body.dispose();
|
|
182
|
+
this._transformNode.dispose();
|
|
183
|
+
const hk = this._scene.getPhysicsEngine().getPhysicsPlugin();
|
|
184
|
+
const hknp = hk._hknp;
|
|
185
|
+
hknp.HP_QueryCollector_Release(this._startCollector);
|
|
186
|
+
hknp.HP_QueryCollector_Release(this._castCollector);
|
|
187
|
+
}
|
|
156
188
|
/**
|
|
157
189
|
* Get shape used for collision
|
|
158
190
|
*/
|
|
@@ -163,6 +195,7 @@ export class PhysicsCharacterController {
|
|
|
163
195
|
* Set shape used for collision
|
|
164
196
|
*/
|
|
165
197
|
set shape(value) {
|
|
198
|
+
this._body.shape = this._shape;
|
|
166
199
|
if (this._ownShape) {
|
|
167
200
|
this._shape.dispose();
|
|
168
201
|
}
|
|
@@ -182,6 +215,7 @@ export class PhysicsCharacterController {
|
|
|
182
215
|
*/
|
|
183
216
|
setPosition(position) {
|
|
184
217
|
this._position.copyFrom(position);
|
|
218
|
+
this._transformNode.position.copyFrom(this._position);
|
|
185
219
|
}
|
|
186
220
|
/**
|
|
187
221
|
* Character velocity
|
|
@@ -333,7 +367,7 @@ export class PhysicsCharacterController {
|
|
|
333
367
|
}
|
|
334
368
|
return numHitBodies;
|
|
335
369
|
}
|
|
336
|
-
_createSurfaceConstraint(contact, timeTravelled) {
|
|
370
|
+
_createSurfaceConstraint(dt, contact, timeTravelled) {
|
|
337
371
|
const constraint = {
|
|
338
372
|
//let distance = contact.distance - this.keepDistance;
|
|
339
373
|
planeNormal: contact.normal.clone(),
|
|
@@ -369,7 +403,42 @@ export class PhysicsCharacterController {
|
|
|
369
403
|
constraint.priority = 2;
|
|
370
404
|
}
|
|
371
405
|
else if (motionType == 1 /* PhysicsMotionType.ANIMATED */) {
|
|
372
|
-
|
|
406
|
+
const bodyTransformNode = contact.bodyB.body.transformNode;
|
|
407
|
+
const bodyId = bodyTransformNode.uniqueId;
|
|
408
|
+
// Retrieve tracking data
|
|
409
|
+
let tracking = this._bodyPositionTracking.get(bodyId);
|
|
410
|
+
const currentFrameWorldMatrix = contact.bodyB.body.transformNode.getWorldMatrix();
|
|
411
|
+
const frameId = this._scene.getFrameId();
|
|
412
|
+
if (!tracking) {
|
|
413
|
+
// Initialize tracking
|
|
414
|
+
tracking = {
|
|
415
|
+
prevWorldMatrix: currentFrameWorldMatrix.clone(),
|
|
416
|
+
frameId: frameId,
|
|
417
|
+
};
|
|
418
|
+
this._bodyPositionTracking.set(bodyId, tracking);
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
// Only calculate velocity if this contact existed in the previous frame
|
|
422
|
+
// This avoids huge delta spikes when first making contact or after gaps
|
|
423
|
+
if (tracking.frameId + 1 === frameId) {
|
|
424
|
+
const previousFrameWorldMatrix = tracking.prevWorldMatrix;
|
|
425
|
+
const currentFrameWorldMatrixInverse = TmpVectors.Matrix[1];
|
|
426
|
+
currentFrameWorldMatrix.invertToRef(currentFrameWorldMatrixInverse);
|
|
427
|
+
const characterPosition = this.getPosition();
|
|
428
|
+
// compute characterPosition in body local space at previous frame
|
|
429
|
+
const characterLocalPosition = this._tmpVecs[21];
|
|
430
|
+
Vector3.TransformCoordinatesToRef(characterPosition, currentFrameWorldMatrixInverse, characterLocalPosition);
|
|
431
|
+
const characterWorldPosition = this._tmpVecs[22];
|
|
432
|
+
Vector3.TransformCoordinatesToRef(characterLocalPosition, previousFrameWorldMatrix, characterWorldPosition);
|
|
433
|
+
const playerDeltaPosition = this._tmpVecs[23];
|
|
434
|
+
characterPosition.subtractToRef(characterWorldPosition, playerDeltaPosition);
|
|
435
|
+
constraint.velocity.copyFrom(playerDeltaPosition);
|
|
436
|
+
constraint.velocity.scaleInPlace(1 / dt);
|
|
437
|
+
constraint.priority = 1;
|
|
438
|
+
}
|
|
439
|
+
tracking.prevWorldMatrix.copyFrom(currentFrameWorldMatrix);
|
|
440
|
+
tracking.frameId = frameId;
|
|
441
|
+
}
|
|
373
442
|
}
|
|
374
443
|
return constraint;
|
|
375
444
|
}
|
|
@@ -415,7 +484,7 @@ export class PhysicsCharacterController {
|
|
|
415
484
|
_createConstraintsFromManifold(dt, timeTravelled) {
|
|
416
485
|
const constraints = [];
|
|
417
486
|
for (let i = 0; i < this._manifold.length; i++) {
|
|
418
|
-
const surfaceConstraint = this._createSurfaceConstraint(this._manifold[i], timeTravelled);
|
|
487
|
+
const surfaceConstraint = this._createSurfaceConstraint(dt, this._manifold[i], timeTravelled);
|
|
419
488
|
constraints.push(surfaceConstraint);
|
|
420
489
|
this._addMaxSlopePlane(this.maxSlopeCosine, this.up, i, constraints, this._manifold[i].allowedPenetration);
|
|
421
490
|
this._resolveConstraintPenetration(surfaceConstraint, this.penetrationRecoverySpeed);
|
|
@@ -982,7 +1051,7 @@ export class PhysicsCharacterController {
|
|
|
982
1051
|
orientation,
|
|
983
1052
|
this.keepDistance + this.keepContactTolerance, // max distance
|
|
984
1053
|
false, // should hit triggers
|
|
985
|
-
[
|
|
1054
|
+
[this._body._pluginData.hpBodyId[0]],
|
|
986
1055
|
];
|
|
987
1056
|
hknp.HP_World_ShapeProximityWithCollector(hk.world, startCollector, query);
|
|
988
1057
|
}
|
|
@@ -993,7 +1062,7 @@ export class PhysicsCharacterController {
|
|
|
993
1062
|
startNative,
|
|
994
1063
|
[endPos.x, endPos.y, endPos.z],
|
|
995
1064
|
false, // should hit triggers
|
|
996
|
-
[
|
|
1065
|
+
[this._body._pluginData.hpBodyId[0]],
|
|
997
1066
|
];
|
|
998
1067
|
hknp.HP_World_ShapeCastWithCollector(hk.world, castCollector, query);
|
|
999
1068
|
}
|
|
@@ -1069,6 +1138,13 @@ export class PhysicsCharacterController {
|
|
|
1069
1138
|
}
|
|
1070
1139
|
}
|
|
1071
1140
|
//<todo Fire callback to allow user to change impulse + use the info / play sounds
|
|
1141
|
+
const triggerCollisionInfo = {
|
|
1142
|
+
collider: bodyB.body,
|
|
1143
|
+
colliderIndex: bodyB.index,
|
|
1144
|
+
impulse: outputObjectImpulse,
|
|
1145
|
+
impulsePosition: outputImpulsePosition,
|
|
1146
|
+
};
|
|
1147
|
+
this.onTriggerCollisionObservable.notifyObservers(triggerCollisionInfo);
|
|
1072
1148
|
bodyB.body.applyImpulse(outputObjectImpulse, outputImpulsePosition, bodyB.index);
|
|
1073
1149
|
}
|
|
1074
1150
|
}
|
|
@@ -1096,47 +1172,11 @@ export class PhysicsCharacterController {
|
|
|
1096
1172
|
_getInvMass(body) {
|
|
1097
1173
|
return 1 / body.body.getMassProperties(body.index).mass;
|
|
1098
1174
|
}
|
|
1099
|
-
|
|
1100
|
-
* Update internal state. Must be called once per frame
|
|
1101
|
-
* @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0
|
|
1102
|
-
* @param surfaceInfo surface information returned by checkSupport
|
|
1103
|
-
* @param gravity gravity applied to the character. Can be different that world gravity
|
|
1104
|
-
*/
|
|
1105
|
-
integrate(deltaTime, surfaceInfo, gravity) {
|
|
1175
|
+
_integrateManifolds(deltaTime, gravity) {
|
|
1106
1176
|
const hk = this._scene.getPhysicsEngine().getPhysicsPlugin();
|
|
1107
|
-
const invDeltaTime = 1 / deltaTime;
|
|
1108
|
-
let remainingTime = deltaTime;
|
|
1109
|
-
let newVelocity = Vector3.Zero();
|
|
1110
|
-
// If the difference between the cast displacement and the simplex solver output position is less than this
|
|
1111
|
-
// value (per component), do not do a second cast to check if it's possible to reach the output position.
|
|
1112
|
-
const displacementEps = 1e-4;
|
|
1113
1177
|
const epsSqrd = 1e-8;
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
// on current velocity.
|
|
1117
|
-
{
|
|
1118
|
-
const tolerance = displacementEps * invDeltaTime;
|
|
1119
|
-
if (this._velocity.equalsWithEpsilon(this._lastVelocity, tolerance)) {
|
|
1120
|
-
this._lastDisplacement.scaleInPlace(remainingTime * this._lastInvDeltaTime);
|
|
1121
|
-
}
|
|
1122
|
-
else {
|
|
1123
|
-
const displacementVelocity = this._velocity;
|
|
1124
|
-
if (surfaceInfo.supportedState == 2 /* CharacterSupportedState.SUPPORTED */) {
|
|
1125
|
-
const relativeVelocity = this._tmpVecs[28];
|
|
1126
|
-
this._velocity.subtractToRef(surfaceInfo.averageSurfaceVelocity, relativeVelocity);
|
|
1127
|
-
const normalDotVelocity = surfaceInfo.averageSurfaceNormal.dot(relativeVelocity);
|
|
1128
|
-
if (normalDotVelocity < 0) {
|
|
1129
|
-
relativeVelocity.subtractInPlace(surfaceInfo.averageSurfaceNormal.scale(normalDotVelocity));
|
|
1130
|
-
displacementVelocity.copyFrom(relativeVelocity);
|
|
1131
|
-
displacementVelocity.addInPlace(surfaceInfo.averageSurfaceVelocity);
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
this._lastDisplacement.copyFrom(displacementVelocity);
|
|
1135
|
-
this._lastDisplacement.scaleInPlace(remainingTime);
|
|
1136
|
-
}
|
|
1137
|
-
this._lastVelocity.copyFrom(this._velocity);
|
|
1138
|
-
this._lastInvDeltaTime = invDeltaTime;
|
|
1139
|
-
}
|
|
1178
|
+
let newVelocity = Vector3.Zero();
|
|
1179
|
+
let remainingTime = deltaTime;
|
|
1140
1180
|
// Make sure that contact with bodies that have been removed since the call to checkSupport() are removed from the
|
|
1141
1181
|
// manifold
|
|
1142
1182
|
this._validateManifold();
|
|
@@ -1158,7 +1198,7 @@ export class PhysicsCharacterController {
|
|
|
1158
1198
|
// If castCollector had hits on different bodies (so we're not sure if some non-closest body could be in our way) OR
|
|
1159
1199
|
// the simplex has given an output direction different from the cast guess
|
|
1160
1200
|
// we re-cast to check we can move there. There is no need to get the start points again.
|
|
1161
|
-
if (updateResult != 0 || (newDisplacement.lengthSquared() > epsSqrd && !this._lastDisplacement.equalsWithEpsilon(newDisplacement,
|
|
1201
|
+
if (updateResult != 0 || (newDisplacement.lengthSquared() > epsSqrd && !this._lastDisplacement.equalsWithEpsilon(newDisplacement, this._displacementEps))) {
|
|
1162
1202
|
this._castWithCollectors(this._position, this._position.add(newDisplacement), this._castCollector, this._startCollector);
|
|
1163
1203
|
const hknp = hk._hknp;
|
|
1164
1204
|
const numCastHits = hknp.HP_QueryCollector_GetNumHits(this._castCollector)[1];
|
|
@@ -1198,6 +1238,60 @@ export class PhysicsCharacterController {
|
|
|
1198
1238
|
this._lastDisplacement.copyFrom(newDisplacement);
|
|
1199
1239
|
}
|
|
1200
1240
|
this._velocity.copyFrom(newVelocity);
|
|
1241
|
+
this._transformNode.position.copyFrom(this._position);
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Move the character with collisions
|
|
1245
|
+
* @param displacement defines the requested displacement vector
|
|
1246
|
+
*/
|
|
1247
|
+
moveWithCollisions(displacement) {
|
|
1248
|
+
if (this._scene.deltaTime == undefined) {
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
1251
|
+
const deltaTime = this._scene.deltaTime / 1000.0;
|
|
1252
|
+
const invDeltaTime = 1 / deltaTime;
|
|
1253
|
+
displacement.scaleToRef(1 / deltaTime, this._velocity);
|
|
1254
|
+
this._lastDisplacement.copyFrom(displacement);
|
|
1255
|
+
this._lastVelocity.copyFrom(this._velocity);
|
|
1256
|
+
this._lastInvDeltaTime = invDeltaTime;
|
|
1257
|
+
this._integrateManifolds(deltaTime, Vector3.ZeroReadOnly);
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Update internal state. Must be called once per frame
|
|
1261
|
+
* @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0
|
|
1262
|
+
* @param surfaceInfo surface information returned by checkSupport
|
|
1263
|
+
* @param gravity gravity applied to the character. Can be different that world gravity
|
|
1264
|
+
*/
|
|
1265
|
+
integrate(deltaTime, surfaceInfo, gravity) {
|
|
1266
|
+
const invDeltaTime = 1 / deltaTime;
|
|
1267
|
+
const remainingTime = deltaTime;
|
|
1268
|
+
// Choose the first cast direction. If velocity hasn't changed from the previous integrate, guess that the
|
|
1269
|
+
// displacement will be the same as last integrate, scaled by relative step length. Otherwise, guess based
|
|
1270
|
+
// on current velocity.
|
|
1271
|
+
{
|
|
1272
|
+
const tolerance = this._displacementEps * invDeltaTime;
|
|
1273
|
+
if (this._velocity.equalsWithEpsilon(this._lastVelocity, tolerance)) {
|
|
1274
|
+
this._lastDisplacement.scaleInPlace(remainingTime * this._lastInvDeltaTime);
|
|
1275
|
+
}
|
|
1276
|
+
else {
|
|
1277
|
+
const displacementVelocity = this._velocity;
|
|
1278
|
+
if (surfaceInfo.supportedState == 2 /* CharacterSupportedState.SUPPORTED */) {
|
|
1279
|
+
const relativeVelocity = this._tmpVecs[28];
|
|
1280
|
+
this._velocity.subtractToRef(surfaceInfo.averageSurfaceVelocity, relativeVelocity);
|
|
1281
|
+
const normalDotVelocity = surfaceInfo.averageSurfaceNormal.dot(relativeVelocity);
|
|
1282
|
+
if (normalDotVelocity < 0) {
|
|
1283
|
+
relativeVelocity.subtractInPlace(surfaceInfo.averageSurfaceNormal.scale(normalDotVelocity));
|
|
1284
|
+
displacementVelocity.copyFrom(relativeVelocity);
|
|
1285
|
+
displacementVelocity.addInPlace(surfaceInfo.averageSurfaceVelocity);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
this._lastDisplacement.copyFrom(displacementVelocity);
|
|
1289
|
+
this._lastDisplacement.scaleInPlace(remainingTime);
|
|
1290
|
+
}
|
|
1291
|
+
this._lastVelocity.copyFrom(this._velocity);
|
|
1292
|
+
this._lastInvDeltaTime = invDeltaTime;
|
|
1293
|
+
}
|
|
1294
|
+
this._integrateManifolds(deltaTime, gravity);
|
|
1201
1295
|
}
|
|
1202
1296
|
/**
|
|
1203
1297
|
* Helper function to calculate velocity based on surface informations and current velocity state and target
|