{"ast":null,"code":"import { Color4 } from \"../../../Maths/math.color.js\";\nimport { FrameGraphTask } from \"../../frameGraphTask.js\";\n/**\n * Task used to clear a texture.\n */\nexport class FrameGraphClearTextureTask extends FrameGraphTask {\n /**\n * Constructs a new clear task.\n * @param name The name of the task.\n * @param frameGraph The frame graph the task belongs to.\n */\n constructor(name, frameGraph) {\n super(name, frameGraph);\n /**\n * The color to clear the texture with.\n */\n this.color = new Color4(0.2, 0.2, 0.3, 1);\n /**\n * If the color should be cleared.\n */\n this.clearColor = true;\n /**\n * If the depth should be cleared.\n */\n this.clearDepth = false;\n /**\n * If the stencil should be cleared.\n */\n this.clearStencil = false;\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\n }\n record() {\n if (this.destinationTexture === undefined && this.depthTexture === undefined) {\n throw new Error(`FrameGraphClearTextureTask ${this.name}: destinationTexture and depthTexture can't both be undefined.`);\n }\n if (this.destinationTexture !== undefined) {\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture);\n }\n if (this.depthTexture !== undefined) {\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\n }\n const pass = this._frameGraph.addRenderPass(this.name);\n pass.setRenderTarget(this.destinationTexture);\n pass.setRenderTargetDepth(this.depthTexture);\n pass.setExecuteFunc(context => {\n context.clear(this.color, !!this.clearColor, !!this.clearDepth, !!this.clearStencil);\n });\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\n passDisabled.setRenderTarget(this.destinationTexture);\n passDisabled.setRenderTargetDepth(this.depthTexture);\n passDisabled.setExecuteFunc(_context => {});\n }\n}","map":{"version":3,"names":["Color4","FrameGraphTask","FrameGraphClearTextureTask","constructor","name","frameGraph","color","clearColor","clearDepth","clearStencil","outputTexture","_frameGraph","textureManager","createDanglingHandle","outputDepthTexture","record","destinationTexture","undefined","depthTexture","Error","resolveDanglingHandle","pass","addRenderPass","setRenderTarget","setRenderTargetDepth","setExecuteFunc","context","clear","passDisabled","_context"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FrameGraph/Tasks/Texture/clearTextureTask.js"],"sourcesContent":["import { Color4 } from \"../../../Maths/math.color.js\";\nimport { FrameGraphTask } from \"../../frameGraphTask.js\";\n/**\n * Task used to clear a texture.\n */\nexport class FrameGraphClearTextureTask extends FrameGraphTask {\n /**\n * Constructs a new clear task.\n * @param name The name of the task.\n * @param frameGraph The frame graph the task belongs to.\n */\n constructor(name, frameGraph) {\n super(name, frameGraph);\n /**\n * The color to clear the texture with.\n */\n this.color = new Color4(0.2, 0.2, 0.3, 1);\n /**\n * If the color should be cleared.\n */\n this.clearColor = true;\n /**\n * If the depth should be cleared.\n */\n this.clearDepth = false;\n /**\n * If the stencil should be cleared.\n */\n this.clearStencil = false;\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\n }\n record() {\n if (this.destinationTexture === undefined && this.depthTexture === undefined) {\n throw new Error(`FrameGraphClearTextureTask ${this.name}: destinationTexture and depthTexture can't both be undefined.`);\n }\n if (this.destinationTexture !== undefined) {\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.destinationTexture);\n }\n if (this.depthTexture !== undefined) {\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\n }\n const pass = this._frameGraph.addRenderPass(this.name);\n pass.setRenderTarget(this.destinationTexture);\n pass.setRenderTargetDepth(this.depthTexture);\n pass.setExecuteFunc((context) => {\n context.clear(this.color, !!this.clearColor, !!this.clearDepth, !!this.clearStencil);\n });\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\n passDisabled.setRenderTarget(this.destinationTexture);\n passDisabled.setRenderTargetDepth(this.depthTexture);\n passDisabled.setExecuteFunc((_context) => { });\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,8BAA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