@loaders.gl/gltf 4.4.0-alpha.16 → 4.4.0-alpha.17

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/dist.dev.js CHANGED
@@ -2673,104 +2673,117 @@ var __exports__ = (() => {
2673
2673
  }
2674
2674
 
2675
2675
  // ../textures/src/lib/gl-extensions.ts
2676
- var GL_EXTENSIONS_CONSTANTS = {
2677
- // WEBGL_compressed_texture_s3tc
2678
- COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
2679
- COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
2680
- COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
2681
- COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
2682
- // WEBGL_compressed_texture_es3
2683
- COMPRESSED_R11_EAC: 37488,
2684
- COMPRESSED_SIGNED_R11_EAC: 37489,
2685
- COMPRESSED_RG11_EAC: 37490,
2686
- COMPRESSED_SIGNED_RG11_EAC: 37491,
2687
- COMPRESSED_RGB8_ETC2: 37492,
2688
- COMPRESSED_RGBA8_ETC2_EAC: 37493,
2689
- COMPRESSED_SRGB8_ETC2: 37494,
2690
- COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,
2691
- COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,
2692
- COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,
2693
- // WEBGL_compressed_texture_pvrtc
2694
- COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
2695
- COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
2696
- COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
2697
- COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
2698
- // WEBGL_compressed_texture_etc1
2699
- COMPRESSED_RGB_ETC1_WEBGL: 36196,
2700
- // WEBGL_compressed_texture_atc
2701
- COMPRESSED_RGB_ATC_WEBGL: 35986,
2702
- COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,
2703
- COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
2704
- // WEBGL_compressed_texture_astc
2705
- COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,
2706
- COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,
2707
- COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,
2708
- COMPRESSED_RGBA_ASTC_6X5_KHR: 37811,
2709
- COMPRESSED_RGBA_ASTC_6X6_KHR: 37812,
2710
- COMPRESSED_RGBA_ASTC_8X5_KHR: 37813,
2711
- COMPRESSED_RGBA_ASTC_8X6_KHR: 37814,
2712
- COMPRESSED_RGBA_ASTC_8X8_KHR: 37815,
2713
- COMPRESSED_RGBA_ASTC_10X5_KHR: 37816,
2714
- COMPRESSED_RGBA_ASTC_10X6_KHR: 37817,
2715
- COMPRESSED_RGBA_ASTC_10X8_KHR: 37818,
2716
- COMPRESSED_RGBA_ASTC_10X10_KHR: 37819,
2717
- COMPRESSED_RGBA_ASTC_12X10_KHR: 37820,
2718
- COMPRESSED_RGBA_ASTC_12X12_KHR: 37821,
2719
- COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: 37840,
2720
- COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: 37841,
2721
- COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: 37842,
2722
- COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: 37843,
2723
- COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: 37844,
2724
- COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: 37845,
2725
- COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: 37846,
2726
- COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: 37847,
2727
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: 37848,
2728
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: 37849,
2729
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: 37850,
2730
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,
2731
- COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,
2732
- COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,
2733
- // EXT_texture_compression_rgtc
2734
- COMPRESSED_RED_RGTC1_EXT: 36283,
2735
- COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,
2736
- COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,
2737
- COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,
2738
- // WEBGL_compressed_texture_s3tc_srgb
2739
- COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,
2740
- COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,
2741
- COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,
2742
- COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919
2743
- };
2676
+ var GL_RGBA4 = 32854;
2677
+ var GL_RGBA8 = 32856;
2678
+ var GL_RGB565 = 36194;
2679
+ var GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
2680
+ var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;
2681
+ var GL_COMPRESSED_RGBA8_ETC2_EAC = 37493;
2682
+ var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840;
2683
+ var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842;
2684
+ var GL_COMPRESSED_RGB_ETC1_WEBGL = 36196;
2685
+ var GL_COMPRESSED_RGB_ATC_WEBGL = 35986;
2686
+ var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798;
2687
+ var GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 37808;
2688
+ var GL_COMPRESSED_RED_RGTC1_EXT = 36283;
2689
+ var GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285;
2690
+ var GL_COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492;
2744
2691
 
2745
- // ../textures/src/lib/utils/texture-formats.ts
2692
+ // ../textures/src/lib/utils/detect-supported-texture-formats.ts
2746
2693
  var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
2747
- var WEBGL_EXTENSIONS = {
2694
+ var WEBGL_TEXTURE_FORMATS = {
2748
2695
  /* eslint-disable camelcase */
2749
- WEBGL_compressed_texture_s3tc: "dxt",
2750
- WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
2751
- WEBGL_compressed_texture_etc1: "etc1",
2752
- WEBGL_compressed_texture_etc: "etc2",
2753
- WEBGL_compressed_texture_pvrtc: "pvrtc",
2754
- WEBGL_compressed_texture_atc: "atc",
2755
- WEBGL_compressed_texture_astc: "astc",
2756
- EXT_texture_compression_rgtc: "rgtc"
2696
+ WEBGL_compressed_texture_s3tc: [
2697
+ "bc1-rgb-unorm-webgl",
2698
+ "bc1-rgba-unorm",
2699
+ "bc2-rgba-unorm",
2700
+ "bc3-rgba-unorm"
2701
+ ],
2702
+ WEBGL_compressed_texture_s3tc_srgb: [
2703
+ "bc1-rgb-unorm-srgb-webgl",
2704
+ "bc1-rgba-unorm-srgb",
2705
+ "bc2-rgba-unorm-srgb",
2706
+ "bc3-rgba-unorm-srgb"
2707
+ ],
2708
+ EXT_texture_compression_rgtc: ["bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm"],
2709
+ EXT_texture_compression_bptc: [
2710
+ "bc6h-rgb-ufloat",
2711
+ "bc6h-rgb-float",
2712
+ "bc7-rgba-unorm",
2713
+ "bc7-rgba-unorm-srgb"
2714
+ ],
2715
+ WEBGL_compressed_texture_etc1: ["etc1-rbg-unorm-webgl"],
2716
+ WEBGL_compressed_texture_etc: [
2717
+ "etc2-rgb8unorm",
2718
+ "etc2-rgb8unorm-srgb",
2719
+ "etc2-rgb8a1unorm",
2720
+ "etc2-rgb8a1unorm-srgb",
2721
+ "etc2-rgba8unorm",
2722
+ "etc2-rgba8unorm-srgb",
2723
+ "eac-r11unorm",
2724
+ "eac-r11snorm",
2725
+ "eac-rg11unorm",
2726
+ "eac-rg11snorm"
2727
+ ],
2728
+ WEBGL_compressed_texture_pvrtc: [
2729
+ "pvrtc-rgb4unorm-webgl",
2730
+ "pvrtc-rgba4unorm-webgl",
2731
+ "pvrtc-rbg2unorm-webgl",
2732
+ "pvrtc-rgba2unorm-webgl"
2733
+ ],
2734
+ WEBGL_compressed_texture_atc: [
2735
+ "atc-rgb-unorm-webgl",
2736
+ "atc-rgba-unorm-webgl",
2737
+ "atc-rgbai-unorm-webgl"
2738
+ ],
2739
+ WEBGL_compressed_texture_astc: [
2740
+ "astc-4x4-unorm",
2741
+ "astc-4x4-unorm-srgb",
2742
+ "astc-5x4-unorm",
2743
+ "astc-5x4-unorm-srgb",
2744
+ "astc-5x5-unorm",
2745
+ "astc-5x5-unorm-srgb",
2746
+ "astc-6x5-unorm",
2747
+ "astc-6x5-unorm-srgb",
2748
+ "astc-6x6-unorm",
2749
+ "astc-6x6-unorm-srgb",
2750
+ "astc-8x5-unorm",
2751
+ "astc-8x5-unorm-srgb",
2752
+ "astc-8x6-unorm",
2753
+ "astc-8x6-unorm-srgb",
2754
+ "astc-8x8-unorm",
2755
+ "astc-8x8-unorm-srgb",
2756
+ "astc-10x5-unorm",
2757
+ "astc-10x5-unorm-srgb",
2758
+ "astc-10x6-unorm",
2759
+ "astc-10x6-unorm-srgb",
2760
+ "astc-10x8-unorm",
2761
+ "astc-10x8-unorm-srgb",
2762
+ "astc-10x10-unorm",
2763
+ "astc-10x10-unorm-srgb",
2764
+ "astc-12x10-unorm",
2765
+ "astc-12x10-unorm-srgb",
2766
+ "astc-12x12-unorm",
2767
+ "astc-12x12-unorm-srgb"
2768
+ ]
2757
2769
  /* eslint-enable camelcase */
2758
2770
  };
2759
- var formats = null;
2760
- function getSupportedGPUTextureFormats(gl) {
2761
- if (!formats) {
2771
+ var textureFormats = null;
2772
+ function detectSupportedTextureFormats(gl) {
2773
+ if (!textureFormats) {
2762
2774
  gl = gl || getWebGLContext() || void 0;
2763
- formats = /* @__PURE__ */ new Set();
2775
+ textureFormats = /* @__PURE__ */ new Set();
2764
2776
  for (const prefix of BROWSER_PREFIXES) {
2765
- for (const extension in WEBGL_EXTENSIONS) {
2777
+ for (const extension in WEBGL_TEXTURE_FORMATS) {
2766
2778
  if (gl && gl.getExtension(`${prefix}${extension}`)) {
2767
- const gpuTextureFormat = WEBGL_EXTENSIONS[extension];
2768
- formats.add(gpuTextureFormat);
2779
+ for (const textureFormat of WEBGL_TEXTURE_FORMATS[extension]) {
2780
+ textureFormats.add(textureFormat);
2781
+ }
2769
2782
  }
2770
2783
  }
2771
2784
  }
2772
2785
  }
2773
- return formats;
2786
+ return textureFormats;
2774
2787
  }
2775
2788
  function getWebGLContext() {
2776
2789
  try {
@@ -2815,49 +2828,113 @@ var __exports__ = (() => {
2815
2828
  }
2816
2829
 
2817
2830
  // ../textures/src/lib/parsers/parse-basis.ts
2818
- var OutputFormat = {
2831
+ var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
2819
2832
  etc1: {
2820
2833
  basisFormat: 0,
2821
2834
  compressed: true,
2822
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL
2835
+ format: GL_COMPRESSED_RGB_ETC1_WEBGL,
2836
+ textureFormat: "etc1-rbg-unorm-webgl"
2837
+ },
2838
+ etc2: {
2839
+ basisFormat: 1,
2840
+ compressed: true,
2841
+ format: GL_COMPRESSED_RGBA8_ETC2_EAC,
2842
+ textureFormat: "etc2-rgba8unorm"
2823
2843
  },
2824
- etc2: { basisFormat: 1, compressed: true },
2825
2844
  bc1: {
2826
2845
  basisFormat: 2,
2827
2846
  compressed: true,
2828
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT
2847
+ format: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
2848
+ textureFormat: "bc1-rgb-unorm-webgl"
2829
2849
  },
2830
2850
  bc3: {
2831
2851
  basisFormat: 3,
2832
2852
  compressed: true,
2833
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT
2853
+ format: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
2854
+ textureFormat: "bc3-rgba-unorm"
2855
+ },
2856
+ bc4: {
2857
+ basisFormat: 4,
2858
+ compressed: true,
2859
+ format: GL_COMPRESSED_RED_RGTC1_EXT,
2860
+ textureFormat: "bc4-r-unorm"
2861
+ },
2862
+ bc5: {
2863
+ basisFormat: 5,
2864
+ compressed: true,
2865
+ format: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
2866
+ textureFormat: "bc5-rg-unorm"
2867
+ },
2868
+ "bc7-m6-opaque-only": {
2869
+ basisFormat: 6,
2870
+ compressed: true,
2871
+ format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
2872
+ textureFormat: "bc7-rgba-unorm"
2873
+ },
2874
+ "bc7-m5": {
2875
+ basisFormat: 7,
2876
+ compressed: true,
2877
+ format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
2878
+ textureFormat: "bc7-rgba-unorm"
2834
2879
  },
2835
- bc4: { basisFormat: 4, compressed: true },
2836
- bc5: { basisFormat: 5, compressed: true },
2837
- "bc7-m6-opaque-only": { basisFormat: 6, compressed: true },
2838
- "bc7-m5": { basisFormat: 7, compressed: true },
2839
2880
  "pvrtc1-4-rgb": {
2840
2881
  basisFormat: 8,
2841
2882
  compressed: true,
2842
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG
2883
+ format: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
2884
+ textureFormat: "pvrtc-rgb4unorm-webgl"
2843
2885
  },
2844
2886
  "pvrtc1-4-rgba": {
2845
2887
  basisFormat: 9,
2846
2888
  compressed: true,
2847
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
2889
+ format: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
2890
+ textureFormat: "pvrtc-rgba4unorm-webgl"
2848
2891
  },
2849
2892
  "astc-4x4": {
2850
2893
  basisFormat: 10,
2851
2894
  compressed: true,
2852
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR
2895
+ format: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
2896
+ textureFormat: "astc-4x4-unorm"
2897
+ },
2898
+ "atc-rgb": {
2899
+ basisFormat: 11,
2900
+ compressed: true,
2901
+ format: GL_COMPRESSED_RGB_ATC_WEBGL,
2902
+ textureFormat: "atc-rgb-unorm-webgl"
2903
+ },
2904
+ "atc-rgba-interpolated-alpha": {
2905
+ basisFormat: 12,
2906
+ compressed: true,
2907
+ format: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
2908
+ textureFormat: "atc-rgbai-unorm-webgl"
2909
+ },
2910
+ rgba32: {
2911
+ basisFormat: 13,
2912
+ compressed: false,
2913
+ format: GL_RGBA8,
2914
+ textureFormat: "rgba8unorm"
2915
+ },
2916
+ rgb565: {
2917
+ basisFormat: 14,
2918
+ compressed: false,
2919
+ format: GL_RGB565,
2920
+ textureFormat: "rgb565unorm-webgl"
2921
+ },
2922
+ bgr565: {
2923
+ basisFormat: 15,
2924
+ compressed: false,
2925
+ format: GL_RGB565,
2926
+ textureFormat: "rgb565unorm-webgl"
2853
2927
  },
2854
- "atc-rgb": { basisFormat: 11, compressed: true },
2855
- "atc-rgba-interpolated-alpha": { basisFormat: 12, compressed: true },
2856
- rgba32: { basisFormat: 13, compressed: false },
2857
- rgb565: { basisFormat: 14, compressed: false },
2858
- bgr565: { basisFormat: 15, compressed: false },
2859
- rgba4444: { basisFormat: 16, compressed: false }
2928
+ rgba4444: {
2929
+ basisFormat: 16,
2930
+ compressed: false,
2931
+ format: GL_RGBA4,
2932
+ textureFormat: "rgba4unorm-webgl"
2933
+ }
2860
2934
  };
2935
+ var BASIS_FORMATS = Object.freeze(
2936
+ Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS)
2937
+ );
2861
2938
  async function parseBasis(data, options = {}) {
2862
2939
  if (!options.basis?.containerFormat || options.basis.containerFormat === "auto") {
2863
2940
  if (isKTX(data)) {
@@ -2911,7 +2988,7 @@ var __exports__ = (() => {
2911
2988
  const hasAlpha = basisFile.getHasAlpha(
2912
2989
  /* imageIndex, levelIndex */
2913
2990
  );
2914
- const { compressed, format, basisFormat } = getBasisOptions(options, hasAlpha);
2991
+ const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, hasAlpha);
2915
2992
  const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
2916
2993
  const decodedData = new Uint8Array(decodedSize);
2917
2994
  if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
@@ -2919,11 +2996,13 @@ var __exports__ = (() => {
2919
2996
  }
2920
2997
  return {
2921
2998
  // standard loaders.gl image category payload
2999
+ shape: "texture-level",
2922
3000
  width,
2923
3001
  height,
2924
3002
  data: decodedData,
2925
3003
  compressed,
2926
- format,
3004
+ ...format !== void 0 ? { format } : {},
3005
+ ...textureFormat !== void 0 ? { textureFormat } : {},
2927
3006
  // Additional fields
2928
3007
  // Add levelSize field.
2929
3008
  hasAlpha
@@ -2948,7 +3027,7 @@ var __exports__ = (() => {
2948
3027
  }
2949
3028
  function transcodeKTX2Image(ktx2File, levelIndex, options) {
2950
3029
  const { alphaFlag, height, width } = ktx2File.getImageLevelInfo(levelIndex, 0, 0);
2951
- const { compressed, format, basisFormat } = getBasisOptions(options, alphaFlag);
3030
+ const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, alphaFlag);
2952
3031
  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(
2953
3032
  levelIndex,
2954
3033
  0,
@@ -2971,48 +3050,98 @@ var __exports__ = (() => {
2971
3050
  }
2972
3051
  return {
2973
3052
  // standard loaders.gl image category payload
3053
+ shape: "texture-level",
2974
3054
  width,
2975
3055
  height,
2976
3056
  data: decodedData,
2977
3057
  compressed,
3058
+ ...format !== void 0 ? { format } : {},
3059
+ ...textureFormat !== void 0 ? { textureFormat } : {},
2978
3060
  // Additional fields
2979
3061
  levelSize: decodedSize,
2980
- hasAlpha: alphaFlag,
2981
- format
3062
+ hasAlpha: alphaFlag
2982
3063
  };
2983
3064
  }
2984
3065
  function getBasisOptions(options, hasAlpha) {
2985
- let format = options.basis?.format;
3066
+ let format = options.basis?.format || "auto";
2986
3067
  if (format === "auto") {
2987
- format = selectSupportedBasisFormat();
3068
+ format = options.basis?.supportedTextureFormats ? selectSupportedBasisFormat(options.basis.supportedTextureFormats) : selectSupportedBasisFormat();
2988
3069
  }
2989
3070
  if (typeof format === "object") {
2990
3071
  format = hasAlpha ? format.alpha : format.noAlpha;
2991
3072
  }
2992
- format = format.toLowerCase();
2993
- return OutputFormat[format];
3073
+ const normalizedFormat = format.toLowerCase();
3074
+ const basisOutputOptions = BASIS_FORMAT_TO_OUTPUT_OPTIONS[normalizedFormat];
3075
+ if (!basisOutputOptions) {
3076
+ throw new Error(`Unknown Basis format ${format}`);
3077
+ }
3078
+ return basisOutputOptions;
2994
3079
  }
2995
- function selectSupportedBasisFormat() {
2996
- const supportedFormats = getSupportedGPUTextureFormats();
2997
- if (supportedFormats.has("astc")) {
3080
+ function selectSupportedBasisFormat(supportedTextureFormats = detectSupportedTextureFormats()) {
3081
+ const textureFormats2 = new Set(supportedTextureFormats);
3082
+ if (hasSupportedTextureFormat(textureFormats2, ["astc-4x4-unorm", "astc-4x4-unorm-srgb"])) {
2998
3083
  return "astc-4x4";
2999
- } else if (supportedFormats.has("dxt")) {
3084
+ } else if (hasSupportedTextureFormat(textureFormats2, ["bc7-rgba-unorm", "bc7-rgba-unorm-srgb"])) {
3085
+ return {
3086
+ alpha: "bc7-m5",
3087
+ noAlpha: "bc7-m6-opaque-only"
3088
+ };
3089
+ } else if (hasSupportedTextureFormat(textureFormats2, [
3090
+ "bc1-rgb-unorm-webgl",
3091
+ "bc1-rgb-unorm-srgb-webgl",
3092
+ "bc1-rgba-unorm",
3093
+ "bc1-rgba-unorm-srgb",
3094
+ "bc2-rgba-unorm",
3095
+ "bc2-rgba-unorm-srgb",
3096
+ "bc3-rgba-unorm",
3097
+ "bc3-rgba-unorm-srgb"
3098
+ ])) {
3000
3099
  return {
3001
3100
  alpha: "bc3",
3002
3101
  noAlpha: "bc1"
3003
3102
  };
3004
- } else if (supportedFormats.has("pvrtc")) {
3103
+ } else if (hasSupportedTextureFormat(textureFormats2, [
3104
+ "pvrtc-rgb4unorm-webgl",
3105
+ "pvrtc-rgba4unorm-webgl",
3106
+ "pvrtc-rbg2unorm-webgl",
3107
+ "pvrtc-rgba2unorm-webgl"
3108
+ ])) {
3005
3109
  return {
3006
3110
  alpha: "pvrtc1-4-rgba",
3007
3111
  noAlpha: "pvrtc1-4-rgb"
3008
3112
  };
3009
- } else if (supportedFormats.has("etc1")) {
3010
- return "etc1";
3011
- } else if (supportedFormats.has("etc2")) {
3113
+ } else if (hasSupportedTextureFormat(textureFormats2, [
3114
+ "etc2-rgb8unorm",
3115
+ "etc2-rgb8unorm-srgb",
3116
+ "etc2-rgb8a1unorm",
3117
+ "etc2-rgb8a1unorm-srgb",
3118
+ "etc2-rgba8unorm",
3119
+ "etc2-rgba8unorm-srgb",
3120
+ "eac-r11unorm",
3121
+ "eac-r11snorm",
3122
+ "eac-rg11unorm",
3123
+ "eac-rg11snorm"
3124
+ ])) {
3012
3125
  return "etc2";
3126
+ } else if (textureFormats2.has("etc1-rbg-unorm-webgl")) {
3127
+ return "etc1";
3128
+ } else if (hasSupportedTextureFormat(textureFormats2, [
3129
+ "atc-rgb-unorm-webgl",
3130
+ "atc-rgba-unorm-webgl",
3131
+ "atc-rgbai-unorm-webgl"
3132
+ ])) {
3133
+ return {
3134
+ alpha: "atc-rgba-interpolated-alpha",
3135
+ noAlpha: "atc-rgb"
3136
+ };
3013
3137
  }
3014
3138
  return "rgb565";
3015
3139
  }
3140
+ function hasSupportedTextureFormat(supportedTextureFormats, candidateTextureFormats) {
3141
+ return candidateTextureFormats.some(
3142
+ (textureFormat) => supportedTextureFormats.has(textureFormat)
3143
+ );
3144
+ }
3016
3145
 
3017
3146
  // ../textures/src/basis-loader.ts
3018
3147
  var BasisWorkerLoader = {
@@ -6301,8 +6430,7 @@ var __exports__ = (() => {
6301
6430
  const strictOptions = options;
6302
6431
  const gltfOptions = {
6303
6432
  ...strictOptions,
6304
- core: { ...strictOptions?.core, mimeType: image.mimeType },
6305
- basis: strictOptions.basis || { format: selectSupportedBasisFormat() }
6433
+ core: { ...strictOptions?.core, mimeType: image.mimeType }
6306
6434
  };
6307
6435
  let parsedImage = await parseFromContext(
6308
6436
  arrayBuffer,