@onerjs/core 8.28.6 → 8.28.8
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/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.d.ts +55 -0
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.js +147 -0
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -1
- package/FrameGraph/Node/Blocks/index.js +1 -1
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +1 -6
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/taaTask.d.ts +29 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js +102 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -0
- package/FrameGraph/frameGraphTextureManager.d.ts +9 -0
- package/FrameGraph/frameGraphTextureManager.js +15 -0
- package/FrameGraph/frameGraphTextureManager.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -1
- package/FrameGraph/index.js +1 -1
- package/FrameGraph/index.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.js +4 -3
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Lights/pointLight.js +6 -4
- package/Lights/pointLight.js.map +1 -1
- package/Lights/rectAreaLight.js +6 -4
- package/Lights/rectAreaLight.js.map +1 -1
- package/Lights/spotLight.js +3 -2
- package/Lights/spotLight.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +1 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +11 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +74 -27
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/PBR/index.d.ts +1 -1
- package/Materials/PBR/index.js +1 -1
- package/Materials/PBR/index.js.map +1 -1
- package/Materials/PBR/{openPbrMaterial.d.ts → openpbrMaterial.d.ts} +17 -0
- package/Materials/PBR/{openPbrMaterial.js → openpbrMaterial.js} +33 -5
- package/Materials/PBR/openpbrMaterial.js.map +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +1 -1
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/material.d.ts +7 -3
- package/Materials/material.js +11 -7
- package/Materials/material.js.map +1 -1
- package/Materials/standardMaterial.js +1 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.vector.d.ts +1 -1
- package/Maths/math.vector.js +1 -1
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/mesh.js +9 -0
- package/Meshes/mesh.js.map +1 -1
- package/Morph/morphTargetManager.d.ts +2 -0
- package/Morph/morphTargetManager.js +19 -1
- package/Morph/morphTargetManager.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.d.ts +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +4 -22
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
- package/PostProcesses/thinTAAPostProcess.d.ts +10 -5
- package/PostProcesses/thinTAAPostProcess.js +37 -7
- package/PostProcesses/thinTAAPostProcess.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/boundingBoxRenderer.js +6 -1
- package/Rendering/boundingBoxRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.js +4 -0
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +10 -2
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +4 -4
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/Shaders/gaussianSplattingDepth.fragment.d.ts +5 -0
- package/Shaders/gaussianSplattingDepth.fragment.js +11 -0
- package/Shaders/gaussianSplattingDepth.fragment.js.map +1 -0
- package/Shaders/gaussianSplattingDepth.vertex.d.ts +8 -0
- package/Shaders/gaussianSplattingDepth.vertex.js +17 -0
- package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +7 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +4 -4
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrFragmentSamplersDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.fragment.d.ts +6 -0
- package/ShadersWGSL/gaussianSplattingDepth.fragment.js +17 -0
- package/ShadersWGSL/gaussianSplattingDepth.fragment.js.map +1 -0
- package/ShadersWGSL/gaussianSplattingDepth.vertex.d.ts +8 -0
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js +19 -0
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -0
- package/package.json +1 -1
- package/scene.d.ts +3 -1
- package/scene.js +6 -5
- package/scene.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.d.ts +0 -48
- package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js +0 -119
- package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js.map +0 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.d.ts +0 -24
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +0 -109
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +0 -1
- package/Materials/PBR/openPbrMaterial.js.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
3
|
-
import { textureSizeIsObject } from "../../../Materials/Textures/textureCreationOptions.js";
|
|
4
3
|
/**
|
|
5
4
|
* Task which applies a post process.
|
|
6
5
|
*/
|
|
@@ -71,11 +70,7 @@ export class FrameGraphPostProcessTask extends FrameGraphTask {
|
|
|
71
70
|
this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthAttachmentTexture, this.depthAttachmentTexture);
|
|
72
71
|
}
|
|
73
72
|
if (sourceTextureCreationOptions) {
|
|
74
|
-
const sourceSize =
|
|
75
|
-
? textureSizeIsObject(sourceTextureCreationOptions.size)
|
|
76
|
-
? sourceTextureCreationOptions.size
|
|
77
|
-
: { width: sourceTextureCreationOptions.size, height: sourceTextureCreationOptions.size }
|
|
78
|
-
: this._frameGraph.textureManager.getAbsoluteDimensions(sourceTextureCreationOptions.size);
|
|
73
|
+
const sourceSize = this._frameGraph.textureManager.getTextureAbsoluteDimensions(sourceTextureCreationOptions);
|
|
79
74
|
this._sourceWidth = sourceSize.width;
|
|
80
75
|
this._sourceHeight = sourceSize.height;
|
|
81
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postProcessTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/postProcessTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAEzF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IA+EzD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACxC,CAAC;IAQD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,WAA0B;QACxE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QA3F5B;;WAEG;QACI,uBAAkB,GAAG,SAAS,CAAC,6BAA6B,CAAC;QAmBpE;;;;;WAKG;QACI,kBAAa,GAAG,KAAK,CAAC;QAE7B;;;;;WAKG;QACI,oBAAe,GAAG,KAAK,CAAC;QAE/B;;;WAGG;QACI,sBAAiB,GAAG,KAAK,CAAC;QAEjC;;WAEG;QACI,iBAAY,GAAG,KAAK,CAAC;QAE5B;;WAEG;QACI,cAAS,GAAG,IAAI,CAAC;QAyCpB,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;QAC5E,IAAI,CAAC,4BAA4B,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC;IAC/F,CAAC;IAEe,OAAO;QACnB,OA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raphRenderPass, FrameGraphRenderContext, EffectWrapper, IStencilState } from \"core/index\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { textureSizeIsObject } from \"../../../Materials/Textures/textureCreationOptions\";\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 * It's allowed to be undefined if the post process does not require a source texture.\r\n * In that case, targetTexture must be provided.\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 target 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 targetTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The stencil state to use for the post process (optional).\r\n */\r\n public stencilState?: IStencilState;\r\n\r\n /**\r\n * The depth attachment texture to use for the post process (optional).\r\n * Note that a post-process task never writes to the depth buffer: attaching a depth texture is only useful if you want to test against the depth/stencil aspect or write to the stencil buffer.\r\n */\r\n public depthAttachmentTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * If true, the depth attachment will be read-only.\r\n * This means that the post process will not write to the depth buffer.\r\n * Setting depthReadOnly and stencilReadOnly to true is useful when you want to also be able to bind this same depth/stencil attachment to a shader.\r\n * Note that it will only work in WebGPU, as WebGL does not support read-only depth/stencil attachments.\r\n */\r\n public depthReadOnly = false;\r\n\r\n /**\r\n * If true, the stencil attachment will be read-only.\r\n * This means that the post process will not write to the stencil buffer.\r\n * Setting depthReadOnly and stencilReadOnly to true is useful when you want to also be able to bind this same depth/stencil attachment to a shader.\r\n * Note that it will only work in WebGPU, as WebGL does not support read-only depth/stencil attachments.\r\n */\r\n public stencilReadOnly = false;\r\n\r\n /**\r\n * If true, color write will be disabled when applying the post process.\r\n * This means that the post process will not write to the color buffer.\r\n */\r\n public disableColorWrite = false;\r\n\r\n /**\r\n * If true, the post process will be generated by a back face full-screen quad (CW order).\r\n */\r\n public drawBackFace = false;\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 * The output texture of the post process.\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 depthAttachmentTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthAttachmentTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The post process to apply.\r\n */\r\n public readonly postProcess: EffectWrapper;\r\n\r\n /**\r\n * The draw wrapper used by the post process\r\n */\r\n public get drawWrapper() {\r\n return this._postProcessDrawWrapper;\r\n }\r\n\r\n protected readonly _postProcessDrawWrapper: DrawWrapper;\r\n protected _sourceWidth: number;\r\n protected _sourceHeight: number;\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 this.outputDepthAttachmentTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this.postProcess.isReady();\r\n }\r\n\r\n public record(\r\n skipCreationOfDisabledPasses = false,\r\n additionalExecute?: (context: FrameGraphRenderContext) => void,\r\n additionalBindings?: (context: FrameGraphRenderContext) => void\r\n ): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined && this.targetTexture === undefined) {\r\n throw new Error(`FrameGraphPostProcessTask \"${this.name}\": sourceTexture or targetTexture is required`);\r\n }\r\n\r\n const sourceTextureCreationOptions = this.sourceTexture !== undefined ? this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture) : undefined;\r\n if (sourceTextureCreationOptions) {\r\n sourceTextureCreationOptions.options.samples = 1;\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture, this.name, sourceTextureCreationOptions);\r\n if (this.depthAttachmentTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthAttachmentTexture, this.depthAttachmentTexture);\r\n }\r\n\r\n if (sourceTextureCreationOptions) {\r\n const sourceSize = !sourceTextureCreationOptions.sizeIsPercentage\r\n ? textureSizeIsObject(sourceTextureCreationOptions.size)\r\n ? sourceTextureCreationOptions.size\r\n : { width: sourceTextureCreationOptions.size, height: sourceTextureCreationOptions.size }\r\n : this._frameGraph.textureManager.getAbsoluteDimensions(sourceTextureCreationOptions.size);\r\n\r\n this._sourceWidth = sourceSize.width;\r\n this._sourceHeight = sourceSize.height;\r\n }\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 const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.depthReadOnly = this.depthReadOnly;\r\n pass.stencilReadOnly = this.stencilReadOnly;\r\n\r\n pass.addDependencies(this.sourceTexture);\r\n\r\n pass.setRenderTarget(this.outputTexture);\r\n pass.setRenderTargetDepth(this.depthAttachmentTexture);\r\n pass.setExecuteFunc((context) => {\r\n if (this.sourceTexture !== undefined) {\r\n context.setTextureSamplingMode(this.sourceTexture, this.sourceSamplingMode);\r\n }\r\n additionalExecute?.(context);\r\n context.applyFullScreenEffect(\r\n this._postProcessDrawWrapper,\r\n () => {\r\n if (this.sourceTexture !== undefined) {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"textureSampler\", this.sourceTexture);\r\n }\r\n additionalBindings?.(context);\r\n this.postProcess.bind();\r\n },\r\n this.stencilState,\r\n this.disableColorWrite,\r\n this.drawBackFace,\r\n this.depthTest\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.depthReadOnly = this.depthReadOnly;\r\n passDisabled.stencilReadOnly = this.stencilReadOnly;\r\n\r\n passDisabled.addDependencies(this.sourceTexture);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n passDisabled.setRenderTargetDepth(this.depthAttachmentTexture);\r\n passDisabled.setExecuteFunc((context) => {\r\n if (this.sourceTexture !== undefined) {\r\n context.copyTexture(this.sourceTexture);\r\n }\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
|
+
{"version":3,"file":"postProcessTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/postProcessTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IA+EzD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACxC,CAAC;IAQD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,WAA0B;QACxE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QA3F5B;;WAEG;QACI,uBAAkB,GAAG,SAAS,CAAC,6BAA6B,CAAC;QAmBpE;;;;;WAKG;QACI,kBAAa,GAAG,KAAK,CAAC;QAE7B;;;;;WAKG;QACI,oBAAe,GAAG,KAAK,CAAC;QAE/B;;;WAGG;QACI,sBAAiB,GAAG,KAAK,CAAC;QAEjC;;WAEG;QACI,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AAC,OAAO,EAAE,CAAC;QAC3B,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphTextureHandle, DrawWrapper, FrameGraphRenderPass, FrameGraphRenderContext, EffectWrapper, IStencilState } 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 * It's allowed to be undefined if the post process does not require a source texture.\r\n * In that case, targetTexture must be provided.\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 target 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 targetTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The stencil state to use for the post process (optional).\r\n */\r\n public stencilState?: IStencilState;\r\n\r\n /**\r\n * The depth attachment texture to use for the post process (optional).\r\n * Note that a post-process task never writes to the depth buffer: attaching a depth texture is only useful if you want to test against the depth/stencil aspect or write to the stencil buffer.\r\n */\r\n public depthAttachmentTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * If true, the depth attachment will be read-only.\r\n * This means that the post process will not write to the depth buffer.\r\n * Setting depthReadOnly and stencilReadOnly to true is useful when you want to also be able to bind this same depth/stencil attachment to a shader.\r\n * Note that it will only work in WebGPU, as WebGL does not support read-only depth/stencil attachments.\r\n */\r\n public depthReadOnly = false;\r\n\r\n /**\r\n * If true, the stencil attachment will be read-only.\r\n * This means that the post process will not write to the stencil buffer.\r\n * Setting depthReadOnly and stencilReadOnly to true is useful when you want to also be able to bind this same depth/stencil attachment to a shader.\r\n * Note that it will only work in WebGPU, as WebGL does not support read-only depth/stencil attachments.\r\n */\r\n public stencilReadOnly = false;\r\n\r\n /**\r\n * If true, color write will be disabled when applying the post process.\r\n * This means that the post process will not write to the color buffer.\r\n */\r\n public disableColorWrite = false;\r\n\r\n /**\r\n * If true, the post process will be generated by a back face full-screen quad (CW order).\r\n */\r\n public drawBackFace = false;\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 * The output texture of the post process.\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 depthAttachmentTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthAttachmentTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The post process to apply.\r\n */\r\n public readonly postProcess: EffectWrapper;\r\n\r\n /**\r\n * The draw wrapper used by the post process\r\n */\r\n public get drawWrapper() {\r\n return this._postProcessDrawWrapper;\r\n }\r\n\r\n protected readonly _postProcessDrawWrapper: DrawWrapper;\r\n protected _sourceWidth: number;\r\n protected _sourceHeight: number;\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 this.outputDepthAttachmentTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this.postProcess.isReady();\r\n }\r\n\r\n public record(\r\n skipCreationOfDisabledPasses = false,\r\n additionalExecute?: (context: FrameGraphRenderContext) => void,\r\n additionalBindings?: (context: FrameGraphRenderContext) => void\r\n ): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined && this.targetTexture === undefined) {\r\n throw new Error(`FrameGraphPostProcessTask \"${this.name}\": sourceTexture or targetTexture is required`);\r\n }\r\n\r\n const sourceTextureCreationOptions = this.sourceTexture !== undefined ? this._frameGraph.textureManager.getTextureCreationOptions(this.sourceTexture) : undefined;\r\n if (sourceTextureCreationOptions) {\r\n sourceTextureCreationOptions.options.samples = 1;\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture, this.name, sourceTextureCreationOptions);\r\n if (this.depthAttachmentTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthAttachmentTexture, this.depthAttachmentTexture);\r\n }\r\n\r\n if (sourceTextureCreationOptions) {\r\n const sourceSize = this._frameGraph.textureManager.getTextureAbsoluteDimensions(sourceTextureCreationOptions);\r\n\r\n this._sourceWidth = sourceSize.width;\r\n this._sourceHeight = sourceSize.height;\r\n }\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 const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.depthReadOnly = this.depthReadOnly;\r\n pass.stencilReadOnly = this.stencilReadOnly;\r\n\r\n pass.addDependencies(this.sourceTexture);\r\n\r\n pass.setRenderTarget(this.outputTexture);\r\n pass.setRenderTargetDepth(this.depthAttachmentTexture);\r\n pass.setExecuteFunc((context) => {\r\n if (this.sourceTexture !== undefined) {\r\n context.setTextureSamplingMode(this.sourceTexture, this.sourceSamplingMode);\r\n }\r\n additionalExecute?.(context);\r\n context.applyFullScreenEffect(\r\n this._postProcessDrawWrapper,\r\n () => {\r\n if (this.sourceTexture !== undefined) {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"textureSampler\", this.sourceTexture);\r\n }\r\n additionalBindings?.(context);\r\n this.postProcess.bind();\r\n },\r\n this.stencilState,\r\n this.disableColorWrite,\r\n this.drawBackFace,\r\n this.depthTest\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.depthReadOnly = this.depthReadOnly;\r\n passDisabled.stencilReadOnly = this.stencilReadOnly;\r\n\r\n passDisabled.addDependencies(this.sourceTexture);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n passDisabled.setRenderTargetDepth(this.depthAttachmentTexture);\r\n passDisabled.setExecuteFunc((context) => {\r\n if (this.sourceTexture !== undefined) {\r\n context.copyTexture(this.sourceTexture);\r\n }\r\n });\r\n }\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n this.postProcess.dispose();\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FrameGraph, FrameGraphRenderPass, FrameGraphObjectRendererTask, Observer, ObjectRenderer, FrameGraphTextureHandle, Scene } from "../../../index.js";
|
|
2
|
+
import { ThinTAAPostProcess } from "../../../PostProcesses/thinTAAPostProcess.js";
|
|
3
|
+
import { FrameGraphPostProcessTask } from "./postProcessTask.js";
|
|
4
|
+
/**
|
|
5
|
+
* Task which applies a Temporal Anti-Aliasing post process.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FrameGraphTAATask extends FrameGraphPostProcessTask {
|
|
8
|
+
readonly postProcess: ThinTAAPostProcess;
|
|
9
|
+
/**
|
|
10
|
+
* The object renderer task used to render the scene objects.
|
|
11
|
+
*/
|
|
12
|
+
objectRendererTask: FrameGraphObjectRendererTask;
|
|
13
|
+
/**
|
|
14
|
+
* The handle to the velocity texture. Only needed if postProcess.reprojectHistory is enabled.
|
|
15
|
+
* Note that you must use the linear velocity texture!
|
|
16
|
+
*/
|
|
17
|
+
velocityTexture: FrameGraphTextureHandle;
|
|
18
|
+
protected _onBeforeRenderSceneObserver: Observer<Scene>;
|
|
19
|
+
protected _initRenderingObserver: Observer<ObjectRenderer>;
|
|
20
|
+
/**
|
|
21
|
+
* Constructs a new Temporal Anti-Aliasing task.
|
|
22
|
+
* @param name The name of the task.
|
|
23
|
+
* @param frameGraph The frame graph this task is associated with.
|
|
24
|
+
* @param thinPostProcess The thin post process to use for the Temporal Anti-Aliasing effect. If not provided, a new one will be created.
|
|
25
|
+
*/
|
|
26
|
+
constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinTAAPostProcess);
|
|
27
|
+
record(): FrameGraphRenderPass;
|
|
28
|
+
dispose(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ThinTAAPostProcess } from "../../../PostProcesses/thinTAAPostProcess.js";
|
|
2
|
+
import { FrameGraphPostProcessTask } from "./postProcessTask.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Task which applies a Temporal Anti-Aliasing post process.
|
|
6
|
+
*/
|
|
7
|
+
export class FrameGraphTAATask extends FrameGraphPostProcessTask {
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new Temporal Anti-Aliasing task.
|
|
10
|
+
* @param name The name of the task.
|
|
11
|
+
* @param frameGraph The frame graph this task is associated with.
|
|
12
|
+
* @param thinPostProcess The thin post process to use for the Temporal Anti-Aliasing effect. If not provided, a new one will be created.
|
|
13
|
+
*/
|
|
14
|
+
constructor(name, frameGraph, thinPostProcess) {
|
|
15
|
+
super(name, frameGraph, thinPostProcess || new ThinTAAPostProcess(name, frameGraph.scene));
|
|
16
|
+
}
|
|
17
|
+
record() {
|
|
18
|
+
if (this.sourceTexture === undefined || this.objectRendererTask === undefined) {
|
|
19
|
+
throw new Error(`FrameGraphPostProcessTask "${this.name}": sourceTexture and objectRendererTask are required`);
|
|
20
|
+
}
|
|
21
|
+
this._frameGraph.scene.onBeforeRenderObservable.remove(this._onBeforeRenderSceneObserver);
|
|
22
|
+
this._onBeforeRenderSceneObserver = this._frameGraph.scene.onBeforeRenderObservable.add(() => {
|
|
23
|
+
if (this.postProcess.reprojectHistory && !this.disabled) {
|
|
24
|
+
this.postProcess._updateJitter();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const objectRenderer = this.objectRendererTask.objectRenderer;
|
|
28
|
+
objectRenderer.onInitRenderingObservable.remove(this._initRenderingObserver);
|
|
29
|
+
this._initRenderingObserver = objectRenderer.onInitRenderingObservable.add(() => {
|
|
30
|
+
if (!this.postProcess.reprojectHistory && !this.disabled) {
|
|
31
|
+
this.postProcess._updateJitter();
|
|
32
|
+
// We pass false to this.camera.getProjectionMatrix() when TAA is enabled to avoid overwriting the projection matrix calculated by the call to this.postProcess.updateJitter()
|
|
33
|
+
const camera = objectRenderer.activeCamera;
|
|
34
|
+
this._frameGraph.scene.setTransformMatrix(camera.getViewMatrix(), camera.getProjectionMatrix(this.postProcess.disabled));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const textureManager = this._frameGraph.textureManager;
|
|
38
|
+
const sourceSize = textureManager.getTextureAbsoluteDimensions(this.sourceTexture);
|
|
39
|
+
this._sourceWidth = this._outputWidth = sourceSize.width;
|
|
40
|
+
this._sourceHeight = this._outputHeight = sourceSize.height;
|
|
41
|
+
const renderTextureSize = textureManager.getTextureAbsoluteDimensions(this.objectRendererTask.outputTexture);
|
|
42
|
+
this.postProcess.textureWidth = renderTextureSize.width;
|
|
43
|
+
this.postProcess.textureHeight = renderTextureSize.height;
|
|
44
|
+
const pingPongTextureCreationOptions = {
|
|
45
|
+
size: sourceSize,
|
|
46
|
+
options: {
|
|
47
|
+
createMipMaps: false,
|
|
48
|
+
types: [2],
|
|
49
|
+
formats: [5],
|
|
50
|
+
samples: 1,
|
|
51
|
+
useSRGBBuffers: [false],
|
|
52
|
+
creationFlags: [0],
|
|
53
|
+
labels: [""],
|
|
54
|
+
},
|
|
55
|
+
sizeIsPercentage: false,
|
|
56
|
+
isHistoryTexture: true,
|
|
57
|
+
};
|
|
58
|
+
const pingPongHandle = textureManager.createRenderTargetTexture(`${this.name} history`, pingPongTextureCreationOptions);
|
|
59
|
+
textureManager.resolveDanglingHandle(this.outputTexture, pingPongHandle);
|
|
60
|
+
const pass = this._frameGraph.addRenderPass(this.name);
|
|
61
|
+
pass.depthReadOnly = this.depthReadOnly;
|
|
62
|
+
pass.stencilReadOnly = this.stencilReadOnly;
|
|
63
|
+
pass.addDependencies(this.sourceTexture);
|
|
64
|
+
pass.setRenderTarget(this.outputTexture);
|
|
65
|
+
pass.setRenderTargetDepth(this.depthAttachmentTexture);
|
|
66
|
+
pass.setExecuteFunc((context) => {
|
|
67
|
+
objectRenderer.dontSetTransformationMatrix = !this.postProcess.reprojectHistory;
|
|
68
|
+
this.postProcess.camera = objectRenderer.activeCamera;
|
|
69
|
+
if (this.sourceTexture !== undefined) {
|
|
70
|
+
context.setTextureSamplingMode(this.sourceTexture, this.sourceSamplingMode);
|
|
71
|
+
}
|
|
72
|
+
if (this.velocityTexture !== undefined) {
|
|
73
|
+
context.setTextureSamplingMode(this.velocityTexture, 2);
|
|
74
|
+
}
|
|
75
|
+
context.setTextureSamplingMode(pingPongHandle, 2);
|
|
76
|
+
context.applyFullScreenEffect(this._postProcessDrawWrapper, () => {
|
|
77
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "textureSampler", this.sourceTexture);
|
|
78
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "historySampler", pingPongHandle);
|
|
79
|
+
if (this.postProcess.reprojectHistory && this.velocityTexture !== undefined) {
|
|
80
|
+
context.bindTextureHandle(this._postProcessDrawWrapper.effect, "velocitySampler", this.velocityTexture);
|
|
81
|
+
}
|
|
82
|
+
this.postProcess.bind();
|
|
83
|
+
}, this.stencilState, this.disableColorWrite, this.drawBackFace, this.depthTest);
|
|
84
|
+
});
|
|
85
|
+
const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
|
|
86
|
+
passDisabled.depthReadOnly = this.depthReadOnly;
|
|
87
|
+
passDisabled.stencilReadOnly = this.stencilReadOnly;
|
|
88
|
+
passDisabled.addDependencies(this.sourceTexture);
|
|
89
|
+
passDisabled.setRenderTarget(this.outputTexture);
|
|
90
|
+
passDisabled.setRenderTargetDepth(this.depthAttachmentTexture);
|
|
91
|
+
passDisabled.setExecuteFunc((context) => {
|
|
92
|
+
context.copyTexture(this.sourceTexture);
|
|
93
|
+
});
|
|
94
|
+
return pass;
|
|
95
|
+
}
|
|
96
|
+
dispose() {
|
|
97
|
+
this.objectRendererTask?.objectRenderer.onInitRenderingObservable.remove(this._initRenderingObserver);
|
|
98
|
+
this._frameGraph.scene.onBeforeRenderObservable.remove(this._onBeforeRenderSceneObserver);
|
|
99
|
+
super.dispose();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=taaTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taaTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/taaTask.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,qDAA8C;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,sCAA+B;AAEnD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,yBAAyB;IAiB5D;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,eAAoC;QAClF,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/F,CAAC;IAEe,MAAM;QAClB,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YAC5E,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,IAAI,sDAAsD,CAAC,CAAC;QACnH,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,wBAAw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EACtB,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,SAAS,CACjB,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEnF,YAAY,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QAChD,YAAY,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAEpD,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAEjD,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC/D,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAc,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,kBAAkB,EAAE,cAAc,CAAC,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACtG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC1F,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphRenderPass,\r\n FrameGraphObjectRendererTask,\r\n FrameGraphTextureCreationOptions,\r\n Observer,\r\n ObjectRenderer,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n} from \"core/index\";\r\nimport { ThinTAAPostProcess } from \"core/PostProcesses/thinTAAPostProcess\";\r\nimport { FrameGraphPostProcessTask } from \"./postProcessTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\n/**\r\n * Task which applies a Temporal Anti-Aliasing post process.\r\n */\r\nexport class FrameGraphTAATask extends FrameGraphPostProcessTask {\r\n public override readonly postProcess: ThinTAAPostProcess;\r\n\r\n /**\r\n * The object renderer task used to render the scene objects.\r\n */\r\n public objectRendererTask: FrameGraphObjectRendererTask;\r\n\r\n /**\r\n * The handle to the velocity texture. Only needed if postProcess.reprojectHistory is enabled.\r\n * Note that you must use the linear velocity texture!\r\n */\r\n public velocityTexture: FrameGraphTextureHandle;\r\n\r\n protected _onBeforeRenderSceneObserver: Observer<Scene>;\r\n protected _initRenderingObserver: Observer<ObjectRenderer>;\r\n\r\n /**\r\n * Constructs a new Temporal Anti-Aliasing task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n * @param thinPostProcess The thin post process to use for the Temporal Anti-Aliasing effect. If not provided, a new one will be created.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, thinPostProcess?: ThinTAAPostProcess) {\r\n super(name, frameGraph, thinPostProcess || new ThinTAAPostProcess(name, frameGraph.scene));\r\n }\r\n\r\n public override record(): FrameGraphRenderPass {\r\n if (this.sourceTexture === undefined || this.objectRendererTask === undefined) {\r\n throw new Error(`FrameGraphPostProcessTask \"${this.name}\": sourceTexture and objectRendererTask are required`);\r\n }\r\n\r\n this._frameGraph.scene.onBeforeRenderObservable.remove(this._onBeforeRenderSceneObserver);\r\n this._onBeforeRenderSceneObserver = this._frameGraph.scene.onBeforeRenderObservable.add(() => {\r\n if (this.postProcess.reprojectHistory && !this.disabled) {\r\n this.postProcess._updateJitter();\r\n }\r\n });\r\n\r\n const objectRenderer = this.objectRendererTask.objectRenderer;\r\n\r\n objectRenderer.onInitRenderingObservable.remove(this._initRenderingObserver);\r\n this._initRenderingObserver = objectRenderer.onInitRenderingObservable.add(() => {\r\n if (!this.postProcess.reprojectHistory && !this.disabled) {\r\n this.postProcess._updateJitter();\r\n\r\n // We pass false to this.camera.getProjectionMatrix() when TAA is enabled to avoid overwriting the projection matrix calculated by the call to this.postProcess.updateJitter()\r\n const camera = objectRenderer.activeCamera!;\r\n this._frameGraph.scene.setTransformMatrix(camera.getViewMatrix(), camera.getProjectionMatrix(this.postProcess.disabled));\r\n }\r\n });\r\n\r\n const textureManager = this._frameGraph.textureManager;\r\n const sourceSize = textureManager.getTextureAbsoluteDimensions(this.sourceTexture);\r\n\r\n this._sourceWidth = this._outputWidth = sourceSize.width;\r\n this._sourceHeight = this._outputHeight = sourceSize.height;\r\n\r\n const renderTextureSize = textureManager.getTextureAbsoluteDimensions(this.objectRendererTask.outputTexture);\r\n\r\n this.postProcess.textureWidth = renderTextureSize.width;\r\n this.postProcess.textureHeight = renderTextureSize.height;\r\n\r\n const pingPongTextureCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: sourceSize,\r\n options: {\r\n createMipMaps: false,\r\n types: [Constants.TEXTURETYPE_HALF_FLOAT],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n creationFlags: [0],\r\n labels: [\"\"],\r\n },\r\n sizeIsPercentage: false,\r\n isHistoryTexture: true,\r\n };\r\n\r\n const pingPongHandle = textureManager.createRenderTargetTexture(`${this.name} history`, pingPongTextureCreationOptions);\r\n\r\n textureManager.resolveDanglingHandle(this.outputTexture, pingPongHandle);\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.depthReadOnly = this.depthReadOnly;\r\n pass.stencilReadOnly = this.stencilReadOnly;\r\n\r\n pass.addDependencies(this.sourceTexture);\r\n\r\n pass.setRenderTarget(this.outputTexture);\r\n pass.setRenderTargetDepth(this.depthAttachmentTexture);\r\n pass.setExecuteFunc((context) => {\r\n objectRenderer.dontSetTransformationMatrix = !this.postProcess.reprojectHistory;\r\n this.postProcess.camera = objectRenderer.activeCamera;\r\n\r\n if (this.sourceTexture !== undefined) {\r\n context.setTextureSamplingMode(this.sourceTexture, this.sourceSamplingMode);\r\n }\r\n if (this.velocityTexture !== undefined) {\r\n context.setTextureSamplingMode(this.velocityTexture, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n }\r\n\r\n context.setTextureSamplingMode(pingPongHandle, Constants.TEXTURE_BILINEAR_SAMPLINGMODE);\r\n\r\n context.applyFullScreenEffect(\r\n this._postProcessDrawWrapper,\r\n () => {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"textureSampler\", this.sourceTexture!);\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"historySampler\", pingPongHandle);\r\n if (this.postProcess.reprojectHistory && this.velocityTexture !== undefined) {\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"velocitySampler\", this.velocityTexture);\r\n }\r\n this.postProcess.bind();\r\n },\r\n this.stencilState,\r\n this.disableColorWrite,\r\n this.drawBackFace,\r\n this.depthTest\r\n );\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.depthReadOnly = this.depthReadOnly;\r\n passDisabled.stencilReadOnly = this.stencilReadOnly;\r\n\r\n passDisabled.addDependencies(this.sourceTexture);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n passDisabled.setRenderTargetDepth(this.depthAttachmentTexture);\r\n passDisabled.setExecuteFunc((context) => {\r\n context.copyTexture(this.sourceTexture!);\r\n });\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose() {\r\n this.objectRendererTask?.objectRenderer.onInitRenderingObservable.remove(this._initRenderingObserver);\r\n this._frameGraph.scene.onBeforeRenderObservable.remove(this._onBeforeRenderSceneObserver);\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -172,6 +172,15 @@ export declare class FrameGraphTextureManager {
|
|
|
172
172
|
width: number;
|
|
173
173
|
height: number;
|
|
174
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* Gets the absolute dimensions of a texture from its handle or creation options.
|
|
177
|
+
* @param handleOrCreationOptions The handle or creation options of the texture
|
|
178
|
+
* @returns The absolute dimensions of the texture
|
|
179
|
+
*/
|
|
180
|
+
getTextureAbsoluteDimensions(handleOrCreationOptions: FrameGraphTextureHandle | FrameGraphTextureCreationOptions): {
|
|
181
|
+
width: number;
|
|
182
|
+
height: number;
|
|
183
|
+
};
|
|
175
184
|
/**
|
|
176
185
|
* Calculates the total byte size of all textures used by the frame graph texture manager (including external textures)
|
|
177
186
|
* @param optimizedSize True if the calculation should not factor in aliased textures
|
|
@@ -326,6 +326,21 @@ export class FrameGraphTextureManager {
|
|
|
326
326
|
height: Math.floor((height * screenHeight) / 100),
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* Gets the absolute dimensions of a texture from its handle or creation options.
|
|
331
|
+
* @param handleOrCreationOptions The handle or creation options of the texture
|
|
332
|
+
* @returns The absolute dimensions of the texture
|
|
333
|
+
*/
|
|
334
|
+
getTextureAbsoluteDimensions(handleOrCreationOptions) {
|
|
335
|
+
if (typeof handleOrCreationOptions === "number") {
|
|
336
|
+
handleOrCreationOptions = this.getTextureCreationOptions(handleOrCreationOptions);
|
|
337
|
+
}
|
|
338
|
+
return !handleOrCreationOptions.sizeIsPercentage
|
|
339
|
+
? textureSizeIsObject(handleOrCreationOptions.size)
|
|
340
|
+
? handleOrCreationOptions.size
|
|
341
|
+
: { width: handleOrCreationOptions.size, height: handleOrCreationOptions.size }
|
|
342
|
+
: this.getAbsoluteDimensions(handleOrCreationOptions.size);
|
|
343
|
+
}
|
|
329
344
|
/**
|
|
330
345
|
* Calculates the total byte size of all textures used by the frame graph texture manager (including external textures)
|
|
331
346
|
* @param optimizedSize True if the calculation should not factor in aliased textures
|