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

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
@@ -293,7 +293,7 @@ exports.MeshDecoder = /*#__PURE__*/ function() {
293
293
  var encodedMeshData = JSON.parse(jsonDataString);
294
294
  // @ts-ignore Vector3 is not compatible with {x: number, y: number, z: number}.
295
295
  encodedMeshData.bounds && modelMesh.bounds.copyFrom(encodedMeshData.bounds);
296
- var offset = Math.ceil(bufferReader.offset / 4) * 4;
296
+ var offset = Math.ceil(bufferReader.position / 4) * 4;
297
297
  var buffer = bufferReader.data.buffer;
298
298
  var byteOffset = bufferReader.data.byteOffset;
299
299
  var float32Array = new Float32Array(buffer, encodedMeshData.positions.start + offset + byteOffset, (encodedMeshData.positions.end - encodedMeshData.positions.start) / 4);
@@ -2247,7 +2247,7 @@ var SupercompressionScheme;
2247
2247
  alphaSliceByteLength: sgdReader.nextUint32()
2248
2248
  };
2249
2249
  }
2250
- var endpointsByteOffset = sgdByteOffset + sgdReader.offset;
2250
+ var endpointsByteOffset = sgdByteOffset + sgdReader.position;
2251
2251
  var selectorsByteOffset = endpointsByteOffset + endpointsByteLength;
2252
2252
  var tablesByteOffset = selectorsByteOffset + selectorsByteLength;
2253
2253
  var extendedByteOffset = tablesByteOffset + tablesByteLength;
@@ -2907,6 +2907,7 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
2907
2907
  _proto.initialize = function initialize(engine, configuration) {
2908
2908
  if (configuration.ktx2Loader) {
2909
2909
  var options = configuration.ktx2Loader;
2910
+ if (options.priorityFormats) exports.KTX2Loader._priorityFormats = options.priorityFormats;
2910
2911
  if (this._isKhronosSupported(options.priorityFormats, engine) && options.workerCount !== 0) {
2911
2912
  return exports.KTX2Loader._getKhronosTranscoder(options.workerCount).init();
2912
2913
  } else {
@@ -2935,17 +2936,7 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
2935
2936
  exports.KTX2TargetFormat.PVRTC,
2936
2937
  exports.KTX2TargetFormat.R8G8B8A8
2937
2938
  ];
2938
- var supportedList = new Array();
2939
- if (Array.isArray(priorityFormats[0])) {
2940
- for(var i = 0; i < priorityFormats.length; i++){
2941
- supportedList.push(exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats[i]));
2942
- }
2943
- } else {
2944
- supportedList.push(exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats));
2945
- }
2946
- return supportedList.every(function(format) {
2947
- return KhronosTranscoder.transcoderMap[format];
2948
- });
2939
+ return !!KhronosTranscoder.transcoderMap[exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats)];
2949
2940
  };
2950
2941
  /**
2951
2942
  * Destroy ktx2 transcoder worker.
@@ -2959,7 +2950,8 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
2959
2950
  /** @internal */ KTX2Loader1._parseBuffer = function _parseBuffer(buffer, engine, params) {
2960
2951
  var _params;
2961
2952
  var ktx2Container = new KTX2Container(buffer);
2962
- var formatPriorities = (_params = params) == null ? void 0 : _params.priorityFormats;
2953
+ var _params_priorityFormats;
2954
+ var formatPriorities = (_params_priorityFormats = (_params = params) == null ? void 0 : _params.priorityFormats) != null ? _params_priorityFormats : exports.KTX2Loader._priorityFormats;
2963
2955
  var targetFormat = exports.KTX2Loader._decideTargetFormat(engine, ktx2Container, formatPriorities);
2964
2956
  var transcodeResultPromise;
2965
2957
  if (exports.KTX2Loader._isBinomialInit || !KhronosTranscoder.transcoderMap[targetFormat] || !ktx2Container.isUASTC) {
@@ -3026,13 +3018,6 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
3026
3018
  return targetFormat;
3027
3019
  };
3028
3020
  KTX2Loader1._detectSupportedFormat = function _detectSupportedFormat(renderer, priorityFormats) {
3029
- if (priorityFormats === void 0) priorityFormats = [
3030
- exports.KTX2TargetFormat.ASTC,
3031
- exports.KTX2TargetFormat.ETC,
3032
- exports.KTX2TargetFormat.BC7,
3033
- exports.KTX2TargetFormat.BC1_BC3,
3034
- exports.KTX2TargetFormat.PVRTC
3035
- ];
3036
3021
  for(var i = 0; i < priorityFormats.length; i++){
3037
3022
  var capabilities = this._supportedMap[priorityFormats[i]];
3038
3023
  for(var j = 0; j < capabilities.length; j++){
@@ -3074,6 +3059,14 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
3074
3059
  return KTX2Loader1;
3075
3060
  }(engineCore.Loader), function() {
3076
3061
  _KTX2Loader._isBinomialInit = false;
3062
+ }(), function() {
3063
+ _KTX2Loader._priorityFormats = [
3064
+ exports.KTX2TargetFormat.BC7,
3065
+ exports.KTX2TargetFormat.ASTC,
3066
+ exports.KTX2TargetFormat.BC1_BC3,
3067
+ exports.KTX2TargetFormat.ETC,
3068
+ exports.KTX2TargetFormat.PVRTC
3069
+ ];
3077
3070
  }(), function() {
3078
3071
  var _obj;
3079
3072
  _KTX2Loader._supportedMap = (_obj = {}, _obj[exports.KTX2TargetFormat.ASTC] = [