@galacean/engine-loader 1.1.0-beta.14 → 1.1.0-beta.16

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
@@ -2928,14 +2928,6 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
2928
2928
  });
2929
2929
  };
2930
2930
  _proto._isKhronosSupported = function _isKhronosSupported(priorityFormats, engine) {
2931
- if (priorityFormats === void 0) priorityFormats = [
2932
- exports.KTX2TargetFormat.ASTC,
2933
- exports.KTX2TargetFormat.ETC,
2934
- exports.KTX2TargetFormat.BC7,
2935
- exports.KTX2TargetFormat.BC1_BC3,
2936
- exports.KTX2TargetFormat.PVRTC,
2937
- exports.KTX2TargetFormat.R8G8B8A8
2938
- ];
2939
2931
  return !!KhronosTranscoder.transcoderMap[exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats)];
2940
2932
  };
2941
2933
  /**
@@ -3019,10 +3011,21 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
3019
3011
  };
3020
3012
  KTX2Loader1._detectSupportedFormat = function _detectSupportedFormat(renderer, priorityFormats) {
3021
3013
  for(var i = 0; i < priorityFormats.length; i++){
3022
- var capabilities = this._supportedMap[priorityFormats[i]];
3023
- for(var j = 0; j < capabilities.length; j++){
3024
- if (renderer.canIUse(capabilities[j])) {
3025
- return priorityFormats[i];
3014
+ var format = priorityFormats[i];
3015
+ var capabilities = this._supportedMap[format];
3016
+ if (capabilities) {
3017
+ for(var j = 0; j < capabilities.length; j++){
3018
+ if (renderer.canIUse(capabilities[j])) {
3019
+ return format;
3020
+ }
3021
+ }
3022
+ } else {
3023
+ switch(priorityFormats[i]){
3024
+ case exports.KTX2TargetFormat.R8G8B8A8:
3025
+ return format;
3026
+ case exports.KTX2TargetFormat.R8:
3027
+ case exports.KTX2TargetFormat.R8G8:
3028
+ if (renderer.isWebGL2) return format;
3026
3029
  }
3027
3030
  }
3028
3031
  }
@@ -3541,6 +3544,10 @@ exports.GLTFAnimationParser = /*#__PURE__*/ function(GLTFParser1) {
3541
3544
  relativePath = relativePath === "" ? "" + entity.name : entity.name + "/" + relativePath;
3542
3545
  entity = entity.parent;
3543
3546
  }
3547
+ // If the target node is in the default scene, relativePath will be empty
3548
+ if (entity !== context.glTFResource.defaultSceneRoot) {
3549
+ continue;
3550
+ }
3544
3551
  var ComponentType = void 0;
3545
3552
  var propertyName = void 0;
3546
3553
  switch(target.path){
@@ -5537,29 +5544,34 @@ var SceneLoader = /*#__PURE__*/ function(Loader1) {
5537
5544
  var promises = [];
5538
5545
  // parse ambient light
5539
5546
  var ambient = data.scene.ambient;
5540
- var useCustomAmbient = ambient.specularMode === "Custom";
5541
- var useSH = ambient.diffuseMode === engineCore.DiffuseMode.SphericalHarmonics;
5542
- scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
5543
- scene.ambientLight.specularIntensity = ambient.specularIntensity;
5544
- scene.ambientLight.diffuseMode = ambient.diffuseMode;
5545
- scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
5546
- scene.ambientLight.specularTextureDecodeRGBM = true;
5547
- if (useCustomAmbient && ambient.customAmbientLight) {
5548
- promises.push(// @ts-ignore
5549
- resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
5550
- scene.ambientLight.specularTexture = ambientLight.specularTexture;
5551
- }));
5552
- }
5553
- if (ambient.ambientLight && (!useCustomAmbient || useSH)) {
5554
- promises.push(// @ts-ignore
5555
- resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
5556
- if (!useCustomAmbient) {
5557
- scene.ambientLight.specularTexture = ambientLight.specularTexture;
5558
- }
5559
- if (useSH) {
5560
- scene.ambientLight.diffuseSphericalHarmonics = ambientLight.diffuseSphericalHarmonics;
5561
- }
5562
- }));
5547
+ if (ambient) {
5548
+ var useCustomAmbient = ambient.specularMode === "Custom";
5549
+ var useSH = ambient.diffuseMode === engineCore.DiffuseMode.SphericalHarmonics;
5550
+ scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
5551
+ scene.ambientLight.specularIntensity = ambient.specularIntensity;
5552
+ scene.ambientLight.diffuseMode = ambient.diffuseMode;
5553
+ scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
5554
+ scene.ambientLight.specularTextureDecodeRGBM = true;
5555
+ if (useCustomAmbient && ambient.customAmbientLight) {
5556
+ promises.push(// @ts-ignore
5557
+ resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
5558
+ var _ambientLight;
5559
+ scene.ambientLight.specularTexture = (_ambientLight = ambientLight) == null ? void 0 : _ambientLight.specularTexture;
5560
+ }));
5561
+ }
5562
+ if (ambient.ambientLight && (!useCustomAmbient || useSH)) {
5563
+ promises.push(// @ts-ignore
5564
+ resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
5565
+ if (!useCustomAmbient) {
5566
+ var _ambientLight;
5567
+ scene.ambientLight.specularTexture = (_ambientLight = ambientLight) == null ? void 0 : _ambientLight.specularTexture;
5568
+ }
5569
+ if (useSH) {
5570
+ var _ambientLight1;
5571
+ scene.ambientLight.diffuseSphericalHarmonics = (_ambientLight1 = ambientLight) == null ? void 0 : _ambientLight1.diffuseSphericalHarmonics;
5572
+ }
5573
+ }));
5574
+ }
5563
5575
  }
5564
5576
  var background = data.scene.background;
5565
5577
  scene.background.mode = background.mode;