{"ast":null,"code":"import { GetExponentOfTwo } from \"../../Misc/tools.functions.js\";\nimport { ThinEngine } from \"../../Engines/thinEngine.js\";\nimport { InternalTexture } from \"../../Materials/Textures/internalTexture.js\";\nThinEngine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {\n const texture = new InternalTexture(this, 4 /* InternalTextureSource.Dynamic */);\n texture.baseWidth = width;\n texture.baseHeight = height;\n if (generateMipMaps) {\n width = this.needPOTTextures ? GetExponentOfTwo(width, this._caps.maxTextureSize) : width;\n height = this.needPOTTextures ? GetExponentOfTwo(height, this._caps.maxTextureSize) : height;\n }\n // this.resetTextureCache();\n texture.width = width;\n texture.height = height;\n texture.isReady = false;\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n this.updateTextureSamplingMode(samplingMode, texture);\n this._internalTexturesCache.push(texture);\n return texture;\n};\nThinEngine.prototype.updateDynamicTexture = function (texture, source, invertY, premulAlpha = false, format, forceBindTexture = false,\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nallowGPUOptimization = false) {\n if (!texture) {\n return;\n }\n const gl = this._gl;\n const target = gl.TEXTURE_2D;\n const wasPreviouslyBound = this._bindTextureDirectly(target, texture, true, forceBindTexture);\n this._unpackFlipY(invertY === undefined ? texture.invertY : invertY);\n if (premulAlpha) {\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);\n }\n const textureType = this._getWebGLTextureType(texture.type);\n const glformat = this._getInternalFormat(format ? format : texture.format);\n const internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, glformat);\n gl.texImage2D(target, 0, internalFormat, glformat, textureType, source);\n if (texture.generateMipMaps) {\n gl.generateMipmap(target);\n }\n if (!wasPreviouslyBound) {\n this._bindTextureDirectly(target, null);\n }\n if (premulAlpha) {\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\n }\n if (format) {\n texture.format = format;\n }\n texture._dynamicTextureSource = source;\n texture._premulAlpha = premulAlpha;\n texture.invertY = invertY || false;\n texture.isReady = true;\n};","map":{"version":3,"names":["GetExponentOfTwo","ThinEngine","InternalTexture","prototype","createDynamicTexture","width","height","generateMipMaps","samplingMode","texture","baseWidth","baseHeight","needPOTTextures","_caps","maxTextureSize","isReady","updateTextureSamplingMode","_internalTexturesCache","push","updateDynamicTexture","source","invertY","premulAlpha","format","forceBindTexture","allowGPUOptimization","gl","_gl","target","TEXTURE_2D","wasPreviouslyBound","_bindTextureDirectly","_unpackFlipY","undefined","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","textureType","_getWebGLTextureType","type","glformat","_getInternalFormat","internalFormat","_getRGBABufferInternalSizedFormat","texImage2D","generateMipmap","_dynamicTextureSource","_premulAlpha"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicTexture.js"],"sourcesContent":["import { GetExponentOfTwo } from \"../../Misc/tools.functions.js\";\nimport { ThinEngine } from \"../../Engines/thinEngine.js\";\nimport { InternalTexture } from \"../../Materials/Textures/internalTexture.js\";\nThinEngine.prototype.createDynamicTexture = function (width, height, generateMipMaps, samplingMode) {\n const texture = new InternalTexture(this, 4 /* InternalTextureSource.Dynamic */);\n texture.baseWidth = width;\n texture.baseHeight = height;\n if (generateMipMaps) {\n width = this.needPOTTextures ? GetExponentOfTwo(width, this._caps.maxTextureSize) : width;\n height = this.needPOTTextures ? GetExponentOfTwo(height, this._caps.maxTextureSize) : height;\n }\n // this.resetTextureCache();\n texture.width = width;\n texture.height = height;\n texture.isReady = false;\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n this.updateTextureSamplingMode(samplingMode, texture);\n this._internalTexturesCache.push(texture);\n return texture;\n};\nThinEngine.prototype.updateDynamicTexture = function (texture, source, invertY, premulAlpha = false, format, forceBindTexture = false, \n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nallowGPUOptimization = false) {\n if (!texture) {\n return;\n }\n const gl = this._gl;\n const target = gl.TEXTURE_2D;\n const wasPreviouslyBound = this._bindTextureDirectly(target, texture, true, forceBindTexture);\n this._unpackFlipY(invertY === undefined ? texture.invertY : invertY);\n if (premulAlpha) {\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);\n }\n const textureType = this._getWebGLTextureType(texture.type);\n const glformat = this._getInternalFormat(format ? format : texture.format);\n const internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, glformat);\n gl.texImage2D(target, 0, internalFormat, glformat, textureType, source);\n if (texture.generateMipMaps) {\n gl.generateMipmap(target);\n }\n if (!wasPreviouslyBound) {\n this._bindTextureDirectly(target, null);\n }\n if (premulAlpha) {\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\n }\n if (format) {\n texture.format = format;\n }\n texture._dynamicTextureSource = source;\n texture._premulAlpha = premulAlpha;\n texture.invertY = invertY || false;\n texture.isReady = true;\n};\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,UAAU,QAAQ,6BAA6B;AACxD,SAASC,eAAe,QAAQ,6CAA6C;AAC7ED,UAAU,CAACE,SAAS,CAACC,oBAAoB,GAAG,UAAUC,KAAK,EAAEC,MAAM,EAAEC,eAAe,EAAEC,YAAY,EAAE;EAChG,MAAMC,OAAO,GAAG,IAAIP,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,mCAAmC,CAAC;EAChFO,OAAO,CAACC,SAAS,GAAGL,KAAK;EACzBI,OAAO,CAACE,UAAU,GAAGL,MAAM;EAC3B,IAAIC,eAAe,EAAE;IACjBF,KAAK,GAAG,IAAI,CAACO,eAAe,GAAGZ,gBAAgB,CAACK,KAAK,EAAE,IAAI,CAACQ,KAAK,CAACC,cAAc,CAAC,GAAGT,KAAK;IACzFC,MAAM,GAAG,IAAI,CAACM,eAAe,GAAGZ,gBAAgB,CAACM,MAAM,EAAE,IAAI,CAACO,KAAK,CAACC,cAAc,CAAC,GAAGR,MAAM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