980047373dbd8ef3384a612b0e150ef95d023bfa8e5c5ae1113c7b275d66c59a.json 5.6 KB

1
  1. {"ast":null,"code":"/** @internal */\nexport class WebGLHardwareTexture {\n get underlyingResource() {\n return this._webGLTexture;\n }\n constructor(existingTexture = null, context) {\n // There can be multiple buffers for a single WebGL texture because different layers of a 2DArrayTexture / 3DTexture\n // or different faces of a cube texture can be bound to different render targets at the same time.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this._MSAARenderBuffers = null;\n this._context = context;\n if (!existingTexture) {\n existingTexture = context.createTexture();\n if (!existingTexture) {\n throw new Error(\"Unable to create webGL texture\");\n }\n }\n this.set(existingTexture);\n }\n setUsage() {}\n set(hardwareTexture) {\n this._webGLTexture = hardwareTexture;\n }\n reset() {\n this._webGLTexture = null;\n this._MSAARenderBuffers = null;\n }\n addMSAARenderBuffer(buffer) {\n if (!this._MSAARenderBuffers) {\n this._MSAARenderBuffers = [];\n }\n this._MSAARenderBuffers.push(buffer);\n }\n releaseMSAARenderBuffers() {\n if (this._MSAARenderBuffers) {\n for (const buffer of this._MSAARenderBuffers) {\n this._context.deleteRenderbuffer(buffer);\n }\n this._MSAARenderBuffers = null;\n }\n }\n getMSAARenderBuffer(index = 0) {\n var _this$_MSAARenderBuff, _this$_MSAARenderBuff2;\n return (_this$_MSAARenderBuff = (_this$_MSAARenderBuff2 = this._MSAARenderBuffers) === null || _this$_MSAARenderBuff2 === void 0 ? void 0 : _this$_MSAARenderBuff2[index]) !== null && _this$_MSAARenderBuff !== void 0 ? _this$_MSAARenderBuff : null;\n }\n release() {\n this.releaseMSAARenderBuffers();\n if (this._webGLTexture) {\n this._context.deleteTexture(this._webGLTexture);\n }\n this.reset();\n }\n}","map":{"version":3,"names":["WebGLHardwareTexture","underlyingResource","_webGLTexture","constructor","existingTexture","context","_MSAARenderBuffers","_context","createTexture","Error","set","setUsage","hardwareTexture","reset","addMSAARenderBuffer","buffer","push","releaseMSAARenderBuffers","deleteRenderbuffer","getMSAARenderBuffer","index","_this$_MSAARenderBuff","_this$_MSAARenderBuff2","release","deleteTexture"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/WebGL/webGLHardwareTexture.js"],"sourcesContent":["/** @internal */\nexport class WebGLHardwareTexture {\n get underlyingResource() {\n return this._webGLTexture;\n }\n constructor(existingTexture = null, context) {\n // There can be multiple buffers for a single WebGL texture because different layers of a 2DArrayTexture / 3DTexture\n // or different faces of a cube texture can be bound to different render targets at the same time.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this._MSAARenderBuffers = null;\n this._context = context;\n if (!existingTexture) {\n existingTexture = context.createTexture();\n if (!existingTexture) {\n throw new Error(\"Unable to create webGL texture\");\n }\n }\n this.set(existingTexture);\n }\n setUsage() { }\n set(hardwareTexture) {\n this._webGLTexture = hardwareTexture;\n }\n reset() {\n this._webGLTexture = null;\n this._MSAARenderBuffers = null;\n }\n addMSAARenderBuffer(buffer) {\n if (!this._MSAARenderBuffers) {\n this._MSAARenderBuffers = [];\n }\n this._MSAARenderBuffers.push(buffer);\n }\n releaseMSAARenderBuffers() {\n if (this._MSAARenderBuffers) {\n for (const buffer of this._MSAARenderBuffers) {\n this._context.deleteRenderbuffer(buffer);\n }\n this._MSAARenderBuffers = null;\n }\n }\n getMSAARenderBuffer(index = 0) {\n return this._MSAARenderBuffers?.[index] ?? null;\n }\n release() {\n this.releaseMSAARenderBuffers();\n if (this._webGLTexture) {\n this._context.deleteTexture(this._webGLTexture);\n }\n this.reset();\n }\n}\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,oBAAoB,CAAC;EAC9B,IAAIC,kBAAkBA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACC,aAAa;EAC7B;EACAC,WAAWA,CAACC,eAAe,GAAG,IAAI,EAAEC,OAAO,EAAE;IACzC;IACA;IACA;IACA,IAAI,CAACC,kBAAkB,GAAG,IAAI;IAC9B,IAAI,CAACC,QAAQ,GAAGF,OAAO;IACvB,IAAI,CAACD,eAAe,EA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