@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
package/Lights/lightingVolume.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbortError } from "../Misc/error.js";
|
|
2
2
|
|
|
3
|
-
import { Matrix, Vector3 } from "../Maths/math.vector.js";
|
|
3
|
+
import { Matrix, Vector3, TmpVectors } from "../Maths/math.vector.js";
|
|
4
4
|
import { DirectionalLight } from "./directionalLight.js";
|
|
5
5
|
import { Mesh } from "../Meshes/mesh.js";
|
|
6
6
|
import { ComputeShader } from "../Compute/computeShader.js";
|
|
@@ -10,7 +10,6 @@ import { StorageBuffer } from "../Buffers/storageBuffer.js";
|
|
|
10
10
|
import { BaseTexture } from "../Materials/Textures/baseTexture.js";
|
|
11
11
|
import { VertexBuffer } from "../Buffers/buffer.js";
|
|
12
12
|
import "../ShadersWGSL/lightingVolume.compute.js";
|
|
13
|
-
const InvViewProjMatrix = new Matrix();
|
|
14
13
|
const TmpVec3 = new Vector3();
|
|
15
14
|
/**
|
|
16
15
|
* Class used to create a lighting volume from a directional light's shadow generator.
|
|
@@ -29,13 +28,14 @@ export class LightingVolume {
|
|
|
29
28
|
}
|
|
30
29
|
this._shadowGenerator = sg;
|
|
31
30
|
this._light = light;
|
|
32
|
-
this.
|
|
31
|
+
this._updateGeometry();
|
|
33
32
|
if (!this._engine.isWebGPU) {
|
|
34
33
|
this._createFallbackTextures();
|
|
35
34
|
}
|
|
36
35
|
const depthTexture = this._shadowGenerator.getShadowMap()?.depthStencilTexture;
|
|
37
|
-
if (this.
|
|
36
|
+
if (this._engine.isWebGPU && depthTexture) {
|
|
38
37
|
this._cs.setInternalTexture("shadowMap", depthTexture);
|
|
38
|
+
this._cs2.setInternalTexture("shadowMap", depthTexture);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -48,20 +48,6 @@ export class LightingVolume {
|
|
|
48
48
|
this._tesselation = n;
|
|
49
49
|
this._createGeometry();
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Indicates whether to build the full volume (true) or only the far plane (false). Default is false.
|
|
53
|
-
*/
|
|
54
|
-
get buildFullVolume() {
|
|
55
|
-
return this._buildFullVolume;
|
|
56
|
-
}
|
|
57
|
-
set buildFullVolume(value) {
|
|
58
|
-
if (this._buildFullVolume === value) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
this._buildFullVolume = value;
|
|
62
|
-
this._createGeometry();
|
|
63
|
-
this._createComputeShader();
|
|
64
|
-
}
|
|
65
51
|
/**
|
|
66
52
|
* The mesh used as a support for the lighting volume.
|
|
67
53
|
* Note that this mesh is not automatically added to the scene's mesh array.
|
|
@@ -99,6 +85,17 @@ export class LightingVolume {
|
|
|
99
85
|
get firstUpdate() {
|
|
100
86
|
return this._firstUpdate;
|
|
101
87
|
}
|
|
88
|
+
/** @internal */
|
|
89
|
+
_setComputeShaderFastMode(enabled) {
|
|
90
|
+
if (this._cs) {
|
|
91
|
+
this._cs.fastMode = enabled;
|
|
92
|
+
this._cs.triggerContextRebuild = enabled;
|
|
93
|
+
}
|
|
94
|
+
if (this._cs2) {
|
|
95
|
+
this._cs2.fastMode = enabled;
|
|
96
|
+
this._cs2.triggerContextRebuild = enabled;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
102
99
|
/**
|
|
103
100
|
* Creates a new LightingVolume.
|
|
104
101
|
* @param name The name of the lighting volume.
|
|
@@ -107,12 +104,14 @@ export class LightingVolume {
|
|
|
107
104
|
* @param tesselation The tesselation level of the lighting volume (default: 64).
|
|
108
105
|
*/
|
|
109
106
|
constructor(name, scene, shadowGenerator, tesselation = 64) {
|
|
107
|
+
this._buildFullVolume = true;
|
|
110
108
|
this._readPixelPromise = null;
|
|
111
109
|
this._readPixelAbortController = null;
|
|
112
110
|
this._numFrames = 0;
|
|
113
111
|
this._firstUpdate = true;
|
|
112
|
+
this._currentLightDirection = new Vector3();
|
|
113
|
+
this._needFullUpdateUBO = true;
|
|
114
114
|
this._tesselation = 0;
|
|
115
|
-
this._buildFullVolume = false;
|
|
116
115
|
this._frequency = 1;
|
|
117
116
|
const light = shadowGenerator ? shadowGenerator.getLight() : undefined;
|
|
118
117
|
if (light && !(light instanceof DirectionalLight)) {
|
|
@@ -121,6 +120,7 @@ export class LightingVolume {
|
|
|
121
120
|
this._name = name;
|
|
122
121
|
this._shadowGenerator = shadowGenerator;
|
|
123
122
|
this._light = light;
|
|
123
|
+
this._indices = [];
|
|
124
124
|
this._engine = scene.getEngine();
|
|
125
125
|
this._scene = scene;
|
|
126
126
|
this._mesh = new Mesh(name, this._scene);
|
|
@@ -128,9 +128,12 @@ export class LightingVolume {
|
|
|
128
128
|
if (this._engine.isWebGPU) {
|
|
129
129
|
this._uBuffer = new UniformBuffer(this._engine);
|
|
130
130
|
this._uBuffer.addUniform("invViewProjMatrix", 16);
|
|
131
|
+
this._uBuffer.addUniform("invViewMatrix", 16);
|
|
131
132
|
this._uBuffer.addUniform("startVertexIndex", 1);
|
|
132
133
|
this._uBuffer.addUniform("step", 1);
|
|
133
134
|
this._uBuffer.addUniform("tesselation", 1);
|
|
135
|
+
this._uBuffer.addUniform("orthoMin", 3);
|
|
136
|
+
this._uBuffer.addUniform("orthoMax", 3);
|
|
134
137
|
this._uBuffer.update();
|
|
135
138
|
this._createComputeShader();
|
|
136
139
|
}
|
|
@@ -150,6 +153,9 @@ export class LightingVolume {
|
|
|
150
153
|
if (this._cs) {
|
|
151
154
|
isReady = this._cs.isReady() && isReady;
|
|
152
155
|
}
|
|
156
|
+
if (this._cs2) {
|
|
157
|
+
isReady = this._cs2.isReady() && isReady;
|
|
158
|
+
}
|
|
153
159
|
return isReady;
|
|
154
160
|
}
|
|
155
161
|
/**
|
|
@@ -164,15 +170,24 @@ export class LightingVolume {
|
|
|
164
170
|
return;
|
|
165
171
|
}
|
|
166
172
|
this._numFrames = 0;
|
|
167
|
-
if (this.
|
|
173
|
+
if (this._engine.isWebGPU) {
|
|
174
|
+
this._uBuffer.updateMatrix("invViewProjMatrix", this._shadowGenerator.getTransformMatrix().invertToRef(TmpVectors.Matrix[0]));
|
|
175
|
+
this._engine._debugPushGroup?.(`Update lighting volume (${this._name})`, 1);
|
|
176
|
+
if (this._needUpdateGeometry()) {
|
|
177
|
+
this._fullUpdateUBO(true);
|
|
178
|
+
const dispatchSize = Math.ceil((this._tesselation + 1) / 32);
|
|
179
|
+
this._engine._debugPushGroup?.(`Update vertices of other planes`, 1);
|
|
180
|
+
this._cs2.dispatch(dispatchSize, 1, 1);
|
|
181
|
+
this._engine._debugPopGroup?.(1);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
this._fullUpdateUBO();
|
|
185
|
+
}
|
|
168
186
|
const dispatchSize = Math.ceil((this._tesselation + 1) / 8);
|
|
169
|
-
|
|
170
|
-
viewProjMatrix.invertToRef(InvViewProjMatrix);
|
|
171
|
-
this._uBuffer.updateMatrix("invViewProjMatrix", InvViewProjMatrix);
|
|
172
|
-
this._uBuffer.update();
|
|
173
|
-
this._engine._debugPushGroup?.(`Generate lighting volume (${this._name})`);
|
|
187
|
+
this._engine._debugPushGroup?.(`Update vertices of far plane`, 1);
|
|
174
188
|
this._cs.dispatch(dispatchSize, dispatchSize, 1);
|
|
175
|
-
this._engine._debugPopGroup?.();
|
|
189
|
+
this._engine._debugPopGroup?.(1);
|
|
190
|
+
this._engine._debugPopGroup?.(1);
|
|
176
191
|
this._firstUpdate = false;
|
|
177
192
|
}
|
|
178
193
|
else {
|
|
@@ -200,26 +215,45 @@ export class LightingVolume {
|
|
|
200
215
|
this._uBuffer?.dispose();
|
|
201
216
|
this._depthCopy?.dispose();
|
|
202
217
|
}
|
|
218
|
+
_needUpdateGeometry() {
|
|
219
|
+
if (this._cs?.triggerContextRebuild || (this._light && !this._currentLightDirection.equals(this._light.direction))) {
|
|
220
|
+
this._currentLightDirection.copyFrom(this._light.direction);
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
203
225
|
_createComputeShader() {
|
|
204
|
-
this._cs = new ComputeShader("
|
|
226
|
+
this._cs = new ComputeShader("updateFarPlaneVertices", this._engine, "lightingVolume", {
|
|
205
227
|
bindingsMapping: {
|
|
206
228
|
shadowMap: { group: 0, binding: 0 },
|
|
207
229
|
params: { group: 0, binding: 1 },
|
|
208
230
|
positions: { group: 0, binding: 2 },
|
|
209
231
|
},
|
|
210
232
|
defines: !this._buildFullVolume ? ["#define KEEP_EDGES", "#define MOVE_FAR_DEPTH_TO_NEAR"] : undefined,
|
|
233
|
+
entryPoint: "updateFarPlaneVertices",
|
|
234
|
+
});
|
|
235
|
+
this._cs2 = new ComputeShader("updatePlaneVertices", this._engine, "lightingVolume", {
|
|
236
|
+
bindingsMapping: {
|
|
237
|
+
shadowMap: { group: 0, binding: 0 },
|
|
238
|
+
params: { group: 0, binding: 1 },
|
|
239
|
+
positions: { group: 0, binding: 2 },
|
|
240
|
+
},
|
|
241
|
+
entryPoint: "updatePlaneVertices",
|
|
211
242
|
});
|
|
212
243
|
if (this._shadowGenerator) {
|
|
213
244
|
const depthTexture = this._shadowGenerator.getShadowMap()?.depthStencilTexture;
|
|
214
245
|
if (depthTexture) {
|
|
215
246
|
this._cs.setInternalTexture("shadowMap", depthTexture);
|
|
247
|
+
this._cs2.setInternalTexture("shadowMap", depthTexture);
|
|
216
248
|
}
|
|
217
249
|
}
|
|
218
250
|
if (this._uBuffer) {
|
|
219
251
|
this._cs.setUniformBuffer("params", this._uBuffer);
|
|
252
|
+
this._cs2.setUniformBuffer("params", this._uBuffer);
|
|
220
253
|
}
|
|
221
254
|
if (this._storageBuffer) {
|
|
222
255
|
this._cs.setStorageBuffer("positions", this._storageBuffer);
|
|
256
|
+
this._cs2.setStorageBuffer("positions", this._storageBuffer);
|
|
223
257
|
}
|
|
224
258
|
}
|
|
225
259
|
_createFallbackTextures() {
|
|
@@ -280,13 +314,22 @@ export class LightingVolume {
|
|
|
280
314
|
const invViewProjMatrix = shadowGenerator.getTransformMatrix().clone();
|
|
281
315
|
invViewProjMatrix.invertToRef(invViewProjMatrix);
|
|
282
316
|
const factor = 4;
|
|
317
|
+
if (this._needUpdateGeometry()) {
|
|
318
|
+
this._updateGeometry();
|
|
319
|
+
}
|
|
283
320
|
let posIndex = startPos;
|
|
284
321
|
let stepY = 0;
|
|
285
322
|
for (let y = 0; y < numTesselation + 1; ++y) {
|
|
286
323
|
for (let x = 0; x < numTesselation + 1; ++x) {
|
|
287
324
|
let depth = depthValues[Math.floor(mapSize * Math.floor(stepY) + x * step) * factor];
|
|
288
|
-
if (!this._buildFullVolume
|
|
289
|
-
|
|
325
|
+
if (!this._buildFullVolume) {
|
|
326
|
+
if (y === 0 || x === 0 || y === numTesselation || x === numTesselation) {
|
|
327
|
+
posIndex += 3;
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
if (depth === 1) {
|
|
331
|
+
depth = 0;
|
|
332
|
+
}
|
|
290
333
|
}
|
|
291
334
|
TmpVec3.set((x - halfTesselation) / halfTesselation, (y - halfTesselation) / halfTesselation, -1 + 2 * depth);
|
|
292
335
|
Vector3.TransformCoordinatesToRef(TmpVec3, invViewProjMatrix, TmpVec3);
|
|
@@ -301,126 +344,193 @@ export class LightingVolume {
|
|
|
301
344
|
this._readPixelPromise = null;
|
|
302
345
|
this._firstUpdate = false;
|
|
303
346
|
}
|
|
347
|
+
_fullUpdateUBO(force = false) {
|
|
348
|
+
const light = this._light;
|
|
349
|
+
if ((!force && !this._needFullUpdateUBO) || !light || !this._shadowGenerator) {
|
|
350
|
+
this._uBuffer.update();
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
this._needFullUpdateUBO = false;
|
|
354
|
+
const numTesselation = this._tesselation;
|
|
355
|
+
const min = TmpVectors.Vector3[0].set(light.orthoLeft, light.orthoBottom, light.shadowMinZ ?? 0);
|
|
356
|
+
const max = TmpVectors.Vector3[1].set(light.orthoRight, light.orthoTop, light.shadowMaxZ ?? 10000);
|
|
357
|
+
const invViewMatrix = this._shadowGenerator.viewMatrix.invertToRef(TmpVectors.Matrix[1]);
|
|
358
|
+
this._uBuffer.updateUInt("startVertexIndex", this._buildFullVolume ? (numTesselation + 1) * 4 * 3 : 4 * 3);
|
|
359
|
+
this._uBuffer.updateFloat("step", ((this._shadowGenerator?.mapSize ?? 128) - 1) / numTesselation);
|
|
360
|
+
this._uBuffer.updateUInt("tesselation", numTesselation);
|
|
361
|
+
this._uBuffer.updateVector3("orthoMin", min);
|
|
362
|
+
this._uBuffer.updateVector3("orthoMax", max);
|
|
363
|
+
this._uBuffer.updateMatrix("invViewMatrix", invViewMatrix);
|
|
364
|
+
this._uBuffer.update();
|
|
365
|
+
}
|
|
304
366
|
_createGeometry() {
|
|
305
|
-
|
|
367
|
+
const light = this._light;
|
|
368
|
+
if (!light) {
|
|
306
369
|
return;
|
|
307
370
|
}
|
|
308
371
|
this._tesselation = Math.max(Math.ceil(this._tesselation) & ~1, 2);
|
|
372
|
+
const numTesselation = this._tesselation;
|
|
373
|
+
const vertexNumber = (numTesselation + 1) * (numTesselation + 1) + (this._buildFullVolume ? (numTesselation + 1) * 4 : 4);
|
|
374
|
+
this._positions = new Float32Array(vertexNumber * 3);
|
|
375
|
+
this._indices.length = 0;
|
|
376
|
+
this._createIndices(light);
|
|
377
|
+
this._mesh.setIndices(this._indices, vertexNumber);
|
|
378
|
+
if (this._engine.isWebGPU) {
|
|
379
|
+
const webGPUEngine = this._engine;
|
|
380
|
+
this._storageBuffer?.dispose();
|
|
381
|
+
this._storageBuffer = new StorageBuffer(webGPUEngine, vertexNumber * 3 * 4, 8 | 3);
|
|
382
|
+
this._mesh.setVerticesBuffer(new VertexBuffer(webGPUEngine, this._storageBuffer.getBuffer(), "position", { takeBufferOwnership: false }), true, vertexNumber);
|
|
383
|
+
this._cs.setStorageBuffer("positions", this._storageBuffer);
|
|
384
|
+
this._cs2.setStorageBuffer("positions", this._storageBuffer);
|
|
385
|
+
this._cs.triggerContextRebuild = true;
|
|
386
|
+
this._cs2.triggerContextRebuild = true;
|
|
387
|
+
this._needFullUpdateUBO = true;
|
|
388
|
+
}
|
|
389
|
+
this._updateGeometry();
|
|
390
|
+
}
|
|
391
|
+
_updateGeometry() {
|
|
309
392
|
const light = this._light;
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
393
|
+
if (!light || !this._shadowGenerator) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (this._indices.length === 0) {
|
|
397
|
+
this._createGeometry();
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if (this._engine.isWebGPU) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
316
403
|
const numTesselation = this._tesselation;
|
|
404
|
+
const min = TmpVectors.Vector3[0].set(light.orthoLeft, light.orthoBottom, light.shadowMinZ ?? 0);
|
|
405
|
+
const max = TmpVectors.Vector3[1].set(light.orthoRight, light.orthoTop, light.shadowMaxZ ?? 10000);
|
|
406
|
+
const invViewMatrix = this._shadowGenerator.viewMatrix.invertToRef(TmpVectors.Matrix[1]);
|
|
317
407
|
const stepX = (max.x - min.x) / numTesselation;
|
|
318
408
|
const stepY = (max.y - min.y) / numTesselation;
|
|
319
|
-
|
|
409
|
+
let vIndex = 0;
|
|
410
|
+
if (this._buildFullVolume) {
|
|
411
|
+
// Right faces of the frustum
|
|
412
|
+
for (let i = 0; i <= numTesselation; ++i) {
|
|
413
|
+
TmpVec3.set(max.x, min.y + i * stepY, min.z);
|
|
414
|
+
Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
|
|
415
|
+
this._positions[vIndex++] = TmpVec3.x;
|
|
416
|
+
this._positions[vIndex++] = TmpVec3.y;
|
|
417
|
+
this._positions[vIndex++] = TmpVec3.z;
|
|
418
|
+
}
|
|
419
|
+
// Left faces of the frustum
|
|
420
|
+
for (let i = 0; i <= numTesselation; ++i) {
|
|
421
|
+
TmpVec3.set(min.x, min.y + i * stepY, min.z);
|
|
422
|
+
Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
|
|
423
|
+
this._positions[vIndex++] = TmpVec3.x;
|
|
424
|
+
this._positions[vIndex++] = TmpVec3.y;
|
|
425
|
+
this._positions[vIndex++] = TmpVec3.z;
|
|
426
|
+
}
|
|
427
|
+
// Bottom faces of the frustum
|
|
428
|
+
for (let i = 0; i <= numTesselation; ++i) {
|
|
429
|
+
TmpVec3.set(min.x + i * stepX, min.y, min.z);
|
|
430
|
+
Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
|
|
431
|
+
this._positions[vIndex++] = TmpVec3.x;
|
|
432
|
+
this._positions[vIndex++] = TmpVec3.y;
|
|
433
|
+
this._positions[vIndex++] = TmpVec3.z;
|
|
434
|
+
}
|
|
435
|
+
// Top faces of the frustum
|
|
436
|
+
for (let i = 0; i <= numTesselation; ++i) {
|
|
437
|
+
TmpVec3.set(min.x + i * stepX, max.y, min.z);
|
|
438
|
+
Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
|
|
439
|
+
this._positions[vIndex++] = TmpVec3.x;
|
|
440
|
+
this._positions[vIndex++] = TmpVec3.y;
|
|
441
|
+
this._positions[vIndex++] = TmpVec3.z;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
// Closes the volume with two near triangles
|
|
446
|
+
TmpVec3.set(max.x, min.y, min.z);
|
|
447
|
+
Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
|
|
448
|
+
this._positions[vIndex++] = TmpVec3.x;
|
|
449
|
+
this._positions[vIndex++] = TmpVec3.y;
|
|
450
|
+
this._positions[vIndex++] = TmpVec3.z;
|
|
451
|
+
TmpVec3.set(max.x, max.y, min.z);
|
|
452
|
+
Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
|
|
453
|
+
this._positions[vIndex++] = TmpVec3.x;
|
|
454
|
+
this._positions[vIndex++] = TmpVec3.y;
|
|
455
|
+
this._positions[vIndex++] = TmpVec3.z;
|
|
456
|
+
TmpVec3.set(min.x, min.y, min.z);
|
|
457
|
+
Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
|
|
458
|
+
this._positions[vIndex++] = TmpVec3.x;
|
|
459
|
+
this._positions[vIndex++] = TmpVec3.y;
|
|
460
|
+
this._positions[vIndex++] = TmpVec3.z;
|
|
461
|
+
TmpVec3.set(min.x, max.y, min.z);
|
|
462
|
+
Vector3.TransformCoordinatesToRef(TmpVec3, invViewMatrix, TmpVec3);
|
|
463
|
+
this._positions[vIndex++] = TmpVec3.x;
|
|
464
|
+
this._positions[vIndex++] = TmpVec3.y;
|
|
465
|
+
this._positions[vIndex++] = TmpVec3.z;
|
|
466
|
+
}
|
|
467
|
+
this._mesh.setVerticesData("position", this._positions);
|
|
468
|
+
}
|
|
469
|
+
_createIndices(light) {
|
|
470
|
+
const invViewMatrix = Matrix.LookAtLH(light.position, light.position.add(light.direction), Vector3.UpReadOnly);
|
|
471
|
+
invViewMatrix.invertToRef(invViewMatrix);
|
|
472
|
+
const numTesselation = this._tesselation;
|
|
320
473
|
const startFarIndices = this._buildFullVolume ? (numTesselation + 1) * 4 : 4;
|
|
321
474
|
if (this._buildFullVolume) {
|
|
322
|
-
|
|
475
|
+
const rightFaceStartIndex = 0;
|
|
323
476
|
// Right faces of the frustum
|
|
324
477
|
for (let i = 0; i <= numTesselation; ++i) {
|
|
325
|
-
v.set(max.x, min.y + i * stepY, min.z);
|
|
326
|
-
const p = Vector3.TransformCoordinates(v, invViewMatrix);
|
|
327
|
-
positions.push(p.x, p.y, p.z);
|
|
328
478
|
if (i < numTesselation) {
|
|
329
|
-
|
|
330
|
-
|
|
479
|
+
this._indices.push(rightFaceStartIndex + i, startFarIndices + numTesselation + (i + 1) * (numTesselation + 1), startFarIndices + numTesselation + i * (numTesselation + 1));
|
|
480
|
+
this._indices.push(rightFaceStartIndex + i, rightFaceStartIndex + i + 1, startFarIndices + numTesselation + (i + 1) * (numTesselation + 1));
|
|
331
481
|
}
|
|
332
482
|
}
|
|
333
|
-
const
|
|
334
|
-
const n1 = positions.length / 3 - 1;
|
|
335
|
-
const n2 = n1 + 1;
|
|
336
|
-
startIndices = positions.length / 3;
|
|
483
|
+
const leftFaceStartIndex = rightFaceStartIndex + numTesselation + 1;
|
|
337
484
|
// Left faces of the frustum
|
|
338
485
|
for (let i = 0; i <= numTesselation; ++i) {
|
|
339
|
-
v.set(min.x, min.y + i * stepY, min.z);
|
|
340
|
-
const p = Vector3.TransformCoordinates(v, invViewMatrix);
|
|
341
|
-
positions.push(p.x, p.y, p.z);
|
|
342
486
|
if (i < numTesselation) {
|
|
343
|
-
|
|
344
|
-
|
|
487
|
+
this._indices.push(leftFaceStartIndex + i, startFarIndices + 0 + i * (numTesselation + 1), startFarIndices + 0 + (i + 1) * (numTesselation + 1));
|
|
488
|
+
this._indices.push(leftFaceStartIndex + i, startFarIndices + 0 + (i + 1) * (numTesselation + 1), leftFaceStartIndex + i + 1);
|
|
345
489
|
}
|
|
346
490
|
}
|
|
347
|
-
const
|
|
348
|
-
startIndices = positions.length / 3;
|
|
491
|
+
const bottomFaceStartIndex = leftFaceStartIndex + numTesselation + 1;
|
|
349
492
|
// Bottom faces of the frustum
|
|
350
493
|
for (let i = 0; i <= numTesselation; ++i) {
|
|
351
|
-
v.set(min.x + i * stepX, min.y, min.z);
|
|
352
|
-
const p = Vector3.TransformCoordinates(v, invViewMatrix);
|
|
353
|
-
positions.push(p.x, p.y, p.z);
|
|
354
494
|
if (i < numTesselation) {
|
|
355
|
-
|
|
356
|
-
|
|
495
|
+
this._indices.push(bottomFaceStartIndex + i, bottomFaceStartIndex + i + 1, startFarIndices + i + 0 * (numTesselation + 1));
|
|
496
|
+
this._indices.push(bottomFaceStartIndex + i + 1, startFarIndices + i + 1 + 0 * (numTesselation + 1), startFarIndices + i + 0 * (numTesselation + 1));
|
|
357
497
|
}
|
|
358
498
|
}
|
|
359
|
-
|
|
499
|
+
const topFaceStartIndex = bottomFaceStartIndex + numTesselation + 1;
|
|
360
500
|
// Top faces of the frustum
|
|
361
501
|
for (let i = 0; i <= numTesselation; ++i) {
|
|
362
|
-
v.set(min.x + i * stepX, max.y, min.z);
|
|
363
|
-
const p = Vector3.TransformCoordinates(v, invViewMatrix);
|
|
364
|
-
positions.push(p.x, p.y, p.z);
|
|
365
502
|
if (i < numTesselation) {
|
|
366
|
-
|
|
367
|
-
|
|
503
|
+
this._indices.push(topFaceStartIndex + i, startFarIndices + i + numTesselation * (numTesselation + 1), topFaceStartIndex + i + 1);
|
|
504
|
+
this._indices.push(topFaceStartIndex + i + 1, startFarIndices + i + numTesselation * (numTesselation + 1), startFarIndices + i + 1 + numTesselation * (numTesselation + 1));
|
|
368
505
|
}
|
|
369
506
|
}
|
|
370
|
-
startIndices = positions.length / 3;
|
|
371
507
|
// Near faces of the frustum
|
|
372
|
-
|
|
373
|
-
|
|
508
|
+
for (let i = 0; i < numTesselation; ++i) {
|
|
509
|
+
this._indices.push(leftFaceStartIndex + i, leftFaceStartIndex + i + 1, topFaceStartIndex + numTesselation - i);
|
|
510
|
+
if (i < numTesselation - 1) {
|
|
511
|
+
this._indices.push(leftFaceStartIndex + i + 1, topFaceStartIndex + numTesselation - i - 1, topFaceStartIndex + numTesselation - i);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
for (let i = 0; i < numTesselation; ++i) {
|
|
515
|
+
this._indices.push(bottomFaceStartIndex + i, rightFaceStartIndex + numTesselation - i, rightFaceStartIndex + numTesselation - i - 1);
|
|
516
|
+
if (i < numTesselation - 1) {
|
|
517
|
+
this._indices.push(bottomFaceStartIndex + i, rightFaceStartIndex + numTesselation - i - 1, bottomFaceStartIndex + i + 1);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
374
520
|
}
|
|
375
521
|
else {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
p = Vector3.TransformCoordinates(v, invViewMatrix);
|
|
379
|
-
positions.push(p.x, p.y, p.z);
|
|
380
|
-
v.set(max.x, max.y, min.z);
|
|
381
|
-
p = Vector3.TransformCoordinates(v, invViewMatrix);
|
|
382
|
-
positions.push(p.x, p.y, p.z);
|
|
383
|
-
v.set(min.x, min.y, min.z);
|
|
384
|
-
p = Vector3.TransformCoordinates(v, invViewMatrix);
|
|
385
|
-
positions.push(p.x, p.y, p.z);
|
|
386
|
-
v.set(min.x, max.y, min.z);
|
|
387
|
-
p = Vector3.TransformCoordinates(v, invViewMatrix);
|
|
388
|
-
positions.push(p.x, p.y, p.z);
|
|
389
|
-
indices.push(0, 2, 1);
|
|
390
|
-
indices.push(2, 3, 1);
|
|
522
|
+
this._indices.push(0, 2, 1);
|
|
523
|
+
this._indices.push(2, 3, 1);
|
|
391
524
|
}
|
|
392
525
|
// Tesselate the far plane
|
|
393
|
-
let y = min.y;
|
|
394
526
|
for (let iy = 0; iy <= numTesselation; ++iy) {
|
|
395
|
-
let x = min.x;
|
|
396
527
|
for (let ix = 0; ix <= numTesselation; ++ix) {
|
|
397
|
-
v.set(x, y, min.z);
|
|
398
|
-
const p = Vector3.TransformCoordinates(v, invViewMatrix);
|
|
399
|
-
positions.push(p.x, p.y, p.z);
|
|
400
528
|
if (ix < numTesselation && iy < numTesselation) {
|
|
401
|
-
|
|
402
|
-
|
|
529
|
+
this._indices.push(startFarIndices + ix + iy * (numTesselation + 1), startFarIndices + ix + 1 + iy * (numTesselation + 1), startFarIndices + ix + 1 + (iy + 1) * (numTesselation + 1));
|
|
530
|
+
this._indices.push(startFarIndices + ix + iy * (numTesselation + 1), startFarIndices + ix + 1 + (iy + 1) * (numTesselation + 1), startFarIndices + ix + (iy + 1) * (numTesselation + 1));
|
|
403
531
|
}
|
|
404
|
-
x += stepX;
|
|
405
532
|
}
|
|
406
|
-
y += stepY;
|
|
407
|
-
}
|
|
408
|
-
if (this._uBuffer && this._cs) {
|
|
409
|
-
const webGPUEngine = this._engine;
|
|
410
|
-
this._storageBuffer?.dispose();
|
|
411
|
-
this._storageBuffer = new StorageBuffer(webGPUEngine, positions.length * 4, 8 | 3);
|
|
412
|
-
this._storageBuffer.update(positions);
|
|
413
|
-
const vertexBuffer = new VertexBuffer(webGPUEngine, this._storageBuffer.getBuffer(), "position");
|
|
414
|
-
this._mesh.setVerticesBuffer(vertexBuffer);
|
|
415
|
-
this._cs.setStorageBuffer("positions", this._storageBuffer);
|
|
416
|
-
this._uBuffer.updateUInt("startVertexIndex", this._buildFullVolume ? (numTesselation + 1) * 4 * 3 : 4 * 3);
|
|
417
|
-
this._uBuffer.updateFloat("step", ((this._shadowGenerator?.mapSize ?? 128) - 1) / numTesselation);
|
|
418
|
-
this._uBuffer.updateUInt("tesselation", numTesselation);
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
this._mesh.setVerticesData("position", positions);
|
|
422
533
|
}
|
|
423
|
-
this._mesh.setIndices(indices, positions.length / 3);
|
|
424
534
|
}
|
|
425
535
|
}
|
|
426
536
|
//# sourceMappingURL=lightingVolume.js.map
|