@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/main.js CHANGED
@@ -3852,11 +3852,11 @@ function registerGLTFParser(pipeline) {
3852
3852
  var minFilter = sampler.minFilter, magFilter = sampler.magFilter, wrapS = sampler.wrapS, wrapT = sampler.wrapT;
3853
3853
  var info = {};
3854
3854
  if (minFilter || magFilter) {
3855
- info.mipmap = minFilter >= TextureMinFilter.NEAREST_MIPMAP_NEAREST;
3855
+ info.mipmap = minFilter !== undefined && minFilter >= TextureMinFilter.NEAREST_MIPMAP_NEAREST;
3856
3856
  if (magFilter === TextureMagFilter.NEAREST) {
3857
3857
  info.filterMode = engineCore.TextureFilterMode.Point;
3858
3858
  } else {
3859
- if (minFilter <= TextureMinFilter.LINEAR_MIPMAP_NEAREST) {
3859
+ if (minFilter !== undefined && minFilter <= TextureMinFilter.LINEAR_MIPMAP_NEAREST) {
3860
3860
  info.filterMode = engineCore.TextureFilterMode.Bilinear;
3861
3861
  } else {
3862
3862
  info.filterMode = engineCore.TextureFilterMode.Trilinear;
@@ -3964,7 +3964,7 @@ function registerGLTFParser(pipeline) {
3964
3964
  _proto._getBufferData = function _getBufferData(buffers, restoreInfo) {
3965
3965
  var main = restoreInfo.main;
3966
3966
  var data;
3967
- if (main) {
3967
+ if (main.bufferIndex !== undefined) {
3968
3968
  var buffer = buffers[main.bufferIndex];
3969
3969
  data = new main.TypedArray(buffer, main.byteOffset, main.length);
3970
3970
  } else {
@@ -4642,7 +4642,7 @@ exports.GLTFMaterialParser = /*#__PURE__*/ function(GLTFParser1) {
4642
4642
  }
4643
4643
  if (texCoord === engineCore.TextureCoordinate.UV1) {
4644
4644
  material.occlusionTextureCoord = engineCore.TextureCoordinate.UV1;
4645
- } else if (texCoord > engineCore.TextureCoordinate.UV1) {
4645
+ } else if (texCoord !== undefined && texCoord > engineCore.TextureCoordinate.UV1) {
4646
4646
  engineCore.Logger.warn("Occlusion texture uv coordinate must be UV0 or UV1.");
4647
4647
  }
4648
4648
  }
@@ -5163,7 +5163,7 @@ exports.GLTFTextureParser = /*#__PURE__*/ function(GLTFParser1) {
5163
5163
  var engine = glTFResource.engine, url = glTFResource.url;
5164
5164
  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;
5165
5165
  var useSampler = sampler !== undefined;
5166
- var samplerInfo = useSampler && GLTFUtils.getSamplerInfo(glTF.samplers[sampler]);
5166
+ var samplerInfo = useSampler ? GLTFUtils.getSamplerInfo(glTF.samplers[sampler]) : undefined;
5167
5167
  var texture;
5168
5168
  if (uri) {
5169
5169
  var extIndex = uri.lastIndexOf(".");
@@ -5178,7 +5178,7 @@ exports.GLTFTextureParser = /*#__PURE__*/ function(GLTFParser1) {
5178
5178
  }
5179
5179
  }).onProgress(undefined, context._onTaskDetail).then(function(texture) {
5180
5180
  texture.name = textureName || imageName || texture.name || "texture_" + textureIndex;
5181
- useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
5181
+ samplerInfo && GLTFUtils.parseSampler(texture, samplerInfo);
5182
5182
  return texture;
5183
5183
  });
5184
5184
  context._addTaskCompletePromise(texture);
@@ -5196,7 +5196,7 @@ exports.GLTFTextureParser = /*#__PURE__*/ function(GLTFParser1) {
5196
5196
  texture.setImageSource(image);
5197
5197
  texture.generateMipmaps();
5198
5198
  texture.name = textureName || imageName || "texture_" + textureIndex;
5199
- useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
5199
+ samplerInfo && GLTFUtils.parseSampler(texture, samplerInfo);
5200
5200
  var bufferTextureRestoreInfo = new BufferTextureRestoreInfo(texture, bufferView, mimeType);
5201
5201
  context.contentRestorer.bufferTextures.push(bufferTextureRestoreInfo);
5202
5202
  return texture;
@@ -6718,7 +6718,7 @@ var KHR_materials_sheen = /*#__PURE__*/ function(GLTFExtensionParser) {
6718
6718
  _proto.additiveParse = function additiveParse(context, material, schema) {
6719
6719
  var sheenColorFactor = schema.sheenColorFactor, sheenColorTexture = schema.sheenColorTexture, _schema_sheenRoughnessFactor = schema.sheenRoughnessFactor, sheenRoughnessFactor = _schema_sheenRoughnessFactor === void 0 ? 0 : _schema_sheenRoughnessFactor, sheenRoughnessTexture = schema.sheenRoughnessTexture;
6720
6720
  if (sheenColorFactor) {
6721
- material.sheenColor.set(sheenColorFactor[0], sheenColorFactor[1], sheenColorFactor[2], undefined);
6721
+ material.sheenColor.set(sheenColorFactor[0], sheenColorFactor[1], sheenColorFactor[2], material.sheenColor.a);
6722
6722
  }
6723
6723
  material.sheenRoughness = sheenRoughnessFactor;
6724
6724
  if (sheenColorTexture) {
@@ -6809,7 +6809,8 @@ var KHR_materials_variants = /*#__PURE__*/ function(GLTFExtensionParser) {
6809
6809
  });
6810
6810
  };
6811
6811
  var _glTFResource;
6812
- 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;
6812
+ var glTFResource = context.glTFResource;
6813
+ var _context_glTF_extensions_KHR_materials_variants = context.glTF.extensions.KHR_materials_variants, variantNames = _context_glTF_extensions_KHR_materials_variants.variants;
6813
6814
  var mappings = schema.mappings;
6814
6815
  (_glTFResource = glTFResource)._extensionsData || (_glTFResource._extensionsData = {});
6815
6816
  var extensionData = [];
@@ -6833,7 +6834,7 @@ var KHR_materials_volume = /*#__PURE__*/ function(GLTFExtensionParser) {
6833
6834
  material.thickness = thicknessFactor;
6834
6835
  material.attenuationDistance = attenuationDistance;
6835
6836
  if (attenuationColor) {
6836
- material.attenuationColor.set(attenuationColor[0], attenuationColor[1], attenuationColor[2], undefined);
6837
+ material.attenuationColor.set(attenuationColor[0], attenuationColor[1], attenuationColor[2], material.attenuationColor.a);
6837
6838
  }
6838
6839
  if (thicknessTexture) {
6839
6840
  exports.GLTFMaterialParser._checkOtherTextureTransform(thicknessTexture, "Thickness texture");
@@ -6873,7 +6874,7 @@ var KHR_texture_basisu = /*#__PURE__*/ function(GLTFExtensionParser) {
6873
6874
  var sampler = textureInfo.sampler, textureName = textureInfo.name;
6874
6875
  var source = schema.source;
6875
6876
  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;
6876
- var samplerInfo = sampler !== undefined && GLTFUtils.getSamplerInfo(glTF.samplers[sampler]);
6877
+ var samplerInfo = sampler !== undefined ? GLTFUtils.getSamplerInfo(glTF.samplers[sampler]) : undefined;
6877
6878
  if (uri) {
6878
6879
  var index = uri.lastIndexOf(".");
6879
6880
  var promise = engine.resourceManager.load({
@@ -6883,7 +6884,7 @@ var KHR_texture_basisu = /*#__PURE__*/ function(GLTFExtensionParser) {
6883
6884
  if (!texture.name) {
6884
6885
  texture.name = textureName || imageName || "texture_" + index;
6885
6886
  }
6886
- if (sampler !== undefined) {
6887
+ if (samplerInfo) {
6887
6888
  GLTFUtils.parseSampler(texture, samplerInfo);
6888
6889
  }
6889
6890
  return texture;
@@ -6899,7 +6900,7 @@ var KHR_texture_basisu = /*#__PURE__*/ function(GLTFExtensionParser) {
6899
6900
  return exports.KTX2Loader._createTextureByBuffer(engine, ktx2Container.isSRGB, result, targetFormat, params);
6900
6901
  }).then(function(texture) {
6901
6902
  texture.name = textureName || imageName || "texture_" + bufferViewIndex;
6902
- if (sampler !== undefined) {
6903
+ if (samplerInfo) {
6903
6904
  GLTFUtils.parseSampler(texture, samplerInfo);
6904
6905
  }
6905
6906
  var bufferTextureRestoreInfo = new BufferTextureRestoreInfo(texture, bufferView, mimeType);
@@ -7077,7 +7078,7 @@ var KHR_materials_specular = /*#__PURE__*/ function(GLTFExtensionParser) {
7077
7078
  var _schema_specularFactor = schema.specularFactor, specularFactor = _schema_specularFactor === void 0 ? 1 : _schema_specularFactor, specularTexture = schema.specularTexture, specularColorFactor = schema.specularColorFactor, specularColorTexture = schema.specularColorTexture;
7078
7079
  material.specularIntensity = specularFactor;
7079
7080
  if (specularColorFactor) {
7080
- material.specularColor.set(specularColorFactor[0], specularColorFactor[1], specularColorFactor[2], undefined);
7081
+ material.specularColor.set(specularColorFactor[0], specularColorFactor[1], specularColorFactor[2], material.specularColor.a);
7081
7082
  }
7082
7083
  if (specularTexture) {
7083
7084
  exports.GLTFMaterialParser._checkOtherTextureTransform(specularTexture, "Specular intensity texture");