@onerjs/core 8.30.5 → 8.30.6
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/Actions/action.d.ts +5 -0
- package/Actions/action.js.map +1 -1
- package/Actions/actionManager.js +6 -2
- package/Actions/actionManager.js.map +1 -1
- package/Animations/runtimeAnimation.d.ts +0 -2
- package/Animations/runtimeAnimation.js +3 -5
- package/Animations/runtimeAnimation.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.js +1 -0
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/audioEngineV2.d.ts +2 -0
- package/AudioV2/abstractAudio/audioEngineV2.js +18 -8
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +8 -3
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/Collisions/gpuPicker.js +0 -1
- package/Collisions/gpuPicker.js.map +1 -1
- package/Decorators/nodeDecorator.d.ts +3 -1
- package/Decorators/nodeDecorator.js +2 -0
- package/Decorators/nodeDecorator.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +1 -1
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/nativeEngine.js +12 -13
- package/Engines/nativeEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.d.ts +44 -0
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +152 -0
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/fxaaPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/fxaaPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/fxaaPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js +3 -3
- package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.d.ts +3 -3
- package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.js +3 -3
- package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.js +4 -4
- package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.js +2 -2
- package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +17 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +70 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +7 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +8 -2
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/taaTask.d.ts +1 -1
- package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -4
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +3 -3
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +7 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +4 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/frameGraphContext.d.ts +8 -1
- package/FrameGraph/frameGraphContext.js +9 -0
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +4 -2
- package/FrameGraph/frameGraphRenderContext.js +11 -5
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +8 -0
- package/FrameGraph/frameGraphTask.js +12 -0
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +4 -1
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/clipPlaneMaterialHelper.js +11 -1
- package/Materials/clipPlaneMaterialHelper.js.map +1 -1
- package/Materials/floatingOriginMatrixOverrides.d.ts +4 -1
- package/Materials/floatingOriginMatrixOverrides.js +14 -2
- package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Materials/shaderMaterial.js +1 -1
- package/Materials/shaderMaterial.js.map +1 -1
- package/Maths/math.vector.functions.d.ts +31 -5
- package/Maths/math.vector.functions.js +41 -4
- package/Maths/math.vector.functions.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +10 -0
- package/Misc/copyTextureToTexture.js +15 -0
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +7 -7
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +4 -0
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js +18 -2
- package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js +7 -7
- package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +8 -8
- package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +9 -9
- package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +6 -6
- package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +7 -7
- package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +29 -1
- package/Particles/Node/Blocks/systemBlock.js +74 -3
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.d.ts +2 -7
- package/Particles/Node/nodeParticleBuildState.js +7 -22
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +223 -58
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/thinParticleSystem.js +1 -0
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +27 -4
- package/Physics/v2/Plugins/havokPlugin.js +72 -8
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsEngine.d.ts +12 -2
- package/Physics/v2/physicsEngine.js +15 -1
- package/Physics/v2/physicsEngine.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +3 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Shaders/picking.fragment.js +1 -1
- package/Shaders/picking.fragment.js.map +1 -1
- package/Shaders/picking.vertex.js +1 -1
- package/Shaders/picking.vertex.js.map +1 -1
- package/ShadersWGSL/iblVoxelGrid.vertex.js +1 -1
- package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
- package/ShadersWGSL/picking.fragment.js +1 -1
- package/ShadersWGSL/picking.fragment.js.map +1 -1
- package/ShadersWGSL/picking.vertex.js +1 -1
- package/ShadersWGSL/picking.vertex.js.map +1 -1
- package/Sprites/spriteRenderer.js +10 -8
- package/Sprites/spriteRenderer.js.map +1 -1
- package/XR/features/WebXRLightEstimation.d.ts +8 -0
- package/XR/features/WebXRLightEstimation.js +6 -1
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/assetContainer.d.ts +1 -1
- package/assetContainer.js +1 -1
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +5 -2
- package/scene.js +9 -14
- package/scene.js.map +1 -1
|
@@ -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;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,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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,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;gBAC1G,CAAC;gBACD,kBAAkB,EAAE,CAAC,OAAO,CAAC,CAAC;gBAC9B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YAC5B,CAAC,EACD,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,SAAS,CACjB,CAAC;QACN,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,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;YAChD,YAAY,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;YAEpD,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAEjD,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjD,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YAC/D,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;gBACpC,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;oBACnC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBAC5C,CAAC;YACL,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":["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"]}
|
|
1
|
+
{"version":3,"file":"postProcessTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/PostProcesses/postProcessTask.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAsFzD;;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;QAlG5B;;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;QAgDpB,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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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":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n DrawWrapper,\r\n FrameGraphRenderPass,\r\n FrameGraphRenderContext,\r\n EffectWrapper,\r\n IStencilState,\r\n IViewportLike,\r\n Nullable,\r\n} 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 viewport to use when applying the post process.\r\n * If set to null, the currently active viewport is used.\r\n * If undefined (default), the viewport is reset to a full screen viewport before applying the post process.\r\n */\r\n public viewport?: Nullable<IViewportLike>;\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 if (this.viewport) {\r\n context.setViewport(this.viewport);\r\n }\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 this.viewport !== undefined\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 if (this.viewport) {\r\n context.setViewport(this.viewport);\r\n }\r\n context.copyTexture(this.sourceTexture, undefined, this.viewport !== undefined);\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"]}
|
|
@@ -14,7 +14,7 @@ export declare class FrameGraphTAATask extends FrameGraphPostProcessTask {
|
|
|
14
14
|
* The handle to the velocity texture. Only needed if postProcess.reprojectHistory is enabled.
|
|
15
15
|
* Note that you must use the linear velocity texture!
|
|
16
16
|
*/
|
|
17
|
-
velocityTexture
|
|
17
|
+
velocityTexture?: FrameGraphTextureHandle;
|
|
18
18
|
protected _onBeforeRenderSceneObserver: Observer<Scene>;
|
|
19
19
|
protected _initRenderingObserver: Observer<ObjectRenderer>;
|
|
20
20
|
/**
|
|
@@ -1 +1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AAC,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"]}
|
|
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,IAA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CAAC,YAAY,EACjB,IAAI,CAAC,iBAAiB,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"]}
|
|
@@ -55,19 +55,19 @@ export declare class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
55
55
|
isMainObjectRenderer: boolean;
|
|
56
56
|
private _renderParticles;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Defines if particles should be rendered (default is true).
|
|
59
59
|
*/
|
|
60
60
|
get renderParticles(): boolean;
|
|
61
61
|
set renderParticles(value: boolean);
|
|
62
62
|
private _renderSprites;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Defines if sprites should be rendered (default is true).
|
|
65
65
|
*/
|
|
66
66
|
get renderSprites(): boolean;
|
|
67
67
|
set renderSprites(value: boolean);
|
|
68
68
|
private _forceLayerMaskCheck;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* Forces checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined). Default is true.
|
|
71
71
|
*/
|
|
72
72
|
get forceLayerMaskCheck(): boolean;
|
|
73
73
|
set forceLayerMaskCheck(value: boolean);
|
|
@@ -85,7 +85,7 @@ export declare class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
85
85
|
set enableOutlineRendering(value: boolean);
|
|
86
86
|
/**
|
|
87
87
|
* The output texture.
|
|
88
|
-
* This texture will point to the same texture than the targetTexture property
|
|
88
|
+
* This texture will point to the same texture than the targetTexture property.
|
|
89
89
|
* Note, however, that the handle itself will be different!
|
|
90
90
|
*/
|
|
91
91
|
readonly outputTexture: FrameGraphTextureHandle;
|
|
@@ -32,7 +32,7 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
32
32
|
this._renderer.disableImageProcessing = value;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Defines if particles should be rendered (default is true).
|
|
36
36
|
*/
|
|
37
37
|
get renderParticles() {
|
|
38
38
|
return this._renderParticles;
|
|
@@ -45,7 +45,7 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
45
45
|
this._renderer.renderParticles = value;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Defines if sprites should be rendered (default is true).
|
|
49
49
|
*/
|
|
50
50
|
get renderSprites() {
|
|
51
51
|
return this._renderSprites;
|
|
@@ -58,7 +58,7 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
58
58
|
this._renderer.renderSprites = value;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Forces checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined). Default is true.
|
|
62
62
|
*/
|
|
63
63
|
get forceLayerMaskCheck() {
|
|
64
64
|
return this._forceLayerMaskCheck;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAiBA,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;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;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;IAC9C,CAAC;IAuBD;;;OAGG;IACH,IAAW,sBAAsB;QAC7B,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACxC,CAAC;IAED,IAAW,sBAAsB,CAAC,KAAc;QAC5C,IAAI,KAAK,KAAK,IAAI,CAAC,uBAAuB,EAAE,CAAC;YACzC,OAAO;QACX,CAAC;QAED,IAAI,CAAC,uBAAuB,GAAG,KAAK,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,sBAAsB,GAA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,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,IAAI,CAAE,KAAqB,CAAC,yBAAyB,EAAE,CAAC;oBACpD,SAAS,CAAC,yCAAyC;gBACvD,CAAC;gBACD,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 AbstractEngine,\r\n BoundingBoxRenderer,\r\n ShadowLight,\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\nimport { Constants } from \"../../../Engines/constants\";\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 target texture where the objects will be rendered.\r\n */\r\n public targetTexture: FrameGraphTextureHandle | 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 private _disableImageProcessing = false;\r\n /**\r\n * If image processing should be disabled (default is false).\r\n * false means that the default image processing configuration will be applied (the one from the scene)\r\n */\r\n public get disableImageProcessing() {\r\n return this._disableImageProcessing;\r\n }\r\n\r\n public set disableImageProcessing(value: boolean) {\r\n if (value === this._disableImageProcessing) {\r\n return;\r\n }\r\n\r\n this._disableImageProcessing = value;\r\n this._renderer.disableImageProcessing = value;\r\n }\r\n\r\n /**\r\n * Sets this property to true if this task is the main object renderer of the frame graph.\r\n * It will help to locate the main object renderer in the frame graph when multiple object renderers are used.\r\n * This is useful for the inspector to know which object renderer to use for additional rendering features like wireframe rendering or frustum light debugging.\r\n * It is also used to determine the main camera used by the frame graph: this is the camera used by the main object renderer.\r\n */\r\n public isMainObjectRenderer = false;\r\n\r\n private _renderParticles = true;\r\n /**\r\n * Define if particles should be rendered (default is true).\r\n */\r\n public get renderParticles() {\r\n return this._renderParticles;\r\n }\r\n\r\n public set renderParticles(value: boolean) {\r\n if (value === this._renderParticles) {\r\n return;\r\n }\r\n\r\n this._renderParticles = value;\r\n this._renderer.renderParticles = value;\r\n }\r\n\r\n private _renderSprites = true;\r\n /**\r\n * Define if sprites should be rendered (default is true).\r\n */\r\n public get renderSprites() {\r\n return this._renderSprites;\r\n }\r\n\r\n public set renderSprites(value: boolean) {\r\n if (value === this._renderSprites) {\r\n return;\r\n }\r\n\r\n this._renderSprites = value;\r\n this._renderer.renderSprites = value;\r\n }\r\n\r\n private _forceLayerMaskCheck = true;\r\n /**\r\n * Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined). Default is true.\r\n */\r\n public get forceLayerMaskCheck() {\r\n return this._forceLayerMaskCheck;\r\n }\r\n\r\n public set forceLayerMaskCheck(value: boolean) {\r\n if (value === this._forceLayerMaskCheck) {\r\n return;\r\n }\r\n\r\n this._forceLayerMaskCheck = value;\r\n this._renderer.forceLayerMaskCheck = value;\r\n }\r\n\r\n private _enableBoundingBoxRendering = true;\r\n /**\r\n * Enables the rendering of bounding boxes for meshes (still subject to Mesh.showBoundingBox or scene.forceShowBoundingBoxes). Default is true.\r\n */\r\n public get enableBoundingBoxRendering() {\r\n return this._enableBoundingBoxRendering;\r\n }\r\n\r\n public set enableBoundingBoxRendering(value: boolean) {\r\n if (value === this._enableBoundingBoxRendering) {\r\n return;\r\n }\r\n\r\n this._enableBoundingBoxRendering = value;\r\n this._renderer.enableBoundingBoxRendering = value;\r\n }\r\n\r\n private _enableOutlineRendering = true;\r\n /**\r\n * Enables the rendering of outlines/overlays for meshes (still subject to Mesh.renderOutline/Mesh.renderOverlay). Default is true.\r\n */\r\n public get enableOutlineRendering() {\r\n return this._enableOutlineRendering;\r\n }\r\n\r\n public set enableOutlineRendering(value: boolean) {\r\n if (value === this._enableOutlineRendering) {\r\n return;\r\n }\r\n\r\n this._enableOutlineRendering = value;\r\n this._renderer.enableOutlineRendering = value;\r\n }\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the targetTexture 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 _engine: AbstractEngine;\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._engine = scene.getEngine();\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n this._renderer.disableImageProcessing = this._disableImageProcessing;\r\n this._renderer.renderParticles = this._renderParticles;\r\n this._renderer.renderSprites = this._renderSprites;\r\n this._renderer.enableBoundingBoxRendering = this._enableBoundingBoxRendering;\r\n this._renderer.forceLayerMaskCheck = this._forceLayerMaskCheck;\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.targetTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture 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 targetTextures = Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture];\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(targetTextures[0]);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle && (targetTextures[0] !== backbufferColorTextureHandle || targetTextures.length > 1)) {\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 && targetTextures[0] === 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 target 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, targetTextures[0]);\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(targetTextures);\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 // The cast to \"any\" is to avoid an error in ES6 in case you don't import boundingBoxRenderer\r\n const boundingBoxRenderer = (this as any).getBoundingBoxRenderer?.() as Nullable<BoundingBoxRenderer>;\r\n\r\n const currentBoundingBoxMeshList = boundingBoxRenderer && boundingBoxRenderer.renderList.length > 0 ? boundingBoxRenderer.renderList.data.slice() : [];\r\n if (boundingBoxRenderer) {\r\n currentBoundingBoxMeshList.length = boundingBoxRenderer.renderList.length;\r\n }\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n const camera = this._renderer.activeCamera;\r\n if (camera && camera.cameraRigMode !== Constants.RIG_MODE_NONE && !camera._renderingMultiview) {\r\n for (let index = 0; index < camera._rigCameras.length; index++) {\r\n const rigCamera = camera._rigCameras[index];\r\n\r\n rigCamera.rigParent = undefined; // for some reasons, ObjectRenderer uses the rigParent viewport if rigParent is defined (we want to use rigCamera.viewport instead)\r\n\r\n this._renderer.activeCamera = rigCamera;\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n rigCamera.rigParent = camera;\r\n }\r\n this._renderer.activeCamera = camera;\r\n } else {\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n }\r\n\r\n additionalExecute?.(context);\r\n\r\n if (boundingBoxRenderer) {\r\n boundingBoxRenderer.renderList.data = currentBoundingBoxMeshList;\r\n boundingBoxRenderer.renderList.length = currentBoundingBoxMeshList.length;\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(targetTextures);\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 if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\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 if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\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":"AAiBA,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;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;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;IAC9C,CAAC;IAuBD;;;OAGG;IACH,IAAW,sBAAsB;QAC7B,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACxC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E,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,IAAI,CAAE,KAAqB,CAAC,yBAAyB,EAAE,CAAC;oBACpD,SAAS,CAAC,yCAAyC;gBACvD,CAAC;gBACD,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,IAAI,CAAE,KAAqB,CAAC,yBAAyB,EAAE,CAAC;oBACpD,SAAS,CAAC,yCAAyC;gBACvD,CAAC;gBACD,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 AbstractEngine,\r\n BoundingBoxRenderer,\r\n ShadowLight,\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\nimport { Constants } from \"../../../Engines/constants\";\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 target texture where the objects will be rendered.\r\n */\r\n public targetTexture: FrameGraphTextureHandle | 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 private _disableImageProcessing = false;\r\n /**\r\n * If image processing should be disabled (default is false).\r\n * false means that the default image processing configuration will be applied (the one from the scene)\r\n */\r\n public get disableImageProcessing() {\r\n return this._disableImageProcessing;\r\n }\r\n\r\n public set disableImageProcessing(value: boolean) {\r\n if (value === this._disableImageProcessing) {\r\n return;\r\n }\r\n\r\n this._disableImageProcessing = value;\r\n this._renderer.disableImageProcessing = value;\r\n }\r\n\r\n /**\r\n * Sets this property to true if this task is the main object renderer of the frame graph.\r\n * It will help to locate the main object renderer in the frame graph when multiple object renderers are used.\r\n * This is useful for the inspector to know which object renderer to use for additional rendering features like wireframe rendering or frustum light debugging.\r\n * It is also used to determine the main camera used by the frame graph: this is the camera used by the main object renderer.\r\n */\r\n public isMainObjectRenderer = false;\r\n\r\n private _renderParticles = true;\r\n /**\r\n * Defines if particles should be rendered (default is true).\r\n */\r\n public get renderParticles() {\r\n return this._renderParticles;\r\n }\r\n\r\n public set renderParticles(value: boolean) {\r\n if (value === this._renderParticles) {\r\n return;\r\n }\r\n\r\n this._renderParticles = value;\r\n this._renderer.renderParticles = value;\r\n }\r\n\r\n private _renderSprites = true;\r\n /**\r\n * Defines if sprites should be rendered (default is true).\r\n */\r\n public get renderSprites() {\r\n return this._renderSprites;\r\n }\r\n\r\n public set renderSprites(value: boolean) {\r\n if (value === this._renderSprites) {\r\n return;\r\n }\r\n\r\n this._renderSprites = value;\r\n this._renderer.renderSprites = value;\r\n }\r\n\r\n private _forceLayerMaskCheck = true;\r\n /**\r\n * Forces checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined). Default is true.\r\n */\r\n public get forceLayerMaskCheck() {\r\n return this._forceLayerMaskCheck;\r\n }\r\n\r\n public set forceLayerMaskCheck(value: boolean) {\r\n if (value === this._forceLayerMaskCheck) {\r\n return;\r\n }\r\n\r\n this._forceLayerMaskCheck = value;\r\n this._renderer.forceLayerMaskCheck = value;\r\n }\r\n\r\n private _enableBoundingBoxRendering = true;\r\n /**\r\n * Enables the rendering of bounding boxes for meshes (still subject to Mesh.showBoundingBox or scene.forceShowBoundingBoxes). Default is true.\r\n */\r\n public get enableBoundingBoxRendering() {\r\n return this._enableBoundingBoxRendering;\r\n }\r\n\r\n public set enableBoundingBoxRendering(value: boolean) {\r\n if (value === this._enableBoundingBoxRendering) {\r\n return;\r\n }\r\n\r\n this._enableBoundingBoxRendering = value;\r\n this._renderer.enableBoundingBoxRendering = value;\r\n }\r\n\r\n private _enableOutlineRendering = true;\r\n /**\r\n * Enables the rendering of outlines/overlays for meshes (still subject to Mesh.renderOutline/Mesh.renderOverlay). Default is true.\r\n */\r\n public get enableOutlineRendering() {\r\n return this._enableOutlineRendering;\r\n }\r\n\r\n public set enableOutlineRendering(value: boolean) {\r\n if (value === this._enableOutlineRendering) {\r\n return;\r\n }\r\n\r\n this._enableOutlineRendering = value;\r\n this._renderer.enableOutlineRendering = value;\r\n }\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the targetTexture property.\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 _engine: AbstractEngine;\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._engine = scene.getEngine();\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n this._renderer.disableImageProcessing = this._disableImageProcessing;\r\n this._renderer.renderParticles = this._renderParticles;\r\n this._renderer.renderSprites = this._renderSprites;\r\n this._renderer.enableBoundingBoxRendering = this._enableBoundingBoxRendering;\r\n this._renderer.forceLayerMaskCheck = this._forceLayerMaskCheck;\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.targetTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture 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 targetTextures = Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture];\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(targetTextures[0]);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle && (targetTextures[0] !== backbufferColorTextureHandle || targetTextures.length > 1)) {\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 && targetTextures[0] === 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 target 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, targetTextures[0]);\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(targetTextures);\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 // The cast to \"any\" is to avoid an error in ES6 in case you don't import boundingBoxRenderer\r\n const boundingBoxRenderer = (this as any).getBoundingBoxRenderer?.() as Nullable<BoundingBoxRenderer>;\r\n\r\n const currentBoundingBoxMeshList = boundingBoxRenderer && boundingBoxRenderer.renderList.length > 0 ? boundingBoxRenderer.renderList.data.slice() : [];\r\n if (boundingBoxRenderer) {\r\n currentBoundingBoxMeshList.length = boundingBoxRenderer.renderList.length;\r\n }\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n const camera = this._renderer.activeCamera;\r\n if (camera && camera.cameraRigMode !== Constants.RIG_MODE_NONE && !camera._renderingMultiview) {\r\n for (let index = 0; index < camera._rigCameras.length; index++) {\r\n const rigCamera = camera._rigCameras[index];\r\n\r\n rigCamera.rigParent = undefined; // for some reasons, ObjectRenderer uses the rigParent viewport if rigParent is defined (we want to use rigCamera.viewport instead)\r\n\r\n this._renderer.activeCamera = rigCamera;\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n rigCamera.rigParent = camera;\r\n }\r\n this._renderer.activeCamera = camera;\r\n } else {\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n }\r\n\r\n additionalExecute?.(context);\r\n\r\n if (boundingBoxRenderer) {\r\n boundingBoxRenderer.renderList.data = currentBoundingBoxMeshList;\r\n boundingBoxRenderer.renderList.length = currentBoundingBoxMeshList.length;\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(targetTextures);\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 if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\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 if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\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, FrameGraphTextureHandle } from "../../../index.js";
|
|
1
|
+
import type { FrameGraph, FrameGraphTextureHandle, IViewportLike, Nullable } from "../../../index.js";
|
|
2
2
|
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
3
3
|
/**
|
|
4
4
|
* Task used to copy a texture to another texture.
|
|
@@ -12,6 +12,12 @@ export declare class FrameGraphCopyToTextureTask extends FrameGraphTask {
|
|
|
12
12
|
* The target texture to copy to.
|
|
13
13
|
*/
|
|
14
14
|
targetTexture: FrameGraphTextureHandle;
|
|
15
|
+
/**
|
|
16
|
+
* The viewport to use when doing the copy.
|
|
17
|
+
* If set to null, the currently active viewport is used.
|
|
18
|
+
* If undefined (default), the viewport is reset to a full screen viewport before performing the copy.
|
|
19
|
+
*/
|
|
20
|
+
viewport?: Nullable<IViewportLike>;
|
|
15
21
|
/**
|
|
16
22
|
* The output texture (same as targetTexture, but the handle may be different).
|
|
17
23
|
*/
|
|
@@ -21,7 +21,10 @@ export class FrameGraphCopyToTextureTask extends FrameGraphTask {
|
|
|
21
21
|
pass.addDependencies(this.sourceTexture);
|
|
22
22
|
pass.setRenderTarget(this.outputTexture);
|
|
23
23
|
pass.setExecuteFunc((context) => {
|
|
24
|
-
|
|
24
|
+
if (this.viewport) {
|
|
25
|
+
context.setViewport(this.viewport);
|
|
26
|
+
}
|
|
27
|
+
context.copyTexture(this.sourceTexture, undefined, this.viewport !== undefined);
|
|
25
28
|
});
|
|
26
29
|
const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
|
|
27
30
|
passDisabled.setRenderTarget(this.outputTexture);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyToTextureTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Texture/copyToTextureTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"copyToTextureTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Texture/copyToTextureTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,cAAc;IAuB3D;;;;OAIG;IACH,YAAY,IAAY,EAAE,UAAsB;QAC5C,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAExB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC;IAChF,CAAC;IAEM,MAAM;QACT,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;YACvE,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAC,IAAI,iDAAiD,CAAC,CAAC;QAChH,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,qBAAqB,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAE9F,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAEzC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACzC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChB,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvC,CAAC;YACD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC;QACpF,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,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,YAAY,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE,GAAE,CAAC,CAAC,CAAC;IAClD,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphTextureHandle, IViewportLike, Nullable } from \"core/index\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task used to copy a texture to another texture.\r\n */\r\nexport class FrameGraphCopyToTextureTask extends FrameGraphTask {\r\n /**\r\n * The source texture to copy from.\r\n */\r\n public sourceTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The target texture to copy to.\r\n */\r\n public targetTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The viewport to use when doing the copy.\r\n * If set to null, the currently active viewport is used.\r\n * If undefined (default), the viewport is reset to a full screen viewport before performing the copy.\r\n */\r\n public viewport?: Nullable<IViewportLike>;\r\n\r\n /**\r\n * The output texture (same as targetTexture, but the handle may be different).\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * Constructs a new FrameGraphCopyToTextureTask.\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 this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public record() {\r\n if (this.sourceTexture === undefined || this.targetTexture === undefined) {\r\n throw new Error(`FrameGraphCopyToTextureTask \"${this.name}\": sourceTexture and targetTexture are required`);\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.addDependencies(this.sourceTexture);\r\n\r\n pass.setRenderTarget(this.outputTexture);\r\n pass.setExecuteFunc((context) => {\r\n if (this.viewport) {\r\n context.setViewport(this.viewport);\r\n }\r\n context.copyTexture(this.sourceTexture, undefined, this.viewport !== undefined);\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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbstractEngine, FrameGraphTextureManager, Scene, FrameGraphTextureHandle, Nullable, InternalTexture } from "../index.js";
|
|
1
|
+
import type { AbstractEngine, FrameGraphTextureManager, Scene, FrameGraphTextureHandle, Nullable, InternalTexture, IViewportLike } from "../index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Base class for frame graph context.
|
|
4
4
|
*/
|
|
@@ -49,4 +49,11 @@ export declare class FrameGraphContext {
|
|
|
49
49
|
* @param depthWrite If true, depth writing is enabled
|
|
50
50
|
*/
|
|
51
51
|
setDepthStates(depthTest: boolean, depthWrite: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the current viewport
|
|
54
|
+
* @param viewport defines the viewport element to be used
|
|
55
|
+
* @param requiredWidth defines the width required for rendering. If not provided, the width of the render texture is used.
|
|
56
|
+
* @param requiredHeight defines the height required for rendering. If not provided the height of the render texture is used.
|
|
57
|
+
*/
|
|
58
|
+
setViewport(viewport: IViewportLike, requiredWidth?: number, requiredHeight?: number): void;
|
|
52
59
|
}
|
|
@@ -75,5 +75,14 @@ export class FrameGraphContext {
|
|
|
75
75
|
this._engine.setDepthBuffer(depthTest);
|
|
76
76
|
this._engine.setDepthWrite(depthWrite);
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Sets the current viewport
|
|
80
|
+
* @param viewport defines the viewport element to be used
|
|
81
|
+
* @param requiredWidth defines the width required for rendering. If not provided, the width of the render texture is used.
|
|
82
|
+
* @param requiredHeight defines the height required for rendering. If not provided the height of the render texture is used.
|
|
83
|
+
*/
|
|
84
|
+
setViewport(viewport, requiredWidth, requiredHeight) {
|
|
85
|
+
this._engine.setViewport(viewport, requiredHeight, requiredWidth);
|
|
86
|
+
}
|
|
78
87
|
}
|
|
79
88
|
//# sourceMappingURL=frameGraphContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphContext.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAI1B,gBAAgB;IAChB,YACuB,OAAuB,EACvB,eAAyC,EACzC,MAAa;QAFb,YAAO,GAAP,OAAO,CAAgB;QACvB,oBAAe,GAAf,eAAe,CAA0B;QACzC,WAAM,GAA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AAC;IAED;;OAEG;IACI,kBAAkB;QACrB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,SAAkB,EAAE,UAAmB;QACzD,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type { AbstractEngine, FrameGraphTextureManager, Scene, FrameGraphTextureHandle, Nullable, InternalTexture } from \"core/index\";\r\n\r\n/**\r\n * Base class for frame graph context.\r\n */\r\nexport class FrameGraphContext {\r\n private _depthTest: boolean;\r\n private _depthWrite: boolean;\r\n\r\n /** @internal */\r\n constructor(\r\n protected readonly _engine: AbstractEngine,\r\n protected readonly _textureManager: FrameGraphTextureManager,\r\n protected readonly _scene: Scene\r\n ) {}\r\n\r\n /**\r\n * Renders a component without managing the render target.\r\n * Use this method when you have a component that handles its own rendering logic which is not fully integrated into the frame graph system.\r\n * @param component The component to render.\r\n * @param intermediateRendering If true, the scene's intermediate rendering flag will be set to true during the render call (default: true)\r\n */\r\n public renderUnmanaged(component: { render: () => void }, intermediateRendering = true): void {\r\n const currentRenderTarget = this._engine._currentRenderTarget;\r\n\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n this._scene._intermediateRendering = intermediateRendering;\r\n\r\n component.render();\r\n\r\n this._scene._intermediateRendering = false;\r\n\r\n if (this._engine._currentRenderTarget !== currentRenderTarget) {\r\n if (!currentRenderTarget) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n this._engine.bindFramebuffer(currentRenderTarget);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets a texture from a handle.\r\n * Note that if the texture is a history texture, the read texture for the current frame will be returned.\r\n * @param handle The handle of the texture\r\n * @returns The texture or null if not found\r\n */\r\n public getTextureFromHandle(handle: FrameGraphTextureHandle): Nullable<InternalTexture> {\r\n return this._textureManager.getTextureFromHandle(handle);\r\n }\r\n\r\n /**\r\n * Pushes a debug group to the engine's debug stack.\r\n * @param name The name of the debug group\r\n */\r\n public pushDebugGroup(name: string) {\r\n this._engine._debugPushGroup?.(name, 1);\r\n }\r\n\r\n /**\r\n * Pops a debug group from the engine's debug stack.\r\n */\r\n public popDebugGroup() {\r\n this._engine._debugPopGroup?.(1);\r\n }\r\n\r\n /**\r\n * Saves the current depth states (depth testing and depth writing)\r\n */\r\n public saveDepthStates(): void {\r\n this._depthTest = this._engine.getDepthBuffer();\r\n this._depthWrite = this._engine.getDepthWrite();\r\n }\r\n\r\n /**\r\n * Restores the depth states saved by saveDepthStates\r\n */\r\n public restoreDepthStates(): void {\r\n this._engine.setDepthBuffer(this._depthTest);\r\n this._engine.setDepthWrite(this._depthWrite);\r\n }\r\n\r\n /**\r\n * Sets the depth states for the current render target\r\n * @param depthTest If true, depth testing is enabled\r\n * @param depthWrite If true, depth writing is enabled\r\n */\r\n public setDepthStates(depthTest: boolean, depthWrite: boolean): void {\r\n this._engine.setDepthBuffer(depthTest);\r\n this._engine.setDepthWrite(depthWrite);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"frameGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphContext.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAI1B,gBAAgB;IAChB,YACuB,OAAuB,EACvB,eAAyC,EACzC,MAAa;QAFb,YAAO,GAAP,OAAO,CAAgB;QACvB,oBAAe,GAAf,eAAe,CAA0B;QACzC,WAAM,GAAN,MAAM,CAAO;IACjC,CAAC;IAEJ;;;;;OAKG;IACI,eAAe,CAAC,SAAiC,EAAE,qBAAqB,GAAG,IAAI;QAClF,MAAM,mBAAmB,GAAG,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OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,SAAkB,EAAE,UAAmB;QACzD,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAC,QAAuB,EAAE,aAAsB,EAAE,cAAuB;QACvF,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;IACtE,CAAC;CACJ","sourcesContent":["import type { AbstractEngine, FrameGraphTextureManager, Scene, FrameGraphTextureHandle, Nullable, InternalTexture, IViewportLike } from \"core/index\";\r\n\r\n/**\r\n * Base class for frame graph context.\r\n */\r\nexport class FrameGraphContext {\r\n private _depthTest: boolean;\r\n private _depthWrite: boolean;\r\n\r\n /** @internal */\r\n constructor(\r\n protected readonly _engine: AbstractEngine,\r\n protected readonly _textureManager: FrameGraphTextureManager,\r\n protected readonly _scene: Scene\r\n ) {}\r\n\r\n /**\r\n * Renders a component without managing the render target.\r\n * Use this method when you have a component that handles its own rendering logic which is not fully integrated into the frame graph system.\r\n * @param component The component to render.\r\n * @param intermediateRendering If true, the scene's intermediate rendering flag will be set to true during the render call (default: true)\r\n */\r\n public renderUnmanaged(component: { render: () => void }, intermediateRendering = true): void {\r\n const currentRenderTarget = this._engine._currentRenderTarget;\r\n\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n this._scene._intermediateRendering = intermediateRendering;\r\n\r\n component.render();\r\n\r\n this._scene._intermediateRendering = false;\r\n\r\n if (this._engine._currentRenderTarget !== currentRenderTarget) {\r\n if (!currentRenderTarget) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n this._engine.bindFramebuffer(currentRenderTarget);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets a texture from a handle.\r\n * Note that if the texture is a history texture, the read texture for the current frame will be returned.\r\n * @param handle The handle of the texture\r\n * @returns The texture or null if not found\r\n */\r\n public getTextureFromHandle(handle: FrameGraphTextureHandle): Nullable<InternalTexture> {\r\n return this._textureManager.getTextureFromHandle(handle);\r\n }\r\n\r\n /**\r\n * Pushes a debug group to the engine's debug stack.\r\n * @param name The name of the debug group\r\n */\r\n public pushDebugGroup(name: string) {\r\n this._engine._debugPushGroup?.(name, 1);\r\n }\r\n\r\n /**\r\n * Pops a debug group from the engine's debug stack.\r\n */\r\n public popDebugGroup() {\r\n this._engine._debugPopGroup?.(1);\r\n }\r\n\r\n /**\r\n * Saves the current depth states (depth testing and depth writing)\r\n */\r\n public saveDepthStates(): void {\r\n this._depthTest = this._engine.getDepthBuffer();\r\n this._depthWrite = this._engine.getDepthWrite();\r\n }\r\n\r\n /**\r\n * Restores the depth states saved by saveDepthStates\r\n */\r\n public restoreDepthStates(): void {\r\n this._engine.setDepthBuffer(this._depthTest);\r\n this._engine.setDepthWrite(this._depthWrite);\r\n }\r\n\r\n /**\r\n * Sets the depth states for the current render target\r\n * @param depthTest If true, depth testing is enabled\r\n * @param depthWrite If true, depth writing is enabled\r\n */\r\n public setDepthStates(depthTest: boolean, depthWrite: boolean): void {\r\n this._engine.setDepthBuffer(depthTest);\r\n this._engine.setDepthWrite(depthWrite);\r\n }\r\n\r\n /**\r\n * Sets the current viewport\r\n * @param viewport defines the viewport element to be used\r\n * @param requiredWidth defines the width required for rendering. If not provided, the width of the render texture is used.\r\n * @param requiredHeight defines the height required for rendering. If not provided the height of the render texture is used.\r\n */\r\n public setViewport(viewport: IViewportLike, requiredWidth?: number, requiredHeight?: number): void {\r\n this._engine.setViewport(viewport, requiredHeight, requiredWidth);\r\n }\r\n}\r\n"]}
|
|
@@ -99,15 +99,17 @@ export declare class FrameGraphRenderContext extends FrameGraphContext {
|
|
|
99
99
|
* @param disableColorWrite If true, color write will be disabled when applying the effect (optional)
|
|
100
100
|
* @param drawBackFace If true, the fullscreen quad will be drawn as a back face (in CW - optional)
|
|
101
101
|
* @param depthTest If true, depth testing will be enabled when applying the effect (default is false)
|
|
102
|
+
* @param noViewport If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.
|
|
102
103
|
* @returns True if the effect was applied, otherwise false (effect not ready)
|
|
103
104
|
*/
|
|
104
|
-
applyFullScreenEffect(drawWrapper: DrawWrapper, customBindings?: () => void, stencilState?: IStencilState, disableColorWrite?: boolean, drawBackFace?: boolean, depthTest?: boolean): boolean;
|
|
105
|
+
applyFullScreenEffect(drawWrapper: DrawWrapper, customBindings?: () => void, stencilState?: IStencilState, disableColorWrite?: boolean, drawBackFace?: boolean, depthTest?: boolean, noViewport?: boolean): boolean;
|
|
105
106
|
/**
|
|
106
107
|
* Copies a texture to the current render target
|
|
107
108
|
* @param sourceTexture The source texture to copy from
|
|
108
109
|
* @param forceCopyToBackbuffer If true, the copy will be done to the back buffer regardless of the current render target
|
|
110
|
+
* @param noViewport If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.
|
|
109
111
|
*/
|
|
110
|
-
copyTexture(sourceTexture: FrameGraphTextureHandle, forceCopyToBackbuffer?: boolean): void;
|
|
112
|
+
copyTexture(sourceTexture: FrameGraphTextureHandle, forceCopyToBackbuffer?: boolean, noViewport?: boolean): void;
|
|
111
113
|
/**
|
|
112
114
|
* Renders a RenderTargetTexture or a layer
|
|
113
115
|
* @param object The RenderTargetTexture/Layer to render
|
|
@@ -165,9 +165,10 @@ export class FrameGraphRenderContext extends FrameGraphContext {
|
|
|
165
165
|
* @param disableColorWrite If true, color write will be disabled when applying the effect (optional)
|
|
166
166
|
* @param drawBackFace If true, the fullscreen quad will be drawn as a back face (in CW - optional)
|
|
167
167
|
* @param depthTest If true, depth testing will be enabled when applying the effect (default is false)
|
|
168
|
+
* @param noViewport If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.
|
|
168
169
|
* @returns True if the effect was applied, otherwise false (effect not ready)
|
|
169
170
|
*/
|
|
170
|
-
applyFullScreenEffect(drawWrapper, customBindings, stencilState, disableColorWrite, drawBackFace, depthTest) {
|
|
171
|
+
applyFullScreenEffect(drawWrapper, customBindings, stencilState, disableColorWrite, drawBackFace, depthTest, noViewport) {
|
|
171
172
|
if (!drawWrapper.effect?.isReady()) {
|
|
172
173
|
return false;
|
|
173
174
|
}
|
|
@@ -175,7 +176,9 @@ export class FrameGraphRenderContext extends FrameGraphContext {
|
|
|
175
176
|
const engineDepthMask = this._engine.getDepthWrite(); // for some reasons, depthWrite is not restored by EffectRenderer.restoreStates
|
|
176
177
|
const effectRenderer = drawBackFace ? this._effectRendererBack : this._effectRenderer;
|
|
177
178
|
effectRenderer.saveStates();
|
|
178
|
-
|
|
179
|
+
if (!noViewport) {
|
|
180
|
+
effectRenderer.setViewport();
|
|
181
|
+
}
|
|
179
182
|
this._engine.enableEffect(drawWrapper);
|
|
180
183
|
this._engine.setState(false, undefined, undefined, undefined, undefined, stencilState);
|
|
181
184
|
this._engine.setDepthBuffer(!!depthTest);
|
|
@@ -198,13 +201,16 @@ export class FrameGraphRenderContext extends FrameGraphContext {
|
|
|
198
201
|
* Copies a texture to the current render target
|
|
199
202
|
* @param sourceTexture The source texture to copy from
|
|
200
203
|
* @param forceCopyToBackbuffer If true, the copy will be done to the back buffer regardless of the current render target
|
|
204
|
+
* @param noViewport If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.
|
|
201
205
|
*/
|
|
202
|
-
copyTexture(sourceTexture, forceCopyToBackbuffer = false) {
|
|
206
|
+
copyTexture(sourceTexture, forceCopyToBackbuffer = false, noViewport) {
|
|
203
207
|
if (forceCopyToBackbuffer) {
|
|
204
208
|
this.bindRenderTarget();
|
|
205
209
|
}
|
|
206
|
-
this.
|
|
207
|
-
this.
|
|
210
|
+
this._copyTexture.source = this._textureManager.getTextureFromHandle(sourceTexture, true);
|
|
211
|
+
this.applyFullScreenEffect(this._copyTexture.effectWrapper.drawWrapper, () => {
|
|
212
|
+
this._copyTexture.effectWrapper.onApplyObservable.notifyObservers({});
|
|
213
|
+
}, undefined, undefined, undefined, undefined, noViewport);
|
|
208
214
|
}
|
|
209
215
|
/**
|
|
210
216
|
* Renders a RenderTargetTexture or a layer
|