{"ast":null,"code":"import { Engine } from \"../engine.js\";\nfunction transformTextureUrl(url) {\n const excludeFn = entry => {\n const strRegExPattern = \"\\\\b\" + entry + \"\\\\b\";\n return url && (url === entry || url.match(new RegExp(strRegExPattern, \"g\")));\n };\n if (this._excludedCompressedTextures && this._excludedCompressedTextures.some(excludeFn)) {\n return url;\n }\n const lastDot = url.lastIndexOf(\".\");\n const lastQuestionMark = url.lastIndexOf(\"?\");\n const querystring = lastQuestionMark > -1 ? url.substring(lastQuestionMark, url.length) : \"\";\n return (lastDot > -1 ? url.substring(0, lastDot) : url) + this._textureFormatInUse + querystring;\n}\nObject.defineProperty(Engine.prototype, \"texturesSupported\", {\n get: function () {\n // Intelligently add supported compressed formats in order to check for.\n // Check for ASTC support first as it is most powerful and to be very cross platform.\n // Next PVRTC & DXT, which are probably superior to ETC1/2.\n // Likely no hardware which supports both PVR & DXT, so order matters little.\n // ETC2 is newer and handles ETC1 (no alpha capability), so check for first.\n const texturesSupported = [];\n if (this._caps.astc) {\n texturesSupported.push(\"-astc.ktx\");\n }\n if (this._caps.s3tc) {\n texturesSupported.push(\"-dxt.ktx\");\n }\n if (this._caps.pvrtc) {\n texturesSupported.push(\"-pvrtc.ktx\");\n }\n if (this._caps.etc2) {\n texturesSupported.push(\"-etc2.ktx\");\n }\n if (this._caps.etc1) {\n texturesSupported.push(\"-etc1.ktx\");\n }\n return texturesSupported;\n },\n enumerable: true,\n configurable: true\n});\nObject.defineProperty(Engine.prototype, \"textureFormatInUse\", {\n get: function () {\n return this._textureFormatInUse || null;\n },\n enumerable: true,\n configurable: true\n});\nEngine.prototype.setCompressedTextureExclusions = function (skippedFiles) {\n this._excludedCompressedTextures = skippedFiles;\n};\nEngine.prototype.setTextureFormatToUse = function (formatsAvailable) {\n const texturesSupported = this.texturesSupported;\n for (let i = 0, len1 = texturesSupported.length; i < len1; i++) {\n for (let j = 0, len2 = formatsAvailable.length; j < len2; j++) {\n if (texturesSupported[i] === formatsAvailable[j].toLowerCase()) {\n this._transformTextureUrl = transformTextureUrl.bind(this);\n return this._textureFormatInUse = texturesSupported[i];\n }\n }\n }\n // actively set format to nothing, to allow this to be called more than once\n // and possibly fail the 2nd time\n this._textureFormatInUse = \"\";\n this._transformTextureUrl = null;\n return null;\n};","map":{"version":3,"names":["Engine","transformTextureUrl","url","excludeFn","entry","strRegExPattern","match","RegExp","_excludedCompressedTextures","some","lastDot","lastIndexOf","lastQuestionMark","querystring","substring","length","_textureFormatInUse","Object","defineProperty","prototype","get","texturesSupported","_caps","astc","push","s3tc","pvrtc","etc2","etc1","enumerable","configurable","setCompressedTextureExclusions","skippedFiles","setTextureFormatToUse","formatsAvailable","i","len1","j","len2","toLowerCase","_transformTextureUrl","bind"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/Extensions/engine.textureSelector.js"],"sourcesContent":["import { Engine } from \"../engine.js\";\nfunction transformTextureUrl(url) {\n const excludeFn = (entry) => {\n const strRegExPattern = \"\\\\b\" + entry + \"\\\\b\";\n return url && (url === entry || url.match(new RegExp(strRegExPattern, \"g\")));\n };\n if (this._excludedCompressedTextures && this._excludedCompressedTextures.some(excludeFn)) {\n return url;\n }\n const lastDot = url.lastIndexOf(\".\");\n const lastQuestionMark = url.lastIndexOf(\"?\");\n const querystring = lastQuestionMark > -1 ? url.substring(lastQuestionMark, url.length) : \"\";\n return (lastDot > -1 ? url.substring(0, lastDot) : url) + this._textureFormatInUse + querystring;\n}\nObject.defineProperty(Engine.prototype, \"texturesSupported\", {\n get: function () {\n // Intelligently add supported compressed formats in order to check for.\n // Check for ASTC support first as it is most powerful and to be very cross platform.\n // Next PVRTC & DXT, which are probably superior to ETC1/2.\n // Likely no hardware which supports both PVR & DXT, so order matters little.\n // ETC2 is newer and handles ETC1 (no alpha capability), so check for first.\n const texturesSupported = [];\n if (this._caps.astc) {\n texturesSupported.push(\"-astc.ktx\");\n }\n if (this._caps.s3tc) {\n texturesSupported.push(\"-dxt.ktx\");\n }\n if (this._caps.pvrtc) {\n texturesSupported.push(\"-pvrtc.ktx\");\n }\n if (this._caps.etc2) {\n texturesSupported.push(\"-etc2.ktx\");\n }\n if (this._caps.etc1) {\n texturesSupported.push(\"-etc1.ktx\");\n }\n return texturesSupported;\n },\n enumerable: true,\n configurable: true,\n});\nObject.defineProperty(Engine.prototype, \"textureFormatInUse\", {\n get: function () {\n return this._textureFormatInUse || null;\n },\n enumerable: true,\n configurable: true,\n});\nEngine.prototype.setCompressedTextureExclusions = function (skippedFiles) {\n this._excludedCompressedTextures = skippedFiles;\n};\nEngine.prototype.setTextureFormatToUse = function (formatsAvailable) {\n const texturesSupported = this.texturesSupported;\n for (let i = 0, len1 = texturesSupported.length; i < len1; i++) {\n for (let j = 0, len2 = formatsAvailable.length; j < len2; j++) {\n if (texturesSupported[i] === formatsAvailable[j].toLowerCase()) {\n this._transformTextureUrl = transformTextureUrl.bind(this);\n return (this._textureFormatInUse = texturesSupported[i]);\n }\n }\n }\n // actively set format to nothing, to allow this to be called more than once\n // and possibly fail the 2nd time\n this._textureFormatInUse = \"\";\n this._transformTextureUrl = null;\n return null;\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,SAASC,mBAAmBA,CAACC,GAAG,EAAE;EAC9B,MAAMC,SAAS,GAAIC,KAAK,IAAK;IACzB,MAAMC,eAAe,GAAG,KAAK,GAAGD,KAAK,GAAG,KAAK;IAC7C,OAAOF,GAAG,KAAKA,GAAG,KAAKE,KAAK,IAAIF,GAAG,CAACI,KAAK,CAAC,IAAIC,MAAM,CAACF,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC;EAChF,CAAC;EACD,IAAI,IAAI,CAACG,2BAA2B,IAAI,IAAI,CAACA,2BAA2B,CAACC,IAAI,CAACN,SAAS,CAAC,EAAE;IACtF,OAAOD,GAAG;EACd;EACA,MAAMQ,OAAO,GAAGR,GAAG,CAACS,WAAW,CAAC,GAAG,CAAC;EACpC,MAAMC,gBAAgB,GAAGV,GAAG,CAAC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