{"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { Vector4 } from \"../../Maths/math.vector.js\";\nimport { PostProcess } from \"../../PostProcesses/postProcess.js\";\nimport { GeometryBufferRenderer } from \"../../Rendering/geometryBufferRenderer.js\";\nimport { ProceduralTexture } from \"../../Materials/Textures/Procedurals/proceduralTexture.js\";\nimport { Observable } from \"../../Misc/observable.js\";\n/**\n * This should not be instanciated directly, as it is part of a scene component\n * @internal\n */\nexport class _IblShadowsAccumulationPass {\n /**\n * Returns the output texture of the pass.\n * @returns The output texture.\n */\n getOutputTexture() {\n return this._outputTexture;\n }\n /**\n * Gets the debug pass post process\n * @returns The post process\n */\n getDebugPassPP() {\n if (!this._debugPassPP) {\n this._createDebugPass();\n }\n return this._debugPassPP;\n }\n /**\n * Gets the name of the debug pass\n * @returns The name of the debug pass\n */\n get debugPassName() {\n return this._debugPassName;\n }\n /**\n * A value that controls how much of the previous frame's accumulation to keep.\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\n */\n get remanence() {\n return this._remanence;\n }\n /**\n * A value that controls how much of the previous frame's accumulation to keep.\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\n */\n set remanence(value) {\n this._remanence = value;\n }\n /**\n * Reset the accumulation.\n */\n get reset() {\n return this._reset;\n }\n /**\n * Reset the accumulation.\n */\n set reset(value) {\n this._reset = value;\n }\n /**\n * Tell the pass that the camera is moving. This will cause the accumulation\n * rate to change.\n */\n set isMoving(value) {\n this._isMoving = value;\n }\n /**\n * Sets params that control the position and scaling of the debug display on the screen.\n * @param x Screen X offset of the debug display (0-1)\n * @param y Screen Y offset of the debug display (0-1)\n * @param widthScale X scale of the debug display (0-1)\n * @param heightScale Y scale of the debug display (0-1)\n */\n setDebugDisplayParams(x, y, widthScale, heightScale) {\n this._debugSizeParams.set(x, y, widthScale, heightScale);\n }\n /**\n * Creates the debug post process effect for this pass\n */\n _createDebugPass() {\n if (!this._debugPassPP) {\n const isWebGPU = this._engine.isWebGPU;\n const debugOptions = {\n width: this._engine.getRenderWidth(),\n height: this._engine.getRenderHeight(),\n textureFormat: 5,\n textureType: 0,\n samplingMode: 1,\n uniforms: [\"sizeParams\"],\n samplers: [\"debugSampler\"],\n engine: this._engine,\n reusable: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializations: (useWebGPU, list) => {\n if (useWebGPU) {\n list.push(import(\"../../ShadersWGSL/iblShadowDebug.fragment.js\"));\n } else {\n list.push(import(\"../../Shaders/iblShadowDebug.fragment.js\"));\n }\n }\n };\n this._debugPassPP = new PostProcess(this.debugPassName, \"iblShadowDebug\", debugOptions);\n this._debugPassPP.autoClear = false;\n this._debugPassPP.onApplyObservable.add(effect => {\n // update the caustic texture with what we just rendered.\n effect.setTexture(\"debugSampler\", this._outputTexture);\n effect.setVector4(\"sizeParams\", this._debugSizeParams);\n });\n }\n }\n /**\n * Instantiates the accumulation pass\n * @param scene Scene to attach to\n * @param iblShadowsRenderPipeline The IBL shadows render pipeline\n * @returns The accumulation pass\n */\n constructor(scene, iblShadowsRenderPipeline) {\n this._accumulationParams = new Vector4(0.0, 0.0, 0.0, 0.0);\n /** Enable the debug view for this pass */\n this.debugEnabled = false;\n /**\n * Is the effect enabled\n */\n this.enabled = true;\n /**\n * Observable that triggers when the accumulation texture is ready\n */\n this.onReadyObservable = new Observable();\n this._debugPassName = \"Shadow Accumulation Debug Pass\";\n this._remanence = 0.9;\n this._reset = true;\n this._isMoving = false;\n this._debugSizeParams = new Vector4(0.0, 0.0, 0.0, 0.0);\n this._scene = scene;\n this._engine = scene.getEngine();\n this._renderPipeline = iblShadowsRenderPipeline;\n this._createTextures();\n }\n _createTextures() {\n const isWebGPU = this._engine.isWebGPU;\n const outputTextureOptions = {\n type: 2,\n format: 5,\n samplingMode: 1,\n generateDepthBuffer: false,\n generateMipMaps: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializationsAsync: function () {\n var _ref = _asyncToGenerator(function* () {\n if (isWebGPU) {\n yield Promise.all([import(\"../../ShadersWGSL/iblShadowAccumulation.fragment.js\")]);\n } else {\n yield Promise.all([import(\"../../Shaders/iblShadowAccumulation.fragment.js\")]);\n }\n });\n return function extraInitializationsAsync() {\n return _ref.apply(this, arguments);\n };\n }()\n };\n this._outputTexture = new ProceduralTexture(\"shadowAccumulationPass\", {\n width: this._engine.getRenderWidth(),\n height: this._engine.getRenderHeight()\n }, \"iblShadowAccumulation\", this._scene, outputTextureOptions);\n this._outputTexture.refreshRate = -1;\n this._outputTexture.autoClear = false;\n this._outputTexture.onGeneratedObservable.addOnce(() => {\n this.onReadyObservable.notifyObservers();\n });\n // Need to set all the textures first so that the effect gets created with the proper uniforms.\n this._setOutputTextureBindings();\n let counter = 0;\n this._scene.onBeforeRenderObservable.add(() => {\n counter = 0;\n });\n this._scene.onAfterRenderTargetsRenderObservable.add(() => {\n if (++counter == 2) {\n if (this.enabled && this._outputTexture.isReady()) {\n this._setOutputTextureBindings();\n this._outputTexture.render();\n }\n }\n });\n // Create the accumulation texture for the previous frame.\n // We'll copy the output of the accumulation pass to this texture at the start of every frame.\n const accumulationOptions = {\n type: 2,\n format: 5,\n samplingMode: 1,\n generateDepthBuffer: false,\n generateMipMaps: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializationsAsync: function () {\n var _ref2 = _asyncToGenerator(function* () {\n if (isWebGPU) {\n yield Promise.all([import(\"../../ShadersWGSL/pass.fragment.js\")]);\n } else {\n yield Promise.all([import(\"../../Shaders/pass.fragment.js\")]);\n }\n });\n return function extraInitializationsAsync() {\n return _ref2.apply(this, arguments);\n };\n }()\n };\n this._oldAccumulationCopy = new ProceduralTexture(\"oldAccumulationRT\", {\n width: this._engine.getRenderWidth(),\n height: this._engine.getRenderHeight()\n }, \"pass\", this._scene, accumulationOptions, false);\n this._oldAccumulationCopy.autoClear = false;\n this._oldAccumulationCopy.refreshRate = 1;\n this._oldAccumulationCopy.onBeforeGenerationObservable.add(this._setAccumulationCopyBindings.bind(this));\n this._setAccumulationCopyBindings();\n // Create the local position texture for the previous frame.\n // We'll copy the previous local position texture to this texture at the start of every frame.\n const localPositionOptions = {\n type: 2,\n format: 5,\n samplingMode: 1,\n generateDepthBuffer: false,\n generateMipMaps: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializationsAsync: function () {\n var _ref3 = _asyncToGenerator(function* () {\n if (isWebGPU) {\n yield Promise.all([import(\"../../ShadersWGSL/pass.fragment.js\")]);\n } else {\n yield Promise.all([import(\"../../Shaders/pass.fragment.js\")]);\n }\n });\n return function extraInitializationsAsync() {\n return _ref3.apply(this, arguments);\n };\n }()\n };\n this._oldPositionCopy = new ProceduralTexture(\"oldLocalPositionRT\", {\n width: this._engine.getRenderWidth(),\n height: this._engine.getRenderHeight()\n }, \"pass\", this._scene, localPositionOptions, false);\n this._updatePositionCopy();\n this._oldPositionCopy.autoClear = false;\n this._oldPositionCopy.refreshRate = 1;\n this._oldPositionCopy.onBeforeGenerationObservable.add(this._updatePositionCopy.bind(this));\n }\n _setOutputTextureBindings() {\n const remanence = this._isMoving ? this.remanence : 0.99;\n this._accumulationParams.set(remanence, this.reset ? 1.0 : 0.0, this._renderPipeline.voxelGridSize, 0.0);\n this._outputTexture.setTexture(\"spatialBlurSampler\", this._renderPipeline._getSpatialBlurTexture());\n this._outputTexture.setVector4(\"accumulationParameters\", this._accumulationParams);\n this._outputTexture.setTexture(\"oldAccumulationSampler\", this._oldAccumulationCopy ? this._oldAccumulationCopy : this._renderPipeline._dummyTexture2d);\n this._outputTexture.setTexture(\"prevPositionSampler\", this._oldPositionCopy ? this._oldPositionCopy : this._renderPipeline._dummyTexture2d);\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\n if (!geometryBufferRenderer) {\n return;\n }\n const velocityIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE);\n this._outputTexture.setTexture(\"motionSampler\", geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\n const wPositionIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\n this._outputTexture.setTexture(\"positionSampler\", geometryBufferRenderer.getGBuffer().textures[wPositionIndex]);\n this.reset = false;\n this._isMoving = false;\n }\n _updatePositionCopy() {\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\n const index = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\n this._oldPositionCopy.setTexture(\"textureSampler\", geometryBufferRenderer.getGBuffer().textures[index]);\n }\n _setAccumulationCopyBindings() {\n this._oldAccumulationCopy.setTexture(\"textureSampler\", this._outputTexture);\n }\n /**\n * Called by render pipeline when canvas resized.\n * @param scaleFactor The factor by which to scale the canvas size.\n */\n resize(scaleFactor = 1.0) {\n const newSize = {\n width: Math.max(1.0, Math.floor(this._engine.getRenderWidth() * scaleFactor)),\n height: Math.max(1.0, Math.floor(this._engine.getRenderHeight() * scaleFactor))\n };\n this._outputTexture.resize(newSize, false);\n this._oldAccumulationCopy.resize(newSize, false);\n this._oldPositionCopy.resize({\n width: this._engine.getRenderWidth(),\n height: this._engine.getRenderHeight()\n }, false);\n this.reset = true;\n }\n _disposeTextures() {\n this._oldAccumulationCopy.dispose();\n this._oldPositionCopy.dispose();\n this._outputTexture.dispose();\n }\n /**\n * Checks if the pass is ready\n * @returns true if the pass is ready\n */\n isReady() {\n return this._oldAccumulationCopy && this._oldAccumulationCopy.isReady() && this._oldPositionCopy && this._oldPositionCopy.isReady() && this._outputTexture.isReady() && !(this._debugPassPP && !this._debugPassPP.isReady());\n }\n /**\n * Disposes the associated resources\n */\n dispose() {\n this._disposeTextures();\n if (this._debugPassPP) {\n this._debugPassPP.dispose();\n }\n this.onReadyObservable.clear();\n }\n}","map":{"version":3,"names":["Vector4","PostProcess","GeometryBufferRenderer","ProceduralTexture","Observable","_IblShadowsAccumulationPass","getOutputTexture","_outputTexture","getDebugPassPP","_debugPassPP","_createDebugPass","debugPassName","_debugPassName","remanence","_remanence","value","reset","_reset","isMoving","_isMoving","setDebugDisplayParams","x","y","widthScale","heightScale","_debugSizeParams","set","isWebGPU","_engine","debugOptions","width","getRenderWidth","height","getRenderHeight","textureFormat","textureType","samplingMode","uniforms","samplers","engine","reusable","shaderLanguage","extraInitializations","useWebGPU","list","push","autoClear","onApplyObservable","add","effect","setTexture","setVector4","constructor","scene","iblShadowsRenderPipeline","_accumulationParams","debugEnabled","enabled","onReadyObservable","_scene","getEngine","_renderPipeline","_createTextures","outputTextureOptions","type","format","generateDepthBuffer","generateMipMaps","extraInitializationsAsync","_ref","_asyncToGenerator","Promise","all","apply","arguments","refreshRate","onGeneratedObservable","addOnce","notifyObservers","_setOutputTextureBindings","counter","onBeforeRenderObservable","onAfterRenderTargetsRenderObservable","isReady","render","accumulationOptions","_ref2","_oldAccumulationCopy","onBeforeGenerationObservable","_setAccumulationCopyBindings","bind","localPositionOptions","_ref3","_oldPositionCopy","_updatePositionCopy","voxelGridSize","_getSpatialBlurTexture","_dummyTexture2d","geometryBufferRenderer","velocityIndex","getTextureIndex","VELOCITY_LINEAR_TEXTURE_TYPE","getGBuffer","textures","wPositionIndex","POSITION_TEXTURE_TYPE","index","resize","scaleFactor","newSize","Math","max","floor","_disposeTextures","dispose","clear"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Rendering/IBLShadows/iblShadowsAccumulationPass.js"],"sourcesContent":["\nimport { Vector4 } from \"../../Maths/math.vector.js\";\nimport { PostProcess } from \"../../PostProcesses/postProcess.js\";\nimport { GeometryBufferRenderer } from \"../../Rendering/geometryBufferRenderer.js\";\nimport { ProceduralTexture } from \"../../Materials/Textures/Procedurals/proceduralTexture.js\";\nimport { Observable } from \"../../Misc/observable.js\";\n/**\n * This should not be instanciated directly, as it is part of a scene component\n * @internal\n */\nexport class _IblShadowsAccumulationPass {\n /**\n * Returns the output texture of the pass.\n * @returns The output texture.\n */\n getOutputTexture() {\n return this._outputTexture;\n }\n /**\n * Gets the debug pass post process\n * @returns The post process\n */\n getDebugPassPP() {\n if (!this._debugPassPP) {\n this._createDebugPass();\n }\n return this._debugPassPP;\n }\n /**\n * Gets the name of the debug pass\n * @returns The name of the debug pass\n */\n get debugPassName() {\n return this._debugPassName;\n }\n /**\n * A value that controls how much of the previous frame's accumulation to keep.\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\n */\n get remanence() {\n return this._remanence;\n }\n /**\n * A value that controls how much of the previous frame's accumulation to keep.\n * The higher the value, the faster the shadows accumulate but the more potential ghosting you'll see.\n */\n set remanence(value) {\n this._remanence = value;\n }\n /**\n * Reset the accumulation.\n */\n get reset() {\n return this._reset;\n }\n /**\n * Reset the accumulation.\n */\n set reset(value) {\n this._reset = value;\n }\n /**\n * Tell the pass that the camera is moving. This will cause the accumulation\n * rate to change.\n */\n set isMoving(value) {\n this._isMoving = value;\n }\n /**\n * Sets params that control the position and scaling of the debug display on the screen.\n * @param x Screen X offset of the debug display (0-1)\n * @param y Screen Y offset of the debug display (0-1)\n * @param widthScale X scale of the debug display (0-1)\n * @param heightScale Y scale of the debug display (0-1)\n */\n setDebugDisplayParams(x, y, widthScale, heightScale) {\n this._debugSizeParams.set(x, y, widthScale, heightScale);\n }\n /**\n * Creates the debug post process effect for this pass\n */\n _createDebugPass() {\n if (!this._debugPassPP) {\n const isWebGPU = this._engine.isWebGPU;\n const debugOptions = {\n width: this._engine.getRenderWidth(),\n height: this._engine.getRenderHeight(),\n textureFormat: 5,\n textureType: 0,\n samplingMode: 1,\n uniforms: [\"sizeParams\"],\n samplers: [\"debugSampler\"],\n engine: this._engine,\n reusable: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializations: (useWebGPU, list) => {\n if (useWebGPU) {\n list.push(import(\"../../ShadersWGSL/iblShadowDebug.fragment.js\"));\n }\n else {\n list.push(import(\"../../Shaders/iblShadowDebug.fragment.js\"));\n }\n },\n };\n this._debugPassPP = new PostProcess(this.debugPassName, \"iblShadowDebug\", debugOptions);\n this._debugPassPP.autoClear = false;\n this._debugPassPP.onApplyObservable.add((effect) => {\n // update the caustic texture with what we just rendered.\n effect.setTexture(\"debugSampler\", this._outputTexture);\n effect.setVector4(\"sizeParams\", this._debugSizeParams);\n });\n }\n }\n /**\n * Instantiates the accumulation pass\n * @param scene Scene to attach to\n * @param iblShadowsRenderPipeline The IBL shadows render pipeline\n * @returns The accumulation pass\n */\n constructor(scene, iblShadowsRenderPipeline) {\n this._accumulationParams = new Vector4(0.0, 0.0, 0.0, 0.0);\n /** Enable the debug view for this pass */\n this.debugEnabled = false;\n /**\n * Is the effect enabled\n */\n this.enabled = true;\n /**\n * Observable that triggers when the accumulation texture is ready\n */\n this.onReadyObservable = new Observable();\n this._debugPassName = \"Shadow Accumulation Debug Pass\";\n this._remanence = 0.9;\n this._reset = true;\n this._isMoving = false;\n this._debugSizeParams = new Vector4(0.0, 0.0, 0.0, 0.0);\n this._scene = scene;\n this._engine = scene.getEngine();\n this._renderPipeline = iblShadowsRenderPipeline;\n this._createTextures();\n }\n _createTextures() {\n const isWebGPU = this._engine.isWebGPU;\n const outputTextureOptions = {\n type: 2,\n format: 5,\n samplingMode: 1,\n generateDepthBuffer: false,\n generateMipMaps: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/iblShadowAccumulation.fragment.js\")]);\n }\n else {\n await Promise.all([import(\"../../Shaders/iblShadowAccumulation.fragment.js\")]);\n }\n },\n };\n this._outputTexture = new ProceduralTexture(\"shadowAccumulationPass\", {\n width: this._engine.getRenderWidth(),\n height: this._engine.getRenderHeight(),\n }, \"iblShadowAccumulation\", this._scene, outputTextureOptions);\n this._outputTexture.refreshRate = -1;\n this._outputTexture.autoClear = false;\n this._outputTexture.onGeneratedObservable.addOnce(() => {\n this.onReadyObservable.notifyObservers();\n });\n // Need to set all the textures first so that the effect gets created with the proper uniforms.\n this._setOutputTextureBindings();\n let counter = 0;\n this._scene.onBeforeRenderObservable.add(() => {\n counter = 0;\n });\n this._scene.onAfterRenderTargetsRenderObservable.add(() => {\n if (++counter == 2) {\n if (this.enabled && this._outputTexture.isReady()) {\n this._setOutputTextureBindings();\n this._outputTexture.render();\n }\n }\n });\n // Create the accumulation texture for the previous frame.\n // We'll copy the output of the accumulation pass to this texture at the start of every frame.\n const accumulationOptions = {\n type: 2,\n format: 5,\n samplingMode: 1,\n generateDepthBuffer: false,\n generateMipMaps: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment.js\")]);\n }\n else {\n await Promise.all([import(\"../../Shaders/pass.fragment.js\")]);\n }\n },\n };\n this._oldAccumulationCopy = new ProceduralTexture(\"oldAccumulationRT\", { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() }, \"pass\", this._scene, accumulationOptions, false);\n this._oldAccumulationCopy.autoClear = false;\n this._oldAccumulationCopy.refreshRate = 1;\n this._oldAccumulationCopy.onBeforeGenerationObservable.add(this._setAccumulationCopyBindings.bind(this));\n this._setAccumulationCopyBindings();\n // Create the local position texture for the previous frame.\n // We'll copy the previous local position texture to this texture at the start of every frame.\n const localPositionOptions = {\n type: 2,\n format: 5,\n samplingMode: 1,\n generateDepthBuffer: false,\n generateMipMaps: false,\n shaderLanguage: isWebGPU ? 1 /* ShaderLanguage.WGSL */ : 0 /* ShaderLanguage.GLSL */,\n extraInitializationsAsync: async () => {\n if (isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/pass.fragment.js\")]);\n }\n else {\n await Promise.all([import(\"../../Shaders/pass.fragment.js\")]);\n }\n },\n };\n this._oldPositionCopy = new ProceduralTexture(\"oldLocalPositionRT\", { width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() }, \"pass\", this._scene, localPositionOptions, false);\n this._updatePositionCopy();\n this._oldPositionCopy.autoClear = false;\n this._oldPositionCopy.refreshRate = 1;\n this._oldPositionCopy.onBeforeGenerationObservable.add(this._updatePositionCopy.bind(this));\n }\n _setOutputTextureBindings() {\n const remanence = this._isMoving ? this.remanence : 0.99;\n this._accumulationParams.set(remanence, this.reset ? 1.0 : 0.0, this._renderPipeline.voxelGridSize, 0.0);\n this._outputTexture.setTexture(\"spatialBlurSampler\", this._renderPipeline._getSpatialBlurTexture());\n this._outputTexture.setVector4(\"accumulationParameters\", this._accumulationParams);\n this._outputTexture.setTexture(\"oldAccumulationSampler\", this._oldAccumulationCopy ? this._oldAccumulationCopy : this._renderPipeline._dummyTexture2d);\n this._outputTexture.setTexture(\"prevPositionSampler\", this._oldPositionCopy ? this._oldPositionCopy : this._renderPipeline._dummyTexture2d);\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\n if (!geometryBufferRenderer) {\n return;\n }\n const velocityIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.VELOCITY_LINEAR_TEXTURE_TYPE);\n this._outputTexture.setTexture(\"motionSampler\", geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\n const wPositionIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\n this._outputTexture.setTexture(\"positionSampler\", geometryBufferRenderer.getGBuffer().textures[wPositionIndex]);\n this.reset = false;\n this._isMoving = false;\n }\n _updatePositionCopy() {\n const geometryBufferRenderer = this._scene.geometryBufferRenderer;\n const index = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\n this._oldPositionCopy.setTexture(\"textureSampler\", geometryBufferRenderer.getGBuffer().textures[index]);\n }\n _setAccumulationCopyBindings() {\n this._oldAccumulationCopy.setTexture(\"textureSampler\", this._outputTexture);\n }\n /**\n * Called by render pipeline when canvas resized.\n * @param scaleFactor The factor by which to scale the canvas size.\n */\n resize(scaleFactor = 1.0) {\n const newSize = {\n width: Math.max(1.0, Math.floor(this._engine.getRenderWidth() * scaleFactor)),\n height: Math.max(1.0, Math.floor(this._engine.getRenderHeight() * scaleFactor)),\n };\n this._outputTexture.resize(newSize, false);\n this._oldAccumulationCopy.resize(newSize, false);\n this._oldPositionCopy.resize({ width: this._engine.getRenderWidth(), height: this._engine.getRenderHeight() }, false);\n this.reset = true;\n }\n _disposeTextures() {\n this._oldAccumulationCopy.dispose();\n this._oldPositionCopy.dispose();\n this._outputTexture.dispose();\n }\n /**\n * Checks if the pass is ready\n * @returns true if the pass is ready\n */\n isReady() {\n return (this._oldAccumulationCopy &&\n this._oldAccumulationCopy.isReady() &&\n this._oldPositionCopy &&\n this._oldPositionCopy.isReady() &&\n this._outputTexture.isReady() &&\n !(this._debugPassPP && !this._debugPassPP.isReady()));\n }\n /**\n * Disposes the associated resources\n */\n dispose() {\n this._disposeTextures();\n if (this._debugPassPP) {\n this._debugPassPP.dispose();\n }\n this.onReadyObservable.clear();\n }\n}\n"],"mappings":";AACA,SAASA,OAAO,QAAQ,4BAA4B;AACpD,SAASC,WAAW,QAAQ,oCAAoC;AAChE,SAASC,sBAAsB,QAAQ,2CAA2C;AAClF,SAASC,iBAAiB,QAAQ,2DAA2D;AAC7F,SAASC,UAAU,QAAQ,0BAA0B;AACrD;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,CAAC;EACrC;AACJ;AACA;AACA;EACIC,gBAAgBA,CAAA,EAAG;IACf,OAAO,IAAI,CAACC,cAAc;EAC9B;EACA;AACJ;AACA;AACA;EACIC,cAAcA,CAAA,EAAG;IACb,I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