@babylonjs/core 7.32.0 → 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,29 @@
|
|
|
1
|
+
import { ThinDepthOfFieldMergePostProcess } from "../../../PostProcesses/thinDepthOfFieldMergePostProcess.js";
|
|
2
|
+
import { FrameGraphPostProcessTask } from "./postProcessTask.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export class FrameGraphDepthOfFieldMergeTask extends FrameGraphPostProcessTask {
|
|
7
|
+
constructor(name, frameGraph, thinPostProcess) {
|
|
8
|
+
super(name, frameGraph, thinPostProcess || new ThinDepthOfFieldMergePostProcess(name, frameGraph.engine));
|
|
9
|
+
this.blurSteps = [];
|
|
10
|
+
}
|
|
11
|
+
record(skipCreationOfDisabledPasses = false) {
|
|
12
|
+
if (this.sourceTexture === undefined || this.circleOfConfusionTexture === undefined || this.blurSteps.length === 0) {
|
|
13
|
+
throw new Error(`FrameGraphBloomMergeTask "${this.name}": sourceTexture, circleOfConfusionTexture and blurSteps are required`);
|
|
14
|
+
}
|
|
15
|
+
this.postProcess.updateEffect("#define BLUR_LEVEL " + (this.blurSteps.length - 1) + "\n");
|
|
16
|
+
const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {
|
|
17
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "circleOfConfusionSampler", this.circleOfConfusionTexture);
|
|
18
|
+
this.blurSteps.forEach((handle, index) => {
|
|
19
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "blurStep" + (this.blurSteps.length - index - 1), handle);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
pass.useTexture(this.circleOfConfusionTexture);
|
|
23
|
+
for (const handle of this.blurSteps) {
|
|
24
|
+
pass.useTexture(handle);
|
|
25
|
+
}
|
|
26
|
+
return pass;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=depthOfFieldMergeTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"depthOfFieldMergeTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gCAAgC,EAAE,mEAA4D;AACvG,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,yBAAyB;IAK1E,YAAY,IAAY,EAAE,UAAsB,EAAE,eAAkD;QAChG,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,gCAAgC,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAHvG,cAAS,GAA8B,EAAE,CAAC;IAIjD,CAAC;IAEe,MAAM,CAAC,4BAA4B,GAAG,KAAK;QACvD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,wBAAwB,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAChH,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,IAAI,uEAAuE,CAAC,CAAC;SAClI;QAED,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,qBAAqB,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAE1F,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,0BAA0B,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC;YAC3H,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBACrC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,UAAU,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;YAC9H,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC/C,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE;YACjC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SAC3B;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, FrameGraphTextureHandle, FrameGraphRenderPass } from \"core/index\";\r\nimport { ThinDepthOfFieldMergePostProcess } from \"core/PostProcesses/thinDepthOfFieldMergePostProcess\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class FrameGraphDepthOfFieldMergeTask extends FrameGraphPostProcessTask {\r\n public circleOfConfusionTexture: FrameGraphTextureHandle;\r\n\r\n public blurSteps: FrameGraphTextureHandle[] = [];\r\n\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinDepthOfFieldMergePostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinDepthOfFieldMergePostProcess(name, frameGraph.engine));\r\n }\r\n\r\n public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined || this.circleOfConfusionTexture === undefined || this.blurSteps.length === 0) {\r\n throw new Error(`FrameGraphBloomMergeTask \"${this.name}\": sourceTexture, circleOfConfusionTexture and blurSteps are required`);\r\n }\r\n\r\n this.postProcess.updateEffect(\"#define BLUR_LEVEL \" + (this.blurSteps.length - 1) + \"\\n\");\r\n\r\n const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"circleOfConfusionSampler\", this.circleOfConfusionTexture);\r\n this.blurSteps.forEach((handle, index) => {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"blurStep\" + (this.blurSteps.length - index - 1), handle);\r\n });\r\n });\r\n\r\n pass.useTexture(this.circleOfConfusionTexture);\r\n for (const handle of this.blurSteps) {\r\n pass.useTexture(handle);\r\n }\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { FrameGraph, FrameGraphTextureHandle, AbstractEngine, Camera } from "../../../index.js";
|
|
2
|
+
import { FrameGraphTask } from "../../frameGraphTask";
|
|
3
|
+
import { ThinDepthOfFieldEffectBlurLevel } from "../../../PostProcesses/thinDepthOfFieldEffect.js";
|
|
4
|
+
import { ThinDepthOfFieldEffect } from "../../../PostProcesses/thinDepthOfFieldEffect.js";
|
|
5
|
+
/**
|
|
6
|
+
* Task which applies a depth of field effect.
|
|
7
|
+
*/
|
|
8
|
+
export declare class FrameGraphDepthOfFieldTask extends FrameGraphTask {
|
|
9
|
+
/**
|
|
10
|
+
* The source texture to apply the depth of field effect on.
|
|
11
|
+
*/
|
|
12
|
+
sourceTexture: FrameGraphTextureHandle;
|
|
13
|
+
/**
|
|
14
|
+
* The sampling mode to use for the source texture.
|
|
15
|
+
*/
|
|
16
|
+
sourceSamplingMode: number;
|
|
17
|
+
/**
|
|
18
|
+
* The depth texture to use for the depth of field effect.
|
|
19
|
+
* Should store camera space depth (Z coordinate).
|
|
20
|
+
*/
|
|
21
|
+
depthTexture: FrameGraphTextureHandle;
|
|
22
|
+
/**
|
|
23
|
+
* The sampling mode to use for the depth texture.
|
|
24
|
+
*/
|
|
25
|
+
depthSamplingMode: number;
|
|
26
|
+
/**
|
|
27
|
+
* The camera used to render the scene.
|
|
28
|
+
*/
|
|
29
|
+
camera: Camera;
|
|
30
|
+
/**
|
|
31
|
+
* The destination texture to render the depth of field effect to.
|
|
32
|
+
*/
|
|
33
|
+
destinationTexture?: FrameGraphTextureHandle;
|
|
34
|
+
/**
|
|
35
|
+
* The output texture of the depth of field effect.
|
|
36
|
+
*/
|
|
37
|
+
readonly outputTexture: FrameGraphTextureHandle;
|
|
38
|
+
/**
|
|
39
|
+
* The depth of field effect.
|
|
40
|
+
*/
|
|
41
|
+
readonly depthOfField: ThinDepthOfFieldEffect;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the depth of field effect is applied on HDR textures.
|
|
44
|
+
* When true, the depth of field effect will use a higher precision texture format (half float or float). Else, it will use unsigned byte.
|
|
45
|
+
*/
|
|
46
|
+
readonly hdr: boolean;
|
|
47
|
+
private _engine;
|
|
48
|
+
private _circleOfConfusion;
|
|
49
|
+
private _blurX;
|
|
50
|
+
private _blurY;
|
|
51
|
+
private _merge;
|
|
52
|
+
private _defaultPipelineTextureType;
|
|
53
|
+
/**
|
|
54
|
+
* Constructs a depth of field task.
|
|
55
|
+
* @param name The name of the task.
|
|
56
|
+
* @param frameGraph The frame graph this task belongs to.
|
|
57
|
+
* @param engine The engine to use for the depth of field effect.
|
|
58
|
+
* @param blurLevel The blur level of the depth of field effect (default: ThinDepthOfFieldEffectBlurLevel.Low).
|
|
59
|
+
* @param hdr Whether the depth of field effect is HDR.
|
|
60
|
+
*/
|
|
61
|
+
constructor(name: string, frameGraph: FrameGraph, engine: AbstractEngine, blurLevel?: ThinDepthOfFieldEffectBlurLevel, hdr?: boolean);
|
|
62
|
+
isReady(): boolean;
|
|
63
|
+
record(): void;
|
|
64
|
+
dispose(): void;
|
|
65
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
|
|
2
|
+
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
3
|
+
import { FrameGraphDepthOfFieldMergeTask } from "./depthOfFieldMergeTask.js";
|
|
4
|
+
import { FrameGraphCircleOfConfusionTask } from "./circleOfConfusionTask.js";
|
|
5
|
+
import { FrameGraphDepthOfFieldBlurTask } from "./depthOfFieldBlurTask.js";
|
|
6
|
+
import { ThinDepthOfFieldEffect } from "../../../PostProcesses/thinDepthOfFieldEffect.js";
|
|
7
|
+
/**
|
|
8
|
+
* Task which applies a depth of field effect.
|
|
9
|
+
*/
|
|
10
|
+
export class FrameGraphDepthOfFieldTask extends FrameGraphTask {
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a depth of field task.
|
|
13
|
+
* @param name The name of the task.
|
|
14
|
+
* @param frameGraph The frame graph this task belongs to.
|
|
15
|
+
* @param engine The engine to use for the depth of field effect.
|
|
16
|
+
* @param blurLevel The blur level of the depth of field effect (default: ThinDepthOfFieldEffectBlurLevel.Low).
|
|
17
|
+
* @param hdr Whether the depth of field effect is HDR.
|
|
18
|
+
*/
|
|
19
|
+
constructor(name, frameGraph, engine, blurLevel = 0 /* ThinDepthOfFieldEffectBlurLevel.Low */, hdr = false) {
|
|
20
|
+
super(name, frameGraph);
|
|
21
|
+
/**
|
|
22
|
+
* The sampling mode to use for the source texture.
|
|
23
|
+
*/
|
|
24
|
+
this.sourceSamplingMode = 2;
|
|
25
|
+
/**
|
|
26
|
+
* The sampling mode to use for the depth texture.
|
|
27
|
+
*/
|
|
28
|
+
this.depthSamplingMode = 2;
|
|
29
|
+
this._blurX = [];
|
|
30
|
+
this._blurY = [];
|
|
31
|
+
this._engine = engine;
|
|
32
|
+
this.hdr = hdr;
|
|
33
|
+
this._defaultPipelineTextureType = 0;
|
|
34
|
+
if (hdr) {
|
|
35
|
+
const caps = engine.getCaps();
|
|
36
|
+
if (caps.textureHalfFloatRender) {
|
|
37
|
+
this._defaultPipelineTextureType = 2;
|
|
38
|
+
}
|
|
39
|
+
else if (caps.textureFloatRender) {
|
|
40
|
+
this._defaultPipelineTextureType = 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
this.depthOfField = new ThinDepthOfFieldEffect(name, engine, blurLevel, true);
|
|
44
|
+
this._circleOfConfusion = new FrameGraphCircleOfConfusionTask(`${name} Circle of Confusion`, this._frameGraph, this.depthOfField._circleOfConfusion);
|
|
45
|
+
const blurCount = this.depthOfField._depthOfFieldBlurX.length;
|
|
46
|
+
for (let i = 0; i < blurCount; i++) {
|
|
47
|
+
this._blurX.push(new FrameGraphDepthOfFieldBlurTask(`${name} Blur X`, this._frameGraph, this.depthOfField._depthOfFieldBlurX[i][0]));
|
|
48
|
+
this._blurY.push(new FrameGraphDepthOfFieldBlurTask(`${name} Blur Y`, this._frameGraph, this.depthOfField._depthOfFieldBlurY[i][0]));
|
|
49
|
+
}
|
|
50
|
+
this._merge = new FrameGraphDepthOfFieldMergeTask(`${name} Merge`, this._frameGraph, this.depthOfField._dofMerge);
|
|
51
|
+
this.outputTexture = this._frameGraph.createDanglingHandle();
|
|
52
|
+
}
|
|
53
|
+
isReady() {
|
|
54
|
+
return this.depthOfField.isReady();
|
|
55
|
+
}
|
|
56
|
+
record() {
|
|
57
|
+
if (this.sourceTexture === undefined || this.depthTexture === undefined || this.camera === undefined) {
|
|
58
|
+
throw new Error("FrameGraphDepthOfFieldTask: sourceTexture, depthTexture and camera are required");
|
|
59
|
+
}
|
|
60
|
+
const sourceTextureDescription = this._frameGraph.getTextureDescription(this.sourceTexture);
|
|
61
|
+
const textureSize = {
|
|
62
|
+
width: sourceTextureDescription.size.width,
|
|
63
|
+
height: sourceTextureDescription.size.height,
|
|
64
|
+
};
|
|
65
|
+
const circleOfConfusionTextureFormat = this._engine.isWebGPU || this._engine.version > 1 ? 6 : 5;
|
|
66
|
+
const textureCreationOptions = {
|
|
67
|
+
size: textureSize,
|
|
68
|
+
options: {
|
|
69
|
+
createMipMaps: false,
|
|
70
|
+
generateMipMaps: false,
|
|
71
|
+
types: [this._defaultPipelineTextureType],
|
|
72
|
+
formats: [circleOfConfusionTextureFormat],
|
|
73
|
+
samples: 1,
|
|
74
|
+
useSRGBBuffers: [false],
|
|
75
|
+
generateDepthBuffer: false,
|
|
76
|
+
generateStencilBuffer: false,
|
|
77
|
+
label: "",
|
|
78
|
+
},
|
|
79
|
+
sizeIsPercentage: false,
|
|
80
|
+
};
|
|
81
|
+
const circleOfConfusionTextureHandle = this._frameGraph.createRenderTargetTexture(this._circleOfConfusion.name, textureCreationOptions);
|
|
82
|
+
this._circleOfConfusion.sourceTexture = this.sourceTexture; // texture not used by the CoC shader
|
|
83
|
+
this._circleOfConfusion.depthTexture = this.depthTexture;
|
|
84
|
+
this._circleOfConfusion.depthSamplingMode = this.depthSamplingMode;
|
|
85
|
+
this._circleOfConfusion.camera = this.camera;
|
|
86
|
+
this._circleOfConfusion.destinationTexture = circleOfConfusionTextureHandle;
|
|
87
|
+
this._circleOfConfusion.record(true);
|
|
88
|
+
textureCreationOptions.options.formats = [5];
|
|
89
|
+
const blurSteps = [];
|
|
90
|
+
for (let i = 0; i < this._blurX.length; i++) {
|
|
91
|
+
const ratio = this.depthOfField._depthOfFieldBlurX[i][1];
|
|
92
|
+
textureSize.width = Math.floor(sourceTextureDescription.size.width * ratio);
|
|
93
|
+
textureSize.height = Math.floor(sourceTextureDescription.size.height * ratio);
|
|
94
|
+
const blurYTextureHandle = this._frameGraph.createRenderTargetTexture(this._blurY[i].name, textureCreationOptions);
|
|
95
|
+
this._blurY[i].sourceTexture = i === 0 ? this.sourceTexture : this._blurX[i - 1].outputTexture;
|
|
96
|
+
this._blurY[i].sourceSamplingMode = 2;
|
|
97
|
+
this._blurY[i].circleOfConfusionTexture = circleOfConfusionTextureHandle;
|
|
98
|
+
this._blurY[i].destinationTexture = blurYTextureHandle;
|
|
99
|
+
this._blurY[i].record(true);
|
|
100
|
+
const blurXTextureHandle = this._frameGraph.createRenderTargetTexture(this._blurX[i].name, textureCreationOptions);
|
|
101
|
+
this._blurX[i].sourceTexture = this._blurY[i].outputTexture;
|
|
102
|
+
this._blurX[i].sourceSamplingMode = 2;
|
|
103
|
+
this._blurX[i].circleOfConfusionTexture = circleOfConfusionTextureHandle;
|
|
104
|
+
this._blurX[i].destinationTexture = blurXTextureHandle;
|
|
105
|
+
this._blurX[i].record(true);
|
|
106
|
+
blurSteps.push(blurXTextureHandle);
|
|
107
|
+
}
|
|
108
|
+
const sourceTextureCreationOptions = this._frameGraph.getTextureCreationOptions(this.sourceTexture, true);
|
|
109
|
+
sourceTextureCreationOptions.options.generateDepthBuffer = false;
|
|
110
|
+
sourceTextureCreationOptions.options.generateStencilBuffer = false;
|
|
111
|
+
this._frameGraph.resolveDanglingHandle(this.outputTexture, this.destinationTexture, this._merge.name, sourceTextureCreationOptions);
|
|
112
|
+
this._merge.sourceTexture = this.sourceTexture;
|
|
113
|
+
this._merge.sourceSamplingMode = this.sourceSamplingMode;
|
|
114
|
+
this._merge.circleOfConfusionTexture = circleOfConfusionTextureHandle;
|
|
115
|
+
this._merge.blurSteps = blurSteps;
|
|
116
|
+
this._merge.destinationTexture = this.outputTexture;
|
|
117
|
+
this._merge.record(true);
|
|
118
|
+
const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
|
|
119
|
+
passDisabled.setRenderTarget(this.outputTexture);
|
|
120
|
+
passDisabled.setExecuteFunc((context) => {
|
|
121
|
+
context.copyTexture(this.sourceTexture);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
dispose() {
|
|
125
|
+
this._circleOfConfusion.dispose();
|
|
126
|
+
for (let i = 0; i < this._blurX.length; i++) {
|
|
127
|
+
this._blurX[i].dispose();
|
|
128
|
+
this._blurY[i].dispose();
|
|
129
|
+
}
|
|
130
|
+
this._merge.dispose();
|
|
131
|
+
super.dispose();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=depthOfFieldTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"depthOfFieldTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,yDAAkD;AAEnF;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,cAAc;IAuD1D;;;;;;;OAOG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,MAAsB,EAAE,uDAAgF,EAAE,GAAG,GAAG,KAAK;QACnK,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QA1D5B;;WAEG;QACI,uBAAkB,GAAG,SAAS,CAAC,6BAA6B,CAAC;QAQpE;;WAEG;QACI,sBAAiB,GAAG,SAAS,CAAC,6BAA6B,CAAC;QA8B3D,WAAM,GAAqC,EAAE,CAAC;QAC9C,WAAM,GAAqC,EAAE,CAAC;QAelD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QAEf,IAAI,CAAC,2BAA2B,GAAG,SAAS,CAAC,yBAAyB,CAAC;QACvE,IAAI,GAAG,EAAE;YACL,MAAM,IAAI,G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,EAAE,CAAC;SAC5B;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, FrameGraphTextureCreationOptions, FrameGraphTextureHandle, AbstractEngine, Camera } from \"core/index\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ThinDepthOfFieldEffectBlurLevel } from \"core/PostProcesses/thinDepthOfFieldEffect\";\r\nimport { FrameGraphDepthOfFieldMergeTask } from \"./depthOfFieldMergeTask\";\r\nimport { FrameGraphCircleOfConfusionTask } from \"./circleOfConfusionTask\";\r\nimport { FrameGraphDepthOfFieldBlurTask } from \"./depthOfFieldBlurTask\";\r\nimport { ThinDepthOfFieldEffect } from \"core/PostProcesses/thinDepthOfFieldEffect\";\r\n\r\n/**\r\n * Task which applies a depth of field effect.\r\n */\r\nexport class FrameGraphDepthOfFieldTask extends FrameGraphTask {\r\n /**\r\n * The source texture to apply the depth of field effect on.\r\n */\r\n public sourceTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The sampling mode to use for the source texture.\r\n */\r\n public sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n\r\n /**\r\n * The depth texture to use for the depth of field effect.\r\n * Should store camera space depth (Z coordinate).\r\n */\r\n public depthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The sampling mode to use for the depth texture.\r\n */\r\n public depthSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n\r\n /**\r\n * The camera used to render the scene.\r\n */\r\n public camera: Camera;\r\n\r\n /**\r\n * The destination texture to render the depth of field effect to.\r\n */\r\n public destinationTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output texture of the depth of field effect.\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth of field effect.\r\n */\r\n public readonly depthOfField: ThinDepthOfFieldEffect;\r\n\r\n /**\r\n * Whether the depth of field effect is applied on HDR textures.\r\n * When true, the depth of field effect will use a higher precision texture format (half float or float). Else, it will use unsigned byte.\r\n */\r\n public readonly hdr: boolean;\r\n\r\n private _engine: AbstractEngine;\r\n private _circleOfConfusion: FrameGraphCircleOfConfusionTask;\r\n private _blurX: FrameGraphDepthOfFieldBlurTask[] = [];\r\n private _blurY: FrameGraphDepthOfFieldBlurTask[] = [];\r\n private _merge: FrameGraphDepthOfFieldMergeTask;\r\n private _defaultPipelineTextureType: number;\r\n\r\n /**\r\n * Constructs a depth of field task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task belongs to.\r\n * @param engine The engine to use for the depth of field effect.\r\n * @param blurLevel The blur level of the depth of field effect (default: ThinDepthOfFieldEffectBlurLevel.Low).\r\n * @param hdr Whether the depth of field effect is HDR.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, engine: AbstractEngine, blurLevel: ThinDepthOfFieldEffectBlurLevel = ThinDepthOfFieldEffectBlurLevel.Low, hdr = false) {\r\n super(name, frameGraph);\r\n\r\n this._engine = engine;\r\n this.hdr = hdr;\r\n\r\n this._defaultPipelineTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n if (hdr) {\r\n const caps = engine.getCaps();\r\n if (caps.textureHalfFloatRender) {\r\n this._defaultPipelineTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else if (caps.textureFloatRender) {\r\n this._defaultPipelineTextureType = Constants.TEXTURETYPE_FLOAT;\r\n }\r\n }\r\n\r\n this.depthOfField = new ThinDepthOfFieldEffect(name, engine, blurLevel, true);\r\n\r\n this._circleOfConfusion = new FrameGraphCircleOfConfusionTask(`${name} Circle of Confusion`, this._frameGraph, this.depthOfField._circleOfConfusion);\r\n\r\n const blurCount = this.depthOfField._depthOfFieldBlurX.length;\r\n\r\n for (let i = 0; i < blurCount; i++) {\r\n this._blurX.push(new FrameGraphDepthOfFieldBlurTask(`${name} Blur X`, this._frameGraph, this.depthOfField._depthOfFieldBlurX[i][0]));\r\n this._blurY.push(new FrameGraphDepthOfFieldBlurTask(`${name} Blur Y`, this._frameGraph, this.depthOfField._depthOfFieldBlurY[i][0]));\r\n }\r\n\r\n this._merge = new FrameGraphDepthOfFieldMergeTask(`${name} Merge`, this._frameGraph, this.depthOfField._dofMerge);\r\n\r\n this.outputTexture = this._frameGraph.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this.depthOfField.isReady();\r\n }\r\n\r\n public record(): void {\r\n if (this.sourceTexture === undefined || this.depthTexture === undefined || this.camera === undefined) {\r\n throw new Error(\"FrameGraphDepthOfFieldTask: sourceTexture, depthTexture and camera are required\");\r\n }\r\n\r\n const sourceTextureDescription = this._frameGraph.getTextureDescription(this.sourceTexture);\r\n\r\n const textureSize = {\r\n width: sourceTextureDescription.size.width,\r\n height: sourceTextureDescription.size.height,\r\n };\r\n const circleOfConfusionTextureFormat = this._engine.isWebGPU || this._engine.version > 1 ? Constants.TEXTUREFORMAT_RED : Constants.TEXTUREFORMAT_RGBA;\r\n const textureCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: textureSize,\r\n options: {\r\n createMipMaps: false,\r\n generateMipMaps: false,\r\n types: [this._defaultPipelineTextureType],\r\n formats: [circleOfConfusionTextureFormat],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false,\r\n label: \"\",\r\n },\r\n sizeIsPercentage: false,\r\n };\r\n\r\n const circleOfConfusionTextureHandle = this._frameGraph.createRenderTargetTexture(this._circleOfConfusion.name, textureCreationOptions);\r\n\r\n this._circleOfConfusion.sourceTexture = this.sourceTexture; // texture not used by the CoC shader\r\n this._circleOfConfusion.depthTexture = this.depthTexture;\r\n this._circleOfConfusion.depthSamplingMode = this.depthSamplingMode;\r\n this._circleOfConfusion.camera = this.camera;\r\n this._circleOfConfusion.destinationTexture = circleOfConfusionTextureHandle;\r\n this._circleOfConfusion.record(true);\r\n\r\n textureCreationOptions.options.formats = [Constants.TEXTUREFORMAT_RGBA];\r\n\r\n const blurSteps: FrameGraphTextureHandle[] = [];\r\n\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n const ratio = this.depthOfField._depthOfFieldBlurX[i][1];\r\n\r\n textureSize.width = Math.floor(sourceTextureDescription.size.width * ratio);\r\n textureSize.height = Math.floor(sourceTextureDescription.size.height * ratio);\r\n\r\n const blurYTextureHandle = this._frameGraph.createRenderTargetTexture(this._blurY[i].name, textureCreationOptions);\r\n\r\n this._blurY[i].sourceTexture = i === 0 ? this.sourceTexture : this._blurX[i - 1].outputTexture;\r\n this._blurY[i].sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurY[i].circleOfConfusionTexture = circleOfConfusionTextureHandle;\r\n this._blurY[i].destinationTexture = blurYTextureHandle;\r\n this._blurY[i].record(true);\r\n\r\n const blurXTextureHandle = this._frameGraph.createRenderTargetTexture(this._blurX[i].name, textureCreationOptions);\r\n\r\n this._blurX[i].sourceTexture = this._blurY[i].outputTexture;\r\n this._blurX[i].sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurX[i].circleOfConfusionTexture = circleOfConfusionTextureHandle;\r\n this._blurX[i].destinationTexture = blurXTextureHandle;\r\n this._blurX[i].record(true);\r\n\r\n blurSteps.push(blurXTextureHandle);\r\n }\r\n\r\n const sourceTextureCreationOptions = this._frameGraph.getTextureCreationOptions(this.sourceTexture, true);\r\n sourceTextureCreationOptions.options.generateDepthBuffer = false;\r\n sourceTextureCreationOptions.options.generateStencilBuffer = false;\r\n\r\n this._frameGraph.resolveDanglingHandle(this.outputTexture, this.destinationTexture, this._merge.name, sourceTextureCreationOptions);\r\n\r\n this._merge.sourceTexture = this.sourceTexture;\r\n this._merge.sourceSamplingMode = this.sourceSamplingMode;\r\n this._merge.circleOfConfusionTexture = circleOfConfusionTextureHandle;\r\n this._merge.blurSteps = blurSteps;\r\n this._merge.destinationTexture = this.outputTexture;\r\n this._merge.record(true);\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n passDisabled.setExecuteFunc((context) => {\r\n context.copyTexture(this.sourceTexture);\r\n });\r\n }\r\n\r\n public override dispose(): void {\r\n this._circleOfConfusion.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 this._merge.dispose();\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FrameGraph } from "../../../index.js";
|
|
2
|
+
import { ThinExtractHighlightsPostProcess } from "../../../PostProcesses/thinExtractHighlightsPostProcess.js";
|
|
3
|
+
import { FrameGraphPostProcessTask } from "./postProcessTask";
|
|
4
|
+
/**
|
|
5
|
+
* Task used to extract highlights from a scene.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FrameGraphExtractHighlightsTask extends FrameGraphPostProcessTask {
|
|
8
|
+
readonly postProcess: ThinExtractHighlightsPostProcess;
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a new extract highlights task.
|
|
11
|
+
* @param name The name of the task.
|
|
12
|
+
* @param frameGraph The frame graph the task belongs to.
|
|
13
|
+
* @param thinPostProcess The thin post process to use for the task. If not provided, a new one will be created.
|
|
14
|
+
*/
|
|
15
|
+
constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinExtractHighlightsPostProcess);
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ThinExtractHighlightsPostProcess } from "../../../PostProcesses/thinExtractHighlightsPostProcess.js";
|
|
2
|
+
import { FrameGraphPostProcessTask } from "./postProcessTask.js";
|
|
3
|
+
/**
|
|
4
|
+
* Task used to extract highlights from a scene.
|
|
5
|
+
*/
|
|
6
|
+
export class FrameGraphExtractHighlightsTask extends FrameGraphPostProcessTask {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new extract highlights task.
|
|
9
|
+
* @param name The name of the task.
|
|
10
|
+
* @param frameGraph The frame graph the task belongs to.
|
|
11
|
+
* @param thinPostProcess The thin post process to use for the task. If not provided, a new one will be created.
|
|
12
|
+
*/
|
|
13
|
+
constructor(name, frameGraph, thinPostProcess) {
|
|
14
|
+
super(name, frameGraph, thinPostProcess || new ThinExtractHighlightsPostProcess(name, frameGraph.engine));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=extractHighlightsTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractHighlightsTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gCAAgC,EAAE,mEAA4D;AACvG,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,yBAAyB;IAG1E;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,eAAkD;QAChG,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,gCAAgC,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9G,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph } from \"core/index\";\r\nimport { ThinExtractHighlightsPostProcess } from \"core/PostProcesses/thinExtractHighlightsPostProcess\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\n\r\n/**\r\n * Task used to extract highlights from a scene.\r\n */\r\nexport class FrameGraphExtractHighlightsTask extends FrameGraphPostProcessTask {\r\n public override readonly postProcess: ThinExtractHighlightsPostProcess;\r\n\r\n /**\r\n * Constructs a new extract highlights task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param thinPostProcess The thin post process to use for the task. If not provided, a new one will be created.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinExtractHighlightsPostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinExtractHighlightsPostProcess(name, frameGraph.engine));\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { FrameGraph, FrameGraphTextureHandle, DrawWrapper, FrameGraphRenderPass, FrameGraphRenderContext, EffectWrapper } from "../../../index.js";
|
|
2
|
+
import { FrameGraphTask } from "../../frameGraphTask";
|
|
3
|
+
/**
|
|
4
|
+
* Task which applies a post process.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FrameGraphPostProcessTask extends FrameGraphTask {
|
|
7
|
+
/**
|
|
8
|
+
* The source texture to apply the post process on.
|
|
9
|
+
*/
|
|
10
|
+
sourceTexture: FrameGraphTextureHandle;
|
|
11
|
+
/**
|
|
12
|
+
* The sampling mode to use for the source texture.
|
|
13
|
+
*/
|
|
14
|
+
sourceSamplingMode: number;
|
|
15
|
+
/**
|
|
16
|
+
* The destination texture to render the post process to.
|
|
17
|
+
* If not supplied, a texture with the same configuration as the source texture will be created.
|
|
18
|
+
*/
|
|
19
|
+
destinationTexture?: FrameGraphTextureHandle;
|
|
20
|
+
/**
|
|
21
|
+
* The output texture of the post process.
|
|
22
|
+
*/
|
|
23
|
+
readonly outputTexture: FrameGraphTextureHandle;
|
|
24
|
+
/**
|
|
25
|
+
* The post process to apply.
|
|
26
|
+
*/
|
|
27
|
+
readonly postProcess: EffectWrapper;
|
|
28
|
+
protected readonly _postProcessDrawWrapper: DrawWrapper;
|
|
29
|
+
protected _outputWidth: number;
|
|
30
|
+
protected _outputHeight: number;
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a new post process task.
|
|
33
|
+
* @param name Name of the task.
|
|
34
|
+
* @param frameGraph The frame graph this task is associated with.
|
|
35
|
+
* @param postProcess The post process to apply.
|
|
36
|
+
*/
|
|
37
|
+
constructor(name: string, frameGraph: FrameGraph, postProcess: EffectWrapper);
|
|
38
|
+
isReady(): boolean;
|
|
39
|
+
record(skipCreationOfDisabledPasses?: boolean, additionalExecute?: (context: FrameGraphRenderContext) => void, additionalBindings?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass;
|
|
40
|
+
dispose(): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
3
|
+
/**
|
|
4
|
+
* Task which applies a post process.
|
|
5
|
+
*/
|
|
6
|
+
export class FrameGraphPostProcessTask extends FrameGraphTask {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new post process task.
|
|
9
|
+
* @param name Name of the task.
|
|
10
|
+
* @param frameGraph The frame graph this task is associated with.
|
|
11
|
+
* @param postProcess The post process to apply.
|
|
12
|
+
*/
|
|
13
|
+
constructor(name, frameGraph, postProcess) {
|
|
14
|
+
super(name, frameGraph);
|
|
15
|
+
/**
|
|
16
|
+
* The sampling mode to use for the source texture.
|
|
17
|
+
*/
|
|
18
|
+
this.sourceSamplingMode = 2;
|
|
19
|
+
this.postProcess = postProcess;
|
|
20
|
+
this._postProcessDrawWrapper = this.postProcess.drawWrapper;
|
|
21
|
+
this.outputTexture = this._frameGraph.createDanglingHandle();
|
|
22
|
+
}
|
|
23
|
+
isReady() {
|
|
24
|
+
return this.postProcess.isReady();
|
|
25
|
+
}
|
|
26
|
+
record(skipCreationOfDisabledPasses = false, additionalExecute, additionalBindings) {
|
|
27
|
+
if (this.sourceTexture === undefined) {
|
|
28
|
+
throw new Error(`FrameGraphPostProcessTask "${this.name}": sourceTexture is required`);
|
|
29
|
+
}
|
|
30
|
+
const sourceTextureCreationOptions = this._frameGraph.getTextureCreationOptions(this.sourceTexture, true);
|
|
31
|
+
sourceTextureCreationOptions.options.generateDepthBuffer = false;
|
|
32
|
+
sourceTextureCreationOptions.options.generateStencilBuffer = false;
|
|
33
|
+
sourceTextureCreationOptions.options.samples = 1;
|
|
34
|
+
this._frameGraph.resolveDanglingHandle(this.outputTexture, this.destinationTexture, this.name, sourceTextureCreationOptions);
|
|
35
|
+
const outputTextureDescription = this._frameGraph.getTextureDescription(this.outputTexture);
|
|
36
|
+
this._outputWidth = outputTextureDescription.size.width;
|
|
37
|
+
this._outputHeight = outputTextureDescription.size.height;
|
|
38
|
+
const pass = this._frameGraph.addRenderPass(this.name);
|
|
39
|
+
pass.useTexture(this.sourceTexture);
|
|
40
|
+
pass.setRenderTarget(this.outputTexture);
|
|
41
|
+
pass.setExecuteFunc((context) => {
|
|
42
|
+
context.setTextureSamplingMode(this.sourceTexture, this.sourceSamplingMode);
|
|
43
|
+
additionalExecute?.(context);
|
|
44
|
+
context.applyFullScreenEffect(this._postProcessDrawWrapper, () => {
|
|
45
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "textureSampler", this.sourceTexture);
|
|
46
|
+
additionalBindings?.(context);
|
|
47
|
+
this.postProcess.bind();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
if (!skipCreationOfDisabledPasses) {
|
|
51
|
+
const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
|
|
52
|
+
passDisabled.setRenderTarget(this.outputTexture);
|
|
53
|
+
passDisabled.setExecuteFunc((context) => {
|
|
54
|
+
context.copyTexture(this.sourceTexture);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return pass;
|
|
58
|
+
}
|
|
59
|
+
dispose() {
|
|
60
|
+
this.postProcess.dispose();
|
|
61
|
+
super.dispose();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=postProcessTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postProcessTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/postProcessTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EA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CAAC,aAAa,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;SACN;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC3B,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, FrameGraphTextureHandle, DrawWrapper, FrameGraphRenderPass, FrameGraphRenderContext, EffectWrapper } from \"core/index\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task which applies a post process.\r\n */\r\nexport class FrameGraphPostProcessTask extends FrameGraphTask {\r\n /**\r\n * The source texture to apply the post process on.\r\n */\r\n public sourceTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The sampling mode to use for the source texture.\r\n */\r\n public sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n\r\n /**\r\n * The destination texture to render the post process to.\r\n * If not supplied, a texture with the same configuration as the source texture will be created.\r\n */\r\n public destinationTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output texture of the post process.\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The post process to apply.\r\n */\r\n public readonly postProcess: EffectWrapper;\r\n\r\n protected readonly _postProcessDrawWrapper: DrawWrapper;\r\n protected _outputWidth: number;\r\n protected _outputHeight: number;\r\n\r\n /**\r\n * Constructs a new post process task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param postProcess The post process to apply.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, postProcess: EffectWrapper) {\r\n super(name, frameGraph);\r\n\r\n this.postProcess = postProcess;\r\n this._postProcessDrawWrapper = this.postProcess.drawWrapper;\r\n\r\n this.outputTexture = this._frameGraph.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this.postProcess.isReady();\r\n }\r\n\r\n public record(\r\n skipCreationOfDisabledPasses = false,\r\n additionalExecute?: (context: FrameGraphRenderContext) => void,\r\n additionalBindings?: (context: FrameGraphRenderContext) => void\r\n ): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined) {\r\n throw new Error(`FrameGraphPostProcessTask \"${this.name}\": sourceTexture is required`);\r\n }\r\n\r\n const sourceTextureCreationOptions = this._frameGraph.getTextureCreationOptions(this.sourceTexture, true);\r\n sourceTextureCreationOptions.options.generateDepthBuffer = false;\r\n sourceTextureCreationOptions.options.generateStencilBuffer = false;\r\n sourceTextureCreationOptions.options.samples = 1;\r\n\r\n this._frameGraph.resolveDanglingHandle(this.outputTexture, this.destinationTexture, this.name, sourceTextureCreationOptions);\r\n\r\n const outputTextureDescription = this._frameGraph.getTextureDescription(this.outputTexture);\r\n\r\n this._outputWidth = outputTextureDescription.size.width;\r\n this._outputHeight = outputTextureDescription.size.height;\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.useTexture(this.sourceTexture);\r\n pass.setRenderTarget(this.outputTexture);\r\n pass.setExecuteFunc((context) => {\r\n context.setTextureSamplingMode(this.sourceTexture, this.sourceSamplingMode);\r\n additionalExecute?.(context);\r\n context.applyFullScreenEffect(this._postProcessDrawWrapper, () => {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"textureSampler\", this.sourceTexture);\r\n additionalBindings?.(context);\r\n this.postProcess.bind();\r\n });\r\n });\r\n\r\n if (!skipCreationOfDisabledPasses) {\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n passDisabled.setExecuteFunc((context) => {\r\n context.copyTexture(this.sourceTexture);\r\n });\r\n }\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n this.postProcess.dispose();\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Scene, Camera, FrameGraph, FrameGraphObjectList } from "../../../index.js";
|
|
2
|
+
import { FrameGraphTask } from "../../frameGraphTask";
|
|
3
|
+
/**
|
|
4
|
+
* Task used to cull objects that are not visible.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FrameGraphCullObjectsTask extends FrameGraphTask {
|
|
7
|
+
/**
|
|
8
|
+
* The object list to cull.
|
|
9
|
+
*/
|
|
10
|
+
objectList: FrameGraphObjectList;
|
|
11
|
+
/**
|
|
12
|
+
* The camera to use for culling.
|
|
13
|
+
*/
|
|
14
|
+
camera: Camera;
|
|
15
|
+
/**
|
|
16
|
+
* The output object list containing the culled objects.
|
|
17
|
+
*/
|
|
18
|
+
readonly outputObjectList: FrameGraphObjectList;
|
|
19
|
+
private _scene;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new cull objects task.
|
|
22
|
+
* @param name The name of the task.
|
|
23
|
+
* @param frameGraph The frame graph the task belongs to.
|
|
24
|
+
* @param scene The scene to cull objects from.
|
|
25
|
+
*/
|
|
26
|
+
constructor(name: string, frameGraph: FrameGraph, scene: Scene);
|
|
27
|
+
record(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
2
|
+
/**
|
|
3
|
+
* Task used to cull objects that are not visible.
|
|
4
|
+
*/
|
|
5
|
+
export class FrameGraphCullObjectsTask extends FrameGraphTask {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new cull objects task.
|
|
8
|
+
* @param name The name of the task.
|
|
9
|
+
* @param frameGraph The frame graph the task belongs to.
|
|
10
|
+
* @param scene The scene to cull objects from.
|
|
11
|
+
*/
|
|
12
|
+
constructor(name, frameGraph, scene) {
|
|
13
|
+
super(name, frameGraph);
|
|
14
|
+
this._scene = scene;
|
|
15
|
+
this.outputObjectList = {
|
|
16
|
+
meshes: [],
|
|
17
|
+
particleSystems: [],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
record() {
|
|
21
|
+
if (this.objectList === undefined || this.camera === undefined) {
|
|
22
|
+
throw new Error(`FrameGraphCullObjectsTask ${this.name}: objectList and camera are required`);
|
|
23
|
+
}
|
|
24
|
+
const pass = this._frameGraph.addCullPass(this.name);
|
|
25
|
+
pass.setObjectList(this.outputObjectList);
|
|
26
|
+
pass.setExecuteFunc((_context) => {
|
|
27
|
+
this.outputObjectList.meshes = [];
|
|
28
|
+
this.camera._updateFrustumPlanes();
|
|
29
|
+
const frustumPlanes = this.camera._frustumPlanes;
|
|
30
|
+
const meshes = this.objectList.meshes || this._scene.meshes;
|
|
31
|
+
for (let i = 0; i < meshes.length; i++) {
|
|
32
|
+
const mesh = meshes[i];
|
|
33
|
+
if (mesh.isBlocked || !mesh.isReady() || !mesh.isEnabled() || mesh.scaling.hasAZeroComponent) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (mesh.isVisible &&
|
|
37
|
+
mesh.visibility > 0 &&
|
|
38
|
+
(mesh.layerMask & this.camera.layerMask) !== 0 &&
|
|
39
|
+
(this._scene.skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(frustumPlanes))) {
|
|
40
|
+
this.outputObjectList.meshes.push(mesh);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const passDisabled = this._frameGraph.addCullPass(this.name + "_disabled", true);
|
|
45
|
+
passDisabled.setObjectList(this.outputObjectList);
|
|
46
|
+
passDisabled.setExecuteFunc((_context) => {
|
|
47
|
+
this.outputObjectList.meshes = this.objectList.meshes;
|
|
48
|
+
this.outputObjectList.particleSystems = this.objectList.particleSystems;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=cullObjectsTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cullObjectsTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/cullObjectsTask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I,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE;oBAC1F,SAAS;iBACZ;gBAED,IACI,IAAI,CAAC,SAAS;oBACd,IAAI,CAAC,UAAU,GAAG,CAAC;oBACnB,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;oBAC9C,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,IAAI,IAAI,CAAC,wBAAwB,IAAI,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,EACvG;oBACE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAC3C;aACJ;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEjF,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":["// eslint-disable-next-line import/no-internal-modules\r\nimport 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 _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: [],\r\n particleSystems: [],\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 const pass = this._frameGraph.addCullPass(this.name);\r\n\r\n pass.setObjectList(this.outputObjectList);\r\n pass.setExecuteFunc((_context) => {\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.addCullPass(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"]}
|