{"ast":null,"code":"import { RenderTargetWrapper } from \"../renderTargetWrapper.js\";\nimport { HasStencilAspect } from \"../../Materials/Textures/internalTexture.js\";\n/** @internal */\nexport class WebGLRenderTargetWrapper extends RenderTargetWrapper {\n setDepthStencilTexture(texture, disposeExisting = true) {\n super.setDepthStencilTexture(texture, disposeExisting);\n if (!texture) {\n return;\n }\n const engine = this._engine;\n const gl = this._context;\n const hardwareTexture = texture._hardwareTexture;\n if (hardwareTexture && texture._autoMSAAManagement && this._MSAAFramebuffer) {\n const currentFB = engine._currentFramebuffer;\n engine._bindUnboundFramebuffer(this._MSAAFramebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, HasStencilAspect(texture.format) ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, hardwareTexture.getMSAARenderBuffer());\n engine._bindUnboundFramebuffer(currentFB);\n }\n }\n constructor(isMulti, isCube, size, engine, context) {\n super(isMulti, isCube, size, engine);\n /**\n * @internal\n */\n this._framebuffer = null;\n /**\n * @internal\n */\n this._depthStencilBuffer = null;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this._MSAAFramebuffer = null;\n // Multiview\n /**\n * @internal\n */\n this._colorTextureArray = null;\n /**\n * @internal\n */\n this._depthStencilTextureArray = null;\n /**\n * @internal\n */\n this._disposeOnlyFramebuffers = false;\n /**\n * @internal\n */\n this._currentLOD = 0;\n this._context = context;\n }\n _cloneRenderTargetWrapper() {\n let rtw = null;\n if (this._colorTextureArray && this._depthStencilTextureArray) {\n rtw = this._engine.createMultiviewRenderTargetTexture(this.width, this.height);\n rtw.texture.isReady = true;\n } else {\n rtw = super._cloneRenderTargetWrapper();\n }\n return rtw;\n }\n _swapRenderTargetWrapper(target) {\n super._swapRenderTargetWrapper(target);\n target._framebuffer = this._framebuffer;\n target._depthStencilBuffer = this._depthStencilBuffer;\n target._MSAAFramebuffer = this._MSAAFramebuffer;\n target._colorTextureArray = this._colorTextureArray;\n target._depthStencilTextureArray = this._depthStencilTextureArray;\n this._framebuffer = this._depthStencilBuffer = this._MSAAFramebuffer = this._colorTextureArray = this._depthStencilTextureArray = null;\n }\n /**\n * Creates the depth/stencil texture\n * @param comparisonFunction Comparison function to use for the texture\n * @param bilinearFiltering true if bilinear filtering should be used when sampling the texture\n * @param generateStencil true if the stencil aspect should also be created\n * @param samples sample count to use when creating the texture\n * @param format format of the depth texture\n * @param label defines the label to use for the texture (for debugging purpose only)\n * @returns the depth/stencil created texture\n */\n createDepthStencilTexture(comparisonFunction = 0, bilinearFiltering = true, generateStencil = false, samples = 1, format = 14, label) {\n if (this._depthStencilBuffer) {\n const engine = this._engine;\n // Dispose previous depth/stencil render buffers and clear the corresponding attachment.\n // Next time this framebuffer is bound, the new depth/stencil texture will be attached.\n const currentFrameBuffer = engine._currentFramebuffer;\n const gl = this._context;\n engine._bindUnboundFramebuffer(this._framebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\n engine._bindUnboundFramebuffer(currentFrameBuffer);\n gl.deleteRenderbuffer(this._depthStencilBuffer);\n this._depthStencilBuffer = null;\n }\n return super.createDepthStencilTexture(comparisonFunction, bilinearFiltering, generateStencil, samples, format, label);\n }\n /**\n * Shares the depth buffer of this render target with another render target.\n * @param renderTarget Destination renderTarget\n */\n shareDepth(renderTarget) {\n super.shareDepth(renderTarget);\n const gl = this._context;\n const depthbuffer = this._depthStencilBuffer;\n const framebuffer = renderTarget._MSAAFramebuffer || renderTarget._framebuffer;\n const engine = this._engine;\n if (renderTarget._depthStencilBuffer && renderTarget._depthStencilBuffer !== depthbuffer) {\n gl.deleteRenderbuffer(renderTarget._depthStencilBuffer);\n }\n renderTarget._depthStencilBuffer = depthbuffer;\n const attachment = renderTarget._generateStencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\n engine._bindUnboundFramebuffer(framebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthbuffer);\n engine._bindUnboundFramebuffer(null);\n }\n /**\n * Binds a texture to this render target on a specific attachment\n * @param texture The texture to bind to the framebuffer\n * @param attachmentIndex Index of the attachment\n * @param faceIndexOrLayer The face or layer of the texture to render to in case of cube texture or array texture\n * @param lodLevel defines the lod level to bind to the frame buffer\n */\n _bindTextureRenderTarget(texture, attachmentIndex = 0, faceIndexOrLayer, lodLevel = 0) {\n const hardwareTexture = texture._hardwareTexture;\n if (!hardwareTexture) {\n return;\n }\n const framebuffer = this._framebuffer;\n const engine = this._engine;\n const currentFB = engine._currentFramebuffer;\n engine._bindUnboundFramebuffer(framebuffer);\n let attachment;\n if (engine.webGLVersion > 1) {\n const gl = this._context;\n attachment = gl[\"COLOR_ATTACHMENT\" + attachmentIndex];\n if (texture.is2DArray || texture.is3D) {\n var _ref, _faceIndexOrLayer, _this$layerIndices;\n faceIndexOrLayer = (_ref = (_faceIndexOrLayer = faceIndexOrLayer) !== null && _faceIndexOrLayer !== void 0 ? _faceIndexOrLayer : (_this$layerIndices = this.layerIndices) === null || _this$layerIndices === void 0 ? void 0 : _this$layerIndices[attachmentIndex]) !== null && _ref !== void 0 ? _ref : 0;\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, hardwareTexture.underlyingResource, lodLevel, faceIndexOrLayer);\n } else if (texture.isCube) {\n var _ref2, _faceIndexOrLayer2, _this$faceIndices;\n // if face index is not specified, try to query it from faceIndices\n // default is face 0\n faceIndexOrLayer = (_ref2 = (_faceIndexOrLayer2 = faceIndexOrLayer) !== null && _faceIndexOrLayer2 !== void 0 ? _faceIndexOrLayer2 : (_this$faceIndices = this.faceIndices) === null || _this$faceIndices === void 0 ? void 0 : _this$faceIndices[attachmentIndex]) !== null && _ref2 !== void 0 ? _ref2 : 0;\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer, hardwareTexture.underlyingResource, lodLevel);\n } else {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, hardwareTexture.underlyingResource, lodLevel);\n }\n } else {\n // Default behavior (WebGL)\n const gl = this._context;\n attachment = gl[\"COLOR_ATTACHMENT\" + attachmentIndex + \"_WEBGL\"];\n const target = faceIndexOrLayer !== undefined ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer : gl.TEXTURE_2D;\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, target, hardwareTexture.underlyingResource, lodLevel);\n }\n if (texture._autoMSAAManagement && this._MSAAFramebuffer) {\n const gl = this._context;\n engine._bindUnboundFramebuffer(this._MSAAFramebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, hardwareTexture.getMSAARenderBuffer());\n }\n engine._bindUnboundFramebuffer(currentFB);\n }\n /**\n * Set a texture in the textures array\n * @param texture the texture to set\n * @param index the index in the textures array to set\n * @param disposePrevious If this function should dispose the previous texture\n */\n setTexture(texture, index = 0, disposePrevious = true) {\n super.setTexture(texture, index, disposePrevious);\n this._bindTextureRenderTarget(texture, index);\n }\n /**\n * Sets the layer and face indices of every render target texture\n * @param layers The layer of the texture to be set (make negative to not modify)\n * @param faces The face of the texture to be set (make negative to not modify)\n */\n setLayerAndFaceIndices(layers, faces) {\n var _this$_attachments$le, _this$_attachments;\n super.setLayerAndFaceIndices(layers, faces);\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\n return;\n }\n // the length of this._attachments is the right one as it does not count the depth texture, in case we generated it\n const textureCount = (_this$_attachments$le = (_this$_attachments = this._attachments) === null || _this$_attachments === void 0 ? void 0 : _this$_attachments.length) !== null && _this$_attachments$le !== void 0 ? _this$_attachments$le : this.textures.length;\n for (let index = 0; index < textureCount; index++) {\n const texture = this.textures[index];\n if (!texture) {\n // The target type was probably -1 at creation time and setTexture has not been called yet for this index\n continue;\n }\n if (texture.is2DArray || texture.is3D) {\n this._bindTextureRenderTarget(texture, index, this.layerIndices[index]);\n } else if (texture.isCube) {\n this._bindTextureRenderTarget(texture, index, this.faceIndices[index]);\n } else {\n this._bindTextureRenderTarget(texture, index);\n }\n }\n }\n /**\n * Set the face and layer indices of a texture in the textures array\n * @param index The index of the texture in the textures array to modify\n * @param layer The layer of the texture to be set\n * @param face The face of the texture to be set\n */\n setLayerAndFaceIndex(index = 0, layer, face) {\n super.setLayerAndFaceIndex(index, layer, face);\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\n return;\n }\n const texture = this.textures[index];\n if (texture.is2DArray || texture.is3D) {\n this._bindTextureRenderTarget(this.textures[index], index, this.layerIndices[index]);\n } else if (texture.isCube) {\n this._bindTextureRenderTarget(this.textures[index], index, this.faceIndices[index]);\n }\n }\n resolveMSAATextures() {\n const engine = this._engine;\n const currentFramebuffer = engine._currentFramebuffer;\n engine._bindUnboundFramebuffer(this._MSAAFramebuffer);\n super.resolveMSAATextures();\n engine._bindUnboundFramebuffer(currentFramebuffer);\n }\n dispose(disposeOnlyFramebuffers = this._disposeOnlyFramebuffers) {\n const gl = this._context;\n if (!disposeOnlyFramebuffers) {\n if (this._colorTextureArray) {\n this._context.deleteTexture(this._colorTextureArray);\n this._colorTextureArray = null;\n }\n if (this._depthStencilTextureArray) {\n this._context.deleteTexture(this._depthStencilTextureArray);\n this._depthStencilTextureArray = null;\n }\n }\n if (this._framebuffer) {\n gl.deleteFramebuffer(this._framebuffer);\n this._framebuffer = null;\n }\n if (this._depthStencilBuffer) {\n gl.deleteRenderbuffer(this._depthStencilBuffer);\n this._depthStencilBuffer = null;\n }\n if (this._MSAAFramebuffer) {\n gl.deleteFramebuffer(this._MSAAFramebuffer);\n this._MSAAFramebuffer = null;\n }\n super.dispose(disposeOnlyFramebuffers);\n }\n}","map":{"version":3,"names":["RenderTargetWrapper","HasStencilAspect","WebGLRenderTargetWrapper","setDepthStencilTexture","texture","disposeExisting","engine","_engine","gl","_context","hardwareTexture","_hardwareTexture","_autoMSAAManagement","_MSAAFramebuffer","currentFB","_currentFramebuffer","_bindUnboundFramebuffer","framebufferRenderbuffer","FRAMEBUFFER","format","DEPTH_STENCIL_ATTACHMENT","DEPTH_ATTACHMENT","RENDERBUFFER","getMSAARenderBuffer","constructor","isMulti","isCube","size","context","_framebuffer","_depthStencilBuffer","_colorTextureArray","_depthStencilTextureArray","_disposeOnlyFramebuffers","_currentLOD","_cloneRenderTargetWrapper","rtw","createMultiviewRenderTargetTexture","width","height","isReady","_swapRenderTargetWrapper","target","createDepthStencilTexture","comparisonFunction","bilinearFiltering","generateStencil","samples","label","currentFrameBuffer","STENCIL_ATTACHMENT","deleteRenderbuffer","shareDepth","renderTarget","depthbuffer","framebuffer","attachment","_generateStencilBuffer","_bindTextureRenderTarget","attachmentIndex","faceIndexOrLayer","lodLevel","webGLVersion","is2DArray","is3D","_ref","_faceIndexOrLayer","_this$layerIndices","layerIndices","framebufferTextureLayer","underlyingResource","_ref2","_faceIndexOrLayer2","_this$faceIndices","faceIndices","framebufferTexture2D","TEXTURE_CUBE_MAP_POSITIVE_X","TEXTURE_2D","undefined","setTexture","index","disposePrevious","setLayerAndFaceIndices","layers","faces","_this$_attachments$le","_this$_attachments","textures","textureCount","_attachments","length","setLayerAndFaceIndex","layer","face","resolveMSAATextures","currentFramebuffer","dispose","disposeOnlyFramebuffers","deleteTexture","deleteFramebuffer"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/WebGL/webGLRenderTargetWrapper.js"],"sourcesContent":["\nimport { RenderTargetWrapper } from \"../renderTargetWrapper.js\";\nimport { HasStencilAspect } from \"../../Materials/Textures/internalTexture.js\";\n/** @internal */\nexport class WebGLRenderTargetWrapper extends RenderTargetWrapper {\n setDepthStencilTexture(texture, disposeExisting = true) {\n super.setDepthStencilTexture(texture, disposeExisting);\n if (!texture) {\n return;\n }\n const engine = this._engine;\n const gl = this._context;\n const hardwareTexture = texture._hardwareTexture;\n if (hardwareTexture && texture._autoMSAAManagement && this._MSAAFramebuffer) {\n const currentFB = engine._currentFramebuffer;\n engine._bindUnboundFramebuffer(this._MSAAFramebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, HasStencilAspect(texture.format) ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, hardwareTexture.getMSAARenderBuffer());\n engine._bindUnboundFramebuffer(currentFB);\n }\n }\n constructor(isMulti, isCube, size, engine, context) {\n super(isMulti, isCube, size, engine);\n /**\n * @internal\n */\n this._framebuffer = null;\n /**\n * @internal\n */\n this._depthStencilBuffer = null;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this._MSAAFramebuffer = null;\n // Multiview\n /**\n * @internal\n */\n this._colorTextureArray = null;\n /**\n * @internal\n */\n this._depthStencilTextureArray = null;\n /**\n * @internal\n */\n this._disposeOnlyFramebuffers = false;\n /**\n * @internal\n */\n this._currentLOD = 0;\n this._context = context;\n }\n _cloneRenderTargetWrapper() {\n let rtw = null;\n if (this._colorTextureArray && this._depthStencilTextureArray) {\n rtw = this._engine.createMultiviewRenderTargetTexture(this.width, this.height);\n rtw.texture.isReady = true;\n }\n else {\n rtw = super._cloneRenderTargetWrapper();\n }\n return rtw;\n }\n _swapRenderTargetWrapper(target) {\n super._swapRenderTargetWrapper(target);\n target._framebuffer = this._framebuffer;\n target._depthStencilBuffer = this._depthStencilBuffer;\n target._MSAAFramebuffer = this._MSAAFramebuffer;\n target._colorTextureArray = this._colorTextureArray;\n target._depthStencilTextureArray = this._depthStencilTextureArray;\n this._framebuffer = this._depthStencilBuffer = this._MSAAFramebuffer = this._colorTextureArray = this._depthStencilTextureArray = null;\n }\n /**\n * Creates the depth/stencil texture\n * @param comparisonFunction Comparison function to use for the texture\n * @param bilinearFiltering true if bilinear filtering should be used when sampling the texture\n * @param generateStencil true if the stencil aspect should also be created\n * @param samples sample count to use when creating the texture\n * @param format format of the depth texture\n * @param label defines the label to use for the texture (for debugging purpose only)\n * @returns the depth/stencil created texture\n */\n createDepthStencilTexture(comparisonFunction = 0, bilinearFiltering = true, generateStencil = false, samples = 1, format = 14, label) {\n if (this._depthStencilBuffer) {\n const engine = this._engine;\n // Dispose previous depth/stencil render buffers and clear the corresponding attachment.\n // Next time this framebuffer is bound, the new depth/stencil texture will be attached.\n const currentFrameBuffer = engine._currentFramebuffer;\n const gl = this._context;\n engine._bindUnboundFramebuffer(this._framebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\n engine._bindUnboundFramebuffer(currentFrameBuffer);\n gl.deleteRenderbuffer(this._depthStencilBuffer);\n this._depthStencilBuffer = null;\n }\n return super.createDepthStencilTexture(comparisonFunction, bilinearFiltering, generateStencil, samples, format, label);\n }\n /**\n * Shares the depth buffer of this render target with another render target.\n * @param renderTarget Destination renderTarget\n */\n shareDepth(renderTarget) {\n super.shareDepth(renderTarget);\n const gl = this._context;\n const depthbuffer = this._depthStencilBuffer;\n const framebuffer = renderTarget._MSAAFramebuffer || renderTarget._framebuffer;\n const engine = this._engine;\n if (renderTarget._depthStencilBuffer && renderTarget._depthStencilBuffer !== depthbuffer) {\n gl.deleteRenderbuffer(renderTarget._depthStencilBuffer);\n }\n renderTarget._depthStencilBuffer = depthbuffer;\n const attachment = renderTarget._generateStencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\n engine._bindUnboundFramebuffer(framebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthbuffer);\n engine._bindUnboundFramebuffer(null);\n }\n /**\n * Binds a texture to this render target on a specific attachment\n * @param texture The texture to bind to the framebuffer\n * @param attachmentIndex Index of the attachment\n * @param faceIndexOrLayer The face or layer of the texture to render to in case of cube texture or array texture\n * @param lodLevel defines the lod level to bind to the frame buffer\n */\n _bindTextureRenderTarget(texture, attachmentIndex = 0, faceIndexOrLayer, lodLevel = 0) {\n const hardwareTexture = texture._hardwareTexture;\n if (!hardwareTexture) {\n return;\n }\n const framebuffer = this._framebuffer;\n const engine = this._engine;\n const currentFB = engine._currentFramebuffer;\n engine._bindUnboundFramebuffer(framebuffer);\n let attachment;\n if (engine.webGLVersion > 1) {\n const gl = this._context;\n attachment = gl[\"COLOR_ATTACHMENT\" + attachmentIndex];\n if (texture.is2DArray || texture.is3D) {\n faceIndexOrLayer = faceIndexOrLayer ?? this.layerIndices?.[attachmentIndex] ?? 0;\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, hardwareTexture.underlyingResource, lodLevel, faceIndexOrLayer);\n }\n else if (texture.isCube) {\n // if face index is not specified, try to query it from faceIndices\n // default is face 0\n faceIndexOrLayer = faceIndexOrLayer ?? this.faceIndices?.[attachmentIndex] ?? 0;\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer, hardwareTexture.underlyingResource, lodLevel);\n }\n else {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, hardwareTexture.underlyingResource, lodLevel);\n }\n }\n else {\n // Default behavior (WebGL)\n const gl = this._context;\n attachment = gl[\"COLOR_ATTACHMENT\" + attachmentIndex + \"_WEBGL\"];\n const target = faceIndexOrLayer !== undefined ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer : gl.TEXTURE_2D;\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, target, hardwareTexture.underlyingResource, lodLevel);\n }\n if (texture._autoMSAAManagement && this._MSAAFramebuffer) {\n const gl = this._context;\n engine._bindUnboundFramebuffer(this._MSAAFramebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, hardwareTexture.getMSAARenderBuffer());\n }\n engine._bindUnboundFramebuffer(currentFB);\n }\n /**\n * Set a texture in the textures array\n * @param texture the texture to set\n * @param index the index in the textures array to set\n * @param disposePrevious If this function should dispose the previous texture\n */\n setTexture(texture, index = 0, disposePrevious = true) {\n super.setTexture(texture, index, disposePrevious);\n this._bindTextureRenderTarget(texture, index);\n }\n /**\n * Sets the layer and face indices of every render target texture\n * @param layers The layer of the texture to be set (make negative to not modify)\n * @param faces The face of the texture to be set (make negative to not modify)\n */\n setLayerAndFaceIndices(layers, faces) {\n super.setLayerAndFaceIndices(layers, faces);\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\n return;\n }\n // the length of this._attachments is the right one as it does not count the depth texture, in case we generated it\n const textureCount = this._attachments?.length ?? this.textures.length;\n for (let index = 0; index < textureCount; index++) {\n const texture = this.textures[index];\n if (!texture) {\n // The target type was probably -1 at creation time and setTexture has not been called yet for this index\n continue;\n }\n if (texture.is2DArray || texture.is3D) {\n this._bindTextureRenderTarget(texture, index, this.layerIndices[index]);\n }\n else if (texture.isCube) {\n this._bindTextureRenderTarget(texture, index, this.faceIndices[index]);\n }\n else {\n this._bindTextureRenderTarget(texture, index);\n }\n }\n }\n /**\n * Set the face and layer indices of a texture in the textures array\n * @param index The index of the texture in the textures array to modify\n * @param layer The layer of the texture to be set\n * @param face The face of the texture to be set\n */\n setLayerAndFaceIndex(index = 0, layer, face) {\n super.setLayerAndFaceIndex(index, layer, face);\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\n return;\n }\n const texture = this.textures[index];\n if (texture.is2DArray || texture.is3D) {\n this._bindTextureRenderTarget(this.textures[index], index, this.layerIndices[index]);\n }\n else if (texture.isCube) {\n this._bindTextureRenderTarget(this.textures[index], index, this.faceIndices[index]);\n }\n }\n resolveMSAATextures() {\n const engine = this._engine;\n const currentFramebuffer = engine._currentFramebuffer;\n engine._bindUnboundFramebuffer(this._MSAAFramebuffer);\n super.resolveMSAATextures();\n engine._bindUnboundFramebuffer(currentFramebuffer);\n }\n dispose(disposeOnlyFramebuffers = this._disposeOnlyFramebuffers) {\n const gl = this._context;\n if (!disposeOnlyFramebuffers) {\n if (this._colorTextureArray) {\n this._context.deleteTexture(this._colorTextureArray);\n this._colorTextureArray = null;\n }\n if (this._depthStencilTextureArray) {\n this._context.deleteTexture(this._depthStencilTextureArray);\n this._depthStencilTextureArray = null;\n }\n }\n if (this._framebuffer) {\n gl.deleteFramebuffer(this._framebuffer);\n this._framebuffer = null;\n }\n if (this._depthStencilBuffer) {\n gl.deleteRenderbuffer(this._depthStencilBuffer);\n this._depthStencilBuffer = null;\n }\n if (this._MSAAFramebuffer) {\n gl.deleteFramebuffer(this._MSAAFramebuffer);\n this._MSAAFramebuffer = null;\n }\n super.dispose(disposeOnlyFramebuffers);\n }\n}\n"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,gBAAgB,QAAQ,6CAA6C;AAC9E;AACA,OAAO,MAAMC,wBAAwB,SAASF,mBAAmB,CAAC;EAC9DG,sBAAsBA,CAACC,OAAO,EAAEC,eAAe,GAAG,IAAI,EAAE;IACpD,KAAK,CAACF,sBAAsB,CAACC,OAAO,EAAEC,eAAe,CAAC;IACtD,IAAI,CAACD,OAAO,EAAE;MACV;IACJ;IACA,MAAME,MAAM,GAAG,IAAI,CAACC,OAAO;IAC3B,MAAMC,EAAE,GAAG,IAAI,CAACC,QAAQ;IACxB,MAAMC,eAAe,GAAGN,OAAO,CAACO,gBAAgB;IAChD,IAAID,eAAe,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