@babylonjs/core 7.31.2 → 7.32.1
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/Behaviors/Cameras/autoRotationBehavior.js +1 -0
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Cameras/camera.d.ts +5 -2
- package/Cameras/camera.js +1 -0
- package/Cameras/camera.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +9 -1
- package/Decorators/nodeDecorator.js +8 -0
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +40 -53
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +20 -8
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.js +16 -7
- package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +43 -44
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +8 -6
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -3
- package/Engines/WebGPU/webgpuHardwareTexture.js +12 -9
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +25 -19
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +5 -3
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +6 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +6 -1
- package/Engines/constants.js +6 -1
- package/Engines/constants.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +7 -0
- package/Engines/renderTargetWrapper.js +15 -0
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +3 -1
- package/Engines/webgpuEngine.js +9 -8
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.d.ts +47 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js +113 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.d.ts +62 -0
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +171 -0
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.d.ts +51 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js +127 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.d.ts +67 -0
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +187 -0
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.d.ts +77 -0
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +232 -0
- package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.d.ts +47 -0
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js +113 -0
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/cullObjectsBlock.d.ts +41 -0
- package/FrameGraph/Node/Blocks/Rendering/cullObjectsBlock.js +79 -0
- package/FrameGraph/Node/Blocks/Rendering/cullObjectsBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +119 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +451 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +63 -0
- package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +154 -0
- package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportInBlock.d.ts +59 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportInBlock.js +131 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportInBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportOutBlock.d.ts +49 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportOutBlock.js +107 -0
- package/FrameGraph/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +50 -0
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +125 -0
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +38 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +71 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.d.ts +34 -0
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +59 -0
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/elbowBlock.d.ts +28 -0
- package/FrameGraph/Node/Blocks/elbowBlock.js +47 -0
- package/FrameGraph/Node/Blocks/elbowBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/index.d.ts +17 -0
- package/FrameGraph/Node/Blocks/index.js +18 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -0
- package/FrameGraph/Node/Blocks/inputBlock.d.ts +94 -0
- package/FrameGraph/Node/Blocks/inputBlock.js +270 -0
- package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/outputBlock.d.ts +30 -0
- package/FrameGraph/Node/Blocks/outputBlock.js +51 -0
- package/FrameGraph/Node/Blocks/outputBlock.js.map +1 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +110 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +78 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -0
- package/FrameGraph/Node/nodeRenderGraph.d.ts +196 -0
- package/FrameGraph/Node/nodeRenderGraph.js +614 -0
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -0
- package/FrameGraph/Node/nodeRenderGraphBlock.d.ts +190 -0
- package/FrameGraph/Node/nodeRenderGraphBlock.js +495 -0
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.d.ts +143 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +275 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -0
- package/FrameGraph/Node/nodeRenderGraphBuildState.d.ts +21 -0
- package/FrameGraph/Node/nodeRenderGraphBuildState.js +35 -0
- package/FrameGraph/Node/nodeRenderGraphBuildState.js.map +1 -0
- package/FrameGraph/Passes/cullPass.d.ts +28 -0
- package/FrameGraph/Passes/cullPass.js +38 -0
- package/FrameGraph/Passes/cullPass.js.map +1 -0
- package/FrameGraph/Passes/pass.d.ts +14 -0
- package/FrameGraph/Passes/pass.js +20 -0
- package/FrameGraph/Passes/pass.js.map +1 -0
- package/FrameGraph/Passes/renderPass.d.ts +49 -0
- package/FrameGraph/Passes/renderPass.js +72 -0
- package/FrameGraph/Passes/renderPass.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.d.ts +16 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js +17 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.d.ts +12 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +21 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +54 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +114 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.d.ts +17 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js +24 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.d.ts +30 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +35 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.d.ts +12 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +26 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.d.ts +12 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +29 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +65 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +134 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.d.ts +16 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js +17 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +41 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +64 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.d.ts +28 -0
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.js +52 -0
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +145 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +259 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +66 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +127 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +34 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +42 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.d.ts +12 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js +23 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js.map +1 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +26 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +31 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +22 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +34 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -0
- package/FrameGraph/frameGraph.d.ts +143 -0
- package/FrameGraph/frameGraph.js +275 -0
- package/FrameGraph/frameGraph.js.map +1 -0
- package/FrameGraph/frameGraphContext.d.ts +5 -0
- package/FrameGraph/frameGraphContext.js +6 -0
- package/FrameGraph/frameGraphContext.js.map +1 -0
- package/FrameGraph/frameGraphObjectList.d.ts +15 -0
- package/FrameGraph/frameGraphObjectList.js +7 -0
- package/FrameGraph/frameGraphObjectList.js.map +1 -0
- package/FrameGraph/frameGraphRenderContext.d.ts +110 -0
- package/FrameGraph/frameGraphRenderContext.js +237 -0
- package/FrameGraph/frameGraphRenderContext.js.map +1 -0
- package/FrameGraph/frameGraphTask.d.ts +49 -0
- package/FrameGraph/frameGraphTask.js +117 -0
- package/FrameGraph/frameGraphTask.js.map +1 -0
- package/FrameGraph/frameGraphTextureManager.d.ts +50 -0
- package/FrameGraph/frameGraphTextureManager.js +277 -0
- package/FrameGraph/frameGraphTextureManager.js.map +1 -0
- package/FrameGraph/frameGraphTypes.d.ts +59 -0
- package/FrameGraph/frameGraphTypes.js +9 -0
- package/FrameGraph/frameGraphTypes.js.map +1 -0
- package/FrameGraph/index.d.ts +28 -0
- package/FrameGraph/index.js +30 -0
- package/FrameGraph/index.js.map +1 -0
- package/Gamepads/gamepadSceneComponent.d.ts +0 -1
- package/Gamepads/gamepadSceneComponent.js +1 -7
- package/Gamepads/gamepadSceneComponent.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +7 -0
- package/Gizmos/boundingBoxGizmo.js +19 -6
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Inputs/scene.inputManager.d.ts +3 -1
- package/Inputs/scene.inputManager.js +20 -8
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/layer.d.ts +1 -1
- package/Layers/layer.js +1 -1
- package/Layers/layer.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +4 -0
- package/Materials/PBR/pbrBaseMaterial.js +8 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/dynamicTexture.d.ts +32 -2
- package/Materials/Textures/dynamicTexture.js +13 -18
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -0
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +0 -6
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +20 -8
- package/Materials/Textures/multiRenderTarget.js +2 -0
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +8 -1
- package/Materials/Textures/renderTargetTexture.js +28 -10
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +20 -2
- package/Materials/Textures/textureCreationOptions.js +20 -1
- package/Materials/Textures/textureCreationOptions.js.map +1 -1
- package/Materials/effectRenderer.d.ts +132 -14
- package/Materials/effectRenderer.js +229 -33
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/materialHelper.functions.js +2 -0
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.d.ts +122 -0
- package/Materials/materialHelper.geometryrendering.js +259 -0
- package/Materials/materialHelper.geometryrendering.js.map +1 -0
- package/Materials/standardMaterial.d.ts +4 -0
- package/Materials/standardMaterial.js +8 -0
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/index.d.ts +1 -0
- package/Maths/index.js +1 -0
- package/Maths/index.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.d.ts +1 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +22 -1
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js +39 -0
- package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +3 -2
- package/Misc/copyTextureToTexture.js +11 -5
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.d.ts +5 -3
- package/PostProcesses/blackAndWhitePostProcess.js +24 -19
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/bloomEffect.d.ts +7 -5
- package/PostProcesses/bloomEffect.js +49 -23
- package/PostProcesses/bloomEffect.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.d.ts +5 -5
- package/PostProcesses/bloomMergePostProcess.js +28 -19
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +7 -43
- package/PostProcesses/blurPostProcess.js +47 -185
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.d.ts +13 -6
- package/PostProcesses/circleOfConfusionPostProcess.js +59 -38
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.d.ts +2 -6
- package/PostProcesses/depthOfFieldBlurPostProcess.js +14 -11
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.d.ts +5 -2
- package/PostProcesses/depthOfFieldEffect.js +53 -45
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.d.ts +0 -1
- package/PostProcesses/depthOfFieldMergePostProcess.js +18 -12
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.d.ts +8 -4
- package/PostProcesses/extractHighlightsPostProcess.js +35 -22
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/index.d.ts +6 -0
- package/PostProcesses/index.js +6 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +15 -70
- package/PostProcesses/postProcess.js +80 -97
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinBlackAndWhitePostProcess.d.ts +28 -0
- package/PostProcesses/thinBlackAndWhitePostProcess.js +50 -0
- package/PostProcesses/thinBlackAndWhitePostProcess.js.map +1 -0
- package/PostProcesses/thinBloomEffect.d.ts +49 -0
- package/PostProcesses/thinBloomEffect.js +59 -0
- package/PostProcesses/thinBloomEffect.js.map +1 -0
- package/PostProcesses/thinBloomMergePostProcess.d.ts +15 -0
- package/PostProcesses/thinBloomMergePostProcess.js +38 -0
- package/PostProcesses/thinBloomMergePostProcess.js.map +1 -0
- package/PostProcesses/thinBlurPostProcess.d.ts +89 -0
- package/PostProcesses/thinBlurPostProcess.js +242 -0
- package/PostProcesses/thinBlurPostProcess.js.map +1 -0
- package/PostProcesses/thinCircleOfConfusionPostProcess.d.ts +62 -0
- package/PostProcesses/thinCircleOfConfusionPostProcess.js +81 -0
- package/PostProcesses/thinCircleOfConfusionPostProcess.js.map +1 -0
- package/PostProcesses/thinDepthOfFieldBlurPostProcess.d.ts +8 -0
- package/PostProcesses/thinDepthOfFieldBlurPostProcess.js +13 -0
- package/PostProcesses/thinDepthOfFieldBlurPostProcess.js.map +1 -0
- package/PostProcesses/thinDepthOfFieldEffect.d.ts +70 -0
- package/PostProcesses/thinDepthOfFieldEffect.js +115 -0
- package/PostProcesses/thinDepthOfFieldEffect.js.map +1 -0
- package/PostProcesses/thinDepthOfFieldMergePostProcess.d.ts +11 -0
- package/PostProcesses/thinDepthOfFieldMergePostProcess.js +30 -0
- package/PostProcesses/thinDepthOfFieldMergePostProcess.js.map +1 -0
- package/PostProcesses/thinExtractHighlightsPostProcess.d.ts +30 -0
- package/PostProcesses/thinExtractHighlightsPostProcess.js +55 -0
- package/PostProcesses/thinExtractHighlightsPostProcess.js.map +1 -0
- package/Rendering/depthPeelingRenderer.js +2 -2
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js +4 -4
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockPrePass.d.ts +5 -0
- package/Shaders/ShadersInclude/pbrBlockPrePass.js +75 -0
- package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -0
- package/Shaders/ShadersInclude/prePassVertex.js +1 -2
- package/Shaders/ShadersInclude/prePassVertex.js.map +1 -1
- package/Shaders/circleOfConfusion.fragment.js +9 -1
- package/Shaders/circleOfConfusion.fragment.js.map +1 -1
- package/Shaders/colorCorrection.fragment.js +1 -0
- package/Shaders/colorCorrection.fragment.js.map +1 -1
- package/Shaders/default.fragment.js +17 -25
- package/Shaders/default.fragment.js.map +1 -1
- package/Shaders/default.vertex.js +4 -6
- package/Shaders/default.vertex.js.map +1 -1
- package/Shaders/pbr.fragment.d.ts +1 -0
- package/Shaders/pbr.fragment.js +2 -74
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Shaders/pbr.vertex.js +3 -3
- package/Shaders/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +100 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/prePassVertex.js +1 -2
- package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
- package/ShadersWGSL/background.vertex.js +1 -1
- package/ShadersWGSL/background.vertex.js.map +1 -1
- package/ShadersWGSL/circleOfConfusion.fragment.js +10 -2
- package/ShadersWGSL/circleOfConfusion.fragment.js.map +1 -1
- package/ShadersWGSL/default.fragment.js +20 -31
- package/ShadersWGSL/default.fragment.js.map +1 -1
- package/ShadersWGSL/default.vertex.js +4 -5
- package/ShadersWGSL/default.vertex.js.map +1 -1
- package/ShadersWGSL/glowMapGeneration.fragment.js +1 -1
- package/ShadersWGSL/glowMapGeneration.fragment.js.map +1 -1
- package/ShadersWGSL/glowMapGeneration.vertex.js +1 -1
- package/ShadersWGSL/glowMapGeneration.vertex.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.d.ts +1 -0
- package/ShadersWGSL/pbr.fragment.js +2 -100
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.vertex.js +4 -2
- package/ShadersWGSL/pbr.vertex.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.js +1 -1
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +19 -2
- package/scene.js +110 -13
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +0 -1
- package/sceneComponent.js +0 -1
- package/sceneComponent.js.map +1 -1
- package/types.d.ts +12 -0
- package/types.js.map +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { FrameGraphTextureHandle, Scene, Camera, FrameGraph, FrameGraphObjectList, AbstractMesh } from "../../../index.js";
|
|
2
|
+
import { RenderTargetTexture } from "../../../Materials/Textures/renderTargetTexture";
|
|
3
|
+
import { FrameGraphTask } from "../../frameGraphTask";
|
|
4
|
+
/**
|
|
5
|
+
* Description of a texture used by the geometry renderer task.
|
|
6
|
+
*/
|
|
7
|
+
export interface IFrameGraphGeometryRendererTextureDescription {
|
|
8
|
+
/**
|
|
9
|
+
* The type of the texture.
|
|
10
|
+
* The value should be one of the Constants.PREPASS_XXX_TEXTURE_TYPE values.
|
|
11
|
+
*/
|
|
12
|
+
type: number;
|
|
13
|
+
/**
|
|
14
|
+
* The type of the texture.
|
|
15
|
+
*/
|
|
16
|
+
textureType: number;
|
|
17
|
+
/**
|
|
18
|
+
* The format of the texture.
|
|
19
|
+
*/
|
|
20
|
+
textureFormat: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Task used to render geometry to a set of textures.
|
|
24
|
+
*/
|
|
25
|
+
export declare class FrameGraphGeometryRendererTask extends FrameGraphTask {
|
|
26
|
+
/**
|
|
27
|
+
* The depth texture attachment to use for rendering (optional).
|
|
28
|
+
*/
|
|
29
|
+
depthTexture?: FrameGraphTextureHandle;
|
|
30
|
+
private _camera;
|
|
31
|
+
/**
|
|
32
|
+
* Gets or sets the camera used for rendering.
|
|
33
|
+
*/
|
|
34
|
+
get camera(): Camera;
|
|
35
|
+
set camera(camera: Camera);
|
|
36
|
+
/**
|
|
37
|
+
* The object list used for rendering.
|
|
38
|
+
*/
|
|
39
|
+
objectList: FrameGraphObjectList;
|
|
40
|
+
/**
|
|
41
|
+
* Whether depth testing is enabled (default is true).
|
|
42
|
+
*/
|
|
43
|
+
depthTest: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether depth writing is enabled (default is true).
|
|
46
|
+
*/
|
|
47
|
+
depthWrite: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The size of the output textures (default is 100% of the back buffer texture size).
|
|
50
|
+
*/
|
|
51
|
+
size: {
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Whether the size is a percentage of the back buffer size (default is true).
|
|
57
|
+
*/
|
|
58
|
+
sizeIsPercentage: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The number of samples to use for the output textures (default is 1).
|
|
61
|
+
*/
|
|
62
|
+
samples: number;
|
|
63
|
+
/**
|
|
64
|
+
* The list of texture descriptions used by the geometry renderer task.
|
|
65
|
+
*/
|
|
66
|
+
textureDescriptions: IFrameGraphGeometryRendererTextureDescription[];
|
|
67
|
+
/**
|
|
68
|
+
* The output depth texture attachment texture.
|
|
69
|
+
* This texture will point to the same texture than the depthTexture property if it is set.
|
|
70
|
+
* Note, however, that the handle itself will be different!
|
|
71
|
+
*/
|
|
72
|
+
readonly outputDepthTexture: FrameGraphTextureHandle;
|
|
73
|
+
/**
|
|
74
|
+
* The depth (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
75
|
+
*/
|
|
76
|
+
readonly geometryViewDepthTexture: FrameGraphTextureHandle;
|
|
77
|
+
/**
|
|
78
|
+
* The depth (in screen space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
79
|
+
*/
|
|
80
|
+
readonly geometryScreenDepthTexture: FrameGraphTextureHandle;
|
|
81
|
+
/**
|
|
82
|
+
* The normal (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
83
|
+
*/
|
|
84
|
+
readonly geometryViewNormalTexture: FrameGraphTextureHandle;
|
|
85
|
+
/**
|
|
86
|
+
* The normal (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
87
|
+
*/
|
|
88
|
+
readonly geometryWorldNormalTexture: FrameGraphTextureHandle;
|
|
89
|
+
/**
|
|
90
|
+
* The position (in local space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
91
|
+
*/
|
|
92
|
+
readonly geometryLocalPositionTexture: FrameGraphTextureHandle;
|
|
93
|
+
/**
|
|
94
|
+
* The position (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
95
|
+
*/
|
|
96
|
+
readonly geometryWorldPositionTexture: FrameGraphTextureHandle;
|
|
97
|
+
/**
|
|
98
|
+
* The albedo output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
99
|
+
*/
|
|
100
|
+
readonly geometryAlbedoTexture: FrameGraphTextureHandle;
|
|
101
|
+
/**
|
|
102
|
+
* The reflectivity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
103
|
+
*/
|
|
104
|
+
readonly geometryReflectivityTexture: FrameGraphTextureHandle;
|
|
105
|
+
/**
|
|
106
|
+
* The velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
107
|
+
*/
|
|
108
|
+
readonly geometryVelocityTexture: FrameGraphTextureHandle;
|
|
109
|
+
/**
|
|
110
|
+
* The linear velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!
|
|
111
|
+
*/
|
|
112
|
+
readonly geometryLinearVelocityTexture: FrameGraphTextureHandle;
|
|
113
|
+
/**
|
|
114
|
+
* The render target texture used by the geometry renderer task.
|
|
115
|
+
*/
|
|
116
|
+
get renderTargetTexture(): RenderTargetTexture;
|
|
117
|
+
/**
|
|
118
|
+
* Gets or sets the name of the task.
|
|
119
|
+
*/
|
|
120
|
+
get name(): string;
|
|
121
|
+
set name(value: string);
|
|
122
|
+
private _engine;
|
|
123
|
+
private _scene;
|
|
124
|
+
private _rtt;
|
|
125
|
+
private _clearAttachmentsLayout;
|
|
126
|
+
private _allAttachmentsLayout;
|
|
127
|
+
/**
|
|
128
|
+
* Constructs a new geometry renderer task.
|
|
129
|
+
* @param name The name of the task.
|
|
130
|
+
* @param frameGraph The frame graph the task belongs to.
|
|
131
|
+
* @param scene The scene the frame graph is associated with.
|
|
132
|
+
*/
|
|
133
|
+
constructor(name: string, frameGraph: FrameGraph, scene: Scene);
|
|
134
|
+
/**
|
|
135
|
+
* Gets the list of excluded meshes from the velocity texture.
|
|
136
|
+
*/
|
|
137
|
+
get excludedSkinnedMeshFromVelocityTexture(): AbstractMesh[];
|
|
138
|
+
isReady(): boolean;
|
|
139
|
+
record(): void;
|
|
140
|
+
dispose(): void;
|
|
141
|
+
private _createMultiRenderTargetTexture;
|
|
142
|
+
private _checkDepthTextureCompatibility;
|
|
143
|
+
private _buildClearAttachmentsLayout;
|
|
144
|
+
private _registerForRenderPassId;
|
|
145
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { backbufferDepthStencilTextureHandle } from "../../frameGraphTypes.js";
|
|
2
|
+
import { RenderTargetTexture } from "../../../Materials/Textures/renderTargetTexture.js";
|
|
3
|
+
import { Color4 } from "../../../Maths/math.color.js";
|
|
4
|
+
import { MaterialHelperGeometryRendering } from "../../../Materials/materialHelper.geometryrendering.js";
|
|
5
|
+
|
|
6
|
+
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
7
|
+
const clearColors = [new Color4(0, 0, 0, 0), new Color4(1, 1, 1, 1), new Color4(1e8, 1e8, 1e8, 1e8)];
|
|
8
|
+
/**
|
|
9
|
+
* Task used to render geometry to a set of textures.
|
|
10
|
+
*/
|
|
11
|
+
export class FrameGraphGeometryRendererTask extends FrameGraphTask {
|
|
12
|
+
/**
|
|
13
|
+
* Gets or sets the camera used for rendering.
|
|
14
|
+
*/
|
|
15
|
+
get camera() {
|
|
16
|
+
return this._camera;
|
|
17
|
+
}
|
|
18
|
+
set camera(camera) {
|
|
19
|
+
this._camera = camera;
|
|
20
|
+
this._rtt.activeCamera = this.camera;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The render target texture used by the geometry renderer task.
|
|
24
|
+
*/
|
|
25
|
+
get renderTargetTexture() {
|
|
26
|
+
return this._rtt;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets or sets the name of the task.
|
|
30
|
+
*/
|
|
31
|
+
get name() {
|
|
32
|
+
return this._name;
|
|
33
|
+
}
|
|
34
|
+
set name(value) {
|
|
35
|
+
this._name = value;
|
|
36
|
+
if (this._rtt) {
|
|
37
|
+
this._rtt.name = value + "_internal_rtt";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Constructs a new geometry renderer task.
|
|
42
|
+
* @param name The name of the task.
|
|
43
|
+
* @param frameGraph The frame graph the task belongs to.
|
|
44
|
+
* @param scene The scene the frame graph is associated with.
|
|
45
|
+
*/
|
|
46
|
+
constructor(name, frameGraph, scene) {
|
|
47
|
+
super(name, frameGraph);
|
|
48
|
+
/**
|
|
49
|
+
* Whether depth testing is enabled (default is true).
|
|
50
|
+
*/
|
|
51
|
+
this.depthTest = true;
|
|
52
|
+
/**
|
|
53
|
+
* Whether depth writing is enabled (default is true).
|
|
54
|
+
*/
|
|
55
|
+
this.depthWrite = true;
|
|
56
|
+
/**
|
|
57
|
+
* The size of the output textures (default is 100% of the back buffer texture size).
|
|
58
|
+
*/
|
|
59
|
+
this.size = { width: 100, height: 100 };
|
|
60
|
+
/**
|
|
61
|
+
* Whether the size is a percentage of the back buffer size (default is true).
|
|
62
|
+
*/
|
|
63
|
+
this.sizeIsPercentage = true;
|
|
64
|
+
/**
|
|
65
|
+
* The number of samples to use for the output textures (default is 1).
|
|
66
|
+
*/
|
|
67
|
+
this.samples = 1;
|
|
68
|
+
/**
|
|
69
|
+
* The list of texture descriptions used by the geometry renderer task.
|
|
70
|
+
*/
|
|
71
|
+
this.textureDescriptions = [];
|
|
72
|
+
this._scene = scene;
|
|
73
|
+
this._engine = this._scene.getEngine();
|
|
74
|
+
this._rtt = new RenderTargetTexture(name, 1, scene, {
|
|
75
|
+
delayAllocation: true,
|
|
76
|
+
});
|
|
77
|
+
this._rtt.skipInitialClear = true;
|
|
78
|
+
this._rtt.renderSprites = false;
|
|
79
|
+
this._rtt.renderParticles = false;
|
|
80
|
+
this.name = name;
|
|
81
|
+
this._clearAttachmentsLayout = new Map();
|
|
82
|
+
this._allAttachmentsLayout = [];
|
|
83
|
+
this.outputDepthTexture = this._frameGraph.createDanglingHandle();
|
|
84
|
+
this.geometryViewDepthTexture = this._frameGraph.createDanglingHandle();
|
|
85
|
+
this.geometryScreenDepthTexture = this._frameGraph.createDanglingHandle();
|
|
86
|
+
this.geometryViewNormalTexture = this._frameGraph.createDanglingHandle();
|
|
87
|
+
this.geometryWorldNormalTexture = this._frameGraph.createDanglingHandle();
|
|
88
|
+
this.geometryLocalPositionTexture = this._frameGraph.createDanglingHandle();
|
|
89
|
+
this.geometryWorldPositionTexture = this._frameGraph.createDanglingHandle();
|
|
90
|
+
this.geometryAlbedoTexture = this._frameGraph.createDanglingHandle();
|
|
91
|
+
this.geometryReflectivityTexture = this._frameGraph.createDanglingHandle();
|
|
92
|
+
this.geometryVelocityTexture = this._frameGraph.createDanglingHandle();
|
|
93
|
+
this.geometryLinearVelocityTexture = this._frameGraph.createDanglingHandle();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Gets the list of excluded meshes from the velocity texture.
|
|
97
|
+
*/
|
|
98
|
+
get excludedSkinnedMeshFromVelocityTexture() {
|
|
99
|
+
return MaterialHelperGeometryRendering.GetConfiguration(this._rtt.renderPassId).excludedSkinnedMesh;
|
|
100
|
+
}
|
|
101
|
+
isReady() {
|
|
102
|
+
return this._rtt.isReadyForRendering();
|
|
103
|
+
}
|
|
104
|
+
record() {
|
|
105
|
+
if (this.textureDescriptions.length === 0 || this.objectList === undefined) {
|
|
106
|
+
throw new Error(`FrameGraphGeometryRendererTask ${this.name}: object list and at least one geometry texture description must be provided`);
|
|
107
|
+
}
|
|
108
|
+
const outputTextureHandle = this._createMultiRenderTargetTexture();
|
|
109
|
+
const depthEnabled = this._checkDepthTextureCompatibility();
|
|
110
|
+
this._buildClearAttachmentsLayout();
|
|
111
|
+
this._registerForRenderPassId(this._rtt.renderPassId);
|
|
112
|
+
const outputTextureDescription = this._frameGraph.getTextureDescription(outputTextureHandle);
|
|
113
|
+
this._rtt._size = outputTextureDescription.size;
|
|
114
|
+
// Create pass
|
|
115
|
+
MaterialHelperGeometryRendering.MarkAsDirty(this._rtt.renderPassId, this.objectList.meshes || this._scene.meshes);
|
|
116
|
+
const pass = this._frameGraph.addRenderPass(this.name);
|
|
117
|
+
pass.setRenderTarget(outputTextureHandle);
|
|
118
|
+
let handle = outputTextureHandle + 1;
|
|
119
|
+
for (let i = 0; i < this.textureDescriptions.length; i++) {
|
|
120
|
+
const description = this.textureDescriptions[i];
|
|
121
|
+
const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);
|
|
122
|
+
const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];
|
|
123
|
+
switch (geometryDescription.type) {
|
|
124
|
+
case 5:
|
|
125
|
+
this._frameGraph.resolveDanglingHandle(this.geometryViewDepthTexture, handle++);
|
|
126
|
+
break;
|
|
127
|
+
case 10:
|
|
128
|
+
this._frameGraph.resolveDanglingHandle(this.geometryScreenDepthTexture, handle++);
|
|
129
|
+
break;
|
|
130
|
+
case 6:
|
|
131
|
+
this._frameGraph.resolveDanglingHandle(this.geometryViewNormalTexture, handle++);
|
|
132
|
+
break;
|
|
133
|
+
case 8:
|
|
134
|
+
this._frameGraph.resolveDanglingHandle(this.geometryWorldNormalTexture, handle++);
|
|
135
|
+
break;
|
|
136
|
+
case 9:
|
|
137
|
+
this._frameGraph.resolveDanglingHandle(this.geometryLocalPositionTexture, handle++);
|
|
138
|
+
break;
|
|
139
|
+
case 1:
|
|
140
|
+
this._frameGraph.resolveDanglingHandle(this.geometryWorldPositionTexture, handle++);
|
|
141
|
+
break;
|
|
142
|
+
case 12:
|
|
143
|
+
this._frameGraph.resolveDanglingHandle(this.geometryAlbedoTexture, handle++);
|
|
144
|
+
break;
|
|
145
|
+
case 3:
|
|
146
|
+
this._frameGraph.resolveDanglingHandle(this.geometryReflectivityTexture, handle++);
|
|
147
|
+
break;
|
|
148
|
+
case 2:
|
|
149
|
+
this._frameGraph.resolveDanglingHandle(this.geometryVelocityTexture, handle++);
|
|
150
|
+
break;
|
|
151
|
+
case 11:
|
|
152
|
+
this._frameGraph.resolveDanglingHandle(this.geometryLinearVelocityTexture, handle++);
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (this.depthTexture !== undefined) {
|
|
157
|
+
pass.setRenderTargetDepth(this.depthTexture);
|
|
158
|
+
}
|
|
159
|
+
pass.setExecuteFunc((context) => {
|
|
160
|
+
this._rtt.renderList = this.objectList.meshes;
|
|
161
|
+
this._rtt.particleSystemList = this.objectList.particleSystems;
|
|
162
|
+
this._scene.incrementRenderId();
|
|
163
|
+
this._scene.resetCachedMaterial();
|
|
164
|
+
context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);
|
|
165
|
+
this._clearAttachmentsLayout.forEach((layout, clearType) => {
|
|
166
|
+
context.clearColorAttachments(clearColors[clearType], layout);
|
|
167
|
+
});
|
|
168
|
+
context.bindAttachments(this._allAttachmentsLayout);
|
|
169
|
+
context.render(this._rtt);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
dispose() {
|
|
173
|
+
MaterialHelperGeometryRendering.DeleteConfiguration(this._rtt.renderPassId);
|
|
174
|
+
this._rtt.dispose();
|
|
175
|
+
super.dispose();
|
|
176
|
+
}
|
|
177
|
+
_createMultiRenderTargetTexture() {
|
|
178
|
+
const types = [];
|
|
179
|
+
const formats = [];
|
|
180
|
+
const labels = [];
|
|
181
|
+
const useSRGBBuffers = [];
|
|
182
|
+
for (let i = 0; i < this.textureDescriptions.length; i++) {
|
|
183
|
+
const description = this.textureDescriptions[i];
|
|
184
|
+
const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);
|
|
185
|
+
if (index === -1) {
|
|
186
|
+
throw new Error(`FrameGraphGeometryRendererTask ${this.name}: unknown texture type ${description.type}`);
|
|
187
|
+
}
|
|
188
|
+
types[i] = description.textureType;
|
|
189
|
+
formats[i] = description.textureFormat;
|
|
190
|
+
labels[i] = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index].name;
|
|
191
|
+
useSRGBBuffers[i] = false;
|
|
192
|
+
}
|
|
193
|
+
return this._frameGraph.createRenderTargetTexture(this.name, {
|
|
194
|
+
size: this.size,
|
|
195
|
+
sizeIsPercentage: this.sizeIsPercentage,
|
|
196
|
+
options: {
|
|
197
|
+
createMipMaps: false,
|
|
198
|
+
generateDepthBuffer: false,
|
|
199
|
+
textureCount: this.textureDescriptions.length,
|
|
200
|
+
samples: this.samples,
|
|
201
|
+
types,
|
|
202
|
+
formats,
|
|
203
|
+
useSRGBBuffers,
|
|
204
|
+
labels,
|
|
205
|
+
},
|
|
206
|
+
}, true);
|
|
207
|
+
}
|
|
208
|
+
_checkDepthTextureCompatibility() {
|
|
209
|
+
let depthEnabled = false;
|
|
210
|
+
if (this.depthTexture !== undefined) {
|
|
211
|
+
if (this.depthTexture === backbufferDepthStencilTextureHandle) {
|
|
212
|
+
throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth/stencil back buffer is not allowed as a depth texture`);
|
|
213
|
+
}
|
|
214
|
+
const depthTextureDescription = this._frameGraph.getTextureDescription(this.depthTexture);
|
|
215
|
+
if (depthTextureDescription.options.samples !== this.samples) {
|
|
216
|
+
throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);
|
|
217
|
+
}
|
|
218
|
+
this._frameGraph.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);
|
|
219
|
+
depthEnabled = true;
|
|
220
|
+
}
|
|
221
|
+
return depthEnabled;
|
|
222
|
+
}
|
|
223
|
+
_buildClearAttachmentsLayout() {
|
|
224
|
+
const clearAttachmentsLayout = new Map();
|
|
225
|
+
const allAttachmentsLayout = [];
|
|
226
|
+
for (let i = 0; i < this.textureDescriptions.length; i++) {
|
|
227
|
+
const description = this.textureDescriptions[i];
|
|
228
|
+
const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);
|
|
229
|
+
const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];
|
|
230
|
+
let layout = clearAttachmentsLayout.get(geometryDescription.clearType);
|
|
231
|
+
if (layout === undefined) {
|
|
232
|
+
layout = [];
|
|
233
|
+
clearAttachmentsLayout.set(geometryDescription.clearType, layout);
|
|
234
|
+
for (let j = 0; j < i; j++) {
|
|
235
|
+
layout[j] = false;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
clearAttachmentsLayout.forEach((layout, clearType) => {
|
|
239
|
+
layout.push(clearType === geometryDescription.clearType);
|
|
240
|
+
});
|
|
241
|
+
allAttachmentsLayout.push(true);
|
|
242
|
+
}
|
|
243
|
+
this._clearAttachmentsLayout = new Map();
|
|
244
|
+
clearAttachmentsLayout.forEach((layout, clearType) => {
|
|
245
|
+
this._clearAttachmentsLayout.set(clearType, this._engine.buildTextureLayout(layout));
|
|
246
|
+
});
|
|
247
|
+
this._allAttachmentsLayout = this._engine.buildTextureLayout(allAttachmentsLayout);
|
|
248
|
+
}
|
|
249
|
+
_registerForRenderPassId(renderPassId) {
|
|
250
|
+
const configuration = MaterialHelperGeometryRendering.CreateConfiguration(renderPassId);
|
|
251
|
+
for (let i = 0; i < this.textureDescriptions.length; i++) {
|
|
252
|
+
const description = this.textureDescriptions[i];
|
|
253
|
+
const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);
|
|
254
|
+
const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];
|
|
255
|
+
configuration.defines[geometryDescription.defineIndex] = i;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=geometryRendererTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometryRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/geometryRendererTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,+BAA+B,EAAE,+DAAwD;AAClG,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAuBtD,MAAM,WAAW,GAAa,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE/G;;GAEG;AACH,MAAM,OAAO,8BAA+B,SA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,MAAM,CAAC,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IACvF,CAAC;IAEO,wBAAwB,CAAC,YAAoB;QACjD,MAAM,aAAa,GAAG,+BAA+B,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QAExF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtD,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;YACxH,MAAM,mBAAmB,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC;YAE/F,aAAa,CAAC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;SAC9D;IACL,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraphTextureHandle, Scene, Camera, AbstractEngine, FrameGraph, GeometryRenderingTextureClearType, FrameGraphObjectList, AbstractMesh } from \"core/index\";\r\nimport { backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { RenderTargetTexture } from \"../../../Materials/Textures/renderTargetTexture\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { MaterialHelperGeometryRendering } from \"core/Materials/materialHelper.geometryrendering\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Description of a texture used by the geometry renderer task.\r\n */\r\nexport interface IFrameGraphGeometryRendererTextureDescription {\r\n /**\r\n * The type of the texture.\r\n * The value should be one of the Constants.PREPASS_XXX_TEXTURE_TYPE values.\r\n */\r\n type: number;\r\n\r\n /**\r\n * The type of the texture.\r\n */\r\n textureType: number;\r\n\r\n /**\r\n * The format of the texture.\r\n */\r\n textureFormat: number;\r\n}\r\n\r\nconst clearColors: Color4[] = [new Color4(0, 0, 0, 0), new Color4(1, 1, 1, 1), new Color4(1e8, 1e8, 1e8, 1e8)];\r\n\r\n/**\r\n * Task used to render geometry to a set of textures.\r\n */\r\nexport class FrameGraphGeometryRendererTask extends FrameGraphTask {\r\n /**\r\n * The depth texture attachment to use for rendering (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used for rendering.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n this._camera = camera;\r\n this._rtt.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The object list used for rendering.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * Whether depth testing is enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * Whether depth writing is enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * The size of the output textures (default is 100% of the back buffer texture size).\r\n */\r\n public size: { width: number; height: number } = { width: 100, height: 100 };\r\n\r\n /**\r\n * Whether the size is a percentage of the back buffer size (default is true).\r\n */\r\n public sizeIsPercentage = true;\r\n\r\n /**\r\n * The number of samples to use for the output textures (default is 1).\r\n */\r\n public samples = 1;\r\n\r\n /**\r\n * The list of texture descriptions used by the geometry renderer task.\r\n */\r\n public textureDescriptions: IFrameGraphGeometryRendererTextureDescription[] = [];\r\n\r\n /**\r\n * The output depth texture attachment texture.\r\n * This texture will point to the same texture than the depthTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth (in screen space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryScreenDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in local space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLocalPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The albedo output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryAlbedoTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The reflectivity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryReflectivityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The linear velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLinearVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The render target texture used by the geometry renderer task.\r\n */\r\n public get renderTargetTexture() {\r\n return this._rtt;\r\n }\r\n\r\n /**\r\n * Gets or sets 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(value: string) {\r\n this._name = value;\r\n if (this._rtt) {\r\n this._rtt.name = value + \"_internal_rtt\";\r\n }\r\n }\r\n\r\n private _engine: AbstractEngine;\r\n private _scene: Scene;\r\n private _rtt: RenderTargetTexture;\r\n private _clearAttachmentsLayout: Map<GeometryRenderingTextureClearType, number[]>;\r\n private _allAttachmentsLayout: number[];\r\n\r\n /**\r\n * Constructs a new geometry renderer 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 the frame graph is associated with.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = this._scene.getEngine();\r\n\r\n this._rtt = new RenderTargetTexture(name, 1, scene, {\r\n delayAllocation: true,\r\n });\r\n this._rtt.skipInitialClear = true;\r\n this._rtt.renderSprites = false;\r\n this._rtt.renderParticles = false;\r\n\r\n this.name = name;\r\n this._clearAttachmentsLayout = new Map();\r\n this._allAttachmentsLayout = [];\r\n\r\n this.outputDepthTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryViewDepthTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryScreenDepthTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryViewNormalTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryWorldNormalTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryLocalPositionTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryWorldPositionTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryAlbedoTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryReflectivityTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryVelocityTexture = this._frameGraph.createDanglingHandle();\r\n this.geometryLinearVelocityTexture = this._frameGraph.createDanglingHandle();\r\n }\r\n\r\n /**\r\n * Gets the list of excluded meshes from the velocity texture.\r\n */\r\n public get excludedSkinnedMeshFromVelocityTexture(): AbstractMesh[] {\r\n return MaterialHelperGeometryRendering.GetConfiguration(this._rtt.renderPassId).excludedSkinnedMesh;\r\n }\r\n\r\n public override isReady() {\r\n return this._rtt.isReadyForRendering();\r\n }\r\n\r\n public record() {\r\n if (this.textureDescriptions.length === 0 || this.objectList === undefined) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: object list and at least one geometry texture description must be provided`);\r\n }\r\n\r\n const outputTextureHandle = this._createMultiRenderTargetTexture();\r\n\r\n const depthEnabled = this._checkDepthTextureCompatibility();\r\n\r\n this._buildClearAttachmentsLayout();\r\n\r\n this._registerForRenderPassId(this._rtt.renderPassId);\r\n\r\n const outputTextureDescription = this._frameGraph.getTextureDescription(outputTextureHandle);\r\n\r\n this._rtt._size = outputTextureDescription.size;\r\n\r\n // Create pass\r\n MaterialHelperGeometryRendering.MarkAsDirty(this._rtt.renderPassId, this.objectList.meshes || this._scene.meshes);\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(outputTextureHandle);\r\n\r\n let handle = outputTextureHandle + 1;\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n switch (geometryDescription.type) {\r\n case Constants.PREPASS_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryViewDepthTexture, handle++);\r\n break;\r\n case Constants.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryScreenDepthTexture, handle++);\r\n break;\r\n case Constants.PREPASS_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryViewNormalTexture, handle++);\r\n break;\r\n case Constants.PREPASS_WORLD_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryWorldNormalTexture, handle++);\r\n break;\r\n case Constants.PREPASS_LOCAL_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryLocalPositionTexture, handle++);\r\n break;\r\n case Constants.PREPASS_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryWorldPositionTexture, handle++);\r\n break;\r\n case Constants.PREPASS_ALBEDO_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryAlbedoTexture, handle++);\r\n break;\r\n case Constants.PREPASS_REFLECTIVITY_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryReflectivityTexture, handle++);\r\n break;\r\n case Constants.PREPASS_VELOCITY_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryVelocityTexture, handle++);\r\n break;\r\n case Constants.PREPASS_VELOCITY_LINEAR_TEXTURE_TYPE:\r\n this._frameGraph.resolveDanglingHandle(this.geometryLinearVelocityTexture, handle++);\r\n break;\r\n }\r\n }\r\n\r\n if (this.depthTexture !== undefined) {\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n }\r\n\r\n pass.setExecuteFunc((context) => {\r\n this._rtt.renderList = this.objectList.meshes;\r\n this._rtt.particleSystemList = this.objectList.particleSystems;\r\n\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n this._clearAttachmentsLayout.forEach((layout, clearType) => {\r\n context.clearColorAttachments(clearColors[clearType], layout);\r\n });\r\n\r\n context.bindAttachments(this._allAttachmentsLayout);\r\n\r\n context.render(this._rtt);\r\n });\r\n }\r\n\r\n public override dispose(): void {\r\n MaterialHelperGeometryRendering.DeleteConfiguration(this._rtt.renderPassId);\r\n this._rtt.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _createMultiRenderTargetTexture(): FrameGraphTextureHandle {\r\n const types: number[] = [];\r\n const formats: number[] = [];\r\n const labels: string[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n\r\n if (index === -1) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: unknown texture type ${description.type}`);\r\n }\r\n\r\n types[i] = description.textureType;\r\n formats[i] = description.textureFormat;\r\n labels[i] = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index].name;\r\n useSRGBBuffers[i] = false;\r\n }\r\n\r\n return this._frameGraph.createRenderTargetTexture(\r\n this.name,\r\n {\r\n size: this.size,\r\n sizeIsPercentage: this.sizeIsPercentage,\r\n options: {\r\n createMipMaps: false,\r\n generateDepthBuffer: false,\r\n textureCount: this.textureDescriptions.length,\r\n samples: this.samples,\r\n types,\r\n formats,\r\n useSRGBBuffers,\r\n labels,\r\n },\r\n },\r\n true\r\n );\r\n }\r\n\r\n private _checkDepthTextureCompatibility(): boolean {\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth/stencil back buffer is not allowed as a depth texture`);\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== this.samples) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n this._frameGraph.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n return depthEnabled;\r\n }\r\n\r\n private _buildClearAttachmentsLayout() {\r\n const clearAttachmentsLayout = new Map<GeometryRenderingTextureClearType, boolean[]>();\r\n const allAttachmentsLayout: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n let layout = clearAttachmentsLayout.get(geometryDescription.clearType);\r\n if (layout === undefined) {\r\n layout = [];\r\n clearAttachmentsLayout.set(geometryDescription.clearType, layout);\r\n for (let j = 0; j < i; j++) {\r\n layout[j] = false;\r\n }\r\n }\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n layout.push(clearType === geometryDescription.clearType);\r\n });\r\n\r\n allAttachmentsLayout.push(true);\r\n }\r\n\r\n this._clearAttachmentsLayout = new Map();\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n this._clearAttachmentsLayout.set(clearType, this._engine.buildTextureLayout(layout));\r\n });\r\n\r\n this._allAttachmentsLayout = this._engine.buildTextureLayout(allAttachmentsLayout);\r\n }\r\n\r\n private _registerForRenderPassId(renderPassId: number) {\r\n const configuration = MaterialHelperGeometryRendering.CreateConfiguration(renderPassId);\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n configuration.defines[geometryDescription.defineIndex] = i;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { FrameGraph, FrameGraphTextureHandle, Scene, Camera, FrameGraphObjectList, FrameGraphRenderContext } from "../../../index.js";
|
|
2
|
+
import { RenderTargetTexture } from "../../../Materials/Textures/renderTargetTexture";
|
|
3
|
+
import { FrameGraphTask } from "../../frameGraphTask";
|
|
4
|
+
/**
|
|
5
|
+
* Task used to render objects to a texture.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
8
|
+
/**
|
|
9
|
+
* The destination texture where the objects will be rendered.
|
|
10
|
+
*/
|
|
11
|
+
destinationTexture: FrameGraphTextureHandle;
|
|
12
|
+
/**
|
|
13
|
+
* The depth attachment texture where the objects will be rendered (optional).
|
|
14
|
+
*/
|
|
15
|
+
depthTexture?: FrameGraphTextureHandle;
|
|
16
|
+
/**
|
|
17
|
+
* The dependencies of the task (optional).
|
|
18
|
+
*/
|
|
19
|
+
dependencies?: FrameGraphTextureHandle[];
|
|
20
|
+
private _camera;
|
|
21
|
+
/**
|
|
22
|
+
* Gets or sets the camera used to render the objects.
|
|
23
|
+
*/
|
|
24
|
+
get camera(): Camera;
|
|
25
|
+
set camera(camera: Camera);
|
|
26
|
+
/**
|
|
27
|
+
* The list of objects to render.
|
|
28
|
+
*/
|
|
29
|
+
objectList: FrameGraphObjectList;
|
|
30
|
+
/**
|
|
31
|
+
* If depth testing should be enabled (default is true).
|
|
32
|
+
*/
|
|
33
|
+
depthTest: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* If depth writing should be enabled (default is true).
|
|
36
|
+
*/
|
|
37
|
+
depthWrite: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The output texture.
|
|
40
|
+
*/
|
|
41
|
+
readonly outputTexture: FrameGraphTextureHandle;
|
|
42
|
+
/**
|
|
43
|
+
* The output depth attachment texture.
|
|
44
|
+
* This texture will point to the same texture than the depthTexture property if it is set.
|
|
45
|
+
* Note, however, that the handle itself will be different!
|
|
46
|
+
*/
|
|
47
|
+
readonly outputDepthTexture: FrameGraphTextureHandle;
|
|
48
|
+
protected _scene: Scene;
|
|
49
|
+
protected _rtt: RenderTargetTexture;
|
|
50
|
+
/**
|
|
51
|
+
* The render target texture used to render the objects.
|
|
52
|
+
*/
|
|
53
|
+
get renderTargetTexture(): RenderTargetTexture;
|
|
54
|
+
get name(): string;
|
|
55
|
+
set name(value: string);
|
|
56
|
+
/**
|
|
57
|
+
* Constructs a new object renderer task.
|
|
58
|
+
* @param name The name of the task.
|
|
59
|
+
* @param frameGraph The frame graph the task belongs to.
|
|
60
|
+
* @param scene The scene the frame graph is associated with.
|
|
61
|
+
*/
|
|
62
|
+
constructor(name: string, frameGraph: FrameGraph, scene: Scene);
|
|
63
|
+
isReady(): boolean;
|
|
64
|
+
record(skipCreationOfDisabledPasses?: boolean, additionalExecute?: (context: FrameGraphRenderContext) => void): void;
|
|
65
|
+
dispose(): void;
|
|
66
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from "../../frameGraphTypes.js";
|
|
2
|
+
import { RenderTargetTexture } from "../../../Materials/Textures/renderTargetTexture.js";
|
|
3
|
+
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
4
|
+
/**
|
|
5
|
+
* Task used to render objects to a texture.
|
|
6
|
+
*/
|
|
7
|
+
export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
8
|
+
/**
|
|
9
|
+
* Gets or sets the camera used to render the objects.
|
|
10
|
+
*/
|
|
11
|
+
get camera() {
|
|
12
|
+
return this._camera;
|
|
13
|
+
}
|
|
14
|
+
set camera(camera) {
|
|
15
|
+
this._camera = camera;
|
|
16
|
+
this._rtt.activeCamera = this.camera;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The render target texture used to render the objects.
|
|
20
|
+
*/
|
|
21
|
+
get renderTargetTexture() {
|
|
22
|
+
return this._rtt;
|
|
23
|
+
}
|
|
24
|
+
get name() {
|
|
25
|
+
return this._name;
|
|
26
|
+
}
|
|
27
|
+
set name(value) {
|
|
28
|
+
this._name = value;
|
|
29
|
+
if (this._rtt) {
|
|
30
|
+
this._rtt.name = value + "_internal_rtt";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Constructs a new object renderer task.
|
|
35
|
+
* @param name The name of the task.
|
|
36
|
+
* @param frameGraph The frame graph the task belongs to.
|
|
37
|
+
* @param scene The scene the frame graph is associated with.
|
|
38
|
+
*/
|
|
39
|
+
constructor(name, frameGraph, scene) {
|
|
40
|
+
super(name, frameGraph);
|
|
41
|
+
/**
|
|
42
|
+
* The dependencies of the task (optional).
|
|
43
|
+
*/
|
|
44
|
+
this.dependencies = [];
|
|
45
|
+
/**
|
|
46
|
+
* If depth testing should be enabled (default is true).
|
|
47
|
+
*/
|
|
48
|
+
this.depthTest = true;
|
|
49
|
+
/**
|
|
50
|
+
* If depth writing should be enabled (default is true).
|
|
51
|
+
*/
|
|
52
|
+
this.depthWrite = true;
|
|
53
|
+
this._scene = scene;
|
|
54
|
+
this._rtt = new RenderTargetTexture(name, 1, scene, {
|
|
55
|
+
delayAllocation: true,
|
|
56
|
+
});
|
|
57
|
+
this._rtt.skipInitialClear = true;
|
|
58
|
+
this.name = name;
|
|
59
|
+
this.outputTexture = this._frameGraph.createDanglingHandle();
|
|
60
|
+
this.outputDepthTexture = this._frameGraph.createDanglingHandle();
|
|
61
|
+
}
|
|
62
|
+
isReady() {
|
|
63
|
+
return this._rtt.isReadyForRendering();
|
|
64
|
+
}
|
|
65
|
+
record(skipCreationOfDisabledPasses = false, additionalExecute) {
|
|
66
|
+
if (this.destinationTexture === undefined || this.objectList === undefined) {
|
|
67
|
+
throw new Error(`FrameGraphObjectRendererTask ${this.name}: destinationTexture and objectList are required`);
|
|
68
|
+
}
|
|
69
|
+
const outputTextureDescription = this._frameGraph.getTextureDescription(this.destinationTexture);
|
|
70
|
+
let depthEnabled = false;
|
|
71
|
+
if (this.depthTexture !== undefined) {
|
|
72
|
+
if (this.depthTexture === backbufferDepthStencilTextureHandle && this.destinationTexture !== backbufferColorTextureHandle) {
|
|
73
|
+
throw new Error(`FrameGraphObjectRendererTask ${this.name}: the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil`);
|
|
74
|
+
}
|
|
75
|
+
if (this.depthTexture !== backbufferDepthStencilTextureHandle && this.destinationTexture === backbufferColorTextureHandle) {
|
|
76
|
+
throw new Error(`FrameGraphObjectRendererTask ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the destination is the back buffer color`);
|
|
77
|
+
}
|
|
78
|
+
const depthTextureDescription = this._frameGraph.getTextureDescription(this.depthTexture);
|
|
79
|
+
if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {
|
|
80
|
+
throw new Error(`FrameGraphObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);
|
|
81
|
+
}
|
|
82
|
+
depthEnabled = true;
|
|
83
|
+
}
|
|
84
|
+
this._frameGraph.resolveDanglingHandle(this.outputTexture, this.destinationTexture);
|
|
85
|
+
if (this.depthTexture !== undefined) {
|
|
86
|
+
this._frameGraph.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);
|
|
87
|
+
}
|
|
88
|
+
this._rtt._size = outputTextureDescription.size;
|
|
89
|
+
const pass = this._frameGraph.addRenderPass(this.name);
|
|
90
|
+
pass.setRenderTarget(this.destinationTexture);
|
|
91
|
+
if (this.depthTexture !== undefined) {
|
|
92
|
+
pass.setRenderTargetDepth(this.depthTexture);
|
|
93
|
+
}
|
|
94
|
+
pass.setExecuteFunc((_context) => {
|
|
95
|
+
this._rtt.renderList = this.objectList.meshes;
|
|
96
|
+
this._rtt.particleSystemList = this.objectList.particleSystems;
|
|
97
|
+
this._scene.incrementRenderId();
|
|
98
|
+
this._scene.resetCachedMaterial();
|
|
99
|
+
_context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);
|
|
100
|
+
_context.render(this._rtt);
|
|
101
|
+
additionalExecute?.(_context);
|
|
102
|
+
});
|
|
103
|
+
if (this.dependencies !== undefined) {
|
|
104
|
+
for (const handle of this.dependencies) {
|
|
105
|
+
pass.useTexture(handle);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (!skipCreationOfDisabledPasses) {
|
|
109
|
+
const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
|
|
110
|
+
passDisabled.setRenderTarget(this.destinationTexture);
|
|
111
|
+
if (this.depthTexture !== undefined) {
|
|
112
|
+
passDisabled.setRenderTargetDepth(this.depthTexture);
|
|
113
|
+
}
|
|
114
|
+
passDisabled.setExecuteFunc((_context) => { });
|
|
115
|
+
if (this.dependencies !== undefined) {
|
|
116
|
+
for (const handle of this.dependencies) {
|
|
117
|
+
passDisabled.useTexture(handle);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
dispose() {
|
|
123
|
+
this._rtt.dispose();
|
|
124
|
+
super.dispose();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=objectRendererTask.js.map
|