@galacean/engine-loader 1.5.2 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -7445,24 +7445,15 @@ KHR_materials_iridescence = __decorate([
7445
7445
  var EXT_texture_webp = /*#__PURE__*/ function(GLTFExtensionParser) {
7446
7446
  _inherits(EXT_texture_webp, GLTFExtensionParser);
7447
7447
  function EXT_texture_webp() {
7448
- var _this;
7449
- _this = GLTFExtensionParser.call(this) || this, _this._supportWebP = false;
7450
- // @ts-ignore
7451
- if (engineCore.SystemInfo._isBrowser) {
7452
- var testCanvas = document.createElement("canvas");
7453
- testCanvas.width = testCanvas.height = 1;
7454
- _this._supportWebP = testCanvas.toDataURL("image/webp").indexOf("data:image/webp") == 0;
7455
- } else {
7456
- _this._supportWebP = false;
7457
- }
7458
- return _this;
7448
+ return GLTFExtensionParser.apply(this, arguments) || this;
7459
7449
  }
7460
7450
  var _proto = EXT_texture_webp.prototype;
7461
7451
  _proto.createAndParse = function createAndParse(context, schema, textureInfo, textureIndex, isSRGBColorSpace) {
7462
7452
  var webPIndex = schema.source;
7463
7453
  var sampler = textureInfo.sampler, tmp = textureInfo.source, fallbackIndex = tmp === void 0 ? 0 : tmp, textureName = textureInfo.name;
7464
- var texture = exports.GLTFTextureParser._parseTexture(context, this._supportWebP ? webPIndex : fallbackIndex, textureIndex, sampler, textureName, isSRGBColorSpace);
7465
- return texture;
7454
+ return engineCore.SystemInfo._checkWebpSupported().then(function(supportWebP) {
7455
+ return exports.GLTFTextureParser._parseTexture(context, supportWebP ? webPIndex : fallbackIndex, textureIndex, sampler, textureName, isSRGBColorSpace);
7456
+ });
7466
7457
  };
7467
7458
  return EXT_texture_webp;
7468
7459
  }(GLTFExtensionParser);