@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseLayerTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/baseLayerTask.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,wBAAw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ThinBlurPostProcess,\r\n AbstractEngine,\r\n Nullable,\r\n Observer,\r\n RenderingGroupInfo,\r\n ThinEffectLayer,\r\n FrameGraphRenderPass,\r\n FrameGraphRenderContext,\r\n} from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { FrameGraphObjectRendererTask } from \"../Rendering/objectRendererTask\";\r\nimport { FrameGraphClearTextureTask } from \"../Texture/clearTextureTask\";\r\nimport { FrameGraphBlurTask } from \"../PostProcesses/blurTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTextureManager } from \"../../frameGraphTextureManager\";\r\nimport { getDimensionsFromTextureSize } from \"../../../Materials/Textures/textureCreationOptions\";\r\nimport { FrameGraphPostProcessTask } from \"../PostProcesses/postProcessTask\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { ThinGlowBlurPostProcess } from \"../../../Layers/thinEffectLayer\";\r\nimport { FrameGraphExecuteTask } from \"../Misc/executeTask\";\r\n\r\nclass FrameGraphGlowBlurTask extends FrameGraphPostProcessTask {\r\n public override readonly postProcess: ThinGlowBlurPostProcess;\r\n\r\n /**\r\n * Constructs a new glow blur task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param thinPostProcess The thin post process to use for the glow blur effect. If not provided, a new one will be created.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinGlowBlurPostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinGlowBlurPostProcess(name, frameGraph.engine, new Vector2(1, 0), 1));\r\n }\r\n\r\n public override record(\r\n skipCreationOfDisabledPasses = false,\r\n additionalExecute?: (context: FrameGraphRenderContext) => void,\r\n additionalBindings?: (context: FrameGraphRenderContext) => void\r\n ): FrameGraphRenderPass {\r\n const pass = super.record(skipCreationOfDisabledPasses, additionalExecute, additionalBindings);\r\n\r\n this.postProcess.textureWidth = this._outputWidth;\r\n this.postProcess.textureHeight = this._outputHeight;\r\n\r\n return pass;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class FrameGraphBaseLayerTask extends FrameGraphTask {\r\n /**\r\n * The target texture to apply the effect layer to.\r\n * The effect will be blended with the contents of this texture.\r\n */\r\n public targetTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer task used to render the objects in the texture to which the layer will be applied.\r\n * This is needed because the layer may have to inject code in the rendering manager used by object renderer task.\r\n */\r\n public objectRendererTask: FrameGraphObjectRendererTask;\r\n\r\n /**\r\n * The layer texture to render the effect into.\r\n * If not provided, a default texture will be created.\r\n */\r\n public layerTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output texture of the task (same as targetTexture, but the handle will be different).\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The layer object. Use this object to update the layer properties.\r\n */\r\n public readonly layer: ThinEffectLayer;\r\n\r\n /**\r\n * The name of the task.\r\n */\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(name: string) {\r\n this._name = name;\r\n if (this._blurX) {\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n this._blurX[i].name = `${name} Blur X${i}`;\r\n this._blurY[i].name = `${name} Blur Y${i}`;\r\n }\r\n }\r\n\r\n if (this._clearLayerTextures) {\r\n this._clearLayerTextures.name = name + \" Clear Layer\";\r\n }\r\n\r\n if (this._objectRendererForLayer) {\r\n this._objectRendererForLayer.name = name + \" Render to Layer\";\r\n }\r\n }\r\n\r\n /**\r\n * Gets the object renderer used to render the layer.\r\n */\r\n public get objectRendererForLayer() {\r\n return this._objectRendererForLayer;\r\n }\r\n\r\n protected readonly _scene: Scene;\r\n protected readonly _engine: AbstractEngine;\r\n protected readonly _clearLayerTextures: FrameGraphClearTextureTask;\r\n protected readonly _objectRendererForLayer: FrameGraphObjectRendererTask;\r\n protected readonly _blurX: Array<FrameGraphBlurTask | FrameGraphGlowBlurTask> = [];\r\n protected readonly _blurY: Array<FrameGraphBlurTask | FrameGraphGlowBlurTask> = [];\r\n private readonly _onBeforeBlurTask: Nullable<FrameGraphExecuteTask> = null;\r\n private readonly _onAfterBlurTask: Nullable<FrameGraphExecuteTask> = null;\r\n private _onBeforeObservableObserver: Nullable<Observer<number>> = null;\r\n private _onAfterObservableObserver: Nullable<Observer<number>> = null;\r\n private _onAfterRenderingGroupObserver: Nullable<Observer<RenderingGroupInfo>> = null;\r\n\r\n /**\r\n * Constructs a new layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the layer in.\r\n * @param layer The layer.\r\n * @param numBlurPasses The number of blur passes applied by the layer.\r\n * @param useCustomBlur If true, the layer will use a custom blur post process instead of the default one.\r\n * @param _setRenderTargetDepth If true, the task will set the render target depth.\r\n * @param _notifyBlurObservable If true, the task will notify before and after blurring occurs.\r\n */\r\n constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n layer: ThinEffectLayer,\r\n numBlurPasses: number,\r\n useCustomBlur = false,\r\n private _setRenderTargetDepth = false,\r\n private _notifyBlurObservable = false\r\n ) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n\r\n this.layer = layer;\r\n for (let i = 0; i < numBlurPasses; i++) {\r\n if (useCustomBlur) {\r\n this._blurX.push(new FrameGraphGlowBlurTask(`${name} Blur X${i}`, this._frameGraph, this.layer._postProcesses[1 + i * 2 + 0] as ThinGlowBlurPostProcess));\r\n this._blurY.push(new FrameGraphGlowBlurTask(`${name} Blur Y${i}`, this._frameGraph, this.layer._postProcesses[1 + i * 2 + 1] as ThinGlowBlurPostProcess));\r\n } else {\r\n this._blurX.push(new FrameGraphBlurTask(`${name} Blur X${i}`, this._frameGraph, this.layer._postProcesses[i * 2 + 0] as ThinBlurPostProcess));\r\n this._blurY.push(new FrameGraphBlurTask(`${name} Blur Y${i}`, this._frameGraph, this.layer._postProcesses[i * 2 + 1] as ThinBlurPostProcess));\r\n }\r\n }\r\n\r\n this._clearLayerTextures = new FrameGraphClearTextureTask(name + \" Clear Layer\", frameGraph);\r\n this._clearLayerTextures.clearColor = true;\r\n this._clearLayerTextures.clearDepth = true;\r\n\r\n this._objectRendererForLayer = new FrameGraphObjectRendererTask(name + \" Render to Layer\", frameGraph, scene, undefined, this.layer.objectRenderer);\r\n\r\n if (this._notifyBlurObservable) {\r\n this._onBeforeBlurTask = new FrameGraphExecuteTask(name + \" On Before Blur\", frameGraph);\r\n this._onAfterBlurTask = new FrameGraphExecuteTask(name + \" On After Blur\", frameGraph);\r\n\r\n this._onBeforeBlurTask.func = () => {\r\n if (this.layer.onBeforeBlurObservable.hasObservers()) {\r\n this.layer.onBeforeBlurObservable.notifyObservers(this.layer);\r\n }\r\n };\r\n this._onAfterBlurTask.func = () => {\r\n if (this.layer.onAfterBlurObservable.hasObservers()) {\r\n this.layer.onAfterBlurObservable.notifyObservers(this.layer);\r\n }\r\n };\r\n }\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this._objectRendererForLayer.isReady() && this.layer.isLayerReady();\r\n }\r\n\r\n public record() {\r\n if (this.targetTexture === undefined || this.objectRendererTask === undefined) {\r\n throw new Error(`${this.constructor.name} \"${this.name}\": targetTexture and objectRendererTask are required`);\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n\r\n // Uses the layerTexture or creates a color texture to render the layer to\r\n let textureSize: {\r\n width: number;\r\n height: number;\r\n };\r\n let textureCreationOptions: FrameGraphTextureCreationOptions;\r\n\r\n let colorLayerOutput: FrameGraphTextureHandle;\r\n\r\n if (this.layerTexture) {\r\n colorLayerOutput = this.layerTexture;\r\n textureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.layerTexture);\r\n textureSize = getDimensionsFromTextureSize(textureCreationOptions.size);\r\n textureCreationOptions.size = textureSize;\r\n } else {\r\n const targetTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.targetTexture);\r\n const fixedTextureSize = this.layer._options.mainTextureFixedSize ? Math.max(2, this.layer._options.mainTextureFixedSize) : 0;\r\n\r\n textureSize = getDimensionsFromTextureSize(targetTextureCreationOptions.size);\r\n textureSize.width = fixedTextureSize || Math.floor(textureSize.width * (this.layer._options.mainTextureRatio || 0.1)) || 1;\r\n textureSize.height = fixedTextureSize || Math.floor(textureSize.height * (this.layer._options.mainTextureRatio || 0.1)) || 1;\r\n\r\n textureCreationOptions = {\r\n size: textureSize,\r\n options: {\r\n createMipMaps: false,\r\n types: [this.layer._options.mainTextureType],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n creationFlags: [0],\r\n },\r\n sizeIsPercentage: this.layer._options.mainTextureFixedSize ? false : targetTextureCreationOptions.sizeIsPercentage,\r\n };\r\n colorLayerOutput = this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} Color`, textureCreationOptions);\r\n }\r\n\r\n // Creates a depth texture, used to render objects to the layer\r\n // We don't reuse the depth texture of the objectRendererTask, as the size of the layer texture will generally be different (smaller).\r\n const textureDepthCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: textureSize,\r\n options: FrameGraphTextureManager.CloneTextureOptions(textureCreationOptions.options),\r\n sizeIsPercentage: textureCreationOptions.sizeIsPercentage,\r\n };\r\n\r\n textureDepthCreationOptions.options.formats![0] = Constants.TEXTUREFORMAT_DEPTH32_FLOAT;\r\n\r\n const depthLayerOutput = this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} Depth`, textureDepthCreationOptions);\r\n\r\n // Clears the textures\r\n this._clearLayerTextures.targetTexture = colorLayerOutput;\r\n this._clearLayerTextures.depthTexture = depthLayerOutput;\r\n this._clearLayerTextures.color = this.layer.neutralColor;\r\n this._clearLayerTextures.clearDepth = true;\r\n\r\n const clearTaskPass = this._clearLayerTextures.record();\r\n\r\n // Renders the objects to the layer texture\r\n this._objectRendererForLayer.targetTexture = this._clearLayerTextures.outputTexture;\r\n this._objectRendererForLayer.depthTexture = this._clearLayerTextures.outputDepthTexture;\r\n this._objectRendererForLayer.camera = this.objectRendererTask.camera;\r\n this._objectRendererForLayer.objectList = this.objectRendererTask.objectList;\r\n this._objectRendererForLayer.disableShadows = true;\r\n\r\n const objectRendererForLayerTaskPass = this._objectRendererForLayer.record();\r\n\r\n // Blurs the layer color texture\r\n let blurTextureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n blurTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else {\r\n blurTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n\r\n textureCreationOptions.options.types![0] = blurTextureType;\r\n\r\n const blurTextureSizeRatio = (this.layer._options as any).blurTextureSizeRatio !== undefined ? (this.layer._options as any).blurTextureSizeRatio || 0.1 : undefined;\r\n if (blurTextureSizeRatio !== undefined) {\r\n textureSize.width = Math.floor(textureSize.width * blurTextureSizeRatio) || 1;\r\n textureSize.height = Math.floor(textureSize.height * blurTextureSizeRatio) || 1;\r\n }\r\n\r\n const onBeforeBlurPass = this._onBeforeBlurTask?.record();\r\n\r\n const blurPasses: FrameGraphRenderPass[] = [];\r\n\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n const blurXTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurX[i].name, textureCreationOptions);\r\n\r\n this._blurX[i].sourceTexture = i === 0 ? this._objectRendererForLayer.outputTexture : this._blurY[i - 1].outputTexture;\r\n this._blurX[i].sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurX[i].targetTexture = blurXTextureHandle;\r\n blurPasses.push(this._blurX[i].record(true));\r\n\r\n const blurYTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurY[i].name, textureCreationOptions);\r\n\r\n this._blurY[i].sourceTexture = this._blurX[i].outputTexture;\r\n this._blurY[i].sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurY[i].targetTexture = blurYTextureHandle;\r\n blurPasses.push(this._blurY[i].record(true));\r\n\r\n textureSize.width = textureSize.width >> 1;\r\n textureSize.height = textureSize.height >> 1;\r\n }\r\n\r\n const onAfterBlurPass = this._onAfterBlurTask?.record();\r\n\r\n // Enables stencil (if stencil is needed) when rendering objects to the main texture\r\n // We also disable the internal passes if the layer should not render\r\n this.objectRendererTask.objectRenderer.onBeforeRenderObservable.remove(this._onBeforeObservableObserver);\r\n this._onBeforeObservableObserver = this.objectRendererTask.objectRenderer.onBeforeRenderObservable.add(() => {\r\n const shouldRender = this.layer.shouldRender();\r\n\r\n clearTaskPass.disabled = !shouldRender;\r\n objectRendererForLayerTaskPass.disabled = !shouldRender;\r\n if (onBeforeBlurPass) {\r\n onBeforeBlurPass.disabled = !shouldRender;\r\n }\r\n for (let i = 0; i < blurPasses.length; i++) {\r\n blurPasses[i].disabled = !shouldRender;\r\n }\r\n if (onAfterBlurPass) {\r\n onAfterBlurPass.disabled = !shouldRender;\r\n }\r\n\r\n if (shouldRender && this.layer.needStencil()) {\r\n this._engine.setStencilBuffer(true);\r\n this._engine.setStencilFunctionReference(1);\r\n }\r\n });\r\n\r\n this.objectRendererTask.objectRenderer.onAfterRenderObservable.remove(this._onAfterObservableObserver);\r\n this._onAfterObservableObserver = this.objectRendererTask.objectRenderer.onAfterRenderObservable.add(() => {\r\n if (this.layer.shouldRender() && this.layer.needStencil()) {\r\n this._engine.setStencilBuffer(false);\r\n }\r\n });\r\n\r\n // Composes the layer with the target texture\r\n this.layer.bindTexturesForCompose = undefined as any;\r\n\r\n this._clearAfterRenderingGroupObserver();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n for (let i = 0; i < this._blurY.length; i++) {\r\n pass.addDependencies(this._blurY[i].outputTexture);\r\n }\r\n\r\n pass.setRenderTarget(this.outputTexture);\r\n if (this._setRenderTargetDepth) {\r\n pass.setRenderTargetDepth(this.objectRendererTask.depthTexture);\r\n }\r\n pass.setExecuteFunc((context) => {\r\n context.setTextureSamplingMode(this._blurY[this._blurY.length - 1].targetTexture!, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n\r\n if (!this.layer.bindTexturesForCompose) {\r\n this.layer.bindTexturesForCompose = (effect: Effect) => {\r\n for (let i = 0; i < this._blurY.length; i++) {\r\n context.bindTextureHandle(effect, `textureSampler${i > 0 ? i + 1 : \"\"}`, this._blurY[i].outputTexture);\r\n }\r\n };\r\n }\r\n\r\n if (this.layer._options.renderingGroupId !== -1) {\r\n if (!this._onAfterRenderingGroupObserver) {\r\n this._onAfterRenderingGroupObserver = this._scene.onAfterRenderingGroupObservable.add((info) => {\r\n if (\r\n !this.layer.shouldRender() ||\r\n info.renderingGroupId !== this.layer._options.renderingGroupId ||\r\n info.renderingManager !== this.objectRendererTask.objectRenderer.renderingManager\r\n ) {\r\n return;\r\n }\r\n this._objectRendererForLayer.objectList = this.objectRendererTask.objectList;\r\n context.saveDepthStates();\r\n context.setDepthStates(false, false);\r\n context._applyRenderTarget();\r\n this.layer.compose();\r\n context.restoreDepthStates();\r\n });\r\n }\r\n } else {\r\n this._clearAfterRenderingGroupObserver();\r\n if (this.layer.shouldRender()) {\r\n this._objectRendererForLayer.objectList = this.objectRendererTask.objectList; // in case the object list has changed in objectRendererTask\r\n\r\n context.setDepthStates(false, false);\r\n context._applyRenderTarget();\r\n\r\n this.layer.compose();\r\n }\r\n }\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n if (this._setRenderTargetDepth) {\r\n passDisabled.setRenderTargetDepth(this.objectRendererTask.depthTexture);\r\n }\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n private _clearAfterRenderingGroupObserver() {\r\n this._scene.onAfterRenderingGroupObservable.remove(this._onAfterRenderingGroupObserver);\r\n this._onAfterRenderingGroupObserver = null;\r\n }\r\n\r\n public override dispose(): void {\r\n this._clearAfterRenderingGroupObserver();\r\n this._clearLayerTextures.dispose();\r\n this._objectRendererForLayer.dispose();\r\n this._onBeforeBlurTask?.dispose();\r\n this._onAfterBlurTask?.dispose();\r\n this.layer.dispose();\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n this._blurX[i].dispose();\r\n this._blurY[i].dispose();\r\n }\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"baseLayerTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/baseLayerTask.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,sBAAuB,SAAQ,yBAAyB;IAG1D;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,eAAyC;QACvF,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,uBAAuB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3H,CAAC;IAEe,YAAY;QACxB,OAA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AAI,CAAC;IAC/C,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,iCAAiC,EAAE,CAAC;QACzC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC;QACvC,IAAI,CAAC,iBAAiB,EAAE,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,gBAAgB,EAAE,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n FrameGraphTextureCreationOptions,\r\n Effect,\r\n ThinBlurPostProcess,\r\n AbstractEngine,\r\n Nullable,\r\n Observer,\r\n RenderingGroupInfo,\r\n ThinEffectLayer,\r\n FrameGraphRenderPass,\r\n FrameGraphRenderContext,\r\n} from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { FrameGraphObjectRendererTask } from \"../Rendering/objectRendererTask\";\r\nimport { FrameGraphClearTextureTask } from \"../Texture/clearTextureTask\";\r\nimport { FrameGraphBlurTask } from \"../PostProcesses/blurTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTextureManager } from \"../../frameGraphTextureManager\";\r\nimport { getDimensionsFromTextureSize } from \"../../../Materials/Textures/textureCreationOptions\";\r\nimport { FrameGraphPostProcessTask } from \"../PostProcesses/postProcessTask\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { ThinGlowBlurPostProcess } from \"../../../Layers/thinEffectLayer\";\r\nimport { FrameGraphExecuteTask } from \"../Misc/executeTask\";\r\n\r\nclass FrameGraphGlowBlurTask extends FrameGraphPostProcessTask {\r\n public override readonly postProcess: ThinGlowBlurPostProcess;\r\n\r\n /**\r\n * Constructs a new glow blur task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param thinPostProcess The thin post process to use for the glow blur effect. If not provided, a new one will be created.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinGlowBlurPostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinGlowBlurPostProcess(name, frameGraph.engine, new Vector2(1, 0), 1));\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphGlowBlurTask\";\r\n }\r\n\r\n public override record(\r\n skipCreationOfDisabledPasses = false,\r\n additionalExecute?: (context: FrameGraphRenderContext) => void,\r\n additionalBindings?: (context: FrameGraphRenderContext) => void\r\n ): FrameGraphRenderPass {\r\n const pass = super.record(skipCreationOfDisabledPasses, additionalExecute, additionalBindings);\r\n\r\n this.postProcess.textureWidth = this._outputWidth;\r\n this.postProcess.textureHeight = this._outputHeight;\r\n\r\n return pass;\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class FrameGraphBaseLayerTask extends FrameGraphTask {\r\n /**\r\n * The target texture to apply the effect layer to.\r\n * The effect will be blended with the contents of this texture.\r\n */\r\n public targetTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer task used to render the objects in the texture to which the layer will be applied.\r\n * This is needed because the layer may have to inject code in the rendering manager used by object renderer task.\r\n */\r\n public objectRendererTask: FrameGraphObjectRendererTask;\r\n\r\n /**\r\n * The layer texture to render the effect into.\r\n * If not provided, a default texture will be created.\r\n */\r\n public layerTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output texture of the task (same as targetTexture, but the handle will be different).\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The layer object. Use this object to update the layer properties.\r\n */\r\n public readonly layer: ThinEffectLayer;\r\n\r\n /**\r\n * The name of the task.\r\n */\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(name: string) {\r\n this._name = name;\r\n if (this._blurX) {\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n this._blurX[i].name = `${name} Blur X${i}`;\r\n this._blurY[i].name = `${name} Blur Y${i}`;\r\n }\r\n }\r\n\r\n if (this._clearLayerTextures) {\r\n this._clearLayerTextures.name = name + \" Clear Layer\";\r\n }\r\n\r\n if (this._objectRendererForLayer) {\r\n this._objectRendererForLayer.name = name + \" Render to Layer\";\r\n }\r\n }\r\n\r\n /**\r\n * Gets the object renderer used to render the layer.\r\n */\r\n public get objectRendererForLayer() {\r\n return this._objectRendererForLayer;\r\n }\r\n\r\n protected readonly _scene: Scene;\r\n protected readonly _engine: AbstractEngine;\r\n protected readonly _clearLayerTextures: FrameGraphClearTextureTask;\r\n protected readonly _objectRendererForLayer: FrameGraphObjectRendererTask;\r\n protected readonly _blurX: Array<FrameGraphBlurTask | FrameGraphGlowBlurTask> = [];\r\n protected readonly _blurY: Array<FrameGraphBlurTask | FrameGraphGlowBlurTask> = [];\r\n private readonly _onBeforeBlurTask: Nullable<FrameGraphExecuteTask> = null;\r\n private readonly _onAfterBlurTask: Nullable<FrameGraphExecuteTask> = null;\r\n private _onBeforeObservableObserver: Nullable<Observer<number>> = null;\r\n private _onAfterObservableObserver: Nullable<Observer<number>> = null;\r\n private _onAfterRenderingGroupObserver: Nullable<Observer<RenderingGroupInfo>> = null;\r\n\r\n /**\r\n * Constructs a new layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the layer in.\r\n * @param layer The layer.\r\n * @param numBlurPasses The number of blur passes applied by the layer.\r\n * @param useCustomBlur If true, the layer will use a custom blur post process instead of the default one.\r\n * @param _setRenderTargetDepth If true, the task will set the render target depth.\r\n * @param _notifyBlurObservable If true, the task will notify before and after blurring occurs.\r\n */\r\n constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n layer: ThinEffectLayer,\r\n numBlurPasses: number,\r\n useCustomBlur = false,\r\n private _setRenderTargetDepth = false,\r\n private _notifyBlurObservable = false\r\n ) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n\r\n this.layer = layer;\r\n for (let i = 0; i < numBlurPasses; i++) {\r\n if (useCustomBlur) {\r\n this._blurX.push(new FrameGraphGlowBlurTask(`${name} Blur X${i}`, this._frameGraph, this.layer._postProcesses[1 + i * 2 + 0] as ThinGlowBlurPostProcess));\r\n this._blurY.push(new FrameGraphGlowBlurTask(`${name} Blur Y${i}`, this._frameGraph, this.layer._postProcesses[1 + i * 2 + 1] as ThinGlowBlurPostProcess));\r\n } else {\r\n this._blurX.push(new FrameGraphBlurTask(`${name} Blur X${i}`, this._frameGraph, this.layer._postProcesses[i * 2 + 0] as ThinBlurPostProcess));\r\n this._blurY.push(new FrameGraphBlurTask(`${name} Blur Y${i}`, this._frameGraph, this.layer._postProcesses[i * 2 + 1] as ThinBlurPostProcess));\r\n }\r\n }\r\n\r\n this._clearLayerTextures = new FrameGraphClearTextureTask(name + \" Clear Layer\", frameGraph);\r\n this._clearLayerTextures.clearColor = true;\r\n this._clearLayerTextures.clearDepth = true;\r\n\r\n this._objectRendererForLayer = new FrameGraphObjectRendererTask(name + \" Render to Layer\", frameGraph, scene, undefined, this.layer.objectRenderer);\r\n\r\n if (this._notifyBlurObservable) {\r\n this._onBeforeBlurTask = new FrameGraphExecuteTask(name + \" On Before Blur\", frameGraph);\r\n this._onAfterBlurTask = new FrameGraphExecuteTask(name + \" On After Blur\", frameGraph);\r\n\r\n this._onBeforeBlurTask.func = () => {\r\n if (this.layer.onBeforeBlurObservable.hasObservers()) {\r\n this.layer.onBeforeBlurObservable.notifyObservers(this.layer);\r\n }\r\n };\r\n this._onAfterBlurTask.func = () => {\r\n if (this.layer.onAfterBlurObservable.hasObservers()) {\r\n this.layer.onAfterBlurObservable.notifyObservers(this.layer);\r\n }\r\n };\r\n }\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this._objectRendererForLayer.isReady() && this.layer.isLayerReady();\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphBaseLayerTask\";\r\n }\r\n\r\n public record() {\r\n if (this.targetTexture === undefined || this.objectRendererTask === undefined) {\r\n throw new Error(`${this.constructor.name} \"${this.name}\": targetTexture and objectRendererTask are required`);\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n\r\n // Uses the layerTexture or creates a color texture to render the layer to\r\n let textureSize: {\r\n width: number;\r\n height: number;\r\n };\r\n let textureCreationOptions: FrameGraphTextureCreationOptions;\r\n\r\n let colorLayerOutput: FrameGraphTextureHandle;\r\n\r\n if (this.layerTexture) {\r\n colorLayerOutput = this.layerTexture;\r\n textureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.layerTexture);\r\n textureSize = getDimensionsFromTextureSize(textureCreationOptions.size);\r\n textureCreationOptions.size = textureSize;\r\n } else {\r\n const targetTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.targetTexture);\r\n const fixedTextureSize = this.layer._options.mainTextureFixedSize ? Math.max(2, this.layer._options.mainTextureFixedSize) : 0;\r\n\r\n textureSize = getDimensionsFromTextureSize(targetTextureCreationOptions.size);\r\n textureSize.width = fixedTextureSize || Math.floor(textureSize.width * (this.layer._options.mainTextureRatio || 0.1)) || 1;\r\n textureSize.height = fixedTextureSize || Math.floor(textureSize.height * (this.layer._options.mainTextureRatio || 0.1)) || 1;\r\n\r\n textureCreationOptions = {\r\n size: textureSize,\r\n options: {\r\n createMipMaps: false,\r\n types: [this.layer._options.mainTextureType],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n creationFlags: [0],\r\n },\r\n sizeIsPercentage: this.layer._options.mainTextureFixedSize ? false : targetTextureCreationOptions.sizeIsPercentage,\r\n };\r\n colorLayerOutput = this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} Color`, textureCreationOptions);\r\n }\r\n\r\n // Creates a depth texture, used to render objects to the layer\r\n // We don't reuse the depth texture of the objectRendererTask, as the size of the layer texture will generally be different (smaller).\r\n const textureDepthCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: textureSize,\r\n options: FrameGraphTextureManager.CloneTextureOptions(textureCreationOptions.options),\r\n sizeIsPercentage: textureCreationOptions.sizeIsPercentage,\r\n };\r\n\r\n textureDepthCreationOptions.options.formats![0] = Constants.TEXTUREFORMAT_DEPTH32_FLOAT;\r\n\r\n const depthLayerOutput = this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} Depth`, textureDepthCreationOptions);\r\n\r\n // Clears the textures\r\n this._clearLayerTextures.targetTexture = colorLayerOutput;\r\n this._clearLayerTextures.depthTexture = depthLayerOutput;\r\n this._clearLayerTextures.color = this.layer.neutralColor;\r\n this._clearLayerTextures.clearDepth = true;\r\n\r\n const clearTaskPass = this._clearLayerTextures.record();\r\n\r\n // Renders the objects to the layer texture\r\n this._objectRendererForLayer.targetTexture = this._clearLayerTextures.outputTexture;\r\n this._objectRendererForLayer.depthTexture = this._clearLayerTextures.outputDepthTexture;\r\n this._objectRendererForLayer.camera = this.objectRendererTask.camera;\r\n this._objectRendererForLayer.objectList = this.objectRendererTask.objectList;\r\n this._objectRendererForLayer.disableShadows = true;\r\n\r\n const objectRendererForLayerTaskPass = this._objectRendererForLayer.record();\r\n\r\n // Blurs the layer color texture\r\n let blurTextureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n blurTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else {\r\n blurTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n\r\n textureCreationOptions.options.types![0] = blurTextureType;\r\n\r\n const blurTextureSizeRatio = (this.layer._options as any).blurTextureSizeRatio !== undefined ? (this.layer._options as any).blurTextureSizeRatio || 0.1 : undefined;\r\n if (blurTextureSizeRatio !== undefined) {\r\n textureSize.width = Math.floor(textureSize.width * blurTextureSizeRatio) || 1;\r\n textureSize.height = Math.floor(textureSize.height * blurTextureSizeRatio) || 1;\r\n }\r\n\r\n const onBeforeBlurPass = this._onBeforeBlurTask?.record();\r\n\r\n const blurPasses: FrameGraphRenderPass[] = [];\r\n\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n const blurXTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurX[i].name, textureCreationOptions);\r\n\r\n this._blurX[i].sourceTexture = i === 0 ? this._objectRendererForLayer.outputTexture : this._blurY[i - 1].outputTexture;\r\n this._blurX[i].sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurX[i].targetTexture = blurXTextureHandle;\r\n blurPasses.push(this._blurX[i].record(true));\r\n\r\n const blurYTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurY[i].name, textureCreationOptions);\r\n\r\n this._blurY[i].sourceTexture = this._blurX[i].outputTexture;\r\n this._blurY[i].sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurY[i].targetTexture = blurYTextureHandle;\r\n blurPasses.push(this._blurY[i].record(true));\r\n\r\n textureSize.width = textureSize.width >> 1;\r\n textureSize.height = textureSize.height >> 1;\r\n }\r\n\r\n const onAfterBlurPass = this._onAfterBlurTask?.record();\r\n\r\n // Enables stencil (if stencil is needed) when rendering objects to the main texture\r\n // We also disable the internal passes if the layer should not render\r\n this.objectRendererTask.objectRenderer.onBeforeRenderObservable.remove(this._onBeforeObservableObserver);\r\n this._onBeforeObservableObserver = this.objectRendererTask.objectRenderer.onBeforeRenderObservable.add(() => {\r\n const shouldRender = this.layer.shouldRender();\r\n\r\n clearTaskPass.disabled = !shouldRender;\r\n objectRendererForLayerTaskPass.disabled = !shouldRender;\r\n if (onBeforeBlurPass) {\r\n onBeforeBlurPass.disabled = !shouldRender;\r\n }\r\n for (let i = 0; i < blurPasses.length; i++) {\r\n blurPasses[i].disabled = !shouldRender;\r\n }\r\n if (onAfterBlurPass) {\r\n onAfterBlurPass.disabled = !shouldRender;\r\n }\r\n\r\n if (shouldRender && this.layer.needStencil()) {\r\n this._engine.setStencilBuffer(true);\r\n this._engine.setStencilFunctionReference(1);\r\n }\r\n });\r\n\r\n this.objectRendererTask.objectRenderer.onAfterRenderObservable.remove(this._onAfterObservableObserver);\r\n this._onAfterObservableObserver = this.objectRendererTask.objectRenderer.onAfterRenderObservable.add(() => {\r\n if (this.layer.shouldRender() && this.layer.needStencil()) {\r\n this._engine.setStencilBuffer(false);\r\n }\r\n });\r\n\r\n // Composes the layer with the target texture\r\n this.layer.bindTexturesForCompose = undefined as any;\r\n\r\n this._clearAfterRenderingGroupObserver();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n for (let i = 0; i < this._blurY.length; i++) {\r\n pass.addDependencies(this._blurY[i].outputTexture);\r\n }\r\n\r\n pass.setRenderTarget(this.outputTexture);\r\n if (this._setRenderTargetDepth) {\r\n pass.setRenderTargetDepth(this.objectRendererTask.depthTexture);\r\n }\r\n pass.setExecuteFunc((context) => {\r\n context.setTextureSamplingMode(this._blurY[this._blurY.length - 1].targetTexture!, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n\r\n if (!this.layer.bindTexturesForCompose) {\r\n this.layer.bindTexturesForCompose = (effect: Effect) => {\r\n for (let i = 0; i < this._blurY.length; i++) {\r\n context.bindTextureHandle(effect, `textureSampler${i > 0 ? i + 1 : \"\"}`, this._blurY[i].outputTexture);\r\n }\r\n };\r\n }\r\n\r\n if (this.layer._options.renderingGroupId !== -1) {\r\n if (!this._onAfterRenderingGroupObserver) {\r\n this._onAfterRenderingGroupObserver = this._scene.onAfterRenderingGroupObservable.add((info) => {\r\n if (\r\n !this.layer.shouldRender() ||\r\n info.renderingGroupId !== this.layer._options.renderingGroupId ||\r\n info.renderingManager !== this.objectRendererTask.objectRenderer.renderingManager\r\n ) {\r\n return;\r\n }\r\n this._objectRendererForLayer.objectList = this.objectRendererTask.objectList;\r\n context.saveDepthStates();\r\n context.setDepthStates(false, false);\r\n context._applyRenderTarget();\r\n this.layer.compose();\r\n context.restoreDepthStates();\r\n });\r\n }\r\n } else {\r\n this._clearAfterRenderingGroupObserver();\r\n if (this.layer.shouldRender()) {\r\n this._objectRendererForLayer.objectList = this.objectRendererTask.objectList; // in case the object list has changed in objectRendererTask\r\n\r\n context.setDepthStates(false, false);\r\n context._applyRenderTarget();\r\n\r\n this.layer.compose();\r\n }\r\n }\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n if (this._setRenderTargetDepth) {\r\n passDisabled.setRenderTargetDepth(this.objectRendererTask.depthTexture);\r\n }\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n private _clearAfterRenderingGroupObserver() {\r\n this._scene.onAfterRenderingGroupObservable.remove(this._onAfterRenderingGroupObserver);\r\n this._onAfterRenderingGroupObserver = null;\r\n }\r\n\r\n public override dispose(): void {\r\n this._clearAfterRenderingGroupObserver();\r\n this._clearLayerTextures.dispose();\r\n this._objectRendererForLayer.dispose();\r\n this._onBeforeBlurTask?.dispose();\r\n this._onAfterBlurTask?.dispose();\r\n this.layer.dispose();\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n this._blurX[i].dispose();\r\n this._blurY[i].dispose();\r\n }\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -15,5 +15,8 @@ export class FrameGraphGlowLayerTask extends FrameGraphBaseLayerTask {
|
|
|
15
15
|
super(name, frameGraph, scene, new ThinGlowLayer(name, scene, options, true), 2);
|
|
16
16
|
this.layer._renderPassId = this._objectRendererForLayer.objectRenderer.renderPassId;
|
|
17
17
|
}
|
|
18
|
+
getClassName() {
|
|
19
|
+
return "FrameGraphGlowLayerTask";
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
//# sourceMappingURL=glowLayerTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glowLayerTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/glowLayerTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,yCAAkC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,uBAAuB;IAMhE;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY,EAAE,OAA+B;QAC3F,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAEjF,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAAC,YAAY,CAAC;IACxF,CAAC;CACJ","sourcesContent":["import type { FrameGraph, Scene, IThinGlowLayerOptions } from \"core/index\";\r\nimport { ThinGlowLayer } from \"core/Layers/thinGlowLayer\";\r\nimport { FrameGraphBaseLayerTask } from \"./baseLayerTask\";\r\n\r\n/**\r\n * Task which applies a glowing effect to a texture.\r\n */\r\nexport class FrameGraphGlowLayerTask extends FrameGraphBaseLayerTask {\r\n /**\r\n * The glow layer object. Use this object to update the glow layer properties (e.g. intensity, blur kernel size).\r\n */\r\n public override readonly layer: ThinGlowLayer;\r\n\r\n /**\r\n * Constructs a new glow layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the glow layer in.\r\n * @param options Options for the glow layer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinGlowLayerOptions) {\r\n super(name, frameGraph, scene, new ThinGlowLayer(name, scene, options, true), 2);\r\n\r\n this.layer._renderPassId = this._objectRendererForLayer.objectRenderer.renderPassId;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"glowLayerTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/glowLayerTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,yCAAkC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,uBAAuB;IAMhE;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY,EAAE,OAA+B;QAC3F,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAEjF,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAAC,YAAY,CAAC;IACxF,CAAC;IAEe,YAAY;QACxB,OAAO,yBAAyB,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import type { FrameGraph, Scene, IThinGlowLayerOptions } from \"core/index\";\r\nimport { ThinGlowLayer } from \"core/Layers/thinGlowLayer\";\r\nimport { FrameGraphBaseLayerTask } from \"./baseLayerTask\";\r\n\r\n/**\r\n * Task which applies a glowing effect to a texture.\r\n */\r\nexport class FrameGraphGlowLayerTask extends FrameGraphBaseLayerTask {\r\n /**\r\n * The glow layer object. Use this object to update the glow layer properties (e.g. intensity, blur kernel size).\r\n */\r\n public override readonly layer: ThinGlowLayer;\r\n\r\n /**\r\n * Constructs a new glow layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the glow layer in.\r\n * @param options Options for the glow layer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinGlowLayerOptions) {\r\n super(name, frameGraph, scene, new ThinGlowLayer(name, scene, options, true), 2);\r\n\r\n this.layer._renderPassId = this._objectRendererForLayer.objectRenderer.renderPassId;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphGlowLayerTask\";\r\n }\r\n}\r\n"]}
|
|
@@ -17,5 +17,6 @@ export declare class FrameGraphHighlightLayerTask extends FrameGraphBaseLayerTas
|
|
|
17
17
|
* @param options Options for the highlight layer.
|
|
18
18
|
*/
|
|
19
19
|
constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinHighlightLayerOptions);
|
|
20
|
+
getClassName(): string;
|
|
20
21
|
record(): void;
|
|
21
22
|
}
|
|
@@ -17,6 +17,9 @@ export class FrameGraphHighlightLayerTask extends FrameGraphBaseLayerTask {
|
|
|
17
17
|
const alphaBlendingMode = options?.alphaBlendingMode ?? 2;
|
|
18
18
|
super(name, frameGraph, scene, new ThinHighlightLayer(name, scene, options, true), 1, alphaBlendingMode === 2, true, true);
|
|
19
19
|
}
|
|
20
|
+
getClassName() {
|
|
21
|
+
return "FrameGraphHighlightLayerTask";
|
|
22
|
+
}
|
|
20
23
|
record() {
|
|
21
24
|
if (!this.objectRendererTask.depthTexture) {
|
|
22
25
|
throw new Error(`FrameGraphHighlightLayerTask "${this.name}": objectRendererTask must have a depthTexture input`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlightLayerTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/highlightLayerTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,8CAAuC;AACpE,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,+DAAwD;AAEnF;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,uBAAuB;IAMrE;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY,EAAE,OAAoC;QAChG,MAAM,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,SAAS,CAAC,aAAa,CAAC;QAEhF,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,iBAAiB,KAAK,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACrJ,CAAC;IAEe,MAAM;QAClB,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAC,IAAI,sDAAsD,CAAC,CAAC;QACtH,CAAC;QAED,MAAM,2BAA2B,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,yBAAyB,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACpI,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACpH,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAC,IAAI,+DAA+D,CAAC,CAAC;QAC/H,CAAC;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,IAAI,CAAC,KAAK,CAAC,+BAA+B,GAAG,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,YAAY,CAAC;IACrG,CAAC;CACJ","sourcesContent":["import type { FrameGraph, Scene, IThinHighlightLayerOptions } from \"core/index\";\r\nimport { ThinHighlightLayer } from \"core/Layers/thinHighlightLayer\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphBaseLayerTask } from \"./baseLayerTask\";\r\nimport { HasStencilAspect } from \"core/Materials/Textures/textureHelper.functions\";\r\n\r\n/**\r\n * Task which applies a highlight effect to a texture.\r\n */\r\nexport class FrameGraphHighlightLayerTask extends FrameGraphBaseLayerTask {\r\n /**\r\n * The highlight layer object. Use this object to update the highlight layer properties.\r\n */\r\n public override readonly layer: ThinHighlightLayer;\r\n\r\n /**\r\n * Constructs a new highlight layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the highlight layer in.\r\n * @param options Options for the highlight layer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinHighlightLayerOptions) {\r\n const alphaBlendingMode = options?.alphaBlendingMode ?? Constants.ALPHA_COMBINE;\r\n\r\n super(name, frameGraph, scene, new ThinHighlightLayer(name, scene, options, true), 1, alphaBlendingMode === Constants.ALPHA_COMBINE, true, true);\r\n }\r\n\r\n public override record() {\r\n if (!this.objectRendererTask.depthTexture) {\r\n throw new Error(`FrameGraphHighlightLayerTask \"${this.name}\": objectRendererTask must have a depthTexture input`);\r\n }\r\n\r\n const depthTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.objectRendererTask.depthTexture);\r\n if (!depthTextureCreationOptions.options.formats || !HasStencilAspect(depthTextureCreationOptions.options.formats[0])) {\r\n throw new Error(`FrameGraphHighlightLayerTask \"${this.name}\": objectRendererTask depthTexture must have a stencil aspect`);\r\n }\r\n\r\n super.record();\r\n\r\n this.layer._mainObjectRendererRenderPassId = this.objectRendererTask.objectRenderer.renderPassId;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"highlightLayerTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/highlightLayerTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,8CAAuC;AACpE,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE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esContent":["import type { FrameGraph, Scene, IThinHighlightLayerOptions } from \"core/index\";\r\nimport { ThinHighlightLayer } from \"core/Layers/thinHighlightLayer\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphBaseLayerTask } from \"./baseLayerTask\";\r\nimport { HasStencilAspect } from \"core/Materials/Textures/textureHelper.functions\";\r\n\r\n/**\r\n * Task which applies a highlight effect to a texture.\r\n */\r\nexport class FrameGraphHighlightLayerTask extends FrameGraphBaseLayerTask {\r\n /**\r\n * The highlight layer object. Use this object to update the highlight layer properties.\r\n */\r\n public override readonly layer: ThinHighlightLayer;\r\n\r\n /**\r\n * Constructs a new highlight layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the highlight layer in.\r\n * @param options Options for the highlight layer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinHighlightLayerOptions) {\r\n const alphaBlendingMode = options?.alphaBlendingMode ?? Constants.ALPHA_COMBINE;\r\n\r\n super(name, frameGraph, scene, new ThinHighlightLayer(name, scene, options, true), 1, alphaBlendingMode === Constants.ALPHA_COMBINE, true, true);\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphHighlightLayerTask\";\r\n }\r\n\r\n public override record() {\r\n if (!this.objectRendererTask.depthTexture) {\r\n throw new Error(`FrameGraphHighlightLayerTask \"${this.name}\": objectRendererTask must have a depthTexture input`);\r\n }\r\n\r\n const depthTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.objectRendererTask.depthTexture);\r\n if (!depthTextureCreationOptions.options.formats || !HasStencilAspect(depthTextureCreationOptions.options.formats[0])) {\r\n throw new Error(`FrameGraphHighlightLayerTask \"${this.name}\": objectRendererTask depthTexture must have a stencil aspect`);\r\n }\r\n\r\n super.record();\r\n\r\n this.layer._mainObjectRendererRenderPassId = this.objectRendererTask.objectRenderer.renderPassId;\r\n }\r\n}\r\n"]}
|
|
@@ -110,6 +110,7 @@ export declare class FrameGraphComputeShaderTask extends FrameGraphTask {
|
|
|
110
110
|
* @param sampler Sampler to bind
|
|
111
111
|
*/
|
|
112
112
|
setTextureSampler(name: string, sampler: TextureSampler): void;
|
|
113
|
+
getClassName(): string;
|
|
113
114
|
record(skipCreationOfDisabledPasses?: boolean): FrameGraphPass<FrameGraphContext>;
|
|
114
115
|
dispose(): void;
|
|
115
116
|
}
|
|
@@ -132,6 +132,9 @@ export class FrameGraphComputeShaderTask extends FrameGraphTask {
|
|
|
132
132
|
setTextureSampler(name, sampler) {
|
|
133
133
|
this._cs.setTextureSampler(name, sampler);
|
|
134
134
|
}
|
|
135
|
+
getClassName() {
|
|
136
|
+
return "FrameGraphComputeShaderTask";
|
|
137
|
+
}
|
|
135
138
|
record(skipCreationOfDisabledPasses) {
|
|
136
139
|
const pass = this._frameGraph.addPass(this.name);
|
|
137
140
|
if (this._notSupported) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeShaderTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Misc/computeShaderTask.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,0CAAmC;AAC3D,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,aAAa,EAAE,4CAAqC;AAC7D,OAAO,EAAE,MAAM,EAAE,gCAAyB;AAE1C;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,cAAc;IAsB3D;;OAEG;IACH,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAC,IAAY;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,UAAuC,EAAE,UAA0C,EAAE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AI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;YAE7E,YAAY,CAAC,cAAc,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEe,OAAO;QACnB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type {\r\n BaseTexture,\r\n DataBuffer,\r\n ExternalTexture,\r\n FrameGraph,\r\n FrameGraphContext,\r\n FrameGraphPass,\r\n IComputeShaderOptions,\r\n IComputeShaderPath,\r\n InternalTexture,\r\n StorageBuffer,\r\n TextureSampler,\r\n VideoTexture,\r\n} from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ComputeShader } from \"core/Compute/computeShader\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { UniformBuffer } from \"core/Materials/uniformBuffer\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Task used to execute a compute shader (WebGPU only)\r\n */\r\nexport class FrameGraphComputeShaderTask extends FrameGraphTask {\r\n private readonly _notSupported: boolean;\r\n private readonly _cs: ComputeShader;\r\n private readonly _ubo: { [name: string]: { ubo: UniformBuffer; autoUpdate: boolean } };\r\n\r\n /**\r\n * Defines the dispatch size for the compute shader\r\n */\r\n public dispatchSize = new Vector3(1, 1, 1);\r\n\r\n /**\r\n * Defines an indirect dispatch buffer and offset.\r\n * If set, this will be used instead of the dispatchSize property and an indirect dispatch will be performed.\r\n * \"offset\" is the offset in the buffer where the workgroup counts are stored (default: 0)\r\n */\r\n public indirectDispatch?: { buffer: StorageBuffer | DataBuffer; offset?: number };\r\n\r\n /**\r\n * An optional execute function that will be called at the beginning of the task execution\r\n */\r\n public execute?: (context: FrameGraphContext) => void;\r\n\r\n /**\r\n * Gets the compute shader used by the task\r\n */\r\n public get computeShader(): ComputeShader {\r\n return this._cs;\r\n }\r\n\r\n /**\r\n * Gets a uniform buffer created by a call to createUniformBuffer()\r\n * @param name Name of the uniform buffer\r\n * @returns The uniform buffer\r\n */\r\n public getUniformBuffer(name: string): UniformBuffer {\r\n return this._ubo[name]?.ubo;\r\n }\r\n\r\n /**\r\n * Creates a new compute shader task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param shaderPath Defines the route to the shader code in one of three ways:\r\n * * object: \\{ compute: \"custom\" \\}, used with ShaderStore.ShadersStoreWGSL[\"customComputeShader\"]\r\n * * object: \\{ computeElement: \"HTMLElementId\" \\}, used with shader code in script tags\r\n * * object: \\{ computeSource: \"compute shader code string\" \\}, where the string contains the shader code\r\n * * string: try first to find the code in ShaderStore.ShadersStoreWGSL[shaderPath + \"ComputeShader\"]. If not, assumes it is a file with name shaderPath.compute.fx in index.html folder.\r\n * @param options Define the options used to create the shader\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, shaderPath: IComputeShaderPath | string, options: Partial<IComputeShaderOptions> = {}) {\r\n super(name, frameGraph);\r\n\r\n if (!frameGraph.engine.getCaps().supportComputeShaders) {\r\n this._notSupported = true;\r\n Logger.Error(\"This engine does not support compute shaders!\");\r\n return;\r\n }\r\n\r\n this._notSupported = false;\r\n this._cs = new ComputeShader(name + \"_cs\", frameGraph.engine, shaderPath, options);\r\n this._ubo = {};\r\n }\r\n\r\n public override isReady(): boolean {\r\n return this._notSupported ? true : this._cs.isReady();\r\n }\r\n\r\n /**\r\n * Creates a uniform buffer and binds it to the shader\r\n * @param name Name of the uniform buffer\r\n * @param description Description of the uniform buffer: names and sizes (in floats) of the uniforms\r\n * @param autoUpdate If the UBO must be updated automatically before each dispatch (default: true)\r\n * @returns The created uniform buffer\r\n */\r\n public createUniformBuffer(name: string, description: { [name: string]: number }, autoUpdate = true): UniformBuffer {\r\n const uBuffer = new UniformBuffer(this._frameGraph.engine);\r\n\r\n this._ubo[name] = { ubo: uBuffer, autoUpdate };\r\n\r\n for (const key in description) {\r\n uBuffer.addUniform(key, description[key]);\r\n }\r\n\r\n this._cs.setUniformBuffer(name, uBuffer);\r\n\r\n return uBuffer;\r\n }\r\n\r\n /**\r\n * Binds a texture to the shader\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n * @param bindSampler Bind the sampler corresponding to the texture (default: true). The sampler will be bound just before the binding index of the texture\r\n */\r\n public setTexture(name: string, texture: BaseTexture, bindSampler = true): void {\r\n this._cs.setTexture(name, texture, bindSampler);\r\n }\r\n\r\n /**\r\n * Binds an internal texture to the shader\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n */\r\n public setInternalTexture(name: string, texture: InternalTexture): void {\r\n this._cs.setInternalTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Binds a storage texture to the shader\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n */\r\n public setStorageTexture(name: string, texture: BaseTexture): void {\r\n this._cs.setStorageTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Binds an external texture to the shader\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n */\r\n public setExternalTexture(name: string, texture: ExternalTexture): void {\r\n this._cs.setExternalTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Binds a video texture to the shader (by binding the external texture attached to this video)\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n * @returns true if the video texture was successfully bound, else false. false will be returned if the current engine does not support external textures\r\n */\r\n public setVideoTexture(name: string, texture: VideoTexture) {\r\n return this._cs.setVideoTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Binds a uniform buffer to the shader\r\n * @param name Binding name of the buffer\r\n * @param buffer Buffer to bind\r\n */\r\n public setUniformBuffer(name: string, buffer: UniformBuffer | DataBuffer): void {\r\n this._cs.setUniformBuffer(name, buffer);\r\n }\r\n\r\n /**\r\n * Binds a storage buffer to the shader\r\n * @param name Binding name of the buffer\r\n * @param buffer Buffer to bind\r\n */\r\n public setStorageBuffer(name: string, buffer: StorageBuffer | DataBuffer): void {\r\n this._cs.setStorageBuffer(name, buffer);\r\n }\r\n\r\n /**\r\n * Binds a texture sampler to the shader\r\n * @param name Binding name of the sampler\r\n * @param sampler Sampler to bind\r\n */\r\n public setTextureSampler(name: string, sampler: TextureSampler): void {\r\n this._cs.setTextureSampler(name, sampler);\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses?: boolean): FrameGraphPass<FrameGraphContext> {\r\n const pass = this._frameGraph.addPass(this.name);\r\n\r\n if (this._notSupported) {\r\n pass.setExecuteFunc(() => {});\r\n } else {\r\n pass.setExecuteFunc((context) => {\r\n this.execute?.(context);\r\n\r\n for (const key in this._ubo) {\r\n const uboEntry = this._ubo[key];\r\n if (uboEntry.autoUpdate) {\r\n uboEntry.ubo.update();\r\n }\r\n }\r\n\r\n if (this.indirectDispatch) {\r\n context.pushDebugGroup(`Indirect dispatch compute shader (${this.name})`);\r\n this._cs.dispatchIndirect(this.indirectDispatch.buffer, this.indirectDispatch.offset);\r\n context.popDebugGroup();\r\n } else {\r\n context.pushDebugGroup(`Dispatch compute shader (${this.name})`);\r\n this._cs.dispatch(this.dispatchSize.x, this.dispatchSize.y, this.dispatchSize.z);\r\n context.popDebugGroup();\r\n }\r\n });\r\n }\r\n\r\n if (!skipCreationOfDisabledPasses) {\r\n const passDisabled = this._frameGraph.addPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setExecuteFunc(() => {});\r\n }\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n for (const key in this._ubo) {\r\n this._ubo[key].ubo.dispose();\r\n }\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"computeShaderTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/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,qCAAqC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;oBAC1E,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBACtF,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC5B,CAAC;qBAAM,CAAC;oBACJ,OAAO,CAAC,cAAc,CAAC,4BAA4B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;oBACjE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;oBACjF,OAAO,CAAC,aAAa,EAAE,CAAC;gBAC5B,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC;QAED,IAAI,CAAC,4BAA4B,EAAE,CAAC;YAChC,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;YAE7E,YAAY,CAAC,cAAc,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEe,OAAO;QACnB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type {\r\n BaseTexture,\r\n DataBuffer,\r\n ExternalTexture,\r\n FrameGraph,\r\n FrameGraphContext,\r\n FrameGraphPass,\r\n IComputeShaderOptions,\r\n IComputeShaderPath,\r\n InternalTexture,\r\n StorageBuffer,\r\n TextureSampler,\r\n VideoTexture,\r\n} from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ComputeShader } from \"core/Compute/computeShader\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { UniformBuffer } from \"core/Materials/uniformBuffer\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Task used to execute a compute shader (WebGPU only)\r\n */\r\nexport class FrameGraphComputeShaderTask extends FrameGraphTask {\r\n private readonly _notSupported: boolean;\r\n private readonly _cs: ComputeShader;\r\n private readonly _ubo: { [name: string]: { ubo: UniformBuffer; autoUpdate: boolean } };\r\n\r\n /**\r\n * Defines the dispatch size for the compute shader\r\n */\r\n public dispatchSize = new Vector3(1, 1, 1);\r\n\r\n /**\r\n * Defines an indirect dispatch buffer and offset.\r\n * If set, this will be used instead of the dispatchSize property and an indirect dispatch will be performed.\r\n * \"offset\" is the offset in the buffer where the workgroup counts are stored (default: 0)\r\n */\r\n public indirectDispatch?: { buffer: StorageBuffer | DataBuffer; offset?: number };\r\n\r\n /**\r\n * An optional execute function that will be called at the beginning of the task execution\r\n */\r\n public execute?: (context: FrameGraphContext) => void;\r\n\r\n /**\r\n * Gets the compute shader used by the task\r\n */\r\n public get computeShader(): ComputeShader {\r\n return this._cs;\r\n }\r\n\r\n /**\r\n * Gets a uniform buffer created by a call to createUniformBuffer()\r\n * @param name Name of the uniform buffer\r\n * @returns The uniform buffer\r\n */\r\n public getUniformBuffer(name: string): UniformBuffer {\r\n return this._ubo[name]?.ubo;\r\n }\r\n\r\n /**\r\n * Creates a new compute shader task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param shaderPath Defines the route to the shader code in one of three ways:\r\n * * object: \\{ compute: \"custom\" \\}, used with ShaderStore.ShadersStoreWGSL[\"customComputeShader\"]\r\n * * object: \\{ computeElement: \"HTMLElementId\" \\}, used with shader code in script tags\r\n * * object: \\{ computeSource: \"compute shader code string\" \\}, where the string contains the shader code\r\n * * string: try first to find the code in ShaderStore.ShadersStoreWGSL[shaderPath + \"ComputeShader\"]. If not, assumes it is a file with name shaderPath.compute.fx in index.html folder.\r\n * @param options Define the options used to create the shader\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, shaderPath: IComputeShaderPath | string, options: Partial<IComputeShaderOptions> = {}) {\r\n super(name, frameGraph);\r\n\r\n if (!frameGraph.engine.getCaps().supportComputeShaders) {\r\n this._notSupported = true;\r\n Logger.Error(\"This engine does not support compute shaders!\");\r\n return;\r\n }\r\n\r\n this._notSupported = false;\r\n this._cs = new ComputeShader(name + \"_cs\", frameGraph.engine, shaderPath, options);\r\n this._ubo = {};\r\n }\r\n\r\n public override isReady(): boolean {\r\n return this._notSupported ? true : this._cs.isReady();\r\n }\r\n\r\n /**\r\n * Creates a uniform buffer and binds it to the shader\r\n * @param name Name of the uniform buffer\r\n * @param description Description of the uniform buffer: names and sizes (in floats) of the uniforms\r\n * @param autoUpdate If the UBO must be updated automatically before each dispatch (default: true)\r\n * @returns The created uniform buffer\r\n */\r\n public createUniformBuffer(name: string, description: { [name: string]: number }, autoUpdate = true): UniformBuffer {\r\n const uBuffer = new UniformBuffer(this._frameGraph.engine);\r\n\r\n this._ubo[name] = { ubo: uBuffer, autoUpdate };\r\n\r\n for (const key in description) {\r\n uBuffer.addUniform(key, description[key]);\r\n }\r\n\r\n this._cs.setUniformBuffer(name, uBuffer);\r\n\r\n return uBuffer;\r\n }\r\n\r\n /**\r\n * Binds a texture to the shader\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n * @param bindSampler Bind the sampler corresponding to the texture (default: true). The sampler will be bound just before the binding index of the texture\r\n */\r\n public setTexture(name: string, texture: BaseTexture, bindSampler = true): void {\r\n this._cs.setTexture(name, texture, bindSampler);\r\n }\r\n\r\n /**\r\n * Binds an internal texture to the shader\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n */\r\n public setInternalTexture(name: string, texture: InternalTexture): void {\r\n this._cs.setInternalTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Binds a storage texture to the shader\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n */\r\n public setStorageTexture(name: string, texture: BaseTexture): void {\r\n this._cs.setStorageTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Binds an external texture to the shader\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n */\r\n public setExternalTexture(name: string, texture: ExternalTexture): void {\r\n this._cs.setExternalTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Binds a video texture to the shader (by binding the external texture attached to this video)\r\n * @param name Binding name of the texture\r\n * @param texture Texture to bind\r\n * @returns true if the video texture was successfully bound, else false. false will be returned if the current engine does not support external textures\r\n */\r\n public setVideoTexture(name: string, texture: VideoTexture) {\r\n return this._cs.setVideoTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Binds a uniform buffer to the shader\r\n * @param name Binding name of the buffer\r\n * @param buffer Buffer to bind\r\n */\r\n public setUniformBuffer(name: string, buffer: UniformBuffer | DataBuffer): void {\r\n this._cs.setUniformBuffer(name, buffer);\r\n }\r\n\r\n /**\r\n * Binds a storage buffer to the shader\r\n * @param name Binding name of the buffer\r\n * @param buffer Buffer to bind\r\n */\r\n public setStorageBuffer(name: string, buffer: StorageBuffer | DataBuffer): void {\r\n this._cs.setStorageBuffer(name, buffer);\r\n }\r\n\r\n /**\r\n * Binds a texture sampler to the shader\r\n * @param name Binding name of the sampler\r\n * @param sampler Sampler to bind\r\n */\r\n public setTextureSampler(name: string, sampler: TextureSampler): void {\r\n this._cs.setTextureSampler(name, sampler);\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphComputeShaderTask\";\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses?: boolean): FrameGraphPass<FrameGraphContext> {\r\n const pass = this._frameGraph.addPass(this.name);\r\n\r\n if (this._notSupported) {\r\n pass.setExecuteFunc(() => {});\r\n } else {\r\n pass.setExecuteFunc((context) => {\r\n this.execute?.(context);\r\n\r\n for (const key in this._ubo) {\r\n const uboEntry = this._ubo[key];\r\n if (uboEntry.autoUpdate) {\r\n uboEntry.ubo.update();\r\n }\r\n }\r\n\r\n if (this.indirectDispatch) {\r\n context.pushDebugGroup(`Indirect dispatch compute shader (${this.name})`);\r\n this._cs.dispatchIndirect(this.indirectDispatch.buffer, this.indirectDispatch.offset);\r\n context.popDebugGroup();\r\n } else {\r\n context.pushDebugGroup(`Dispatch compute shader (${this.name})`);\r\n this._cs.dispatch(this.dispatchSize.x, this.dispatchSize.y, this.dispatchSize.z);\r\n context.popDebugGroup();\r\n }\r\n });\r\n }\r\n\r\n if (!skipCreationOfDisabledPasses) {\r\n const passDisabled = this._frameGraph.addPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setExecuteFunc(() => {});\r\n }\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n for (const key in this._ubo) {\r\n this._ubo[key].ubo.dispose();\r\n }\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -17,6 +17,9 @@ export class FrameGraphCullObjectsTask extends FrameGraphTask {
|
|
|
17
17
|
particleSystems: null,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
getClassName() {
|
|
21
|
+
return "FrameGraphCullObjectsTask";
|
|
22
|
+
}
|
|
20
23
|
record() {
|
|
21
24
|
if (this.objectList === undefined || this.camera === undefined) {
|
|
22
25
|
throw new Error(`FrameGraphCullObjectsTask ${this.name}: objectList and camera are required`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cullObjectsTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Misc/cullObjectsTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAkBzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY;QAC1D,KAAK,CAAC,IAAI,EAAE,UAAU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phTask\";\r\n\r\n/**\r\n * Task used to cull objects that are not visible.\r\n */\r\nexport class FrameGraphCullObjectsTask extends FrameGraphTask {\r\n /**\r\n * The object list to cull.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * The camera to use for culling.\r\n */\r\n public camera: Camera;\r\n\r\n /**\r\n * The output object list containing the culled objects.\r\n */\r\n public readonly outputObjectList: FrameGraphObjectList;\r\n\r\n private readonly _scene: Scene;\r\n\r\n /**\r\n * Creates a new cull objects task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene to cull objects from.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph);\r\n this._scene = scene;\r\n this.outputObjectList = {\r\n meshes: null,\r\n particleSystems: null,\r\n };\r\n }\r\n\r\n public record() {\r\n if (this.objectList === undefined || this.camera === undefined) {\r\n throw new Error(`FrameGraphCullObjectsTask ${this.name}: objectList and camera are required`);\r\n }\r\n\r\n // Initial output values\r\n this.outputObjectList.meshes = this.objectList.meshes;\r\n this.outputObjectList.particleSystems = this.objectList.particleSystems;\r\n\r\n const pass = this._frameGraph.addObjectListPass(this.name);\r\n\r\n pass.setObjectList(this.outputObjectList);\r\n pass.setExecuteFunc((_context) => {\r\n // No culling on particle systems\r\n this.outputObjectList.particleSystems = this.objectList.particleSystems;\r\n\r\n if (this._scene._activeMeshesFrozen) {\r\n // If active meshes are frozen, we don't need culling: we keep the last list created before freezing\r\n return;\r\n }\r\n\r\n this.outputObjectList.meshes = [];\r\n\r\n this.camera._updateFrustumPlanes();\r\n\r\n const frustumPlanes = this.camera._frustumPlanes;\r\n\r\n const meshes = this.objectList.meshes || this._scene.meshes;\r\n for (let i = 0; i < meshes.length; i++) {\r\n const mesh = meshes[i];\r\n if (mesh.isBlocked || !mesh.isReady() || !mesh.isEnabled() || mesh.scaling.hasAZeroComponent) {\r\n continue;\r\n }\r\n\r\n if (\r\n mesh.isVisible &&\r\n mesh.visibility > 0 &&\r\n (mesh.layerMask & this.camera.layerMask) !== 0 &&\r\n (this._scene.skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(frustumPlanes))\r\n ) {\r\n this.outputObjectList.meshes.push(mesh);\r\n }\r\n }\r\n });\r\n\r\n const passDisabled = this._frameGraph.addObjectListPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setObjectList(this.outputObjectList);\r\n passDisabled.setExecuteFunc((_context) => {\r\n this.outputObjectList.meshes = this.objectList.meshes;\r\n this.outputObjectList.particleSystems = this.objectList.particleSystems;\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"cullObjectsTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Misc/cullObjectsTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAkBzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY;QAC1D,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,gBAAgB,GAAG;YACpB,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI;SACxB,CAAC;IACN,CAAC;IAEe,YAAY;QACxB,OAAO,2BAA2B,CAAC;IACvC,CAAC;IAEM,MAAM;QACT,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC7D,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,IAAI,sCAAsC,CAAC,CAAC;QAClG,CAAC;QAED,wBAAwB;QACxB,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtD,IAAI,CAAC,gBAAgB,CAA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AAC,MAAM,CAAC,mBAAmB,IAAI,IAAI,CAAC,wBAAwB,IAAI,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,EACvG,CAAC;oBACC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5C,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEvF,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAClD,YAAY,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE;YACrC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YACtD,IAAI,CAAC,gBAAgB,CAAC,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;QAC5E,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { Scene, Camera, FrameGraph, FrameGraphObjectList } from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task used to cull objects that are not visible.\r\n */\r\nexport class FrameGraphCullObjectsTask extends FrameGraphTask {\r\n /**\r\n * The object list to cull.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * The camera to use for culling.\r\n */\r\n public camera: Camera;\r\n\r\n /**\r\n * The output object list containing the culled objects.\r\n */\r\n public readonly outputObjectList: FrameGraphObjectList;\r\n\r\n private readonly _scene: Scene;\r\n\r\n /**\r\n * Creates a new cull objects task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene to cull objects from.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph);\r\n this._scene = scene;\r\n this.outputObjectList = {\r\n meshes: null,\r\n particleSystems: null,\r\n };\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphCullObjectsTask\";\r\n }\r\n\r\n public record() {\r\n if (this.objectList === undefined || this.camera === undefined) {\r\n throw new Error(`FrameGraphCullObjectsTask ${this.name}: objectList and camera are required`);\r\n }\r\n\r\n // Initial output values\r\n this.outputObjectList.meshes = this.objectList.meshes;\r\n this.outputObjectList.particleSystems = this.objectList.particleSystems;\r\n\r\n const pass = this._frameGraph.addObjectListPass(this.name);\r\n\r\n pass.setObjectList(this.outputObjectList);\r\n pass.setExecuteFunc((_context) => {\r\n // No culling on particle systems\r\n this.outputObjectList.particleSystems = this.objectList.particleSystems;\r\n\r\n if (this._scene._activeMeshesFrozen) {\r\n // If active meshes are frozen, we don't need culling: we keep the last list created before freezing\r\n return;\r\n }\r\n\r\n this.outputObjectList.meshes = [];\r\n\r\n this.camera._updateFrustumPlanes();\r\n\r\n const frustumPlanes = this.camera._frustumPlanes;\r\n\r\n const meshes = this.objectList.meshes || this._scene.meshes;\r\n for (let i = 0; i < meshes.length; i++) {\r\n const mesh = meshes[i];\r\n if (mesh.isBlocked || !mesh.isReady() || !mesh.isEnabled() || mesh.scaling.hasAZeroComponent) {\r\n continue;\r\n }\r\n\r\n if (\r\n mesh.isVisible &&\r\n mesh.visibility > 0 &&\r\n (mesh.layerMask & this.camera.layerMask) !== 0 &&\r\n (this._scene.skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(frustumPlanes))\r\n ) {\r\n this.outputObjectList.meshes.push(mesh);\r\n }\r\n }\r\n });\r\n\r\n const passDisabled = this._frameGraph.addObjectListPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setObjectList(this.outputObjectList);\r\n passDisabled.setExecuteFunc((_context) => {\r\n this.outputObjectList.meshes = this.objectList.meshes;\r\n this.outputObjectList.particleSystems = this.objectList.particleSystems;\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -23,5 +23,6 @@ export declare class FrameGraphExecuteTask extends FrameGraphTask {
|
|
|
23
23
|
* @param frameGraph The frame graph the task belongs to.
|
|
24
24
|
*/
|
|
25
25
|
constructor(name: string, frameGraph: FrameGraph);
|
|
26
|
+
getClassName(): string;
|
|
26
27
|
record(): FrameGraphPass<FrameGraphContext>;
|
|
27
28
|
}
|
|
@@ -14,6 +14,9 @@ export class FrameGraphExecuteTask extends FrameGraphTask {
|
|
|
14
14
|
constructor(name, frameGraph) {
|
|
15
15
|
super(name, frameGraph);
|
|
16
16
|
}
|
|
17
|
+
getClassName() {
|
|
18
|
+
return "FrameGraphExecuteTask";
|
|
19
|
+
}
|
|
17
20
|
record() {
|
|
18
21
|
if (!this.func) {
|
|
19
22
|
throw new Error("FrameGraphExecuteTask: Execute task must have a function.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Misc/executeTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IAgBrC,OAAO;QACnB,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACH,YAAY,IAAY,EAAE,UAAsB;QAC5C,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC5B,CAAC;IAEM,MAAM;QACT,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QACjF,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjD,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAE7E,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,IAAI,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphContext, FrameGraphPass } from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task used to execute a custom function.\r\n */\r\nexport class FrameGraphExecuteTask extends FrameGraphTask {\r\n /**\r\n * The function to execute.\r\n */\r\n public func: (context: FrameGraphContext) => void;\r\n\r\n /**\r\n * The function to execute when the task is disabled (optional).\r\n */\r\n public funcDisabled?: (context: FrameGraphContext) => void;\r\n\r\n /**\r\n * Custom readiness check (optional).\r\n */\r\n public customIsReady?: () => boolean;\r\n\r\n public override isReady(): boolean {\r\n return !this.customIsReady || this.customIsReady();\r\n }\r\n\r\n /**\r\n * Creates a new execute task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n super(name, frameGraph);\r\n }\r\n\r\n public record(): FrameGraphPass<FrameGraphContext> {\r\n if (!this.func) {\r\n throw new Error(\"FrameGraphExecuteTask: Execute task must have a function.\");\r\n }\r\n\r\n const pass = this._frameGraph.addPass(this.name);\r\n\r\n pass.setExecuteFunc((context) => {\r\n this.func(context);\r\n });\r\n\r\n const passDisabled = this._frameGraph.addPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setExecuteFunc((context) => {\r\n this.funcDisabled?.(context);\r\n });\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"executeTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Misc/executeTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IAgBrC,OAAO;QACnB,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACH,YAAY,IAAY,EAAE,UAAsB;QAC5C,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC5B,CAAC;IAEe,YAAY;QACxB,OAAO,uBAAuB,CAAC;IACnC,CAAC;IAEM,MAAM;QACT,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QACjF,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjD,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAE7E,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,IAAI,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphContext, FrameGraphPass } from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task used to execute a custom function.\r\n */\r\nexport class FrameGraphExecuteTask extends FrameGraphTask {\r\n /**\r\n * The function to execute.\r\n */\r\n public func: (context: FrameGraphContext) => void;\r\n\r\n /**\r\n * The function to execute when the task is disabled (optional).\r\n */\r\n public funcDisabled?: (context: FrameGraphContext) => void;\r\n\r\n /**\r\n * Custom readiness check (optional).\r\n */\r\n public customIsReady?: () => boolean;\r\n\r\n public override isReady(): boolean {\r\n return !this.customIsReady || this.customIsReady();\r\n }\r\n\r\n /**\r\n * Creates a new execute task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n super(name, frameGraph);\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphExecuteTask\";\r\n }\r\n\r\n public record(): FrameGraphPass<FrameGraphContext> {\r\n if (!this.func) {\r\n throw new Error(\"FrameGraphExecuteTask: Execute task must have a function.\");\r\n }\r\n\r\n const pass = this._frameGraph.addPass(this.name);\r\n\r\n pass.setExecuteFunc((context) => {\r\n this.func(context);\r\n });\r\n\r\n const passDisabled = this._frameGraph.addPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setExecuteFunc((context) => {\r\n this.funcDisabled?.(context);\r\n });\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FrameGraph, FrameGraphObjectList, FrameGraphShadowGeneratorTask } from "../../../index.js";
|
|
2
|
+
import { LightingVolume } from "../../../Lights/lightingVolume.js";
|
|
3
|
+
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
4
|
+
/**
|
|
5
|
+
* Task used to create a lighting volume from a directional light's shadow generator.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FrameGraphLightingVolumeTask extends FrameGraphTask {
|
|
8
|
+
/**
|
|
9
|
+
* The shadow generator used to create the lighting volume.
|
|
10
|
+
*/
|
|
11
|
+
shadowGenerator: FrameGraphShadowGeneratorTask;
|
|
12
|
+
/**
|
|
13
|
+
* The output object list containing the lighting volume mesh.
|
|
14
|
+
*/
|
|
15
|
+
readonly outputMeshLightingVolume: FrameGraphObjectList;
|
|
16
|
+
/**
|
|
17
|
+
* The lighting volume created by this task.
|
|
18
|
+
*/
|
|
19
|
+
readonly lightingVolume: LightingVolume;
|
|
20
|
+
get name(): string;
|
|
21
|
+
set name(name: string);
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new FrameGraphLightingVolumeTask.
|
|
24
|
+
* @param name Name of the task.
|
|
25
|
+
* @param frameGraph The frame graph instance.
|
|
26
|
+
*/
|
|
27
|
+
constructor(name: string, frameGraph: FrameGraph);
|
|
28
|
+
isReady(): boolean;
|
|
29
|
+
getClassName(): string;
|
|
30
|
+
record(): void;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { LightingVolume } from "../../../Lights/lightingVolume.js";
|
|
2
|
+
import { DirectionalLight } from "../../../Lights/directionalLight.js";
|
|
3
|
+
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
4
|
+
/**
|
|
5
|
+
* Task used to create a lighting volume from a directional light's shadow generator.
|
|
6
|
+
*/
|
|
7
|
+
export class FrameGraphLightingVolumeTask extends FrameGraphTask {
|
|
8
|
+
get name() {
|
|
9
|
+
return this._name;
|
|
10
|
+
}
|
|
11
|
+
set name(name) {
|
|
12
|
+
this._name = name;
|
|
13
|
+
if (this.lightingVolume) {
|
|
14
|
+
this.lightingVolume.name = name;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new FrameGraphLightingVolumeTask.
|
|
19
|
+
* @param name Name of the task.
|
|
20
|
+
* @param frameGraph The frame graph instance.
|
|
21
|
+
*/
|
|
22
|
+
constructor(name, frameGraph) {
|
|
23
|
+
super(name, frameGraph);
|
|
24
|
+
this.lightingVolume = new LightingVolume(name, frameGraph.scene);
|
|
25
|
+
this.outputMeshLightingVolume = {
|
|
26
|
+
meshes: [this.lightingVolume.mesh],
|
|
27
|
+
particleSystems: [],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
isReady() {
|
|
31
|
+
const isReady = this.lightingVolume.isReady();
|
|
32
|
+
if (isReady) {
|
|
33
|
+
this.lightingVolume._setComputeShaderFastMode(true);
|
|
34
|
+
}
|
|
35
|
+
return isReady;
|
|
36
|
+
}
|
|
37
|
+
getClassName() {
|
|
38
|
+
return "FrameGraphLightingVolumeTask";
|
|
39
|
+
}
|
|
40
|
+
record() {
|
|
41
|
+
if (this.shadowGenerator === undefined) {
|
|
42
|
+
throw new Error(`FrameGraphLightingVolumeTask ${this.name}: shadowGenerator is required`);
|
|
43
|
+
}
|
|
44
|
+
const light = this.shadowGenerator.light;
|
|
45
|
+
if (!(light instanceof DirectionalLight)) {
|
|
46
|
+
throw new Error(`FrameGraphLightingVolumeTask ${this.name}: light must be a directional light`);
|
|
47
|
+
}
|
|
48
|
+
this.lightingVolume.shadowGenerator = this.shadowGenerator.shadowGenerator;
|
|
49
|
+
const pass = this._frameGraph.addObjectListPass(this.name);
|
|
50
|
+
pass.setObjectList(this.outputMeshLightingVolume);
|
|
51
|
+
pass.setExecuteFunc(() => {
|
|
52
|
+
this.lightingVolume.update();
|
|
53
|
+
});
|
|
54
|
+
const passDisabled = this._frameGraph.addObjectListPass(this.name + "_disabled", true);
|
|
55
|
+
passDisabled.setObjectList(this.outputMeshLightingVolume);
|
|
56
|
+
passDisabled.setExecuteFunc(() => { });
|
|
57
|
+
}
|
|
58
|
+
dispose() {
|
|
59
|
+
super.dispose();
|
|
60
|
+
this.lightingVolume.dispose();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=lightingVolumeTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightingVolumeTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Misc/lightingVolumeTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,0CAAmC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,4CAAqC;AA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AC;YACvC,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAC,IAAI,qCAAqC,CAAC,CAAC;QACpG,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC;QAE3E,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3D,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAClD,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE;YACrB,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEvF,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC1D,YAAY,CAAC,cAAc,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;IAEe,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphObjectList, FrameGraphShadowGeneratorTask } from \"core/index\";\r\nimport { LightingVolume } from \"core/Lights/lightingVolume\";\r\nimport { DirectionalLight } from \"core/Lights/directionalLight\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task used to create a lighting volume from a directional light's shadow generator.\r\n */\r\nexport class FrameGraphLightingVolumeTask extends FrameGraphTask {\r\n /**\r\n * The shadow generator used to create the lighting volume.\r\n */\r\n public shadowGenerator: FrameGraphShadowGeneratorTask;\r\n\r\n /**\r\n * The output object list containing the lighting volume mesh.\r\n */\r\n public readonly outputMeshLightingVolume: FrameGraphObjectList;\r\n\r\n /**\r\n * The lighting volume created by this task.\r\n */\r\n public readonly lightingVolume: LightingVolume;\r\n\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(name: string) {\r\n this._name = name;\r\n if (this.lightingVolume) {\r\n this.lightingVolume.name = name;\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new FrameGraphLightingVolumeTask.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph instance.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n super(name, frameGraph);\r\n\r\n this.lightingVolume = new LightingVolume(name, frameGraph.scene);\r\n\r\n this.outputMeshLightingVolume = {\r\n meshes: [this.lightingVolume.mesh],\r\n particleSystems: [],\r\n };\r\n }\r\n\r\n public override isReady() {\r\n const isReady = this.lightingVolume.isReady();\r\n if (isReady) {\r\n this.lightingVolume._setComputeShaderFastMode(true);\r\n }\r\n return isReady;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphLightingVolumeTask\";\r\n }\r\n\r\n public record() {\r\n if (this.shadowGenerator === undefined) {\r\n throw new Error(`FrameGraphLightingVolumeTask ${this.name}: shadowGenerator is required`);\r\n }\r\n\r\n const light = this.shadowGenerator.light;\r\n\r\n if (!(light instanceof DirectionalLight)) {\r\n throw new Error(`FrameGraphLightingVolumeTask ${this.name}: light must be a directional light`);\r\n }\r\n\r\n this.lightingVolume.shadowGenerator = this.shadowGenerator.shadowGenerator;\r\n\r\n const pass = this._frameGraph.addObjectListPass(this.name);\r\n\r\n pass.setObjectList(this.outputMeshLightingVolume);\r\n pass.setExecuteFunc(() => {\r\n this.lightingVolume.update();\r\n });\r\n\r\n const passDisabled = this._frameGraph.addObjectListPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setObjectList(this.outputMeshLightingVolume);\r\n passDisabled.setExecuteFunc(() => {});\r\n }\r\n\r\n public override dispose() {\r\n super.dispose();\r\n this.lightingVolume.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -17,5 +17,6 @@ export declare class FrameGraphAnaglyphTask extends FrameGraphPostProcessTask {
|
|
|
17
17
|
* @param thinPostProcess The thin post process to use for the anaglyph effect. If not provided, a new one will be created.
|
|
18
18
|
*/
|
|
19
19
|
constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinAnaglyphPostProcess);
|
|
20
|
+
getClassName(): string;
|
|
20
21
|
record(skipCreationOfDisabledPasses?: boolean): FrameGraphRenderPass;
|
|
21
22
|
}
|
|
@@ -13,6 +13,9 @@ export class FrameGraphAnaglyphTask extends FrameGraphPostProcessTask {
|
|
|
13
13
|
constructor(name, frameGraph, thinPostProcess) {
|
|
14
14
|
super(name, frameGraph, thinPostProcess || new ThinAnaglyphPostProcess(name, frameGraph.engine));
|
|
15
15
|
}
|
|
16
|
+
getClassName() {
|
|
17
|
+
return "FrameGraphAnaglyphTask";
|
|
18
|
+
}
|
|
16
19
|
record(skipCreationOfDisabledPasses = false) {
|
|
17
20
|
if (this.sourceTexture === undefined || this.leftTexture === undefined) {
|
|
18
21
|
throw new Error(`FrameGraphAnaglyphTask "${this.name}": sourceTexture and leftTexture are required`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anaglyphTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/anaglyphTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,0DAAmD;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,yBAAyB;IAQjE;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,eAAyC;QACvF,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,uBAAuB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACrG,CAAC;IAEe,MAAM,CAAC,4BAA4B,GAAG,KAAK;QACvD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,IAAI,+CAA+C,CAAC,CAAC;QACzG,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,4BAA4B,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3E,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACrG,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphRenderPass, FrameGraphTextureHandle } from \"core/index\";\r\nimport { ThinAnaglyphPostProcess } from \"core/PostProcesses/thinAnaglyphPostProcess\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\n\r\n/**\r\n * Task which applies an anaglyph post process.\r\n */\r\nexport class FrameGraphAnaglyphTask extends FrameGraphPostProcessTask {\r\n /**\r\n * The texture to use as the left texture.\r\n */\r\n public leftTexture: FrameGraphTextureHandle;\r\n\r\n public override readonly postProcess: ThinAnaglyphPostProcess;\r\n\r\n /**\r\n * Constructs a new anaglyph task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param thinPostProcess The thin post process to use for the anaglyph effect. If not provided, a new one will be created.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinAnaglyphPostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinAnaglyphPostProcess(name, frameGraph.engine));\r\n }\r\n\r\n public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined || this.leftTexture === undefined) {\r\n throw new Error(`FrameGraphAnaglyphTask \"${this.name}\": sourceTexture and leftTexture are required`);\r\n }\r\n\r\n const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"leftSampler\", this.leftTexture);\r\n });\r\n\r\n pass.addDependencies(this.leftTexture);\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"anaglyphTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/anaglyphTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,0DAAmD;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,yBAAyB;IAQjE;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,eAAyC;QACvF,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,uBAAuB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACrG,CAAC;IAEe,YAAY;QACxB,OAAO,wBAAwB,CAAC;IACpC,CAAC;IAEe,MAAM,CAAC,4BAA4B,GAAG,KAAK;QACvD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,IAAI,+CAA+C,CAAC,CAAC;QACzG,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,4BAA4B,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3E,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACrG,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphRenderPass, FrameGraphTextureHandle } from \"core/index\";\r\nimport { ThinAnaglyphPostProcess } from \"core/PostProcesses/thinAnaglyphPostProcess\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\n\r\n/**\r\n * Task which applies an anaglyph post process.\r\n */\r\nexport class FrameGraphAnaglyphTask extends FrameGraphPostProcessTask {\r\n /**\r\n * The texture to use as the left texture.\r\n */\r\n public leftTexture: FrameGraphTextureHandle;\r\n\r\n public override readonly postProcess: ThinAnaglyphPostProcess;\r\n\r\n /**\r\n * Constructs a new anaglyph task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param thinPostProcess The thin post process to use for the anaglyph effect. If not provided, a new one will be created.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinAnaglyphPostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinAnaglyphPostProcess(name, frameGraph.engine));\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphAnaglyphTask\";\r\n }\r\n\r\n public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined || this.leftTexture === undefined) {\r\n throw new Error(`FrameGraphAnaglyphTask \"${this.name}\": sourceTexture and leftTexture are required`);\r\n }\r\n\r\n const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"leftSampler\", this.leftTexture);\r\n });\r\n\r\n pass.addDependencies(this.leftTexture);\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
@@ -13,4 +13,5 @@ export declare class FrameGraphBlackAndWhiteTask extends FrameGraphPostProcessTa
|
|
|
13
13
|
* @param thinPostProcess The thin post process to use for the black and white effect. If not provided, a new one will be created.
|
|
14
14
|
*/
|
|
15
15
|
constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinBlackAndWhitePostProcess);
|
|
16
|
+
getClassName(): string;
|
|
16
17
|
}
|
|
@@ -13,5 +13,8 @@ export class FrameGraphBlackAndWhiteTask extends FrameGraphPostProcessTask {
|
|
|
13
13
|
constructor(name, frameGraph, thinPostProcess) {
|
|
14
14
|
super(name, frameGraph, thinPostProcess || new ThinBlackAndWhitePostProcess(name, frameGraph.engine));
|
|
15
15
|
}
|
|
16
|
+
getClassName() {
|
|
17
|
+
return "FrameGraphBlackAndWhiteTask";
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
//# sourceMappingURL=blackAndWhiteTask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blackAndWhiteTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,+DAAwD;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,yBAAyB;IAGtE;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,eAA8C;QAC5F,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,4BAA4B,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1G,CAAC;CACJ","sourcesContent":["import type { FrameGraph } from \"core/FrameGraph/frameGraph\";\r\nimport { ThinBlackAndWhitePostProcess } from \"core/PostProcesses/thinBlackAndWhitePostProcess\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\n\r\n/**\r\n * Task which applies a black and white post process.\r\n */\r\nexport class FrameGraphBlackAndWhiteTask extends FrameGraphPostProcessTask {\r\n public override readonly postProcess: ThinBlackAndWhitePostProcess;\r\n\r\n /**\r\n * Constructs a new black and white task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param thinPostProcess The thin post process to use for the black and white effect. If not provided, a new one will be created.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinBlackAndWhitePostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinBlackAndWhitePostProcess(name, frameGraph.engine));\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"blackAndWhiteTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,+DAAwD;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,yBAAyB;IAGtE;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,eAA8C;QAC5F,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,4BAA4B,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1G,CAAC;IAEe,YAAY;QACxB,OAAO,6BAA6B,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { FrameGraph } from \"core/FrameGraph/frameGraph\";\r\nimport { ThinBlackAndWhitePostProcess } from \"core/PostProcesses/thinBlackAndWhitePostProcess\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\n\r\n/**\r\n * Task which applies a black and white post process.\r\n */\r\nexport class FrameGraphBlackAndWhiteTask extends FrameGraphPostProcessTask {\r\n public override readonly postProcess: ThinBlackAndWhitePostProcess;\r\n\r\n /**\r\n * Constructs a new black and white task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param thinPostProcess The thin post process to use for the black and white effect. If not provided, a new one will be created.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinBlackAndWhitePostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinBlackAndWhitePostProcess(name, frameGraph.engine));\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphBlackAndWhiteTask\";\r\n }\r\n}\r\n"]}
|
|
@@ -8,5 +8,6 @@ export declare class FrameGraphBloomMergeTask extends FrameGraphPostProcessTask
|
|
|
8
8
|
blurTexture: FrameGraphTextureHandle;
|
|
9
9
|
readonly postProcess: ThinBloomMergePostProcess;
|
|
10
10
|
constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinBloomMergePostProcess);
|
|
11
|
+
getClassName(): string;
|
|
11
12
|
record(skipCreationOfDisabledPasses?: boolean): FrameGraphRenderPass;
|
|
12
13
|
}
|