@galacean/engine-loader 1.5.3 → 1.5.5

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/module.js CHANGED
@@ -7441,24 +7441,15 @@ KHR_materials_iridescence = __decorate([
7441
7441
  var EXT_texture_webp = /*#__PURE__*/ function(GLTFExtensionParser) {
7442
7442
  _inherits(EXT_texture_webp, GLTFExtensionParser);
7443
7443
  function EXT_texture_webp() {
7444
- var _this;
7445
- _this = GLTFExtensionParser.call(this) || this, _this._supportWebP = false;
7446
- // @ts-ignore
7447
- if (SystemInfo._isBrowser) {
7448
- var testCanvas = document.createElement("canvas");
7449
- testCanvas.width = testCanvas.height = 1;
7450
- _this._supportWebP = testCanvas.toDataURL("image/webp").indexOf("data:image/webp") == 0;
7451
- } else {
7452
- _this._supportWebP = false;
7453
- }
7454
- return _this;
7444
+ return GLTFExtensionParser.apply(this, arguments) || this;
7455
7445
  }
7456
7446
  var _proto = EXT_texture_webp.prototype;
7457
7447
  _proto.createAndParse = function createAndParse(context, schema, textureInfo, textureIndex, isSRGBColorSpace) {
7458
7448
  var webPIndex = schema.source;
7459
7449
  var sampler = textureInfo.sampler, tmp = textureInfo.source, fallbackIndex = tmp === void 0 ? 0 : tmp, textureName = textureInfo.name;
7460
- var texture = GLTFTextureParser._parseTexture(context, this._supportWebP ? webPIndex : fallbackIndex, textureIndex, sampler, textureName, isSRGBColorSpace);
7461
- return texture;
7450
+ return SystemInfo._checkWebpSupported().then(function(supportWebP) {
7451
+ return GLTFTextureParser._parseTexture(context, supportWebP ? webPIndex : fallbackIndex, textureIndex, sampler, textureName, isSRGBColorSpace);
7452
+ });
7462
7453
  };
7463
7454
  return EXT_texture_webp;
7464
7455
  }(GLTFExtensionParser);