@galacean/engine-loader 2.0.0-alpha.49 → 2.0.0-alpha.50

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
@@ -3848,11 +3848,11 @@ function registerGLTFParser(pipeline) {
3848
3848
  var minFilter = sampler.minFilter, magFilter = sampler.magFilter, wrapS = sampler.wrapS, wrapT = sampler.wrapT;
3849
3849
  var info = {};
3850
3850
  if (minFilter || magFilter) {
3851
- info.mipmap = minFilter >= TextureMinFilter.NEAREST_MIPMAP_NEAREST;
3851
+ info.mipmap = minFilter !== undefined && minFilter >= TextureMinFilter.NEAREST_MIPMAP_NEAREST;
3852
3852
  if (magFilter === TextureMagFilter.NEAREST) {
3853
3853
  info.filterMode = TextureFilterMode.Point;
3854
3854
  } else {
3855
- if (minFilter <= TextureMinFilter.LINEAR_MIPMAP_NEAREST) {
3855
+ if (minFilter !== undefined && minFilter <= TextureMinFilter.LINEAR_MIPMAP_NEAREST) {
3856
3856
  info.filterMode = TextureFilterMode.Bilinear;
3857
3857
  } else {
3858
3858
  info.filterMode = TextureFilterMode.Trilinear;
@@ -3960,7 +3960,7 @@ function registerGLTFParser(pipeline) {
3960
3960
  _proto._getBufferData = function _getBufferData(buffers, restoreInfo) {
3961
3961
  var main = restoreInfo.main;
3962
3962
  var data;
3963
- if (main) {
3963
+ if (main.bufferIndex !== undefined) {
3964
3964
  var buffer = buffers[main.bufferIndex];
3965
3965
  data = new main.TypedArray(buffer, main.byteOffset, main.length);
3966
3966
  } else {
@@ -4638,7 +4638,7 @@ var GLTFMaterialParser = /*#__PURE__*/ function(GLTFParser1) {
4638
4638
  }
4639
4639
  if (texCoord === TextureCoordinate.UV1) {
4640
4640
  material.occlusionTextureCoord = TextureCoordinate.UV1;
4641
- } else if (texCoord > TextureCoordinate.UV1) {
4641
+ } else if (texCoord !== undefined && texCoord > TextureCoordinate.UV1) {
4642
4642
  Logger.warn("Occlusion texture uv coordinate must be UV0 or UV1.");
4643
4643
  }
4644
4644
  }
@@ -5159,7 +5159,7 @@ var GLTFTextureParser = /*#__PURE__*/ function(GLTFParser1) {
5159
5159
  var engine = glTFResource.engine, url = glTFResource.url;
5160
5160
  var _glTF_images_imageIndex = glTF.images[imageIndex], uri = _glTF_images_imageIndex.uri, bufferViewIndex = _glTF_images_imageIndex.bufferView, mimeType = _glTF_images_imageIndex.mimeType, imageName = _glTF_images_imageIndex.name;
5161
5161
  var useSampler = sampler !== undefined;
5162
- var samplerInfo = useSampler && GLTFUtils.getSamplerInfo(glTF.samplers[sampler]);
5162
+ var samplerInfo = useSampler ? GLTFUtils.getSamplerInfo(glTF.samplers[sampler]) : undefined;
5163
5163
  var texture;
5164
5164
  if (uri) {
5165
5165
  var extIndex = uri.lastIndexOf(".");
@@ -5174,7 +5174,7 @@ var GLTFTextureParser = /*#__PURE__*/ function(GLTFParser1) {
5174
5174
  }
5175
5175
  }).onProgress(undefined, context._onTaskDetail).then(function(texture) {
5176
5176
  texture.name = textureName || imageName || texture.name || "texture_" + textureIndex;
5177
- useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
5177
+ samplerInfo && GLTFUtils.parseSampler(texture, samplerInfo);
5178
5178
  return texture;
5179
5179
  });
5180
5180
  context._addTaskCompletePromise(texture);
@@ -5192,7 +5192,7 @@ var GLTFTextureParser = /*#__PURE__*/ function(GLTFParser1) {
5192
5192
  texture.setImageSource(image);
5193
5193
  texture.generateMipmaps();
5194
5194
  texture.name = textureName || imageName || "texture_" + textureIndex;
5195
- useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
5195
+ samplerInfo && GLTFUtils.parseSampler(texture, samplerInfo);
5196
5196
  var bufferTextureRestoreInfo = new BufferTextureRestoreInfo(texture, bufferView, mimeType);
5197
5197
  context.contentRestorer.bufferTextures.push(bufferTextureRestoreInfo);
5198
5198
  return texture;
@@ -6714,7 +6714,7 @@ var KHR_materials_sheen = /*#__PURE__*/ function(GLTFExtensionParser) {
6714
6714
  _proto.additiveParse = function additiveParse(context, material, schema) {
6715
6715
  var sheenColorFactor = schema.sheenColorFactor, sheenColorTexture = schema.sheenColorTexture, _schema_sheenRoughnessFactor = schema.sheenRoughnessFactor, sheenRoughnessFactor = _schema_sheenRoughnessFactor === void 0 ? 0 : _schema_sheenRoughnessFactor, sheenRoughnessTexture = schema.sheenRoughnessTexture;
6716
6716
  if (sheenColorFactor) {
6717
- material.sheenColor.set(sheenColorFactor[0], sheenColorFactor[1], sheenColorFactor[2], undefined);
6717
+ material.sheenColor.set(sheenColorFactor[0], sheenColorFactor[1], sheenColorFactor[2], material.sheenColor.a);
6718
6718
  }
6719
6719
  material.sheenRoughness = sheenRoughnessFactor;
6720
6720
  if (sheenColorTexture) {
@@ -6805,7 +6805,8 @@ var KHR_materials_variants = /*#__PURE__*/ function(GLTFExtensionParser) {
6805
6805
  });
6806
6806
  };
6807
6807
  var _glTFResource;
6808
- var _context_glTF = context.glTF, _context_glTF_extensions = _context_glTF.extensions, _context_glTF_extensions_KHR_materials_variants = _context_glTF_extensions.KHR_materials_variants, variantNames = _context_glTF_extensions_KHR_materials_variants.variants, glTFResource = context.glTFResource;
6808
+ var glTFResource = context.glTFResource;
6809
+ var _context_glTF_extensions_KHR_materials_variants = context.glTF.extensions.KHR_materials_variants, variantNames = _context_glTF_extensions_KHR_materials_variants.variants;
6809
6810
  var mappings = schema.mappings;
6810
6811
  (_glTFResource = glTFResource)._extensionsData || (_glTFResource._extensionsData = {});
6811
6812
  var extensionData = [];
@@ -6829,7 +6830,7 @@ var KHR_materials_volume = /*#__PURE__*/ function(GLTFExtensionParser) {
6829
6830
  material.thickness = thicknessFactor;
6830
6831
  material.attenuationDistance = attenuationDistance;
6831
6832
  if (attenuationColor) {
6832
- material.attenuationColor.set(attenuationColor[0], attenuationColor[1], attenuationColor[2], undefined);
6833
+ material.attenuationColor.set(attenuationColor[0], attenuationColor[1], attenuationColor[2], material.attenuationColor.a);
6833
6834
  }
6834
6835
  if (thicknessTexture) {
6835
6836
  GLTFMaterialParser._checkOtherTextureTransform(thicknessTexture, "Thickness texture");
@@ -6869,7 +6870,7 @@ var KHR_texture_basisu = /*#__PURE__*/ function(GLTFExtensionParser) {
6869
6870
  var sampler = textureInfo.sampler, textureName = textureInfo.name;
6870
6871
  var source = schema.source;
6871
6872
  var _glTF_images_source = glTF.images[source], uri = _glTF_images_source.uri, bufferViewIndex = _glTF_images_source.bufferView, mimeType = _glTF_images_source.mimeType, imageName = _glTF_images_source.name;
6872
- var samplerInfo = sampler !== undefined && GLTFUtils.getSamplerInfo(glTF.samplers[sampler]);
6873
+ var samplerInfo = sampler !== undefined ? GLTFUtils.getSamplerInfo(glTF.samplers[sampler]) : undefined;
6873
6874
  if (uri) {
6874
6875
  var index = uri.lastIndexOf(".");
6875
6876
  var promise = engine.resourceManager.load({
@@ -6879,7 +6880,7 @@ var KHR_texture_basisu = /*#__PURE__*/ function(GLTFExtensionParser) {
6879
6880
  if (!texture.name) {
6880
6881
  texture.name = textureName || imageName || "texture_" + index;
6881
6882
  }
6882
- if (sampler !== undefined) {
6883
+ if (samplerInfo) {
6883
6884
  GLTFUtils.parseSampler(texture, samplerInfo);
6884
6885
  }
6885
6886
  return texture;
@@ -6895,7 +6896,7 @@ var KHR_texture_basisu = /*#__PURE__*/ function(GLTFExtensionParser) {
6895
6896
  return KTX2Loader._createTextureByBuffer(engine, ktx2Container.isSRGB, result, targetFormat, params);
6896
6897
  }).then(function(texture) {
6897
6898
  texture.name = textureName || imageName || "texture_" + bufferViewIndex;
6898
- if (sampler !== undefined) {
6899
+ if (samplerInfo) {
6899
6900
  GLTFUtils.parseSampler(texture, samplerInfo);
6900
6901
  }
6901
6902
  var bufferTextureRestoreInfo = new BufferTextureRestoreInfo(texture, bufferView, mimeType);
@@ -7073,7 +7074,7 @@ var KHR_materials_specular = /*#__PURE__*/ function(GLTFExtensionParser) {
7073
7074
  var _schema_specularFactor = schema.specularFactor, specularFactor = _schema_specularFactor === void 0 ? 1 : _schema_specularFactor, specularTexture = schema.specularTexture, specularColorFactor = schema.specularColorFactor, specularColorTexture = schema.specularColorTexture;
7074
7075
  material.specularIntensity = specularFactor;
7075
7076
  if (specularColorFactor) {
7076
- material.specularColor.set(specularColorFactor[0], specularColorFactor[1], specularColorFactor[2], undefined);
7077
+ material.specularColor.set(specularColorFactor[0], specularColorFactor[1], specularColorFactor[2], material.specularColor.a);
7077
7078
  }
7078
7079
  if (specularTexture) {
7079
7080
  GLTFMaterialParser._checkOtherTextureTransform(specularTexture, "Specular intensity texture");