@babylonjs/core 7.44.0 → 7.45.0
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/Debug/debugLayer.d.ts +4 -0
- package/Debug/debugLayer.js +9 -0
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +2 -4
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -4
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/abstractEngine.d.ts +19 -1
- package/Engines/abstractEngine.js +48 -9
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.d.ts +1 -1
- package/Engines/engine.js +2 -20
- package/Engines/engine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +2 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +1 -5
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.d.ts +16 -12
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +63 -27
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.d.ts +72 -0
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +197 -0
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +4 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +9 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +4 -2
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +2 -0
- package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.d.ts +3 -2
- package/FrameGraph/Node/nodeRenderGraph.js +4 -3
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +4 -4
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.d.ts +8 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +10 -0
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphConnectionPointCustomObject.d.ts +21 -0
- package/FrameGraph/Node/nodeRenderGraphConnectionPointCustomObject.js +31 -0
- package/FrameGraph/Node/nodeRenderGraphConnectionPointCustomObject.js.map +1 -0
- package/FrameGraph/Passes/pass.d.ts +1 -0
- package/FrameGraph/Passes/pass.js +4 -1
- package/FrameGraph/Passes/pass.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +81 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +304 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -0
- package/FrameGraph/Tasks/Layers/glowLayerTask.d.ts +3 -40
- package/FrameGraph/Tasks/Layers/glowLayerTask.js +4 -158
- package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.d.ts +21 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js +32 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.d.ts +2 -2
- package/FrameGraph/Tasks/Misc/executeTask.js +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +5 -4
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +5 -4
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +2 -4
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +4 -2
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +1 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +1 -0
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +2 -2
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +1 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +8 -2
- package/FrameGraph/frameGraph.js +31 -5
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +10 -0
- package/FrameGraph/frameGraphRenderContext.js +14 -0
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +3 -2
- package/FrameGraph/frameGraphTask.js +12 -2
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphTypes.d.ts +4 -0
- package/FrameGraph/frameGraphTypes.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Helpers/environmentHelper.js +7 -6
- package/Helpers/environmentHelper.js.map +1 -1
- package/Layers/effectLayer.d.ts +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +2 -14
- package/Layers/glowLayer.js +34 -36
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +13 -74
- package/Layers/highlightLayer.js +123 -309
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/index.d.ts +1 -0
- package/Layers/index.js +1 -0
- package/Layers/index.js.map +1 -1
- package/Layers/thinEffectLayer.d.ts +55 -2
- package/Layers/thinEffectLayer.js +66 -0
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Layers/thinGlowLayer.d.ts +3 -6
- package/Layers/thinGlowLayer.js +4 -1
- package/Layers/thinGlowLayer.js.map +1 -1
- package/Layers/thinHighlightLayer.d.ts +197 -0
- package/Layers/thinHighlightLayer.js +417 -0
- package/Layers/thinHighlightLayer.js.map +1 -0
- package/Materials/Node/nodeMaterial.js +2 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBRDFConfiguration.d.ts +14 -0
- package/Materials/PBR/pbrBRDFConfiguration.js +19 -0
- package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
- package/Materials/effect.d.ts +5 -0
- package/Materials/effect.js +15 -0
- package/Materials/effect.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +4 -2
- package/Meshes/Compression/dracoCompression.js +24 -11
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Compression/dracoCompressionWorker.js +4 -4
- package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.d.ts +5 -1
- package/Meshes/Compression/dracoEncoder.js +23 -17
- package/Meshes/Compression/dracoEncoder.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.types.d.ts +4 -4
- package/Meshes/Compression/dracoEncoder.types.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +17 -2
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/Compression/test/integration/draco.test.d.ts +1 -0
- package/Meshes/Compression/test/integration/draco.test.js +30 -0
- package/Meshes/Compression/test/integration/draco.test.js.map +1 -0
- package/Meshes/csg.js +4 -0
- package/Meshes/csg.js.map +1 -1
- package/Meshes/transformNode.d.ts +4 -1
- package/Meshes/transformNode.js +4 -1
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/copyTextureToTexture.js +1 -1
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/error.d.ts +6 -0
- package/Misc/error.js +10 -0
- package/Misc/error.js.map +1 -1
- package/Misc/screenshotTools.js +58 -5
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/tools.d.ts +21 -1
- package/Misc/tools.js +33 -0
- package/Misc/tools.js.map +1 -1
- package/Particles/particleHelper.js +2 -1
- package/Particles/particleHelper.js.map +1 -1
- package/Particles/particleSystemSet.d.ts +1 -0
- package/Particles/particleSystemSet.js +1 -0
- package/Particles/particleSystemSet.js.map +1 -1
- package/Particles/webgl2ParticleSystem.d.ts +1 -1
- package/Particles/webgl2ParticleSystem.js +1 -2
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +2 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/Rendering/depthRenderer.js +1 -1
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +5 -3
- package/Rendering/objectRenderer.js +5 -3
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/renderingManager.d.ts +4 -0
- package/Rendering/renderingManager.js +1 -0
- package/Rendering/renderingManager.js.map +1 -1
- package/Shaders/ShadersInclude/intersectionFunctions.d.ts +5 -0
- package/Shaders/ShadersInclude/intersectionFunctions.js +14 -0
- package/Shaders/ShadersInclude/intersectionFunctions.js.map +1 -0
- package/Shaders/ShadersInclude/pbrBlockReflection.js +7 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/Shaders/background.fragment.d.ts +1 -0
- package/Shaders/background.fragment.js +3 -5
- package/Shaders/background.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.d.ts +1 -0
- package/Shaders/gaussianSplatting.vertex.js +3 -1
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/intersectionFunctions.d.ts +5 -0
- package/ShadersWGSL/ShadersInclude/intersectionFunctions.js +14 -0
- package/ShadersWGSL/ShadersInclude/intersectionFunctions.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +7 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/background.fragment.d.ts +1 -0
- package/ShadersWGSL/background.fragment.js +3 -5
- package/ShadersWGSL/background.fragment.js.map +1 -1
- package/ShadersWGSL/glowMapGeneration.fragment.js +1 -2
- package/ShadersWGSL/glowMapGeneration.fragment.js.map +1 -1
- package/ShadersWGSL/layer.fragment.js +1 -2
- package/ShadersWGSL/layer.fragment.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +8 -7
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +4 -0
- package/types.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glowLayerTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/glowLayerTask.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cA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;YAC1C,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n IThinGlowLayerOptions,\r\n Camera,\r\n FrameGraphObjectList,\r\n FrameGraphTextureCreationOptions,\r\n Effect,\r\n ThinBlurPostProcess,\r\n AbstractEngine,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ThinGlowLayer } from \"core/Layers/thinGlowLayer\";\r\nimport { FrameGraphObjectRendererTask } from \"../Rendering/objectRendererTask\";\r\nimport { FrameGraphClearTextureTask } from \"../Texture/clearTextureTask\";\r\nimport { FrameGraphBlurTask } from \"../PostProcesses/blurTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTextureManager } from \"../../frameGraphTextureManager\";\r\nimport { getDimensionsFromTextureSize } from \"../../../Materials/Textures/textureCreationOptions\";\r\n\r\n/**\r\n * Task which applies a glowing effect to a texture.\r\n */\r\nexport class FrameGraphGlowLayerTask extends FrameGraphTask {\r\n /**\r\n * The destination texture to apply the glow layer to.\r\n * The glow effect will be blended with the contents of this texture.\r\n */\r\n public destinationTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The layer texture to render the glow layer to.\r\n * If not provided, a default texture will be created.\r\n */\r\n public layerTexture?: FrameGraphTextureHandle;\r\n\r\n private _camera: Camera;\r\n /**\r\n * Gets or sets the camera used to render the objects to the glow layer.\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.layer.camera = this.camera;\r\n }\r\n\r\n /**\r\n * The list of objects to render to the glow layer.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * The output texture of the task (same as destinationTexture, but the handle will be different).\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The glow layer object. Use this object to update the glow layer properties (e.g. intensity, blur kernel size).\r\n */\r\n public readonly layer: ThinGlowLayer;\r\n\r\n /**\r\n * The name of the task.\r\n */\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(name: string) {\r\n this._name = name;\r\n if (this._blurX) {\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n this._blurX[i].name = `${name} Blur X${i}`;\r\n this._blurY[i].name = `${name} Blur Y${i}`;\r\n }\r\n }\r\n\r\n if (this._clearTask) {\r\n this._clearTask.name = name + \" Clear Layer\";\r\n }\r\n\r\n if (this._objectRendererTask) {\r\n this._objectRendererTask.name = name + \" Render to Layer\";\r\n }\r\n }\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _clearTask: FrameGraphClearTextureTask;\r\n private readonly _objectRendererTask: FrameGraphObjectRendererTask;\r\n private readonly _blurX: FrameGraphBlurTask[] = [];\r\n private readonly _blurY: FrameGraphBlurTask[] = [];\r\n\r\n /**\r\n * Constructs a new glow layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the glow layer in.\r\n * @param options Options for the glow layer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinGlowLayerOptions) {\r\n super(name, frameGraph);\r\n\r\n this._engine = scene.getEngine();\r\n\r\n this.layer = new ThinGlowLayer(name, scene, options, true);\r\n\r\n for (let i = 0; i < 2; i++) {\r\n this._blurX.push(new FrameGraphBlurTask(`${name} Blur X${i}`, this._frameGraph, this.layer._postProcesses[i * 2 + 0] as ThinBlurPostProcess));\r\n this._blurY.push(new FrameGraphBlurTask(`${name} Blur Y${i}`, this._frameGraph, this.layer._postProcesses[i * 2 + 1] as ThinBlurPostProcess));\r\n }\r\n\r\n this._clearTask = new FrameGraphClearTextureTask(name + \" Clear Layer\", frameGraph);\r\n this._clearTask.clearColor = true;\r\n this._clearTask.clearDepth = true;\r\n\r\n this._objectRendererTask = new FrameGraphObjectRendererTask(name + \" Render to Layer\", frameGraph, scene, undefined, this.layer.objectRenderer);\r\n this.layer._renderPassId = this._objectRendererTask.objectRenderer.renderPassId;\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this._objectRendererTask.isReady() && this.layer.isLayerReady();\r\n }\r\n\r\n public record() {\r\n if (this.destinationTexture === undefined || this.objectList === undefined || this.camera === undefined) {\r\n throw new Error(`FrameGrapGlowLayerTask \"${this.name}\": destinationTexture, objectList and camera are required`);\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture);\r\n\r\n // Uses the layerTexture or creates a color texture to render the glow layer to\r\n let textureSize: {\r\n width: number;\r\n height: number;\r\n };\r\n let textureCreationOptions: FrameGraphTextureCreationOptions;\r\n\r\n let colorLayerOutput: FrameGraphTextureHandle;\r\n\r\n if (this.layerTexture) {\r\n colorLayerOutput = this.layerTexture;\r\n textureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.layerTexture);\r\n textureSize = getDimensionsFromTextureSize(textureCreationOptions.size);\r\n textureCreationOptions.size = textureSize;\r\n } else {\r\n textureSize = { width: 50, height: 50 };\r\n textureCreationOptions = {\r\n size: textureSize,\r\n options: {\r\n createMipMaps: false,\r\n types: [Constants.TEXTURETYPE_UNSIGNED_BYTE],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n creationFlags: [0],\r\n },\r\n sizeIsPercentage: true,\r\n };\r\n colorLayerOutput = this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} Color`, textureCreationOptions);\r\n }\r\n\r\n // Creates a depth texture, used to render objects to the glow layer\r\n const textureDepthCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: textureSize,\r\n options: FrameGraphTextureManager.CloneTextureOptions(textureCreationOptions.options),\r\n sizeIsPercentage: textureCreationOptions.sizeIsPercentage,\r\n };\r\n\r\n textureDepthCreationOptions.options.formats![0] = Constants.TEXTUREFORMAT_DEPTH32_FLOAT;\r\n\r\n const depthLayerOutput = this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} Depth`, textureDepthCreationOptions);\r\n\r\n // Clears the textures\r\n this._clearTask.destinationTexture = colorLayerOutput;\r\n this._clearTask.depthTexture = depthLayerOutput;\r\n this._clearTask.color = this.layer.neutralColor;\r\n this._clearTask.record();\r\n\r\n // Renders the objects to the layer texture\r\n this._objectRendererTask.destinationTexture = this._clearTask.outputTexture;\r\n this._objectRendererTask.depthTexture = this._clearTask.outputDepthTexture;\r\n this._objectRendererTask.camera = this.camera;\r\n this._objectRendererTask.objectList = this.objectList;\r\n this._objectRendererTask.disableShadows = true;\r\n\r\n this._objectRendererTask.record();\r\n\r\n // Blurs the layer color texture\r\n let blurTextureType = 0;\r\n if (this._engine.getCaps().textureHalfFloatRender) {\r\n blurTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n } else {\r\n blurTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n\r\n textureCreationOptions.options.types![0] = blurTextureType;\r\n\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n const blurXTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurX[i].name, textureCreationOptions);\r\n\r\n this._blurX[i].sourceTexture = i === 0 ? this._objectRendererTask.outputTexture : this._blurY[i - 1].outputTexture;\r\n this._blurX[i].sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurX[i].destinationTexture = blurXTextureHandle;\r\n this._blurX[i].record(true);\r\n\r\n const blurYTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurY[i].name, textureCreationOptions);\r\n\r\n this._blurY[i].sourceTexture = this._blurX[i].outputTexture;\r\n this._blurY[i].sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurY[i].destinationTexture = blurYTextureHandle;\r\n this._blurY[i].record(true);\r\n\r\n textureSize.width = textureSize.width >> 1;\r\n textureSize.height = textureSize.height >> 1;\r\n }\r\n\r\n this._internalDependencies.push(this._blurY[0].outputTexture, this._blurY[1].outputTexture);\r\n\r\n // Composes the glow layer with the destination texture\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.outputTexture);\r\n pass.setExecuteFunc((context) => {\r\n this.layer.bindTexturesForCompose = (effect: Effect) => {\r\n context.bindTextureHandle(effect, \"textureSampler\", this._blurY[0].outputTexture);\r\n context.setTextureSamplingMode(this._blurY[1].destinationTexture!, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n context.bindTextureHandle(effect, \"textureSampler2\", this._blurY[1].outputTexture);\r\n };\r\n\r\n context._applyRenderTarget();\r\n\r\n this.layer.compose();\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n public override dispose(): void {\r\n this._clearTask.dispose();\r\n this._objectRendererTask.dispose();\r\n this.layer.dispose();\r\n for (let i = 0; i < this._blurX.length; i++) {\r\n this._blurX[i].dispose();\r\n this._blurY[i].dispose();\r\n }\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"glowLayerTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/glowLayerTask.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,yCAAkC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,uBAAuB;IAMhE;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY,EAAE,OAA+B;QAC3F,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAEjF,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAAC,YAAY,CAAC;IACxF,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n Scene,\r\n IThinGlowLayerOptions,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { ThinGlowLayer } from \"core/Layers/thinGlowLayer\";\r\nimport { FrameGraphBaseLayerTask } from \"./baseLayerTask\";\r\n\r\n/**\r\n * Task which applies a glowing effect to a texture.\r\n */\r\nexport class FrameGraphGlowLayerTask extends FrameGraphBaseLayerTask {\r\n /**\r\n * The glow layer object. Use this object to update the glow layer properties (e.g. intensity, blur kernel size).\r\n */\r\n public override readonly layer: ThinGlowLayer;\r\n\r\n /**\r\n * Constructs a new glow layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the glow layer in.\r\n * @param options Options for the glow layer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinGlowLayerOptions) {\r\n super(name, frameGraph, scene, new ThinGlowLayer(name, scene, options, true), 2);\r\n\r\n this.layer._renderPassId = this._objectRendererForLayer.objectRenderer.renderPassId;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FrameGraph, Scene, IThinHighlightLayerOptions } from "../../../index.js";
|
|
2
|
+
import { ThinHighlightLayer } from "../../../Layers/thinHighlightLayer.js";
|
|
3
|
+
import { FrameGraphBaseLayerTask } from "./baseLayerTask";
|
|
4
|
+
/**
|
|
5
|
+
* Task which applies a highlight effect to a texture.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FrameGraphHighlightLayerTask extends FrameGraphBaseLayerTask {
|
|
8
|
+
/**
|
|
9
|
+
* The highlight layer object. Use this object to update the highlight layer properties.
|
|
10
|
+
*/
|
|
11
|
+
readonly layer: ThinHighlightLayer;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new highlight layer task.
|
|
14
|
+
* @param name Name of the task.
|
|
15
|
+
* @param frameGraph The frame graph this task is associated with.
|
|
16
|
+
* @param scene The scene to render the highlight layer in.
|
|
17
|
+
* @param options Options for the highlight layer.
|
|
18
|
+
*/
|
|
19
|
+
constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinHighlightLayerOptions);
|
|
20
|
+
record(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ThinHighlightLayer } from "../../../Layers/thinHighlightLayer.js";
|
|
2
|
+
|
|
3
|
+
import { HasStencilAspect } from "../../../Materials/Textures/internalTexture.js";
|
|
4
|
+
import { FrameGraphBaseLayerTask } from "./baseLayerTask.js";
|
|
5
|
+
/**
|
|
6
|
+
* Task which applies a highlight effect to a texture.
|
|
7
|
+
*/
|
|
8
|
+
export class FrameGraphHighlightLayerTask extends FrameGraphBaseLayerTask {
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a new highlight layer task.
|
|
11
|
+
* @param name Name of the task.
|
|
12
|
+
* @param frameGraph The frame graph this task is associated with.
|
|
13
|
+
* @param scene The scene to render the highlight layer in.
|
|
14
|
+
* @param options Options for the highlight layer.
|
|
15
|
+
*/
|
|
16
|
+
constructor(name, frameGraph, scene, options) {
|
|
17
|
+
const alphaBlendingMode = options?.alphaBlendingMode ?? 2;
|
|
18
|
+
super(name, frameGraph, scene, new ThinHighlightLayer(name, scene, options, true), 1, alphaBlendingMode === 2, true, true);
|
|
19
|
+
}
|
|
20
|
+
record() {
|
|
21
|
+
if (!this.objectRendererTask.depthTexture) {
|
|
22
|
+
throw new Error(`FrameGraphHighlightLayerTask "${this.name}": objectRendererTask must have a depthTexture input`);
|
|
23
|
+
}
|
|
24
|
+
const depthTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.objectRendererTask.depthTexture);
|
|
25
|
+
if (!depthTextureCreationOptions.options.formats || !HasStencilAspect(depthTextureCreationOptions.options.formats[0])) {
|
|
26
|
+
throw new Error(`FrameGraphHighlightLayerTask "${this.name}": objectRendererTask depthTexture must have a stencil aspect`);
|
|
27
|
+
}
|
|
28
|
+
super.record();
|
|
29
|
+
this.layer._mainObjectRendererRenderPassId = this.objectRendererTask.objectRenderer.renderPassId;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=highlightLayerTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlightLayerTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Layers/highlightLayerTask.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,8CAAuC;AACpE,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,gBAAgB,EAAE,uDAAgD;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,uBAAuB;IAMrE;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY,EAAE,OAAoC;QAChG,MAAM,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,SAAS,CAAC,aAAa,CAAC;QAEhF,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,iBAAiB,KAAK,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACrJ,CAAC;IAEe,MAAM;QAClB,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAC,IAAI,sDAAsD,CAAC,CAAC;QACtH,CAAC;QAED,MAAM,2BAA2B,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,yBAAyB,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACpI,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,OAAO,CAAC,OAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrH,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAC,IAAI,+DAA+D,CAAC,CAAC;QAC/H,CAAC;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,IAAI,CAAC,KAAK,CAAC,+BAA+B,GAAG,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,YAAY,CAAC;IACrG,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n Scene,\r\n IThinHighlightLayerOptions,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { ThinHighlightLayer } from \"core/Layers/thinHighlightLayer\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { HasStencilAspect } from \"core/Materials/Textures/internalTexture\";\r\nimport { FrameGraphBaseLayerTask } from \"./baseLayerTask\";\r\n\r\n/**\r\n * Task which applies a highlight effect to a texture.\r\n */\r\nexport class FrameGraphHighlightLayerTask extends FrameGraphBaseLayerTask {\r\n /**\r\n * The highlight layer object. Use this object to update the highlight layer properties.\r\n */\r\n public override readonly layer: ThinHighlightLayer;\r\n\r\n /**\r\n * Constructs a new highlight layer task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param scene The scene to render the highlight layer in.\r\n * @param options Options for the highlight layer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: IThinHighlightLayerOptions) {\r\n const alphaBlendingMode = options?.alphaBlendingMode ?? Constants.ALPHA_COMBINE;\r\n\r\n super(name, frameGraph, scene, new ThinHighlightLayer(name, scene, options, true), 1, alphaBlendingMode === Constants.ALPHA_COMBINE, true, true);\r\n }\r\n\r\n public override record() {\r\n if (!this.objectRendererTask.depthTexture) {\r\n throw new Error(`FrameGraphHighlightLayerTask \"${this.name}\": objectRendererTask must have a depthTexture input`);\r\n }\r\n\r\n const depthTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.objectRendererTask.depthTexture);\r\n if (!depthTextureCreationOptions.options.formats || !HasStencilAspect(depthTextureCreationOptions.options.formats![0])) {\r\n throw new Error(`FrameGraphHighlightLayerTask \"${this.name}\": objectRendererTask depthTexture must have a stencil aspect`);\r\n }\r\n\r\n super.record();\r\n\r\n this.layer._mainObjectRendererRenderPassId = this.objectRendererTask.objectRenderer.renderPassId;\r\n }\r\n}\r\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FrameGraph, FrameGraphContext } from "../../../index.js";
|
|
1
|
+
import type { FrameGraph, FrameGraphContext, FrameGraphPass } from "../../../index.js";
|
|
2
2
|
import { FrameGraphTask } from "../../frameGraphTask";
|
|
3
3
|
/**
|
|
4
4
|
* Task used to execute a custom function.
|
|
@@ -18,5 +18,5 @@ export declare class FrameGraphExecuteTask extends FrameGraphTask {
|
|
|
18
18
|
* @param frameGraph The frame graph the task belongs to.
|
|
19
19
|
*/
|
|
20
20
|
constructor(name: string, frameGraph: FrameGraph);
|
|
21
|
-
record():
|
|
21
|
+
record(): FrameGraphPass<FrameGraphContext>;
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Misc/executeTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;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,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAE7E,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,IAAI,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, FrameGraphContext, FrameGraphPass } from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task used to execute a custom function.\r\n */\r\nexport class FrameGraphExecuteTask extends FrameGraphTask {\r\n /**\r\n * The function to execute.\r\n */\r\n public func: (context: FrameGraphContext) => void;\r\n\r\n /**\r\n * The function to execute when the task is disabled (optional).\r\n */\r\n public funcDisabled?: (context: FrameGraphContext) => void;\r\n\r\n /**\r\n * Creates a new execute task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n super(name, frameGraph);\r\n }\r\n\r\n public record(): FrameGraphPass<FrameGraphContext> {\r\n if (!this.func) {\r\n throw new Error(\"FrameGraphExecuteTask: Execute task must have a function.\");\r\n }\r\n\r\n const pass = this._frameGraph.addPass(this.name);\r\n\r\n pass.setExecuteFunc((context) => {\r\n this.func(context);\r\n });\r\n\r\n const passDisabled = this._frameGraph.addPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setExecuteFunc((context) => {\r\n this.funcDisabled?.(context);\r\n });\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
@@ -14,7 +14,7 @@ export class FrameGraphBloomMergeTask extends FrameGraphPostProcessTask {
|
|
|
14
14
|
const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {
|
|
15
15
|
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "bloomBlur", this.blurTexture);
|
|
16
16
|
});
|
|
17
|
-
this.
|
|
17
|
+
this._addInternalDependencies(this.blurTexture);
|
|
18
18
|
return pass;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bloomMergeTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/bloomMergeTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,4DAAqD;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,yBAAyB;IAKnE,YAAY,IAAY,EAAE,UAAsB,EAAE,eAA2C;QACzF,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,yBAAyB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACvG,CAAC;IAEe,MAAM,CAAC,4BAA4B,GAAG,KAAK;QACvD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,IAAI,+CAA+C,CAAC,CAAC;QAC3G,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,4BAA4B,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3E,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACnG,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"bloomMergeTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/bloomMergeTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,4DAAqD;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,yBAAyB;IAKnE,YAAY,IAAY,EAAE,UAAsB,EAAE,eAA2C;QACzF,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,yBAAyB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IACvG,CAAC;IAEe,MAAM,CAAC,4BAA4B,GAAG,KAAK;QACvD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,IAAI,+CAA+C,CAAC,CAAC;QAC3G,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,4BAA4B,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3E,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACnG,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEhD,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 { ThinBloomMergePostProcess } from \"core/PostProcesses/thinBloomMergePostProcess\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class FrameGraphBloomMergeTask extends FrameGraphPostProcessTask {\r\n public blurTexture: FrameGraphTextureHandle;\r\n\r\n public override readonly postProcess: ThinBloomMergePostProcess;\r\n\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinBloomMergePostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinBloomMergePostProcess(name, frameGraph.engine));\r\n }\r\n\r\n public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined || this.blurTexture === undefined) {\r\n throw new Error(`FrameGraphBloomMergeTask \"${this.name}\": sourceTexture and blurTexture are required`);\r\n }\r\n\r\n const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"bloomBlur\", this.blurTexture);\r\n });\r\n\r\n this._addInternalDependencies(this.blurTexture);\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
@@ -80,7 +80,7 @@ export class FrameGraphBloomTask extends FrameGraphTask {
|
|
|
80
80
|
if (this.sourceTexture === undefined) {
|
|
81
81
|
throw new Error("FrameGraphBloomTask: sourceTexture is required");
|
|
82
82
|
}
|
|
83
|
-
this.
|
|
83
|
+
this._addInternalDependencies(this.sourceTexture);
|
|
84
84
|
const sourceTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.sourceTexture);
|
|
85
85
|
const textureCreationOptions = {
|
|
86
86
|
size: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bloomTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/bloomTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,kDAA2C;AACrE,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,O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,CAAC,yBAAyB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAEnH,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,qBAAqB,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;QAEnJ,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,aAAa,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEzB,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEnF,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,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 } from \"core/index\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphBloomMergeTask } from \"./bloomMergeTask\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ThinBloomEffect } from \"core/PostProcesses/thinBloomEffect\";\r\nimport { FrameGraphExtractHighlightsTask } from \"./extractHighlightsTask\";\r\nimport { FrameGraphBlurTask } from \"./blurTask\";\r\n\r\n/**\r\n * Task which applies a bloom render effect.\r\n */\r\nexport class FrameGraphBloomTask extends FrameGraphTask {\r\n /**\r\n * The source texture to apply the bloom 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 destination texture to render the bloom effect 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 bloom effect.\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The bloom effect to apply.\r\n */\r\n public readonly bloom: ThinBloomEffect;\r\n\r\n /**\r\n * Whether the bloom effect is HDR.\r\n * When true, the bloom 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 /**\r\n * The name of the task.\r\n */\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(name: string) {\r\n this._name = name;\r\n if (this._downscale) {\r\n this._downscale.name = `${name} Downscale`;\r\n }\r\n\r\n if (this._blurX) {\r\n this._blurX.name = `${name} Blur X`;\r\n }\r\n\r\n if (this._blurY) {\r\n this._blurY.name = `${name} Blur Y`;\r\n }\r\n\r\n if (this._merge) {\r\n this._merge.name = `${name} Merge`;\r\n }\r\n }\r\n\r\n private readonly _downscale: FrameGraphExtractHighlightsTask;\r\n private readonly _blurX: FrameGraphBlurTask;\r\n private readonly _blurY: FrameGraphBlurTask;\r\n private readonly _merge: FrameGraphBloomMergeTask;\r\n private readonly _defaultPipelineTextureType: number;\r\n\r\n /**\r\n * Constructs a new bloom task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param engine The engine to use for the bloom effect.\r\n * @param weight Weight of the bloom effect.\r\n * @param kernel Kernel size of the bloom effect.\r\n * @param threshold Threshold of the bloom effect.\r\n * @param hdr Whether the bloom effect is HDR.\r\n * @param bloomScale The scale of the bloom effect. This value is multiplied by the source texture size to determine the bloom texture size.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, engine: AbstractEngine, weight: number, kernel: number, threshold: number, hdr = false, bloomScale = 0.5) {\r\n super(name, frameGraph);\r\n\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.bloom = new ThinBloomEffect(name, engine, bloomScale);\r\n this.bloom.threshold = threshold;\r\n this.bloom.kernel = kernel;\r\n this.bloom.weight = weight;\r\n\r\n this._downscale = new FrameGraphExtractHighlightsTask(`${name} Downscale`, this._frameGraph, this.bloom._downscale);\r\n this._blurX = new FrameGraphBlurTask(`${name} Blur X`, this._frameGraph, this.bloom._blurX);\r\n this._blurY = new FrameGraphBlurTask(`${name} Blur Y`, this._frameGraph, this.bloom._blurY);\r\n this._merge = new FrameGraphBloomMergeTask(`${name} Merge`, this._frameGraph, this.bloom._merge);\r\n\r\n this.onTexturesAllocatedObservable.add((context) => {\r\n this._downscale.onTexturesAllocatedObservable.notifyObservers(context);\r\n this._blurX.onTexturesAllocatedObservable.notifyObservers(context);\r\n this._blurY.onTexturesAllocatedObservable.notifyObservers(context);\r\n this._merge.onTexturesAllocatedObservable.notifyObservers(context);\r\n });\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this.bloom.isReady();\r\n }\r\n\r\n public record(): void {\r\n if (this.sourceTexture === undefined) {\r\n throw new Error(\"FrameGraphBloomTask: sourceTexture is required\");\r\n }\r\n\r\n this._internalDependencies.push(this.sourceTexture);\r\n\r\n const sourceTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.sourceTexture);\r\n\r\n const textureCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: {\r\n width: Math.floor(sourceTextureDescription.size.width * this.bloom.scale),\r\n height: Math.floor(sourceTextureDescription.size.height * this.bloom.scale),\r\n },\r\n options: {\r\n createMipMaps: false,\r\n types: [this._defaultPipelineTextureType],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n labels: [\"\"],\r\n },\r\n sizeIsPercentage: false,\r\n };\r\n\r\n const downscaleTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._downscale.name, textureCreationOptions);\r\n\r\n this._downscale.sourceTexture = this.sourceTexture;\r\n this._downscale.sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._downscale.destinationTexture = downscaleTextureHandle;\r\n this._downscale.record(true);\r\n\r\n const blurXTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurX.name, textureCreationOptions);\r\n\r\n this._blurX.sourceTexture = downscaleTextureHandle;\r\n this._blurX.sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurX.destinationTexture = blurXTextureHandle;\r\n this._blurX.record(true);\r\n\r\n const blurYTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurY.name, textureCreationOptions);\r\n\r\n this._blurY.sourceTexture = blurXTextureHandle;\r\n this._blurY.sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurY.destinationTexture = blurYTextureHandle;\r\n this._blurY.record(true);\r\n\r\n const sourceTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture);\r\n\r\n this._frameGraph.textureManager.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.blurTexture = blurYTextureHandle;\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._downscale.dispose();\r\n this._blurX.dispose();\r\n this._blurY.dispose();\r\n this._merge.dispose();\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"bloomTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/bloomTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,kDAA2C;AACrE,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IAiCnD;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAoB,IAAI,CAAC,IAAY;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI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AAa,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,aAAa,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEzB,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEnF,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,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 } from \"core/index\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphBloomMergeTask } from \"./bloomMergeTask\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ThinBloomEffect } from \"core/PostProcesses/thinBloomEffect\";\r\nimport { FrameGraphExtractHighlightsTask } from \"./extractHighlightsTask\";\r\nimport { FrameGraphBlurTask } from \"./blurTask\";\r\n\r\n/**\r\n * Task which applies a bloom render effect.\r\n */\r\nexport class FrameGraphBloomTask extends FrameGraphTask {\r\n /**\r\n * The source texture to apply the bloom 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 destination texture to render the bloom effect 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 bloom effect.\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The bloom effect to apply.\r\n */\r\n public readonly bloom: ThinBloomEffect;\r\n\r\n /**\r\n * Whether the bloom effect is HDR.\r\n * When true, the bloom 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 /**\r\n * The name of the task.\r\n */\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(name: string) {\r\n this._name = name;\r\n if (this._downscale) {\r\n this._downscale.name = `${name} Downscale`;\r\n }\r\n\r\n if (this._blurX) {\r\n this._blurX.name = `${name} Blur X`;\r\n }\r\n\r\n if (this._blurY) {\r\n this._blurY.name = `${name} Blur Y`;\r\n }\r\n\r\n if (this._merge) {\r\n this._merge.name = `${name} Merge`;\r\n }\r\n }\r\n\r\n private readonly _downscale: FrameGraphExtractHighlightsTask;\r\n private readonly _blurX: FrameGraphBlurTask;\r\n private readonly _blurY: FrameGraphBlurTask;\r\n private readonly _merge: FrameGraphBloomMergeTask;\r\n private readonly _defaultPipelineTextureType: number;\r\n\r\n /**\r\n * Constructs a new bloom task.\r\n * @param name Name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param engine The engine to use for the bloom effect.\r\n * @param weight Weight of the bloom effect.\r\n * @param kernel Kernel size of the bloom effect.\r\n * @param threshold Threshold of the bloom effect.\r\n * @param hdr Whether the bloom effect is HDR.\r\n * @param bloomScale The scale of the bloom effect. This value is multiplied by the source texture size to determine the bloom texture size.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, engine: AbstractEngine, weight: number, kernel: number, threshold: number, hdr = false, bloomScale = 0.5) {\r\n super(name, frameGraph);\r\n\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.bloom = new ThinBloomEffect(name, engine, bloomScale);\r\n this.bloom.threshold = threshold;\r\n this.bloom.kernel = kernel;\r\n this.bloom.weight = weight;\r\n\r\n this._downscale = new FrameGraphExtractHighlightsTask(`${name} Downscale`, this._frameGraph, this.bloom._downscale);\r\n this._blurX = new FrameGraphBlurTask(`${name} Blur X`, this._frameGraph, this.bloom._blurX);\r\n this._blurY = new FrameGraphBlurTask(`${name} Blur Y`, this._frameGraph, this.bloom._blurY);\r\n this._merge = new FrameGraphBloomMergeTask(`${name} Merge`, this._frameGraph, this.bloom._merge);\r\n\r\n this.onTexturesAllocatedObservable.add((context) => {\r\n this._downscale.onTexturesAllocatedObservable.notifyObservers(context);\r\n this._blurX.onTexturesAllocatedObservable.notifyObservers(context);\r\n this._blurY.onTexturesAllocatedObservable.notifyObservers(context);\r\n this._merge.onTexturesAllocatedObservable.notifyObservers(context);\r\n });\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this.bloom.isReady();\r\n }\r\n\r\n public record(): void {\r\n if (this.sourceTexture === undefined) {\r\n throw new Error(\"FrameGraphBloomTask: sourceTexture is required\");\r\n }\r\n\r\n this._addInternalDependencies(this.sourceTexture);\r\n\r\n const sourceTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.sourceTexture);\r\n\r\n const textureCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: {\r\n width: Math.floor(sourceTextureDescription.size.width * this.bloom.scale),\r\n height: Math.floor(sourceTextureDescription.size.height * this.bloom.scale),\r\n },\r\n options: {\r\n createMipMaps: false,\r\n types: [this._defaultPipelineTextureType],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n labels: [\"\"],\r\n },\r\n sizeIsPercentage: false,\r\n };\r\n\r\n const downscaleTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._downscale.name, textureCreationOptions);\r\n\r\n this._downscale.sourceTexture = this.sourceTexture;\r\n this._downscale.sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._downscale.destinationTexture = downscaleTextureHandle;\r\n this._downscale.record(true);\r\n\r\n const blurXTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurX.name, textureCreationOptions);\r\n\r\n this._blurX.sourceTexture = downscaleTextureHandle;\r\n this._blurX.sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurX.destinationTexture = blurXTextureHandle;\r\n this._blurX.record(true);\r\n\r\n const blurYTextureHandle = this._frameGraph.textureManager.createRenderTargetTexture(this._blurY.name, textureCreationOptions);\r\n\r\n this._blurY.sourceTexture = blurXTextureHandle;\r\n this._blurY.sourceSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n this._blurY.destinationTexture = blurYTextureHandle;\r\n this._blurY.record(true);\r\n\r\n const sourceTextureCreationOptions = this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture);\r\n\r\n this._frameGraph.textureManager.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.blurTexture = blurYTextureHandle;\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._downscale.dispose();\r\n this._blurX.dispose();\r\n this._blurY.dispose();\r\n this._merge.dispose();\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -17,18 +17,19 @@ export class FrameGraphCircleOfConfusionTask extends FrameGraphPostProcessTask {
|
|
|
17
17
|
* The sampling mode to use for the depth texture.
|
|
18
18
|
*/
|
|
19
19
|
this.depthSamplingMode = 2;
|
|
20
|
+
this.onTexturesAllocatedObservable.add((context) => {
|
|
21
|
+
context.setTextureSamplingMode(this.depthTexture, this.depthSamplingMode);
|
|
22
|
+
});
|
|
20
23
|
}
|
|
21
24
|
record(skipCreationOfDisabledPasses = false) {
|
|
22
25
|
if (this.sourceTexture === undefined || this.depthTexture === undefined || this.camera === undefined) {
|
|
23
26
|
throw new Error(`FrameGraphCircleOfConfusionTask "${this.name}": sourceTexture, depthTexture and camera are required`);
|
|
24
27
|
}
|
|
25
|
-
const pass = super.record(skipCreationOfDisabledPasses, (context) => {
|
|
26
|
-
context.setTextureSamplingMode(this.depthTexture, this.depthSamplingMode);
|
|
27
|
-
}, (context) => {
|
|
28
|
+
const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {
|
|
28
29
|
this.postProcess.camera = this.camera;
|
|
29
30
|
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "depthSampler", this.depthTexture);
|
|
30
31
|
});
|
|
31
|
-
this.
|
|
32
|
+
this._addInternalDependencies(this.depthTexture);
|
|
32
33
|
return pass;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circleOfConfusionTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,gCAAgC,EAAE,mEAA4D;AAEvG;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,yBAAyB;IAmB1E;;;;;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;QAnB9G;;WAEG;QACI,sBAAiB,GAAG,SAAS,CAAC,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"circleOfConfusionTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,gCAAgC,EAAE,mEAA4D;AAEvG;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,yBAAyB;IAmB1E;;;;;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;QAnB9G;;WAEG;QACI,sBAAiB,GAAG,SAAS,CAAC,6BAA6B,CAAC;QAkB/D,IAAI,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YAC/C,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;IACP,CAAC;IAEe,MAAM,CAAC,4BAA4B,GAAG,KAAK;QACvD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACnG,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,IAAI,wDAAwD,CAAC,CAAC;QAC3H,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,4BAA4B,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3E,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YACtC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACvG,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEjD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, FrameGraphTextureHandle, FrameGraphRenderPass, Camera } from \"core/index\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { ThinCircleOfConfusionPostProcess } from \"core/PostProcesses/thinCircleOfConfusionPostProcess\";\r\n\r\n/**\r\n * Task which applies a circle of confusion post process.\r\n */\r\nexport class FrameGraphCircleOfConfusionTask extends FrameGraphPostProcessTask {\r\n /**\r\n * The depth texture to use for the circle of confusion effect.\r\n * It must 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 to use for the circle of confusion effect.\r\n */\r\n public camera: Camera;\r\n\r\n public override readonly postProcess: ThinCircleOfConfusionPostProcess;\r\n\r\n /**\r\n * Constructs a new circle of confusion task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this 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?: ThinCircleOfConfusionPostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinCircleOfConfusionPostProcess(name, frameGraph.engine));\r\n\r\n this.onTexturesAllocatedObservable.add((context) => {\r\n context.setTextureSamplingMode(this.depthTexture, this.depthSamplingMode);\r\n });\r\n }\r\n\r\n public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined || this.depthTexture === undefined || this.camera === undefined) {\r\n throw new Error(`FrameGraphCircleOfConfusionTask \"${this.name}\": sourceTexture, depthTexture and camera are required`);\r\n }\r\n\r\n const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {\r\n this.postProcess.camera = this.camera;\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"depthSampler\", this.depthTexture);\r\n });\r\n\r\n this._addInternalDependencies(this.depthTexture);\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
@@ -9,17 +9,18 @@ export class FrameGraphDepthOfFieldBlurTask extends FrameGraphBlurTask {
|
|
|
9
9
|
constructor(name, frameGraph, thinPostProcess) {
|
|
10
10
|
super(name, frameGraph, thinPostProcess || new ThinDepthOfFieldBlurPostProcess(name, frameGraph.engine, new Vector2(1, 0), 10));
|
|
11
11
|
this.circleOfConfusionSamplingMode = 2;
|
|
12
|
+
this.onTexturesAllocatedObservable.add((context) => {
|
|
13
|
+
context.setTextureSamplingMode(this.circleOfConfusionTexture, this.circleOfConfusionSamplingMode);
|
|
14
|
+
});
|
|
12
15
|
}
|
|
13
16
|
record(skipCreationOfDisabledPasses = false) {
|
|
14
17
|
if (this.sourceTexture === undefined || this.circleOfConfusionTexture === undefined) {
|
|
15
18
|
throw new Error(`FrameGraphDepthOfFieldBlurTask "${this.name}": sourceTexture and circleOfConfusionTexture are required`);
|
|
16
19
|
}
|
|
17
|
-
const pass = super.record(skipCreationOfDisabledPasses, (context) => {
|
|
18
|
-
context.setTextureSamplingMode(this.circleOfConfusionTexture, this.circleOfConfusionSamplingMode);
|
|
19
|
-
}, (context) => {
|
|
20
|
+
const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {
|
|
20
21
|
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "circleOfConfusionSampler", this.circleOfConfusionTexture);
|
|
21
22
|
});
|
|
22
|
-
this.
|
|
23
|
+
this._addInternalDependencies(this.circleOfConfusionTexture);
|
|
23
24
|
return pass;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"depthOfFieldBlurTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,kEAA2D;AACrG,OAAO,EAAE,OAAO,EAAE,sCAA+B;AAEjD;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,kBAAkB;IAKlE,YAAY,IAAY,EAAE,UAAsB,EAAE,eAAiD;QAC/F,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,+BAA+B,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAH7H,kCAA6B,GAAG,SAAS,CAAC,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"depthOfFieldBlurTask.js","sourceRo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CAAC,CAAC;QAEH,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAE7D,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 { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphBlurTask } from \"./blurTask\";\r\nimport { ThinDepthOfFieldBlurPostProcess } from \"core/PostProcesses/thinDepthOfFieldBlurPostProcess\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class FrameGraphDepthOfFieldBlurTask extends FrameGraphBlurTask {\r\n public circleOfConfusionTexture: FrameGraphTextureHandle;\r\n\r\n public circleOfConfusionSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinDepthOfFieldBlurPostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinDepthOfFieldBlurPostProcess(name, frameGraph.engine, new Vector2(1, 0), 10));\r\n\r\n this.onTexturesAllocatedObservable.add((context) => {\r\n context.setTextureSamplingMode(this.circleOfConfusionTexture, this.circleOfConfusionSamplingMode);\r\n });\r\n }\r\n\r\n public override record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined || this.circleOfConfusionTexture === undefined) {\r\n throw new Error(`FrameGraphDepthOfFieldBlurTask \"${this.name}\": sourceTexture and circleOfConfusionTexture are required`);\r\n }\r\n\r\n const pass = super.record(skipCreationOfDisabledPasses, undefined, (context) => {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"circleOfConfusionSampler\", this.circleOfConfusionTexture);\r\n });\r\n\r\n this._addInternalDependencies(this.circleOfConfusionTexture);\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
@@ -23,10 +23,8 @@ export class FrameGraphDepthOfFieldMergeTask extends FrameGraphPostProcessTask {
|
|
|
23
23
|
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "blurStep" + (this.blurSteps.length - index - 1), handle);
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
|
-
this.
|
|
27
|
-
|
|
28
|
-
this._internalDependencies.push(handle);
|
|
29
|
-
}
|
|
26
|
+
this._addInternalDependencies(this.circleOfConfusionTexture);
|
|
27
|
+
this._addInternalDependencies(this.blurSteps);
|
|
30
28
|
return pass;
|
|
31
29
|
}
|
|
32
30
|
}
|
|
@@ -1 +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;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;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;QAK7C,IAAI,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YAC/C,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,6BAA6B,CAAC,CAAC;QACvH,CAAC,CAAC,CAAC;IACP,CAAC;IAEe,MAAM,CAAC,4BAA4B,GAAG,KAAK;QACvD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAA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,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;YAC9H,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC7D,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE9C,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\nimport { Constants } from \"../../../Engines/constants\";\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 this.onTexturesAllocatedObservable.add((context) => {\r\n context.setTextureSamplingMode(this.blurSteps[this.blurSteps.length - 1], Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n });\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 this._addInternalDependencies(this.circleOfConfusionTexture);\r\n this._addInternalDependencies(this.blurSteps);\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
|
|
@@ -19,6 +19,9 @@ export class FrameGraphPostProcessTask extends FrameGraphTask {
|
|
|
19
19
|
this.postProcess = postProcess;
|
|
20
20
|
this._postProcessDrawWrapper = this.postProcess.drawWrapper;
|
|
21
21
|
this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();
|
|
22
|
+
this.onTexturesAllocatedObservable.add((context) => {
|
|
23
|
+
context.setTextureSamplingMode(this.sourceTexture, this.sourceSamplingMode);
|
|
24
|
+
});
|
|
22
25
|
}
|
|
23
26
|
isReady() {
|
|
24
27
|
return this.postProcess.isReady();
|
|
@@ -33,11 +36,10 @@ export class FrameGraphPostProcessTask extends FrameGraphTask {
|
|
|
33
36
|
const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.outputTexture);
|
|
34
37
|
this._outputWidth = outputTextureDescription.size.width;
|
|
35
38
|
this._outputHeight = outputTextureDescription.size.height;
|
|
36
|
-
this.
|
|
39
|
+
this._addInternalDependencies(this.sourceTexture);
|
|
37
40
|
const pass = this._frameGraph.addRenderPass(this.name);
|
|
38
41
|
pass.setRenderTarget(this.outputTexture);
|
|
39
42
|
pass.setExecuteFunc((context) => {
|
|
40
|
-
context.setTextureSamplingMode(this.sourceTexture, this.sourceSamplingMode);
|
|
41
43
|
additionalExecute?.(context);
|
|
42
44
|
context.applyFullScreenEffect(this._postProcessDrawWrapper, () => {
|
|
43
45
|
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "textureSampler", this.sourceTexture);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postProcessTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/postProcessTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IA+BzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,WAA0B;QACxE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAhC5B;;WAEG;QACI,uBAAkB,GAAG,SAAS,CAAC,6BAA6B,CAAC;QA+BhE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;QAE5D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"postProcessTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/postProcessTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IA+BzD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,WAA0B;QACxE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAhC5B;;WAEG;QACI,uBAAkB,GAAG,SAAS,CAAC,6BAA6B,CAAC;QA+BhE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;QAE5D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,oBAAoB,EAA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Ae,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACzC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;YAC7B,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE;gBAC7D,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;gBACtG,kBAAkB,EAAE,CAAC,OAAO,CAAC,CAAC;gBAC9B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YAC5B,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,4BAA4B,EAAE,CAAC;YAChC,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;YAEnF,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjD,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;gBACpC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACP,CAAC;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.textureManager.createDanglingHandle();\r\n\r\n this.onTexturesAllocatedObservable.add((context) => {\r\n context.setTextureSamplingMode(this.sourceTexture, this.sourceSamplingMode);\r\n });\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.textureManager.getTextureCreationOptions(this.sourceTexture);\r\n sourceTextureCreationOptions.options.samples = 1;\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture, this.name, sourceTextureCreationOptions);\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.outputTexture);\r\n\r\n this._outputWidth = outputTextureDescription.size.width;\r\n this._outputHeight = outputTextureDescription.size.height;\r\n\r\n this._addInternalDependencies(this.sourceTexture);\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.outputTexture);\r\n pass.setExecuteFunc((context) => {\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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FrameGraph, FrameGraphTextureHandle, Scene, Camera, FrameGraphObjectList, FrameGraphRenderContext, ObjectRendererOptions, Nullable, Observer, FrameGraphShadowGeneratorTask } from "../../../index.js";
|
|
1
|
+
import type { FrameGraph, FrameGraphTextureHandle, Scene, Camera, FrameGraphObjectList, FrameGraphRenderContext, ObjectRendererOptions, Nullable, Observer, FrameGraphShadowGeneratorTask, FrameGraphRenderPass } from "../../../index.js";
|
|
2
2
|
import { FrameGraphTask } from "../../frameGraphTask";
|
|
3
3
|
import { ObjectRenderer } from "../../../Rendering/objectRenderer";
|
|
4
4
|
/**
|
|
@@ -74,7 +74,7 @@ export declare class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
74
74
|
*/
|
|
75
75
|
constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions, existingObjectRenderer?: ObjectRenderer);
|
|
76
76
|
isReady(): boolean;
|
|
77
|
-
record(skipCreationOfDisabledPasses?: boolean, additionalExecute?: (context: FrameGraphRenderContext) => void):
|
|
77
|
+
record(skipCreationOfDisabledPasses?: boolean, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass;
|
|
78
78
|
dispose(): void;
|
|
79
79
|
protected _setLightsForShadow(): void;
|
|
80
80
|
}
|
|
@@ -122,6 +122,7 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
122
122
|
passDisabled.setRenderTargetDepth(this.depthTexture);
|
|
123
123
|
passDisabled.setExecuteFunc((_context) => { });
|
|
124
124
|
}
|
|
125
|
+
return pass;
|
|
125
126
|
}
|
|
126
127
|
dispose() {
|
|
127
128
|
this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC;AAEjF;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,cAAc;IAkB5D;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;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,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7E,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC7E,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n FrameGraphObjectList,\r\n FrameGraphRenderContext,\r\n ObjectRendererOptions,\r\n Light,\r\n Nullable,\r\n Observer,\r\n FrameGraphShadowGeneratorTask,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\nimport { FrameGraphCascadedShadowGeneratorTask } from \"./csmShadowGeneratorTask\";\r\n\r\n/**\r\n * Task used to render objects to a texture.\r\n */\r\nexport class FrameGraphObjectRendererTask extends FrameGraphTask {\r\n /**\r\n * The destination texture where the objects will be rendered.\r\n */\r\n public destinationTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth attachment texture where the objects will be rendered (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The shadow generators used to render the objects (optional).\r\n */\r\n public shadowGenerators?: FrameGraphShadowGeneratorTask[] = [];\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used to render the objects.\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._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The list of objects to render.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * If depth testing should be enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * If depth writing should be enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * If shadows should be disabled (default is false).\r\n */\r\n public disableShadows = false;\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the destinationTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth 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 object renderer used to render the objects.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\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._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n protected readonly _scene: Scene;\r\n protected readonly _renderer: ObjectRenderer;\r\n protected _textureWidth: number;\r\n protected _textureHeight: number;\r\n protected _onBeforeRenderObservable: Nullable<Observer<number>> = null;\r\n protected _onAfterRenderObservable: Nullable<Observer<number>> = null;\r\n protected _externalObjectRenderer = false;\r\n\r\n /**\r\n * Constructs a new object 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 * @param options The options of the object renderer.\r\n * @param existingObjectRenderer An existing object renderer to use (optional). If provided, the options parameter will be ignored.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions, existingObjectRenderer?: ObjectRenderer) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n }\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false, additionalExecute?: (context: FrameGraphRenderContext) => void) {\r\n if (this.destinationTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: destinationTexture and objectList are required`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.destinationTexture);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle && this.destinationTexture !== backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil`\r\n );\r\n }\r\n if (this.depthTexture !== backbufferDepthStencilTextureHandle && this.destinationTexture === backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the destination is the back buffer color`\r\n );\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n this._setLightsForShadow();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.destinationTexture);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n additionalExecute?.(context);\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.destinationTexture);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n }\r\n\r\n public override dispose(): void {\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n protected _setLightsForShadow() {\r\n const lightsForShadow: Set<Light> = new Set();\r\n const shadowEnabled: Map<Light, boolean> = new Map();\r\n\r\n if (this.shadowGenerators) {\r\n for (const shadowGeneratorTask of this.shadowGenerators) {\r\n const shadowGenerator = shadowGeneratorTask.shadowGenerator;\r\n const light = shadowGenerator.getLight();\r\n if (light.isEnabled() && light.shadowEnabled) {\r\n lightsForShadow.add(light);\r\n if (FrameGraphCascadedShadowGeneratorTask.IsCascadedShadowGenerator(shadowGeneratorTask)) {\r\n light._shadowGenerators!.set(shadowGeneratorTask.camera, shadowGenerator);\r\n } else {\r\n light._shadowGenerators!.set(null, shadowGenerator);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._onBeforeRenderObservable = this._renderer.onBeforeRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n shadowEnabled.set(light, light.shadowEnabled);\r\n light.shadowEnabled = !this.disableShadows && lightsForShadow.has(light);\r\n }\r\n });\r\n\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n this._onAfterRenderObservable = this._renderer.onAfterRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n light.shadowEnabled = shadowEnabled.get(light)!;\r\n }\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC;AAEjF;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,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AM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC9C,KAAK,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7E,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC7E,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n FrameGraphObjectList,\r\n FrameGraphRenderContext,\r\n ObjectRendererOptions,\r\n Light,\r\n Nullable,\r\n Observer,\r\n FrameGraphShadowGeneratorTask,\r\n FrameGraphRenderPass,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\nimport { FrameGraphCascadedShadowGeneratorTask } from \"./csmShadowGeneratorTask\";\r\n\r\n/**\r\n * Task used to render objects to a texture.\r\n */\r\nexport class FrameGraphObjectRendererTask extends FrameGraphTask {\r\n /**\r\n * The destination texture where the objects will be rendered.\r\n */\r\n public destinationTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth attachment texture where the objects will be rendered (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The shadow generators used to render the objects (optional).\r\n */\r\n public shadowGenerators?: FrameGraphShadowGeneratorTask[] = [];\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used to render the objects.\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._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The list of objects to render.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * If depth testing should be enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * If depth writing should be enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * If shadows should be disabled (default is false).\r\n */\r\n public disableShadows = false;\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the destinationTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth 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 object renderer used to render the objects.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\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._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n protected readonly _scene: Scene;\r\n protected readonly _renderer: ObjectRenderer;\r\n protected _textureWidth: number;\r\n protected _textureHeight: number;\r\n protected _onBeforeRenderObservable: Nullable<Observer<number>> = null;\r\n protected _onAfterRenderObservable: Nullable<Observer<number>> = null;\r\n protected _externalObjectRenderer = false;\r\n\r\n /**\r\n * Constructs a new object 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 * @param options The options of the object renderer.\r\n * @param existingObjectRenderer An existing object renderer to use (optional). If provided, the options parameter will be ignored.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions, existingObjectRenderer?: ObjectRenderer) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n }\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass {\r\n if (this.destinationTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: destinationTexture and objectList are required`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.destinationTexture);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle && this.destinationTexture !== backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil`\r\n );\r\n }\r\n if (this.depthTexture !== backbufferDepthStencilTextureHandle && this.destinationTexture === backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the destination is the back buffer color`\r\n );\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n this._setLightsForShadow();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.destinationTexture);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n additionalExecute?.(context);\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.destinationTexture);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n protected _setLightsForShadow() {\r\n const lightsForShadow: Set<Light> = new Set();\r\n const shadowEnabled: Map<Light, boolean> = new Map();\r\n\r\n if (this.shadowGenerators) {\r\n for (const shadowGeneratorTask of this.shadowGenerators) {\r\n const shadowGenerator = shadowGeneratorTask.shadowGenerator;\r\n const light = shadowGenerator.getLight();\r\n if (light.isEnabled() && light.shadowEnabled) {\r\n lightsForShadow.add(light);\r\n if (FrameGraphCascadedShadowGeneratorTask.IsCascadedShadowGenerator(shadowGeneratorTask)) {\r\n light._shadowGenerators!.set(shadowGeneratorTask.camera, shadowGenerator);\r\n } else {\r\n light._shadowGenerators!.set(null, shadowGenerator);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._onBeforeRenderObservable = this._renderer.onBeforeRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n shadowEnabled.set(light, light.shadowEnabled);\r\n light.shadowEnabled = !this.disableShadows && lightsForShadow.has(light);\r\n }\r\n });\r\n\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n this._onAfterRenderObservable = this._renderer.onAfterRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n light.shadowEnabled = shadowEnabled.get(light)!;\r\n }\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FrameGraph, Scene, DrawWrapper, ObjectRendererOptions } from "../../../index.js";
|
|
1
|
+
import type { FrameGraph, Scene, DrawWrapper, ObjectRendererOptions, FrameGraphRenderPass } from "../../../index.js";
|
|
2
2
|
import { FrameGraphObjectRendererTask } from "./objectRendererTask";
|
|
3
3
|
import { ThinTAAPostProcess } from "../../../PostProcesses/thinTAAPostProcess.js";
|
|
4
4
|
/**
|
|
@@ -18,5 +18,5 @@ export declare class FrameGraphTAAObjectRendererTask extends FrameGraphObjectRen
|
|
|
18
18
|
* @param options The options of the object renderer.
|
|
19
19
|
*/
|
|
20
20
|
constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions);
|
|
21
|
-
record():
|
|
21
|
+
record(): FrameGraphRenderPass;
|
|
22
22
|
}
|
|
@@ -98,6 +98,7 @@ export class FrameGraphTAAObjectRendererTask extends FrameGraphObjectRendererTas
|
|
|
98
98
|
passDisabled.setExecuteFunc((context) => {
|
|
99
99
|
context.copyTexture(this.destinationTexture);
|
|
100
100
|
});
|
|
101
|
+
return pass;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
//# sourceMappingURL=taaObjectRendererTask.js.map
|