@loaders.gl/textures 4.4.0-alpha.2 → 4.4.0

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.
Files changed (234) hide show
  1. package/README.md +197 -1
  2. package/dist/basis-loader.d.ts +15 -10
  3. package/dist/basis-loader.d.ts.map +1 -1
  4. package/dist/basis-loader.js +1 -1
  5. package/dist/basis-loader.js.map +1 -0
  6. package/dist/basis-worker-node.js +932 -10040
  7. package/dist/basis-worker.d.ts +2 -0
  8. package/dist/basis-worker.d.ts.map +1 -0
  9. package/dist/basis-worker.js +337 -151
  10. package/dist/basis-worker.js.map +1 -0
  11. package/dist/compressed-texture-loader.d.ts +2 -5
  12. package/dist/compressed-texture-loader.d.ts.map +1 -1
  13. package/dist/compressed-texture-loader.js +2 -3
  14. package/dist/compressed-texture-loader.js.map +1 -0
  15. package/dist/compressed-texture-worker.d.ts +2 -0
  16. package/dist/compressed-texture-worker.d.ts.map +1 -0
  17. package/dist/compressed-texture-worker.js +1148 -365
  18. package/dist/compressed-texture-worker.js.map +1 -0
  19. package/dist/compressed-texture-writer.js +1 -0
  20. package/dist/compressed-texture-writer.js.map +1 -0
  21. package/dist/crunch-loader.d.ts +1 -5
  22. package/dist/crunch-loader.d.ts.map +1 -1
  23. package/dist/crunch-loader.js +2 -3
  24. package/dist/crunch-loader.js.map +1 -0
  25. package/dist/crunch-worker.d.ts +2 -0
  26. package/dist/crunch-worker.d.ts.map +1 -0
  27. package/dist/crunch-worker.js +204 -92
  28. package/dist/crunch-worker.js.map +1 -0
  29. package/dist/dist.dev.js +2687 -677
  30. package/dist/dist.min.js +1 -2
  31. package/dist/index.cjs +1644 -428
  32. package/dist/index.cjs.map +4 -4
  33. package/dist/index.d.ts +13 -4
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +7 -3
  36. package/dist/index.js.map +1 -0
  37. package/dist/ktx2-basis-writer-worker-node.js +574 -9832
  38. package/dist/ktx2-basis-writer-worker.d.ts +2 -0
  39. package/dist/ktx2-basis-writer-worker.d.ts.map +1 -0
  40. package/dist/ktx2-basis-writer-worker.js +45 -7
  41. package/dist/ktx2-basis-writer-worker.js.map +1 -0
  42. package/dist/ktx2-basis-writer.js +1 -0
  43. package/dist/ktx2-basis-writer.js.map +1 -0
  44. package/dist/lib/composite-image/image-texture-cube.d.ts +47 -0
  45. package/dist/lib/composite-image/image-texture-cube.d.ts.map +1 -0
  46. package/dist/lib/composite-image/image-texture-cube.js +42 -0
  47. package/dist/lib/composite-image/image-texture-cube.js.map +1 -0
  48. package/dist/lib/composite-image/parse-composite-image.d.ts +43 -0
  49. package/dist/lib/composite-image/parse-composite-image.d.ts.map +1 -0
  50. package/dist/lib/composite-image/parse-composite-image.js +437 -0
  51. package/dist/lib/composite-image/parse-composite-image.js.map +1 -0
  52. package/dist/lib/encoders/encode-ktx.d.ts +1 -1
  53. package/dist/lib/encoders/encode-ktx.d.ts.map +1 -1
  54. package/dist/lib/encoders/encode-ktx.js +1 -0
  55. package/dist/lib/encoders/encode-ktx.js.map +1 -0
  56. package/dist/lib/encoders/encode-ktx2-basis-texture.d.ts +2 -1
  57. package/dist/lib/encoders/encode-ktx2-basis-texture.d.ts.map +1 -1
  58. package/dist/lib/encoders/encode-ktx2-basis-texture.js +3 -1
  59. package/dist/lib/encoders/encode-ktx2-basis-texture.js.map +1 -0
  60. package/dist/lib/encoders/encode-texture.js +1 -0
  61. package/dist/lib/encoders/encode-texture.js.map +1 -0
  62. package/dist/lib/gl-extensions.d.ts +166 -58
  63. package/dist/lib/gl-extensions.d.ts.map +1 -1
  64. package/dist/lib/gl-extensions.js +178 -66
  65. package/dist/lib/gl-extensions.js.map +1 -0
  66. package/dist/lib/gl-types.d.ts +4 -0
  67. package/dist/lib/gl-types.d.ts.map +1 -0
  68. package/dist/lib/gl-types.js +5 -0
  69. package/dist/lib/gl-types.js.map +1 -0
  70. package/dist/lib/parsers/basis-module-loader.d.ts +3 -2
  71. package/dist/lib/parsers/basis-module-loader.d.ts.map +1 -1
  72. package/dist/lib/parsers/basis-module-loader.js +1 -0
  73. package/dist/lib/parsers/basis-module-loader.js.map +1 -0
  74. package/dist/lib/parsers/crunch-module-loader.d.ts +2 -2
  75. package/dist/lib/parsers/crunch-module-loader.d.ts.map +1 -1
  76. package/dist/lib/parsers/crunch-module-loader.js +1 -0
  77. package/dist/lib/parsers/crunch-module-loader.js.map +1 -0
  78. package/dist/lib/parsers/parse-basis.d.ts +34 -2
  79. package/dist/lib/parsers/parse-basis.d.ts.map +1 -1
  80. package/dist/lib/parsers/parse-basis.js +265 -64
  81. package/dist/lib/parsers/parse-basis.js.map +1 -0
  82. package/dist/lib/parsers/parse-compressed-texture.js +1 -0
  83. package/dist/lib/parsers/parse-compressed-texture.js.map +1 -0
  84. package/dist/lib/parsers/parse-crunch.d.ts.map +1 -1
  85. package/dist/lib/parsers/parse-crunch.js +7 -6
  86. package/dist/lib/parsers/parse-crunch.js.map +1 -0
  87. package/dist/lib/parsers/parse-dds.d.ts.map +1 -1
  88. package/dist/lib/parsers/parse-dds.js +11 -11
  89. package/dist/lib/parsers/parse-dds.js.map +1 -0
  90. package/dist/lib/parsers/parse-hdr.d.ts +21 -0
  91. package/dist/lib/parsers/parse-hdr.d.ts.map +1 -0
  92. package/dist/lib/parsers/parse-hdr.js +305 -0
  93. package/dist/lib/parsers/parse-hdr.js.map +1 -0
  94. package/dist/lib/parsers/parse-ktx.d.ts.map +1 -1
  95. package/dist/lib/parsers/parse-ktx.js +11 -3
  96. package/dist/lib/parsers/parse-ktx.js.map +1 -0
  97. package/dist/lib/parsers/parse-npy.js +1 -0
  98. package/dist/lib/parsers/parse-npy.js.map +1 -0
  99. package/dist/lib/parsers/parse-pvr.d.ts.map +1 -1
  100. package/dist/lib/parsers/parse-pvr.js +32 -74
  101. package/dist/lib/parsers/parse-pvr.js.map +1 -0
  102. package/dist/lib/texture-api/async-deep-map.js +1 -0
  103. package/dist/lib/texture-api/async-deep-map.js.map +1 -0
  104. package/dist/lib/texture-api/deep-load.js +1 -0
  105. package/dist/lib/texture-api/deep-load.js.map +1 -0
  106. package/dist/lib/texture-api/generate-url.d.ts.map +1 -1
  107. package/dist/lib/texture-api/generate-url.js +3 -10
  108. package/dist/lib/texture-api/generate-url.js.map +1 -0
  109. package/dist/lib/texture-api/load-image-array.d.ts +6 -3
  110. package/dist/lib/texture-api/load-image-array.d.ts.map +1 -1
  111. package/dist/lib/texture-api/load-image-array.js +6 -3
  112. package/dist/lib/texture-api/load-image-array.js.map +1 -0
  113. package/dist/lib/texture-api/load-image-cube.d.ts +7 -11
  114. package/dist/lib/texture-api/load-image-cube.d.ts.map +1 -1
  115. package/dist/lib/texture-api/load-image-cube.js +9 -20
  116. package/dist/lib/texture-api/load-image-cube.js.map +1 -0
  117. package/dist/lib/texture-api/load-image.d.ts +6 -3
  118. package/dist/lib/texture-api/load-image.d.ts.map +1 -1
  119. package/dist/lib/texture-api/load-image.js +9 -4
  120. package/dist/lib/texture-api/load-image.js.map +1 -0
  121. package/dist/lib/texture-api/texture-api-types.d.ts +13 -0
  122. package/dist/lib/texture-api/texture-api-types.d.ts.map +1 -1
  123. package/dist/lib/texture-api/texture-api-types.js +1 -0
  124. package/dist/lib/texture-api/texture-api-types.js.map +1 -0
  125. package/dist/lib/utils/detect-supported-texture-formats.d.ts +14 -0
  126. package/dist/lib/utils/detect-supported-texture-formats.d.ts.map +1 -0
  127. package/dist/lib/utils/detect-supported-texture-formats.js +197 -0
  128. package/dist/lib/utils/detect-supported-texture-formats.js.map +1 -0
  129. package/dist/lib/utils/extract-mipmap-images.d.ts +6 -2
  130. package/dist/lib/utils/extract-mipmap-images.d.ts.map +1 -1
  131. package/dist/lib/utils/extract-mipmap-images.js +14 -2
  132. package/dist/lib/utils/extract-mipmap-images.js.map +1 -0
  133. package/dist/lib/utils/ktx-format-helper.d.ts +9 -1
  134. package/dist/lib/utils/ktx-format-helper.d.ts.map +1 -1
  135. package/dist/lib/utils/ktx-format-helper.js +77 -109
  136. package/dist/lib/utils/ktx-format-helper.js.map +1 -0
  137. package/dist/lib/utils/texture-format-map.d.ts +10 -0
  138. package/dist/lib/utils/texture-format-map.d.ts.map +1 -0
  139. package/dist/lib/utils/texture-format-map.js +87 -0
  140. package/dist/lib/utils/texture-format-map.js.map +1 -0
  141. package/dist/lib/utils/version.js +2 -1
  142. package/dist/lib/utils/version.js.map +1 -0
  143. package/dist/libs/libs/README.md +9 -0
  144. package/dist/libs/libs/basis_encoder.js +21 -0
  145. package/dist/libs/libs/basis_encoder.wasm +0 -0
  146. package/dist/libs/libs/basis_transcoder.js +22 -0
  147. package/dist/libs/libs/basis_transcoder.wasm +0 -0
  148. package/dist/libs/libs/crunch.js +136 -0
  149. package/dist/npy-loader.d.ts +2 -2
  150. package/dist/npy-loader.js +1 -0
  151. package/dist/npy-loader.js.map +1 -0
  152. package/dist/npy-worker.d.ts +2 -0
  153. package/dist/npy-worker.d.ts.map +1 -0
  154. package/dist/npy-worker.js +5 -2
  155. package/dist/npy-worker.js.map +1 -0
  156. package/dist/radiance-hdr-loader.d.ts +25 -0
  157. package/dist/radiance-hdr-loader.d.ts.map +1 -0
  158. package/dist/radiance-hdr-loader.js +23 -0
  159. package/dist/radiance-hdr-loader.js.map +1 -0
  160. package/dist/texture-array-loader.d.ts +25 -0
  161. package/dist/texture-array-loader.d.ts.map +1 -0
  162. package/dist/texture-array-loader.js +24 -0
  163. package/dist/texture-array-loader.js.map +1 -0
  164. package/dist/texture-cube-array-loader.d.ts +25 -0
  165. package/dist/texture-cube-array-loader.d.ts.map +1 -0
  166. package/dist/texture-cube-array-loader.js +24 -0
  167. package/dist/texture-cube-array-loader.js.map +1 -0
  168. package/dist/texture-cube-loader.d.ts +25 -0
  169. package/dist/texture-cube-loader.d.ts.map +1 -0
  170. package/dist/texture-cube-loader.js +24 -0
  171. package/dist/texture-cube-loader.js.map +1 -0
  172. package/dist/texture-loader.d.ts +25 -0
  173. package/dist/texture-loader.d.ts.map +1 -0
  174. package/dist/texture-loader.js +24 -0
  175. package/dist/texture-loader.js.map +1 -0
  176. package/dist/workers/basis-worker-node.js +1 -0
  177. package/dist/workers/basis-worker-node.js.map +1 -0
  178. package/dist/workers/basis-worker.js +1 -0
  179. package/dist/workers/basis-worker.js.map +1 -0
  180. package/dist/workers/compressed-texture-worker.js +1 -1
  181. package/dist/workers/compressed-texture-worker.js.map +1 -0
  182. package/dist/workers/crunch-worker.d.ts +1 -3
  183. package/dist/workers/crunch-worker.d.ts.map +1 -1
  184. package/dist/workers/crunch-worker.js +1 -0
  185. package/dist/workers/crunch-worker.js.map +1 -0
  186. package/dist/workers/ktx2-basis-writer-worker-node.js +1 -0
  187. package/dist/workers/ktx2-basis-writer-worker-node.js.map +1 -0
  188. package/dist/workers/ktx2-basis-writer-worker.js +1 -0
  189. package/dist/workers/ktx2-basis-writer-worker.js.map +1 -0
  190. package/dist/workers/npy-worker.js +1 -0
  191. package/dist/workers/npy-worker.js.map +1 -0
  192. package/package.json +27 -6
  193. package/src/basis-loader.ts +19 -9
  194. package/src/basis-worker.ts +7 -0
  195. package/src/compressed-texture-loader.ts +3 -7
  196. package/src/compressed-texture-worker.ts +6 -0
  197. package/src/crunch-loader.ts +1 -5
  198. package/src/crunch-worker.ts +6 -0
  199. package/src/index.ts +21 -4
  200. package/src/ktx2-basis-writer-worker.ts +6 -0
  201. package/src/lib/composite-image/image-texture-cube.ts +49 -0
  202. package/src/lib/composite-image/parse-composite-image.ts +699 -0
  203. package/src/lib/encoders/encode-ktx.ts +1 -1
  204. package/src/lib/encoders/encode-ktx2-basis-texture.ts +4 -2
  205. package/src/lib/gl-extensions.ts +188 -81
  206. package/src/lib/gl-types.ts +136 -0
  207. package/src/lib/parsers/basis-module-loader.ts +5 -5
  208. package/src/lib/parsers/crunch-module-loader.ts +4 -4
  209. package/src/lib/parsers/parse-basis.ts +358 -66
  210. package/src/lib/parsers/parse-crunch.ts +11 -8
  211. package/src/lib/parsers/parse-dds.ts +11 -12
  212. package/src/lib/parsers/parse-hdr.ts +426 -0
  213. package/src/lib/parsers/parse-ktx.ts +13 -3
  214. package/src/lib/parsers/parse-pvr.ts +33 -75
  215. package/src/lib/texture-api/generate-url.ts +2 -12
  216. package/src/lib/texture-api/load-image-array.ts +15 -6
  217. package/src/lib/texture-api/load-image-cube.ts +20 -34
  218. package/src/lib/texture-api/load-image.ts +19 -8
  219. package/src/lib/texture-api/texture-api-types.ts +15 -0
  220. package/src/lib/utils/detect-supported-texture-formats.ts +210 -0
  221. package/src/lib/utils/extract-mipmap-images.ts +23 -4
  222. package/src/lib/utils/ktx-format-helper.ts +135 -111
  223. package/src/lib/utils/texture-format-map.ts +162 -0
  224. package/src/npy-worker.ts +6 -0
  225. package/src/radiance-hdr-loader.ts +36 -0
  226. package/src/texture-array-loader.ts +46 -0
  227. package/src/texture-cube-array-loader.ts +49 -0
  228. package/src/texture-cube-loader.ts +46 -0
  229. package/src/texture-loader.ts +49 -0
  230. package/src/workers/compressed-texture-worker.ts +0 -1
  231. package/dist/lib/utils/texture-formats.d.ts +0 -8
  232. package/dist/lib/utils/texture-formats.d.ts.map +0 -1
  233. package/dist/lib/utils/texture-formats.js +0 -50
  234. package/src/lib/utils/texture-formats.ts +0 -59
package/dist/index.cjs CHANGED
@@ -29,21 +29,96 @@ __export(dist_exports, {
29
29
  CompressedTextureWriter: () => CompressedTextureWriter,
30
30
  CrunchLoader: () => CrunchLoader,
31
31
  CrunchWorkerLoader: () => CrunchLoader,
32
+ GL_COMPRESSED_R11_EAC: () => GL_COMPRESSED_R11_EAC,
33
+ GL_COMPRESSED_RED_GREEN_RGTC2_EXT: () => GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
34
+ GL_COMPRESSED_RED_RGTC1_EXT: () => GL_COMPRESSED_RED_RGTC1_EXT,
35
+ GL_COMPRESSED_RG11_EAC: () => GL_COMPRESSED_RG11_EAC,
36
+ GL_COMPRESSED_RGB8_ETC2: () => GL_COMPRESSED_RGB8_ETC2,
37
+ GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: () => GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
38
+ GL_COMPRESSED_RGBA8_ETC2_EAC: () => GL_COMPRESSED_RGBA8_ETC2_EAC,
39
+ GL_COMPRESSED_RGBA_ASTC_10x10_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
40
+ GL_COMPRESSED_RGBA_ASTC_10x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
41
+ GL_COMPRESSED_RGBA_ASTC_10x6_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
42
+ GL_COMPRESSED_RGBA_ASTC_10x8_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
43
+ GL_COMPRESSED_RGBA_ASTC_12x10_KHR: () => GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
44
+ GL_COMPRESSED_RGBA_ASTC_12x12_KHR: () => GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
45
+ GL_COMPRESSED_RGBA_ASTC_4x4_KHR: () => GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
46
+ GL_COMPRESSED_RGBA_ASTC_5x4_KHR: () => GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
47
+ GL_COMPRESSED_RGBA_ASTC_5x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
48
+ GL_COMPRESSED_RGBA_ASTC_6x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
49
+ GL_COMPRESSED_RGBA_ASTC_6x6_KHR: () => GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
50
+ GL_COMPRESSED_RGBA_ASTC_8x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
51
+ GL_COMPRESSED_RGBA_ASTC_8x6_KHR: () => GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
52
+ GL_COMPRESSED_RGBA_ASTC_8x8_KHR: () => GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
53
+ GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: () => GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
54
+ GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: () => GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
55
+ GL_COMPRESSED_RGBA_BPTC_UNORM_EXT: () => GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
56
+ GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: () => GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
57
+ GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: () => GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
58
+ GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: () => GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
59
+ GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: () => GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
60
+ GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: () => GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
61
+ GL_COMPRESSED_RGB_ATC_WEBGL: () => GL_COMPRESSED_RGB_ATC_WEBGL,
62
+ GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: () => GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
63
+ GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: () => GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
64
+ GL_COMPRESSED_RGB_ETC1_WEBGL: () => GL_COMPRESSED_RGB_ETC1_WEBGL,
65
+ GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: () => GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
66
+ GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: () => GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
67
+ GL_COMPRESSED_RGB_S3TC_DXT1_EXT: () => GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
68
+ GL_COMPRESSED_SIGNED_R11_EAC: () => GL_COMPRESSED_SIGNED_R11_EAC,
69
+ GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: () => GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
70
+ GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: () => GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
71
+ GL_COMPRESSED_SIGNED_RG11_EAC: () => GL_COMPRESSED_SIGNED_RG11_EAC,
72
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
73
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
74
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
75
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
76
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
77
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
78
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
79
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
80
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
81
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
82
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
83
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
84
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
85
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
86
+ GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: () => GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
87
+ GL_COMPRESSED_SRGB8_ETC2: () => GL_COMPRESSED_SRGB8_ETC2,
88
+ GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: () => GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
89
+ GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: () => GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
90
+ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: () => GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
91
+ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: () => GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
92
+ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: () => GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
93
+ GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: () => GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
32
94
  GL_EXTENSIONS_CONSTANTS: () => GL_EXTENSIONS_CONSTANTS,
95
+ GL_RGB: () => GL_RGB,
96
+ GL_RGB565: () => GL_RGB565,
97
+ GL_RGB5_A1: () => GL_RGB5_A1,
98
+ GL_RGBA: () => GL_RGBA,
99
+ GL_RGBA32F: () => GL_RGBA32F,
100
+ GL_RGBA4: () => GL_RGBA4,
101
+ GL_RGBA8: () => GL_RGBA8,
33
102
  KTX2BasisWriter: () => KTX2BasisWriter,
34
103
  KTX2BasisWriterWorker: () => KTX2BasisWriterWorker,
35
104
  NPYLoader: () => NPYLoader,
36
105
  NPYWorkerLoader: () => NPYWorkerLoader,
37
- getSupportedGPUTextureFormats: () => getSupportedGPUTextureFormats,
106
+ RadianceHDRLoader: () => RadianceHDRLoader,
107
+ TextureArrayLoader: () => TextureArrayLoader,
108
+ TextureCubeArrayLoader: () => TextureCubeArrayLoader,
109
+ TextureCubeLoader: () => TextureCubeLoader,
110
+ TextureLoader: () => TextureLoader,
38
111
  loadImageTexture: () => loadImageTexture,
39
112
  loadImageTextureArray: () => loadImageTextureArray,
40
- loadImageTextureCube: () => loadImageTextureCube,
41
- selectSupportedBasisFormat: () => selectSupportedBasisFormat
113
+ loadImageTextureCube: () => loadImageTextureCube
42
114
  });
43
115
  module.exports = __toCommonJS(dist_exports);
44
116
 
45
117
  // dist/lib/utils/version.js
46
- var VERSION = true ? "4.4.0-alpha.1" : "latest";
118
+ var VERSION = true ? "4.4.0" : "latest";
119
+
120
+ // dist/lib/parsers/parse-basis.js
121
+ var import_worker_utils2 = require("@loaders.gl/worker-utils");
47
122
 
48
123
  // dist/lib/parsers/basis-module-loader.js
49
124
  var import_loader_utils = require("@loaders.gl/loader-utils");
@@ -125,104 +200,271 @@ function initializeBasisEncoderModule(BasisEncoderModule, wasmBinary) {
125
200
  }
126
201
 
127
202
  // dist/lib/gl-extensions.js
203
+ var GL_RGB = 6407;
204
+ var GL_RGBA = 6408;
205
+ var GL_RGBA4 = 32854;
206
+ var GL_RGB5_A1 = 32855;
207
+ var GL_RGBA8 = 32856;
208
+ var GL_RGB565 = 36194;
209
+ var GL_RGBA32F = 34836;
210
+ var GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
211
+ var GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777;
212
+ var GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778;
213
+ var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;
214
+ var GL_COMPRESSED_R11_EAC = 37488;
215
+ var GL_COMPRESSED_SIGNED_R11_EAC = 37489;
216
+ var GL_COMPRESSED_RG11_EAC = 37490;
217
+ var GL_COMPRESSED_SIGNED_RG11_EAC = 37491;
218
+ var GL_COMPRESSED_RGB8_ETC2 = 37492;
219
+ var GL_COMPRESSED_RGBA8_ETC2_EAC = 37493;
220
+ var GL_COMPRESSED_SRGB8_ETC2 = 37494;
221
+ var GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37495;
222
+ var GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37496;
223
+ var GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37497;
224
+ var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840;
225
+ var GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841;
226
+ var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842;
227
+ var GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843;
228
+ var GL_COMPRESSED_RGB_ETC1_WEBGL = 36196;
229
+ var GL_COMPRESSED_RGB_ATC_WEBGL = 35986;
230
+ var GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35987;
231
+ var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798;
232
+ var GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 37808;
233
+ var GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 37809;
234
+ var GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 37810;
235
+ var GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 37811;
236
+ var GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 37812;
237
+ var GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 37813;
238
+ var GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 37814;
239
+ var GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 37815;
240
+ var GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 37816;
241
+ var GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 37817;
242
+ var GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 37818;
243
+ var GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 37819;
244
+ var GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 37820;
245
+ var GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 37821;
246
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 37840;
247
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 37841;
248
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 37842;
249
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 37843;
250
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 37844;
251
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 37845;
252
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 37846;
253
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 37847;
254
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 37848;
255
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 37849;
256
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 37850;
257
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 37851;
258
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 37852;
259
+ var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 37853;
260
+ var GL_COMPRESSED_RED_RGTC1_EXT = 36283;
261
+ var GL_COMPRESSED_SIGNED_RED_RGTC1_EXT = 36284;
262
+ var GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285;
263
+ var GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 36286;
264
+ var GL_COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492;
265
+ var GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 36493;
266
+ var GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 36494;
267
+ var GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 36495;
268
+ var GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916;
269
+ var GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917;
270
+ var GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918;
271
+ var GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919;
128
272
  var GL_EXTENSIONS_CONSTANTS = {
129
- // WEBGL_compressed_texture_s3tc
130
- COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
131
- COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
132
- COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
133
- COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
134
- // WEBGL_compressed_texture_es3
135
- COMPRESSED_R11_EAC: 37488,
136
- COMPRESSED_SIGNED_R11_EAC: 37489,
137
- COMPRESSED_RG11_EAC: 37490,
138
- COMPRESSED_SIGNED_RG11_EAC: 37491,
139
- COMPRESSED_RGB8_ETC2: 37492,
140
- COMPRESSED_RGBA8_ETC2_EAC: 37493,
141
- COMPRESSED_SRGB8_ETC2: 37494,
142
- COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,
143
- COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,
144
- COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,
145
- // WEBGL_compressed_texture_pvrtc
146
- COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
147
- COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
148
- COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
149
- COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
150
- // WEBGL_compressed_texture_etc1
151
- COMPRESSED_RGB_ETC1_WEBGL: 36196,
152
- // WEBGL_compressed_texture_atc
153
- COMPRESSED_RGB_ATC_WEBGL: 35986,
154
- COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,
155
- COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
156
- // WEBGL_compressed_texture_astc
157
- COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,
158
- COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,
159
- COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,
160
- COMPRESSED_RGBA_ASTC_6X5_KHR: 37811,
161
- COMPRESSED_RGBA_ASTC_6X6_KHR: 37812,
162
- COMPRESSED_RGBA_ASTC_8X5_KHR: 37813,
163
- COMPRESSED_RGBA_ASTC_8X6_KHR: 37814,
164
- COMPRESSED_RGBA_ASTC_8X8_KHR: 37815,
165
- COMPRESSED_RGBA_ASTC_10X5_KHR: 37816,
166
- COMPRESSED_RGBA_ASTC_10X6_KHR: 37817,
167
- COMPRESSED_RGBA_ASTC_10X8_KHR: 37818,
168
- COMPRESSED_RGBA_ASTC_10X10_KHR: 37819,
169
- COMPRESSED_RGBA_ASTC_12X10_KHR: 37820,
170
- COMPRESSED_RGBA_ASTC_12X12_KHR: 37821,
171
- COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: 37840,
172
- COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: 37841,
173
- COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: 37842,
174
- COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: 37843,
175
- COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: 37844,
176
- COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: 37845,
177
- COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: 37846,
178
- COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: 37847,
179
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: 37848,
180
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: 37849,
181
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: 37850,
182
- COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,
183
- COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,
184
- COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,
185
- // EXT_texture_compression_rgtc
186
- COMPRESSED_RED_RGTC1_EXT: 36283,
187
- COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,
188
- COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,
189
- COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,
190
- // WEBGL_compressed_texture_s3tc_srgb
191
- COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,
192
- COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,
193
- COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,
194
- COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919
273
+ RGB: GL_RGB,
274
+ RGBA: GL_RGBA,
275
+ RGBA4: GL_RGBA4,
276
+ RGB5_A1: GL_RGB5_A1,
277
+ RGBA8: GL_RGBA8,
278
+ RGB565: GL_RGB565,
279
+ RGBA32F: GL_RGBA32F,
280
+ COMPRESSED_RGB_S3TC_DXT1_EXT: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
281
+ COMPRESSED_RGBA_S3TC_DXT1_EXT: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
282
+ COMPRESSED_RGBA_S3TC_DXT3_EXT: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
283
+ COMPRESSED_RGBA_S3TC_DXT5_EXT: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
284
+ COMPRESSED_R11_EAC: GL_COMPRESSED_R11_EAC,
285
+ COMPRESSED_SIGNED_R11_EAC: GL_COMPRESSED_SIGNED_R11_EAC,
286
+ COMPRESSED_RG11_EAC: GL_COMPRESSED_RG11_EAC,
287
+ COMPRESSED_SIGNED_RG11_EAC: GL_COMPRESSED_SIGNED_RG11_EAC,
288
+ COMPRESSED_RGB8_ETC2: GL_COMPRESSED_RGB8_ETC2,
289
+ COMPRESSED_RGBA8_ETC2_EAC: GL_COMPRESSED_RGBA8_ETC2_EAC,
290
+ COMPRESSED_SRGB8_ETC2: GL_COMPRESSED_SRGB8_ETC2,
291
+ COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
292
+ COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
293
+ COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
294
+ COMPRESSED_RGB_PVRTC_4BPPV1_IMG: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
295
+ COMPRESSED_RGB_PVRTC_2BPPV1_IMG: GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
296
+ COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
297
+ COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
298
+ COMPRESSED_RGB_ETC1_WEBGL: GL_COMPRESSED_RGB_ETC1_WEBGL,
299
+ COMPRESSED_RGB_ATC_WEBGL: GL_COMPRESSED_RGB_ATC_WEBGL,
300
+ COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
301
+ COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
302
+ COMPRESSED_RGBA_ASTC_4x4_KHR: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
303
+ COMPRESSED_RGBA_ASTC_5x4_KHR: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
304
+ COMPRESSED_RGBA_ASTC_5x5_KHR: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
305
+ COMPRESSED_RGBA_ASTC_6x5_KHR: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
306
+ COMPRESSED_RGBA_ASTC_6x6_KHR: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
307
+ COMPRESSED_RGBA_ASTC_8x5_KHR: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
308
+ COMPRESSED_RGBA_ASTC_8x6_KHR: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
309
+ COMPRESSED_RGBA_ASTC_8x8_KHR: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
310
+ COMPRESSED_RGBA_ASTC_10x5_KHR: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
311
+ COMPRESSED_RGBA_ASTC_10x6_KHR: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
312
+ COMPRESSED_RGBA_ASTC_10x8_KHR: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
313
+ COMPRESSED_RGBA_ASTC_10x10_KHR: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
314
+ COMPRESSED_RGBA_ASTC_12x10_KHR: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
315
+ COMPRESSED_RGBA_ASTC_12x12_KHR: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
316
+ COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
317
+ COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
318
+ COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
319
+ COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
320
+ COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
321
+ COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
322
+ COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
323
+ COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
324
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
325
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
326
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
327
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
328
+ COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
329
+ COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
330
+ COMPRESSED_RED_RGTC1_EXT: GL_COMPRESSED_RED_RGTC1_EXT,
331
+ COMPRESSED_SIGNED_RED_RGTC1_EXT: GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
332
+ COMPRESSED_RED_GREEN_RGTC2_EXT: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
333
+ COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
334
+ COMPRESSED_RGBA_BPTC_UNORM_EXT: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
335
+ COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
336
+ COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
337
+ COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
338
+ COMPRESSED_SRGB_S3TC_DXT1_EXT: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
339
+ COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
340
+ COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
341
+ COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
342
+ // Deprecated legacy aliases with non-standard ASTC casing.
343
+ COMPRESSED_RGBA_ASTC_4X4_KHR: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
344
+ COMPRESSED_RGBA_ASTC_5X4_KHR: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
345
+ COMPRESSED_RGBA_ASTC_5X5_KHR: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
346
+ COMPRESSED_RGBA_ASTC_6X5_KHR: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
347
+ COMPRESSED_RGBA_ASTC_6X6_KHR: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
348
+ COMPRESSED_RGBA_ASTC_8X5_KHR: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
349
+ COMPRESSED_RGBA_ASTC_8X6_KHR: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
350
+ COMPRESSED_RGBA_ASTC_8X8_KHR: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
351
+ COMPRESSED_RGBA_ASTC_10X5_KHR: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
352
+ COMPRESSED_RGBA_ASTC_10X6_KHR: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
353
+ COMPRESSED_RGBA_ASTC_10X8_KHR: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
354
+ COMPRESSED_RGBA_ASTC_10X10_KHR: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
355
+ COMPRESSED_RGBA_ASTC_12X10_KHR: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
356
+ COMPRESSED_RGBA_ASTC_12X12_KHR: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
357
+ COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
358
+ COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
359
+ COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
360
+ COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
361
+ COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
362
+ COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
363
+ COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
364
+ COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
365
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
366
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
367
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
368
+ COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
369
+ COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
370
+ COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
195
371
  };
196
372
 
197
- // dist/lib/utils/texture-formats.js
373
+ // dist/lib/utils/detect-supported-texture-formats.js
198
374
  var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
199
- var WEBGL_EXTENSIONS = {
375
+ var WEBGL_TEXTURE_FORMATS = {
200
376
  /* eslint-disable camelcase */
201
- WEBGL_compressed_texture_s3tc: "dxt",
202
- WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
203
- WEBGL_compressed_texture_etc1: "etc1",
204
- WEBGL_compressed_texture_etc: "etc2",
205
- WEBGL_compressed_texture_pvrtc: "pvrtc",
206
- WEBGL_compressed_texture_atc: "atc",
207
- WEBGL_compressed_texture_astc: "astc",
208
- EXT_texture_compression_rgtc: "rgtc"
377
+ WEBGL_compressed_texture_s3tc: [
378
+ "bc1-rgb-unorm-webgl",
379
+ "bc1-rgba-unorm",
380
+ "bc2-rgba-unorm",
381
+ "bc3-rgba-unorm"
382
+ ],
383
+ WEBGL_compressed_texture_s3tc_srgb: [
384
+ "bc1-rgb-unorm-srgb-webgl",
385
+ "bc1-rgba-unorm-srgb",
386
+ "bc2-rgba-unorm-srgb",
387
+ "bc3-rgba-unorm-srgb"
388
+ ],
389
+ EXT_texture_compression_rgtc: ["bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm"],
390
+ EXT_texture_compression_bptc: [
391
+ "bc6h-rgb-ufloat",
392
+ "bc6h-rgb-float",
393
+ "bc7-rgba-unorm",
394
+ "bc7-rgba-unorm-srgb"
395
+ ],
396
+ WEBGL_compressed_texture_etc1: ["etc1-rgb-unorm-webgl"],
397
+ WEBGL_compressed_texture_etc: [
398
+ "etc2-rgb8unorm",
399
+ "etc2-rgb8unorm-srgb",
400
+ "etc2-rgb8a1unorm",
401
+ "etc2-rgb8a1unorm-srgb",
402
+ "etc2-rgba8unorm",
403
+ "etc2-rgba8unorm-srgb",
404
+ "eac-r11unorm",
405
+ "eac-r11snorm",
406
+ "eac-rg11unorm",
407
+ "eac-rg11snorm"
408
+ ],
409
+ WEBGL_compressed_texture_pvrtc: [
410
+ "pvrtc-rgb4unorm-webgl",
411
+ "pvrtc-rgba4unorm-webgl",
412
+ "pvrtc-rgb2unorm-webgl",
413
+ "pvrtc-rgba2unorm-webgl"
414
+ ],
415
+ WEBGL_compressed_texture_atc: [
416
+ "atc-rgb-unorm-webgl",
417
+ "atc-rgba-unorm-webgl",
418
+ "atc-rgbai-unorm-webgl"
419
+ ],
420
+ WEBGL_compressed_texture_astc: [
421
+ "astc-4x4-unorm",
422
+ "astc-4x4-unorm-srgb",
423
+ "astc-5x4-unorm",
424
+ "astc-5x4-unorm-srgb",
425
+ "astc-5x5-unorm",
426
+ "astc-5x5-unorm-srgb",
427
+ "astc-6x5-unorm",
428
+ "astc-6x5-unorm-srgb",
429
+ "astc-6x6-unorm",
430
+ "astc-6x6-unorm-srgb",
431
+ "astc-8x5-unorm",
432
+ "astc-8x5-unorm-srgb",
433
+ "astc-8x6-unorm",
434
+ "astc-8x6-unorm-srgb",
435
+ "astc-8x8-unorm",
436
+ "astc-8x8-unorm-srgb",
437
+ "astc-10x5-unorm",
438
+ "astc-10x5-unorm-srgb",
439
+ "astc-10x6-unorm",
440
+ "astc-10x6-unorm-srgb",
441
+ "astc-10x8-unorm",
442
+ "astc-10x8-unorm-srgb",
443
+ "astc-10x10-unorm",
444
+ "astc-10x10-unorm-srgb",
445
+ "astc-12x10-unorm",
446
+ "astc-12x10-unorm-srgb",
447
+ "astc-12x12-unorm",
448
+ "astc-12x12-unorm-srgb"
449
+ ]
209
450
  /* eslint-enable camelcase */
210
451
  };
211
- var formats = null;
212
- function getSupportedGPUTextureFormats(gl) {
213
- if (!formats) {
452
+ var textureFormats = null;
453
+ function detectSupportedTextureFormats(gl) {
454
+ if (!textureFormats) {
214
455
  gl = gl || getWebGLContext() || void 0;
215
- formats = /* @__PURE__ */ new Set();
456
+ textureFormats = /* @__PURE__ */ new Set();
216
457
  for (const prefix of BROWSER_PREFIXES) {
217
- for (const extension in WEBGL_EXTENSIONS) {
458
+ for (const extension in WEBGL_TEXTURE_FORMATS) {
218
459
  if (gl && gl.getExtension(`${prefix}${extension}`)) {
219
- const gpuTextureFormat = WEBGL_EXTENSIONS[extension];
220
- formats.add(gpuTextureFormat);
460
+ for (const textureFormat of WEBGL_TEXTURE_FORMATS[extension]) {
461
+ textureFormats.add(textureFormat);
462
+ }
221
463
  }
222
464
  }
223
465
  }
224
466
  }
225
- return formats;
467
+ return textureFormats;
226
468
  }
227
469
  function getWebGLContext() {
228
470
  try {
@@ -234,25 +476,114 @@ function getWebGLContext() {
234
476
  }
235
477
 
236
478
  // dist/lib/parsers/parse-ktx.js
479
+ var import_loader_utils2 = require("@loaders.gl/loader-utils");
237
480
  var import_ktx_parse = require("ktx-parse");
238
481
 
482
+ // dist/lib/utils/texture-format-map.js
483
+ var WEBGL_TO_TEXTURE_FORMAT = {
484
+ [GL_RGBA32F]: "rgba32float",
485
+ [GL_COMPRESSED_RGB_S3TC_DXT1_EXT]: "bc1-rgb-unorm-webgl",
486
+ [GL_COMPRESSED_SRGB_S3TC_DXT1_EXT]: "bc1-rgb-unorm-srgb-webgl",
487
+ [GL_COMPRESSED_RGBA_S3TC_DXT1_EXT]: "bc1-rgba-unorm",
488
+ [GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]: "bc1-rgba-unorm-srgb",
489
+ [GL_COMPRESSED_RGBA_S3TC_DXT3_EXT]: "bc2-rgba-unorm",
490
+ [GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]: "bc2-rgba-unorm-srgb",
491
+ [GL_COMPRESSED_RGBA_S3TC_DXT5_EXT]: "bc3-rgba-unorm",
492
+ [GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]: "bc3-rgba-unorm-srgb",
493
+ [GL_COMPRESSED_RED_RGTC1_EXT]: "bc4-r-unorm",
494
+ [GL_COMPRESSED_SIGNED_RED_RGTC1_EXT]: "bc4-r-snorm",
495
+ [GL_COMPRESSED_RED_GREEN_RGTC2_EXT]: "bc5-rg-unorm",
496
+ [GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT]: "bc5-rg-snorm",
497
+ [GL_COMPRESSED_RGB8_ETC2]: "etc2-rgb8unorm",
498
+ [GL_COMPRESSED_SRGB8_ETC2]: "etc2-rgb8unorm-srgb",
499
+ [GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]: "etc2-rgb8a1unorm",
500
+ [GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]: "etc2-rgb8a1unorm-srgb",
501
+ [GL_COMPRESSED_RGBA8_ETC2_EAC]: "etc2-rgba8unorm",
502
+ [GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]: "etc2-rgba8unorm-srgb",
503
+ [GL_COMPRESSED_R11_EAC]: "eac-r11unorm",
504
+ [GL_COMPRESSED_SIGNED_R11_EAC]: "eac-r11snorm",
505
+ [GL_COMPRESSED_RG11_EAC]: "eac-rg11unorm",
506
+ [GL_COMPRESSED_SIGNED_RG11_EAC]: "eac-rg11snorm",
507
+ [GL_COMPRESSED_RGBA_ASTC_4x4_KHR]: "astc-4x4-unorm",
508
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR]: "astc-4x4-unorm-srgb",
509
+ [GL_COMPRESSED_RGBA_ASTC_5x4_KHR]: "astc-5x4-unorm",
510
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR]: "astc-5x4-unorm-srgb",
511
+ [GL_COMPRESSED_RGBA_ASTC_5x5_KHR]: "astc-5x5-unorm",
512
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR]: "astc-5x5-unorm-srgb",
513
+ [GL_COMPRESSED_RGBA_ASTC_6x5_KHR]: "astc-6x5-unorm",
514
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR]: "astc-6x5-unorm-srgb",
515
+ [GL_COMPRESSED_RGBA_ASTC_6x6_KHR]: "astc-6x6-unorm",
516
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR]: "astc-6x6-unorm-srgb",
517
+ [GL_COMPRESSED_RGBA_ASTC_8x5_KHR]: "astc-8x5-unorm",
518
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR]: "astc-8x5-unorm-srgb",
519
+ [GL_COMPRESSED_RGBA_ASTC_8x6_KHR]: "astc-8x6-unorm",
520
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR]: "astc-8x6-unorm-srgb",
521
+ [GL_COMPRESSED_RGBA_ASTC_8x8_KHR]: "astc-8x8-unorm",
522
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR]: "astc-8x8-unorm-srgb",
523
+ [GL_COMPRESSED_RGBA_ASTC_10x5_KHR]: "astc-10x5-unorm",
524
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR]: "astc-10x5-unorm-srgb",
525
+ [GL_COMPRESSED_RGBA_ASTC_10x6_KHR]: "astc-10x6-unorm",
526
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR]: "astc-10x6-unorm-srgb",
527
+ [GL_COMPRESSED_RGBA_ASTC_10x8_KHR]: "astc-10x8-unorm",
528
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR]: "astc-10x8-unorm-srgb",
529
+ [GL_COMPRESSED_RGBA_ASTC_10x10_KHR]: "astc-10x10-unorm",
530
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR]: "astc-10x10-unorm-srgb",
531
+ [GL_COMPRESSED_RGBA_ASTC_12x10_KHR]: "astc-12x10-unorm",
532
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR]: "astc-12x10-unorm-srgb",
533
+ [GL_COMPRESSED_RGBA_ASTC_12x12_KHR]: "astc-12x12-unorm",
534
+ [GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR]: "astc-12x12-unorm-srgb",
535
+ [GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG]: "pvrtc-rgb4unorm-webgl",
536
+ [GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]: "pvrtc-rgba4unorm-webgl",
537
+ [GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG]: "pvrtc-rgb2unorm-webgl",
538
+ [GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]: "pvrtc-rgba2unorm-webgl",
539
+ [GL_COMPRESSED_RGB_ETC1_WEBGL]: "etc1-rgb-unorm-webgl",
540
+ [GL_COMPRESSED_RGB_ATC_WEBGL]: "atc-rgb-unorm-webgl",
541
+ [GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]: "atc-rgba-unorm-webgl",
542
+ [GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]: "atc-rgbai-unorm-webgl"
543
+ };
544
+ var TEXTURE_FORMAT_TO_WEBGL = Object.fromEntries(Object.entries(WEBGL_TO_TEXTURE_FORMAT).map(([format, textureFormat]) => [
545
+ textureFormat,
546
+ Number(format)
547
+ ]));
548
+ function getTextureFormatFromWebGLFormat(format) {
549
+ if (format === void 0) {
550
+ return void 0;
551
+ }
552
+ return WEBGL_TO_TEXTURE_FORMAT[format];
553
+ }
554
+ function getWebGLFormatFromTextureFormat(textureFormat) {
555
+ if (textureFormat === void 0) {
556
+ return void 0;
557
+ }
558
+ return TEXTURE_FORMAT_TO_WEBGL[textureFormat];
559
+ }
560
+
239
561
  // dist/lib/utils/extract-mipmap-images.js
240
562
  function extractMipmapImages(data, options) {
241
563
  const images = new Array(options.mipMapLevels);
564
+ const textureFormat = options.textureFormat || getTextureFormatFromWebGLFormat(options.internalFormat);
565
+ const format = options.internalFormat || getWebGLFormatFromTextureFormat(options.textureFormat);
242
566
  let levelWidth = options.width;
243
567
  let levelHeight = options.height;
244
568
  let offset = 0;
245
569
  for (let i = 0; i < options.mipMapLevels; ++i) {
246
570
  const levelSize = getLevelSize(options, levelWidth, levelHeight, data, i);
247
571
  const levelData = getLevelData(data, i, offset, levelSize);
248
- images[i] = {
572
+ const image = {
573
+ shape: "texture-level",
249
574
  compressed: true,
250
- format: options.internalFormat,
251
575
  data: levelData,
252
576
  width: levelWidth,
253
577
  height: levelHeight,
254
578
  levelSize
255
579
  };
580
+ if (format !== void 0) {
581
+ image.format = format;
582
+ }
583
+ if (textureFormat) {
584
+ image.textureFormat = textureFormat;
585
+ }
586
+ images[i] = image;
256
587
  levelWidth = Math.max(1, levelWidth >> 1);
257
588
  levelHeight = Math.max(1, levelHeight >> 1);
258
589
  offset += levelSize;
@@ -274,118 +605,79 @@ function getLevelSize(options, levelWidth, levelHeight, data, index) {
274
605
 
275
606
  // dist/lib/utils/ktx-format-helper.js
276
607
  var VULKAN_TO_WEBGL_FORMAT_MAP = {
277
- 131: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT,
278
- 132: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_S3TC_DXT1_EXT,
279
- 133: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT1_EXT,
280
- 134: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
281
- 135: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT,
282
- 136: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
283
- 137: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
284
- 138: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
285
- 139: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_RGTC1_EXT,
286
- 140: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_RGTC1_EXT,
287
- 141: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_GREEN_RGTC2_EXT,
288
- 142: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
289
- 147: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_ETC2,
290
- 148: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ETC2,
291
- 149: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
292
- 150: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
293
- 151: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA8_ETC2_EAC,
294
- 152: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
295
- 153: GL_EXTENSIONS_CONSTANTS.COMPRESSED_R11_EAC,
296
- 154: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_R11_EAC,
297
- 155: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC,
298
- 156: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RG11_EAC,
299
- // @ts-ignore
300
- 157: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
301
- // @ts-ignore
302
- 158: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
303
- // @ts-ignore
304
- 159: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
305
- // @ts-ignore
306
- 160: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,
307
- // @ts-ignore
308
- 161: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
309
- // @ts-ignore
310
- 162: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
311
- // @ts-ignore
312
- 163: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
313
- // @ts-ignore
314
- 164: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
315
- // @ts-ignore
316
- 165: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
317
- // @ts-ignore
318
- 166: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
319
- // @ts-ignore
320
- 167: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
321
- // @ts-ignore
322
- 168: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
323
- // @ts-ignore
324
- 169: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
325
- // @ts-ignore
326
- 170: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
327
- // @ts-ignore
328
- 171: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
329
- // @ts-ignore
330
- 172: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
331
- // @ts-ignore
332
- 173: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
333
- // @ts-ignore
334
- 174: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
335
- // @ts-ignore
336
- 175: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
337
- // @ts-ignore
338
- 176: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
339
- // @ts-ignore
340
- 177: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
341
- // @ts-ignore
342
- 178: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
343
- // @ts-ignore
344
- 179: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
345
- // @ts-ignore
346
- 180: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
347
- // @ts-ignore
348
- 181: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
349
- // @ts-ignore
350
- 182: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
351
- // @ts-ignore
352
- 183: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR,
353
- // @ts-ignore
354
- 184: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
355
- 1000054e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
356
- 1000054001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
357
- // @ts-ignore
358
- 1000066e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
359
- // @ts-ignore
360
- 1000066001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
361
- // @ts-ignore
362
- 1000066002: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
363
- // @ts-ignore
364
- 1000066003: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
365
- // @ts-ignore
366
- 1000066004: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
367
- // @ts-ignore
368
- 1000066005: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
369
- // @ts-ignore
370
- 1000066006: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
371
- // @ts-ignore
372
- 1000066007: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
373
- // @ts-ignore
374
- 1000066008: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
375
- // @ts-ignore
376
- 1000066009: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
377
- // @ts-ignore
378
- 1000066010: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
379
- // @ts-ignore
380
- 1000066011: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
381
- // @ts-ignore
382
- 1000066012: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
383
- // @ts-ignore
384
- 1000066013: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR
608
+ 131: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
609
+ 132: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
610
+ 133: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
611
+ 134: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
612
+ 135: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
613
+ 136: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
614
+ 137: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
615
+ 138: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
616
+ 139: GL_COMPRESSED_RED_RGTC1_EXT,
617
+ 140: GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
618
+ 141: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
619
+ 142: GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
620
+ 147: GL_COMPRESSED_RGB8_ETC2,
621
+ 148: GL_COMPRESSED_SRGB8_ETC2,
622
+ 149: GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
623
+ 150: GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
624
+ 151: GL_COMPRESSED_RGBA8_ETC2_EAC,
625
+ 152: GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
626
+ 153: GL_COMPRESSED_R11_EAC,
627
+ 154: GL_COMPRESSED_SIGNED_R11_EAC,
628
+ 155: GL_COMPRESSED_RG11_EAC,
629
+ 156: GL_COMPRESSED_SIGNED_RG11_EAC,
630
+ 157: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
631
+ 158: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
632
+ 159: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
633
+ 160: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
634
+ 161: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
635
+ 162: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
636
+ 163: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
637
+ 164: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
638
+ 165: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
639
+ 166: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
640
+ 167: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
641
+ 168: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
642
+ 169: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
643
+ 170: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
644
+ 171: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
645
+ 172: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
646
+ 173: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
647
+ 174: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
648
+ 175: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
649
+ 176: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
650
+ 177: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
651
+ 178: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
652
+ 179: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
653
+ 180: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
654
+ 181: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
655
+ 182: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
656
+ 183: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
657
+ 184: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
658
+ 1000054e3: GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
659
+ 1000054001: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
660
+ 1000066e3: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
661
+ 1000066001: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
662
+ 1000066002: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
663
+ 1000066003: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
664
+ 1000066004: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
665
+ 1000066005: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
666
+ 1000066006: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
667
+ 1000066007: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
668
+ 1000066008: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
669
+ 1000066009: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
670
+ 1000066010: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
671
+ 1000066011: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
672
+ 1000066012: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
673
+ 1000066013: GL_COMPRESSED_RGBA_ASTC_12x12_KHR
385
674
  };
386
675
  function mapVkFormatToWebGL(vkFormat) {
387
676
  return VULKAN_TO_WEBGL_FORMAT_MAP[vkFormat];
388
677
  }
678
+ function mapVkFormatToTextureFormat(vkFormat) {
679
+ return getTextureFormatFromWebGLFormat(mapVkFormatToWebGL(vkFormat));
680
+ }
389
681
 
390
682
  // dist/lib/parsers/parse-ktx.js
391
683
  var KTX2_ID = [
@@ -425,84 +717,167 @@ function parseKTX(arrayBuffer) {
425
717
  const mipMapLevels = Math.max(1, ktx.levels.length);
426
718
  const width = ktx.pixelWidth;
427
719
  const height = ktx.pixelHeight;
428
- const internalFormat = mapVkFormatToWebGL(ktx.vkFormat);
720
+ const textureFormat = mapVkFormatToTextureFormat(ktx.vkFormat);
721
+ if (textureFormat === void 0) {
722
+ import_loader_utils2.log.warn(`KTX2 container vkFormat ${ktx.vkFormat} does not map to a known texture format; returning texture levels without format metadata.`)();
723
+ }
429
724
  return extractMipmapImages(ktx.levels, {
430
725
  mipMapLevels,
431
726
  width,
432
727
  height,
433
728
  sizeFunction: (level) => level.uncompressedByteLength,
434
- internalFormat
729
+ textureFormat
435
730
  });
436
731
  }
437
732
 
438
733
  // dist/lib/parsers/parse-basis.js
439
- var OutputFormat = {
734
+ var basisTranscodingLock = Promise.resolve();
735
+ var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
440
736
  etc1: {
441
737
  basisFormat: 0,
442
738
  compressed: true,
443
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL
739
+ format: GL_COMPRESSED_RGB_ETC1_WEBGL,
740
+ textureFormat: "etc1-rgb-unorm-webgl"
741
+ },
742
+ etc2: {
743
+ basisFormat: 1,
744
+ compressed: true,
745
+ format: GL_COMPRESSED_RGBA8_ETC2_EAC,
746
+ textureFormat: "etc2-rgba8unorm"
444
747
  },
445
- etc2: { basisFormat: 1, compressed: true },
446
748
  bc1: {
447
749
  basisFormat: 2,
448
750
  compressed: true,
449
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT
751
+ format: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
752
+ textureFormat: "bc1-rgb-unorm-webgl"
450
753
  },
451
754
  bc3: {
452
755
  basisFormat: 3,
453
756
  compressed: true,
454
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT
757
+ format: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
758
+ textureFormat: "bc3-rgba-unorm"
759
+ },
760
+ bc4: {
761
+ basisFormat: 4,
762
+ compressed: true,
763
+ format: GL_COMPRESSED_RED_RGTC1_EXT,
764
+ textureFormat: "bc4-r-unorm"
765
+ },
766
+ bc5: {
767
+ basisFormat: 5,
768
+ compressed: true,
769
+ format: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
770
+ textureFormat: "bc5-rg-unorm"
771
+ },
772
+ "bc7-m6-opaque-only": {
773
+ basisFormat: 6,
774
+ compressed: true,
775
+ format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
776
+ textureFormat: "bc7-rgba-unorm"
777
+ },
778
+ "bc7-m5": {
779
+ basisFormat: 7,
780
+ compressed: true,
781
+ format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
782
+ textureFormat: "bc7-rgba-unorm"
455
783
  },
456
- bc4: { basisFormat: 4, compressed: true },
457
- bc5: { basisFormat: 5, compressed: true },
458
- "bc7-m6-opaque-only": { basisFormat: 6, compressed: true },
459
- "bc7-m5": { basisFormat: 7, compressed: true },
460
784
  "pvrtc1-4-rgb": {
461
785
  basisFormat: 8,
462
786
  compressed: true,
463
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG
787
+ format: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
788
+ textureFormat: "pvrtc-rgb4unorm-webgl"
464
789
  },
465
790
  "pvrtc1-4-rgba": {
466
791
  basisFormat: 9,
467
792
  compressed: true,
468
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
793
+ format: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
794
+ textureFormat: "pvrtc-rgba4unorm-webgl"
469
795
  },
470
796
  "astc-4x4": {
471
797
  basisFormat: 10,
472
798
  compressed: true,
473
- format: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR
799
+ format: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
800
+ textureFormat: "astc-4x4-unorm"
474
801
  },
475
- "atc-rgb": { basisFormat: 11, compressed: true },
476
- "atc-rgba-interpolated-alpha": { basisFormat: 12, compressed: true },
477
- rgba32: { basisFormat: 13, compressed: false },
478
- rgb565: { basisFormat: 14, compressed: false },
479
- bgr565: { basisFormat: 15, compressed: false },
480
- rgba4444: { basisFormat: 16, compressed: false }
802
+ "atc-rgb": {
803
+ basisFormat: 11,
804
+ compressed: true,
805
+ format: GL_COMPRESSED_RGB_ATC_WEBGL,
806
+ textureFormat: "atc-rgb-unorm-webgl"
807
+ },
808
+ "atc-rgba-interpolated-alpha": {
809
+ basisFormat: 12,
810
+ compressed: true,
811
+ format: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
812
+ textureFormat: "atc-rgbai-unorm-webgl"
813
+ },
814
+ rgba32: {
815
+ basisFormat: 13,
816
+ compressed: false,
817
+ format: GL_RGBA8,
818
+ textureFormat: "rgba8unorm"
819
+ },
820
+ rgb565: {
821
+ basisFormat: 14,
822
+ compressed: false,
823
+ format: GL_RGB565,
824
+ textureFormat: "rgb565unorm-webgl"
825
+ },
826
+ bgr565: {
827
+ basisFormat: 15,
828
+ compressed: false,
829
+ format: GL_RGB565,
830
+ textureFormat: "rgb565unorm-webgl"
831
+ },
832
+ rgba4444: {
833
+ basisFormat: 16,
834
+ compressed: false,
835
+ format: GL_RGBA4,
836
+ textureFormat: "rgba4unorm-webgl"
837
+ }
481
838
  };
482
- async function parseBasis(data, options) {
483
- if (options.basis.containerFormat === "auto") {
484
- if (isKTX(data)) {
485
- const fileConstructors = await loadBasisEncoderModule(options);
486
- return parseKTX2File(fileConstructors.KTX2File, data, options);
487
- }
488
- const { BasisFile } = await loadBasisTranscoderModule(options);
489
- return parseBasisFile(BasisFile, data, options);
490
- }
491
- switch (options.basis.module) {
492
- case "encoder":
493
- const fileConstructors = await loadBasisEncoderModule(options);
494
- switch (options.basis.containerFormat) {
495
- case "ktx2":
496
- return parseKTX2File(fileConstructors.KTX2File, data, options);
497
- case "basis":
498
- default:
499
- return parseBasisFile(fileConstructors.BasisFile, data, options);
839
+ var BASIS_FORMATS = Object.freeze(Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS));
840
+ async function withBasisTranscodingLock(transcode) {
841
+ const previousLock = basisTranscodingLock;
842
+ let releaseLock;
843
+ basisTranscodingLock = new Promise((resolve) => {
844
+ releaseLock = resolve;
845
+ });
846
+ await previousLock;
847
+ try {
848
+ return await transcode();
849
+ } finally {
850
+ releaseLock();
851
+ }
852
+ }
853
+ async function parseBasis(data, options = {}) {
854
+ const loadLibraryOptions = (0, import_worker_utils2.extractLoadLibraryOptions)(options);
855
+ return await withBasisTranscodingLock(async () => {
856
+ var _a;
857
+ if (!((_a = options.basis) == null ? void 0 : _a.containerFormat) || options.basis.containerFormat === "auto") {
858
+ if (isKTX(data)) {
859
+ const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
860
+ return parseKTX2File(fileConstructors.KTX2File, data, options);
500
861
  }
501
- case "transcoder":
502
- default:
503
- const { BasisFile } = await loadBasisTranscoderModule(options);
862
+ const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
504
863
  return parseBasisFile(BasisFile, data, options);
505
- }
864
+ }
865
+ switch (options.basis.module) {
866
+ case "encoder":
867
+ const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
868
+ switch (options.basis.containerFormat) {
869
+ case "ktx2":
870
+ return parseKTX2File(fileConstructors.KTX2File, data, options);
871
+ case "basis":
872
+ default:
873
+ return parseBasisFile(fileConstructors.BasisFile, data, options);
874
+ }
875
+ case "transcoder":
876
+ default:
877
+ const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
878
+ return parseBasisFile(BasisFile, data, options);
879
+ }
880
+ });
506
881
  }
507
882
  function parseBasisFile(BasisFile, data, options) {
508
883
  const basisFile = new BasisFile(new Uint8Array(data));
@@ -532,7 +907,7 @@ function transcodeImage(basisFile, imageIndex, levelIndex, options) {
532
907
  const hasAlpha = basisFile.getHasAlpha(
533
908
  /* imageIndex, levelIndex */
534
909
  );
535
- const { compressed, format, basisFormat } = getBasisOptions(options, hasAlpha);
910
+ const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, hasAlpha);
536
911
  const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
537
912
  const decodedData = new Uint8Array(decodedSize);
538
913
  if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
@@ -540,11 +915,13 @@ function transcodeImage(basisFile, imageIndex, levelIndex, options) {
540
915
  }
541
916
  return {
542
917
  // standard loaders.gl image category payload
918
+ shape: "texture-level",
543
919
  width,
544
920
  height,
545
921
  data: decodedData,
546
922
  compressed,
547
- format,
923
+ ...format !== void 0 ? { format } : {},
924
+ ...textureFormat !== void 0 ? { textureFormat } : {},
548
925
  // Additional fields
549
926
  // Add levelSize field.
550
927
  hasAlpha
@@ -569,7 +946,7 @@ function parseKTX2File(KTX2File, data, options) {
569
946
  }
570
947
  function transcodeKTX2Image(ktx2File, levelIndex, options) {
571
948
  const { alphaFlag, height, width } = ktx2File.getImageLevelInfo(levelIndex, 0, 0);
572
- const { compressed, format, basisFormat } = getBasisOptions(options, alphaFlag);
949
+ const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, alphaFlag);
573
950
  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
574
951
  const decodedData = new Uint8Array(decodedSize);
575
952
  if (!ktx2File.transcodeImage(
@@ -587,48 +964,97 @@ function transcodeKTX2Image(ktx2File, levelIndex, options) {
587
964
  }
588
965
  return {
589
966
  // standard loaders.gl image category payload
967
+ shape: "texture-level",
590
968
  width,
591
969
  height,
592
970
  data: decodedData,
593
971
  compressed,
972
+ ...format !== void 0 ? { format } : {},
973
+ ...textureFormat !== void 0 ? { textureFormat } : {},
594
974
  // Additional fields
595
975
  levelSize: decodedSize,
596
- hasAlpha: alphaFlag,
597
- format
976
+ hasAlpha: alphaFlag
598
977
  };
599
978
  }
600
979
  function getBasisOptions(options, hasAlpha) {
601
- let format = options && options.basis && options.basis.format;
980
+ var _a, _b;
981
+ let format = ((_a = options.basis) == null ? void 0 : _a.format) || "auto";
602
982
  if (format === "auto") {
603
- format = selectSupportedBasisFormat();
983
+ format = ((_b = options.basis) == null ? void 0 : _b.supportedTextureFormats) ? selectSupportedBasisFormat(options.basis.supportedTextureFormats) : selectSupportedBasisFormat();
604
984
  }
605
985
  if (typeof format === "object") {
606
986
  format = hasAlpha ? format.alpha : format.noAlpha;
607
987
  }
608
- format = format.toLowerCase();
609
- return OutputFormat[format];
988
+ const normalizedFormat = format.toLowerCase();
989
+ const basisOutputOptions = BASIS_FORMAT_TO_OUTPUT_OPTIONS[normalizedFormat];
990
+ if (!basisOutputOptions) {
991
+ throw new Error(`Unknown Basis format ${format}`);
992
+ }
993
+ return basisOutputOptions;
610
994
  }
611
- function selectSupportedBasisFormat() {
612
- const supportedFormats = getSupportedGPUTextureFormats();
613
- if (supportedFormats.has("astc")) {
995
+ function selectSupportedBasisFormat(supportedTextureFormats = detectSupportedTextureFormats()) {
996
+ const textureFormats2 = new Set(supportedTextureFormats);
997
+ if (hasSupportedTextureFormat(textureFormats2, ["astc-4x4-unorm", "astc-4x4-unorm-srgb"])) {
614
998
  return "astc-4x4";
615
- } else if (supportedFormats.has("dxt")) {
999
+ } else if (hasSupportedTextureFormat(textureFormats2, ["bc7-rgba-unorm", "bc7-rgba-unorm-srgb"])) {
1000
+ return {
1001
+ alpha: "bc7-m5",
1002
+ noAlpha: "bc7-m6-opaque-only"
1003
+ };
1004
+ } else if (hasSupportedTextureFormat(textureFormats2, [
1005
+ "bc1-rgb-unorm-webgl",
1006
+ "bc1-rgb-unorm-srgb-webgl",
1007
+ "bc1-rgba-unorm",
1008
+ "bc1-rgba-unorm-srgb",
1009
+ "bc2-rgba-unorm",
1010
+ "bc2-rgba-unorm-srgb",
1011
+ "bc3-rgba-unorm",
1012
+ "bc3-rgba-unorm-srgb"
1013
+ ])) {
616
1014
  return {
617
1015
  alpha: "bc3",
618
1016
  noAlpha: "bc1"
619
1017
  };
620
- } else if (supportedFormats.has("pvrtc")) {
1018
+ } else if (hasSupportedTextureFormat(textureFormats2, [
1019
+ "pvrtc-rgb4unorm-webgl",
1020
+ "pvrtc-rgba4unorm-webgl",
1021
+ "pvrtc-rgb2unorm-webgl",
1022
+ "pvrtc-rgba2unorm-webgl"
1023
+ ])) {
621
1024
  return {
622
1025
  alpha: "pvrtc1-4-rgba",
623
1026
  noAlpha: "pvrtc1-4-rgb"
624
1027
  };
625
- } else if (supportedFormats.has("etc1")) {
626
- return "etc1";
627
- } else if (supportedFormats.has("etc2")) {
1028
+ } else if (hasSupportedTextureFormat(textureFormats2, [
1029
+ "etc2-rgb8unorm",
1030
+ "etc2-rgb8unorm-srgb",
1031
+ "etc2-rgb8a1unorm",
1032
+ "etc2-rgb8a1unorm-srgb",
1033
+ "etc2-rgba8unorm",
1034
+ "etc2-rgba8unorm-srgb",
1035
+ "eac-r11unorm",
1036
+ "eac-r11snorm",
1037
+ "eac-rg11unorm",
1038
+ "eac-rg11snorm"
1039
+ ])) {
628
1040
  return "etc2";
1041
+ } else if (textureFormats2.has("etc1-rgb-unorm-webgl")) {
1042
+ return "etc1";
1043
+ } else if (hasSupportedTextureFormat(textureFormats2, [
1044
+ "atc-rgb-unorm-webgl",
1045
+ "atc-rgba-unorm-webgl",
1046
+ "atc-rgbai-unorm-webgl"
1047
+ ])) {
1048
+ return {
1049
+ alpha: "atc-rgba-interpolated-alpha",
1050
+ noAlpha: "atc-rgb"
1051
+ };
629
1052
  }
630
1053
  return "rgb565";
631
1054
  }
1055
+ function hasSupportedTextureFormat(supportedTextureFormats, candidateTextureFormats) {
1056
+ return candidateTextureFormats.some((textureFormat) => supportedTextureFormats.has(textureFormat));
1057
+ }
632
1058
 
633
1059
  // dist/basis-loader.js
634
1060
  var BasisWorkerLoader = {
@@ -646,7 +1072,6 @@ var BasisWorkerLoader = {
646
1072
  options: {
647
1073
  basis: {
648
1074
  format: "auto",
649
- libraryPath: "libs/",
650
1075
  containerFormat: "auto",
651
1076
  module: "transcoder"
652
1077
  }
@@ -658,7 +1083,7 @@ var BasisLoader = {
658
1083
  };
659
1084
 
660
1085
  // dist/lib/parsers/parse-dds.js
661
- var import_loader_utils2 = require("@loaders.gl/loader-utils");
1086
+ var import_loader_utils3 = require("@loaders.gl/loader-utils");
662
1087
  var DDS_CONSTANTS = {
663
1088
  MAGIC_NUMBER: 542327876,
664
1089
  HEADER_LENGTH: 31,
@@ -673,13 +1098,13 @@ var DDS_CONSTANTS = {
673
1098
  DDSD_MIPMAPCOUNT: 131072,
674
1099
  DDPF_FOURCC: 4
675
1100
  };
676
- var DDS_PIXEL_FORMATS = {
677
- DXT1: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT,
678
- DXT3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT,
679
- DXT5: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
680
- "ATC ": GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ATC_WEBGL,
681
- ATCA: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
682
- ATCI: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL
1101
+ var DDS_TEXTURE_FORMATS = {
1102
+ DXT1: "bc1-rgb-unorm-webgl",
1103
+ DXT3: "bc2-rgba-unorm",
1104
+ DXT5: "bc3-rgba-unorm",
1105
+ "ATC ": "atc-rgb-unorm-webgl",
1106
+ ATCA: "atc-rgba-unorm-webgl",
1107
+ ATCI: "atc-rgbai-unorm-webgl"
683
1108
  };
684
1109
  var getATCLevelSize = getDxt1LevelSize;
685
1110
  var getATCALevelSize = getDxtXLevelSize;
@@ -700,11 +1125,11 @@ function isDDS(data) {
700
1125
  function parseDDS(data) {
701
1126
  const header = new Int32Array(data, 0, DDS_CONSTANTS.HEADER_LENGTH);
702
1127
  const pixelFormatNumber = header[DDS_CONSTANTS.HEADER_PF_FOURCC_INDEX];
703
- (0, import_loader_utils2.assert)(Boolean(header[DDS_CONSTANTS.HEADER_PF_FLAGS_INDEX] & DDS_CONSTANTS.DDPF_FOURCC), "DDS: Unsupported format, must contain a FourCC code");
1128
+ (0, import_loader_utils3.assert)(Boolean(header[DDS_CONSTANTS.HEADER_PF_FLAGS_INDEX] & DDS_CONSTANTS.DDPF_FOURCC), "DDS: Unsupported format, must contain a FourCC code");
704
1129
  const fourCC = int32ToFourCC(pixelFormatNumber);
705
- const internalFormat = DDS_PIXEL_FORMATS[fourCC];
1130
+ const textureFormat = DDS_TEXTURE_FORMATS[fourCC];
706
1131
  const sizeFunction = DDS_SIZE_FUNCTIONS[fourCC];
707
- (0, import_loader_utils2.assert)(internalFormat && sizeFunction, `DDS: Unknown pixel format ${pixelFormatNumber}`);
1132
+ (0, import_loader_utils3.assert)(textureFormat && sizeFunction, `DDS: Unknown pixel format ${pixelFormatNumber}`);
708
1133
  let mipMapLevels = 1;
709
1134
  if (header[DDS_CONSTANTS.HEADER_FLAGS_INDEX] & DDS_CONSTANTS.DDSD_MIPMAPCOUNT) {
710
1135
  mipMapLevels = Math.max(1, header[DDS_CONSTANTS.MIPMAPCOUNT_INDEX]);
@@ -718,7 +1143,7 @@ function parseDDS(data) {
718
1143
  width,
719
1144
  height,
720
1145
  sizeFunction,
721
- internalFormat
1146
+ textureFormat
722
1147
  });
723
1148
  }
724
1149
  function getDxt1LevelSize(width, height) {
@@ -745,76 +1170,34 @@ var PVR_CONSTANTS = {
745
1170
  MIPMAPCOUNT_INDEX: 11,
746
1171
  METADATA_SIZE_INDEX: 12
747
1172
  };
748
- var PVR_PIXEL_FORMATS = {
749
- 0: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],
750
- 1: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],
751
- 2: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],
752
- 3: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],
753
- 6: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL],
754
- 7: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT],
755
- 9: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT],
756
- 11: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT],
757
- 22: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_ETC2],
758
- 23: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA8_ETC2_EAC],
759
- 24: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],
760
- 25: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_R11_EAC],
761
- 26: [GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC],
762
- 27: [
763
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR,
764
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR
765
- ],
766
- 28: [
767
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5X4_KHR,
768
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR
769
- ],
770
- 29: [
771
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5X5_KHR,
772
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR
773
- ],
774
- 30: [
775
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6X5_KHR,
776
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR
777
- ],
778
- 31: [
779
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6X6_KHR,
780
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR
781
- ],
782
- 32: [
783
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X5_KHR,
784
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR
785
- ],
786
- 33: [
787
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X6_KHR,
788
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR
789
- ],
790
- 34: [
791
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X8_KHR,
792
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR
793
- ],
794
- 35: [
795
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X5_KHR,
796
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR
797
- ],
798
- 36: [
799
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X6_KHR,
800
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR
801
- ],
802
- 37: [
803
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X8_KHR,
804
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR
805
- ],
806
- 38: [
807
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X10_KHR,
808
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR
809
- ],
810
- 39: [
811
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X10_KHR,
812
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR
813
- ],
814
- 40: [
815
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X12_KHR,
816
- GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR
817
- ]
1173
+ var PVR_TEXTURE_FORMATS = {
1174
+ 0: ["pvrtc-rgb2unorm-webgl"],
1175
+ 1: ["pvrtc-rgba2unorm-webgl"],
1176
+ 2: ["pvrtc-rgb4unorm-webgl"],
1177
+ 3: ["pvrtc-rgba4unorm-webgl"],
1178
+ 6: ["etc1-rgb-unorm-webgl"],
1179
+ 7: ["bc1-rgb-unorm-webgl"],
1180
+ 9: ["bc2-rgba-unorm"],
1181
+ 11: ["bc3-rgba-unorm"],
1182
+ 22: ["etc2-rgb8unorm"],
1183
+ 23: ["etc2-rgba8unorm"],
1184
+ 24: ["etc2-rgb8a1unorm"],
1185
+ 25: ["eac-r11unorm"],
1186
+ 26: ["eac-rg11unorm"],
1187
+ 27: ["astc-4x4-unorm", "astc-4x4-unorm-srgb"],
1188
+ 28: ["astc-5x4-unorm", "astc-5x4-unorm-srgb"],
1189
+ 29: ["astc-5x5-unorm", "astc-5x5-unorm-srgb"],
1190
+ 30: ["astc-6x5-unorm", "astc-6x5-unorm-srgb"],
1191
+ 31: ["astc-6x6-unorm", "astc-6x6-unorm-srgb"],
1192
+ 32: ["astc-8x5-unorm", "astc-8x5-unorm-srgb"],
1193
+ 33: ["astc-8x6-unorm", "astc-8x6-unorm-srgb"],
1194
+ 34: ["astc-8x8-unorm", "astc-8x8-unorm-srgb"],
1195
+ 35: ["astc-10x5-unorm", "astc-10x5-unorm-srgb"],
1196
+ 36: ["astc-10x6-unorm", "astc-10x6-unorm-srgb"],
1197
+ 37: ["astc-10x8-unorm", "astc-10x8-unorm-srgb"],
1198
+ 38: ["astc-10x10-unorm", "astc-10x10-unorm-srgb"],
1199
+ 39: ["astc-12x10-unorm", "astc-12x10-unorm-srgb"],
1200
+ 40: ["astc-12x12-unorm", "astc-12x12-unorm-srgb"]
818
1201
  };
819
1202
  var PVR_SIZE_FUNCTIONS = {
820
1203
  0: pvrtc2bppSize,
@@ -854,8 +1237,8 @@ function parsePVR(data) {
854
1237
  const header = new Uint32Array(data, 0, PVR_CONSTANTS.HEADER_LENGTH);
855
1238
  const pvrFormat = header[PVR_CONSTANTS.PIXEL_FORMAT_INDEX];
856
1239
  const colourSpace = header[PVR_CONSTANTS.COLOUR_SPACE_INDEX];
857
- const pixelFormats = PVR_PIXEL_FORMATS[pvrFormat] || [];
858
- const internalFormat = pixelFormats.length > 1 && colourSpace ? pixelFormats[1] : pixelFormats[0];
1240
+ const textureFormats2 = PVR_TEXTURE_FORMATS[pvrFormat] || [];
1241
+ const textureFormat = textureFormats2.length > 1 && colourSpace ? textureFormats2[1] : textureFormats2[0];
859
1242
  const sizeFunction = PVR_SIZE_FUNCTIONS[pvrFormat];
860
1243
  const mipMapLevels = header[PVR_CONSTANTS.MIPMAPCOUNT_INDEX];
861
1244
  const width = header[PVR_CONSTANTS.WIDTH_INDEX];
@@ -867,7 +1250,7 @@ function parsePVR(data) {
867
1250
  width,
868
1251
  height,
869
1252
  sizeFunction,
870
- internalFormat
1253
+ textureFormat
871
1254
  });
872
1255
  }
873
1256
  function pvrtc2bppSize(width, height) {
@@ -967,7 +1350,6 @@ var CompressedTextureWorkerLoader = {
967
1350
  binary: true,
968
1351
  options: {
969
1352
  "compressed-texture": {
970
- libraryPath: "libs/",
971
1353
  useBasis: false
972
1354
  }
973
1355
  }
@@ -976,13 +1358,13 @@ var CompressedTextureLoader = {
976
1358
  ...CompressedTextureWorkerLoader,
977
1359
  parse: async (arrayBuffer, options) => {
978
1360
  var _a;
1361
+ options = { ...options };
979
1362
  if ((_a = options == null ? void 0 : options["compressed-texture"]) == null ? void 0 : _a.useBasis) {
980
1363
  options.basis = {
981
1364
  format: {
982
1365
  alpha: "BC3",
983
1366
  noAlpha: "BC1"
984
1367
  },
985
- // @ts-expect-error TODO not allowed to modify inputs
986
1368
  ...options.basis,
987
1369
  containerFormat: "ktx2",
988
1370
  module: "encoder"
@@ -1007,10 +1389,326 @@ var CrunchLoader = {
1007
1389
  mimeTypes: ["image/crn", "image/x-crn", "application/octet-stream"],
1008
1390
  binary: true,
1009
1391
  options: {
1010
- crunch: {
1011
- libraryPath: "libs/"
1392
+ crunch: {}
1393
+ }
1394
+ };
1395
+
1396
+ // dist/lib/parsers/parse-hdr.js
1397
+ var HDR_MAGIC_HEADERS = ["#?RADIANCE", "#?RGBE"];
1398
+ var HDR_FORMAT = "32-bit_rle_rgbe";
1399
+ function isHDR(arrayBuffer) {
1400
+ const state = {
1401
+ data: new Uint8Array(arrayBuffer),
1402
+ offset: 0
1403
+ };
1404
+ const firstLine = readLine(state);
1405
+ return firstLine ? HDR_MAGIC_HEADERS.includes(firstLine) : false;
1406
+ }
1407
+ function parseHDR(arrayBuffer) {
1408
+ const state = {
1409
+ data: new Uint8Array(arrayBuffer),
1410
+ offset: 0
1411
+ };
1412
+ const header = readHeader(state);
1413
+ const { width, height } = header;
1414
+ const rgbeData = readPixels(state, header);
1415
+ const data = convertRGBEToFloat(rgbeData);
1416
+ const level = {
1417
+ shape: "texture-level",
1418
+ compressed: false,
1419
+ width,
1420
+ height,
1421
+ data,
1422
+ levelSize: data.byteLength,
1423
+ format: GL_RGBA32F,
1424
+ textureFormat: "rgba32float"
1425
+ };
1426
+ return {
1427
+ shape: "texture",
1428
+ type: "2d",
1429
+ format: "rgba32float",
1430
+ ...header.metadata ? { metadata: header.metadata } : {},
1431
+ data: [level]
1432
+ };
1433
+ }
1434
+ function readHeader(state) {
1435
+ const magicHeader = readLine(state);
1436
+ if (!magicHeader || !HDR_MAGIC_HEADERS.includes(magicHeader)) {
1437
+ throw new Error("RadianceHDRLoader: bad initial token");
1438
+ }
1439
+ let hasFormat = false;
1440
+ const metadata = {};
1441
+ while (state.offset < state.data.length) {
1442
+ const line = readLine(state);
1443
+ if (line === null) {
1444
+ break;
1445
+ }
1446
+ if (!line || line.startsWith("#")) {
1447
+ continue;
1448
+ }
1449
+ if (line.startsWith("FORMAT=")) {
1450
+ hasFormat = line.slice("FORMAT=".length) === HDR_FORMAT;
1451
+ if (!hasFormat) {
1452
+ throw new Error("RadianceHDRLoader: unsupported format specifier");
1453
+ }
1454
+ continue;
1012
1455
  }
1456
+ parseMetadataLine(metadata, line);
1457
+ const dimensions = parseDimensions(line);
1458
+ if (dimensions) {
1459
+ if (!hasFormat) {
1460
+ throw new Error("RadianceHDRLoader: missing format specifier");
1461
+ }
1462
+ return {
1463
+ ...dimensions,
1464
+ ...hasMetadata(metadata) ? { metadata } : {}
1465
+ };
1466
+ }
1467
+ }
1468
+ if (!hasFormat) {
1469
+ throw new Error("RadianceHDRLoader: missing format specifier");
1470
+ }
1471
+ throw new Error("RadianceHDRLoader: missing image size specifier");
1472
+ }
1473
+ function parseDimensions(line) {
1474
+ const match = line.match(/^([+-])([YX])\s+(\d+)\s+([+-])([YX])\s+(\d+)$/);
1475
+ if (!match) {
1476
+ return null;
1477
+ }
1478
+ const majorSign = match[1] === "+" ? 1 : -1;
1479
+ const majorAxis = match[2];
1480
+ const majorLength = Number(match[3]);
1481
+ const minorSign = match[4] === "+" ? 1 : -1;
1482
+ const minorAxis = match[5];
1483
+ const minorLength = Number(match[6]);
1484
+ if (majorAxis === minorAxis) {
1485
+ throw new Error("RadianceHDRLoader: invalid image dimensions");
1486
+ }
1487
+ const width = majorAxis === "X" ? majorLength : minorLength;
1488
+ const height = majorAxis === "Y" ? majorLength : minorLength;
1489
+ if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {
1490
+ throw new Error("RadianceHDRLoader: invalid image dimensions");
1491
+ }
1492
+ return { width, height, majorAxis, majorSign, minorAxis, minorSign };
1493
+ }
1494
+ function readPixels(state, header) {
1495
+ const { width, height } = header;
1496
+ const pixelCount = width * height;
1497
+ const flatByteLength = pixelCount * 4;
1498
+ const scanlineLength = header.minorAxis === "X" ? width : height;
1499
+ const scanlineCount = header.majorAxis === "Y" ? height : width;
1500
+ if (scanlineLength < 8 || scanlineLength > 32767) {
1501
+ return reorderPixels(readFlatPixels(state, flatByteLength), header);
1502
+ }
1503
+ if (state.offset + 4 > state.data.length) {
1504
+ throw new Error("RadianceHDRLoader: unexpected end of file");
1505
+ }
1506
+ const data = state.data;
1507
+ const isRunLengthEncoded = data[state.offset] === 2 && data[state.offset + 1] === 2 && !(data[state.offset + 2] & 128);
1508
+ if (!isRunLengthEncoded) {
1509
+ return reorderPixels(readFlatPixels(state, flatByteLength), header);
1510
+ }
1511
+ const scanlineWidth = data[state.offset + 2] << 8 | data[state.offset + 3];
1512
+ if (scanlineWidth !== scanlineLength) {
1513
+ return reorderPixels(readFlatPixels(state, flatByteLength), header);
1013
1514
  }
1515
+ const pixels = new Uint8Array(flatByteLength);
1516
+ const scanlineBuffer = new Uint8Array(scanlineLength * 4);
1517
+ for (let scanlineIndex = 0; scanlineIndex < scanlineCount; scanlineIndex++) {
1518
+ if (state.offset + 4 > data.length) {
1519
+ throw new Error("RadianceHDRLoader: unexpected end of file");
1520
+ }
1521
+ const red = data[state.offset++];
1522
+ const green = data[state.offset++];
1523
+ const blue = data[state.offset++];
1524
+ const exponent = data[state.offset++];
1525
+ if (red !== 2 || green !== 2 || (blue << 8 | exponent) !== scanlineLength) {
1526
+ throw new Error("RadianceHDRLoader: bad rgbe scanline format");
1527
+ }
1528
+ for (let channelIndex = 0; channelIndex < 4; channelIndex++) {
1529
+ const channelOffset = channelIndex * scanlineLength;
1530
+ const channelEnd = channelOffset + scanlineLength;
1531
+ let pixelOffset = channelOffset;
1532
+ while (pixelOffset < channelEnd) {
1533
+ if (state.offset >= data.length) {
1534
+ throw new Error("RadianceHDRLoader: unexpected end of file");
1535
+ }
1536
+ let count = data[state.offset++];
1537
+ if (count > 128) {
1538
+ count -= 128;
1539
+ if (count === 0 || pixelOffset + count > channelEnd || state.offset >= data.length) {
1540
+ throw new Error("RadianceHDRLoader: bad scanline data");
1541
+ }
1542
+ const value = data[state.offset++];
1543
+ scanlineBuffer.fill(value, pixelOffset, pixelOffset + count);
1544
+ pixelOffset += count;
1545
+ continue;
1546
+ }
1547
+ if (count === 0 || pixelOffset + count > channelEnd || state.offset + count > data.length) {
1548
+ throw new Error("RadianceHDRLoader: bad scanline data");
1549
+ }
1550
+ scanlineBuffer.set(data.subarray(state.offset, state.offset + count), pixelOffset);
1551
+ pixelOffset += count;
1552
+ state.offset += count;
1553
+ }
1554
+ }
1555
+ for (let pixelIndex = 0; pixelIndex < scanlineLength; pixelIndex++) {
1556
+ const outputOffset = getOutputOffset(header, scanlineIndex, pixelIndex);
1557
+ pixels[outputOffset] = scanlineBuffer[pixelIndex];
1558
+ pixels[outputOffset + 1] = scanlineBuffer[pixelIndex + scanlineLength];
1559
+ pixels[outputOffset + 2] = scanlineBuffer[pixelIndex + scanlineLength * 2];
1560
+ pixels[outputOffset + 3] = scanlineBuffer[pixelIndex + scanlineLength * 3];
1561
+ }
1562
+ }
1563
+ return pixels;
1564
+ }
1565
+ function reorderPixels(data, header) {
1566
+ const pixels = new Uint8Array(data.length);
1567
+ const scanlineLength = header.minorAxis === "X" ? header.width : header.height;
1568
+ const scanlineCount = header.majorAxis === "Y" ? header.height : header.width;
1569
+ for (let scanlineIndex = 0; scanlineIndex < scanlineCount; scanlineIndex++) {
1570
+ for (let pixelIndex = 0; pixelIndex < scanlineLength; pixelIndex++) {
1571
+ const sourceOffset = (scanlineIndex * scanlineLength + pixelIndex) * 4;
1572
+ const outputOffset = getOutputOffset(header, scanlineIndex, pixelIndex);
1573
+ pixels[outputOffset] = data[sourceOffset];
1574
+ pixels[outputOffset + 1] = data[sourceOffset + 1];
1575
+ pixels[outputOffset + 2] = data[sourceOffset + 2];
1576
+ pixels[outputOffset + 3] = data[sourceOffset + 3];
1577
+ }
1578
+ }
1579
+ return pixels;
1580
+ }
1581
+ function getOutputOffset(header, scanlineIndex, pixelIndex) {
1582
+ const majorCoordinate = getCoordinate(header.majorAxis === "X" ? header.width : header.height, header.majorSign, scanlineIndex);
1583
+ const minorCoordinate = getCoordinate(header.minorAxis === "X" ? header.width : header.height, header.minorSign, pixelIndex);
1584
+ const x = header.majorAxis === "X" ? majorCoordinate : minorCoordinate;
1585
+ const y = header.majorAxis === "Y" ? majorCoordinate : minorCoordinate;
1586
+ return ((header.height - 1 - y) * header.width + x) * 4;
1587
+ }
1588
+ function getCoordinate(length, sign, index) {
1589
+ return sign === 1 ? index : length - 1 - index;
1590
+ }
1591
+ function readFlatPixels(state, byteLength) {
1592
+ if (state.offset + byteLength > state.data.length) {
1593
+ throw new Error("RadianceHDRLoader: unexpected end of file");
1594
+ }
1595
+ const pixels = state.data.slice(state.offset, state.offset + byteLength);
1596
+ state.offset += byteLength;
1597
+ return pixels;
1598
+ }
1599
+ function convertRGBEToFloat(data) {
1600
+ const floatData = new Float32Array(data.length);
1601
+ for (let sourceOffset = 0; sourceOffset < data.length; sourceOffset += 4) {
1602
+ const exponent = data[sourceOffset + 3];
1603
+ const destinationOffset = sourceOffset;
1604
+ if (exponent > 0) {
1605
+ const scale = Math.pow(2, exponent - 128) / 255;
1606
+ floatData[destinationOffset] = data[sourceOffset] * scale;
1607
+ floatData[destinationOffset + 1] = data[sourceOffset + 1] * scale;
1608
+ floatData[destinationOffset + 2] = data[sourceOffset + 2] * scale;
1609
+ }
1610
+ floatData[destinationOffset + 3] = 1;
1611
+ }
1612
+ return floatData;
1613
+ }
1614
+ function readLine(state) {
1615
+ if (state.offset >= state.data.length) {
1616
+ return null;
1617
+ }
1618
+ const lineStart = state.offset;
1619
+ while (state.offset < state.data.length) {
1620
+ const byte = state.data[state.offset++];
1621
+ if (byte === 10) {
1622
+ const line2 = decodeASCII(state.data.subarray(lineStart, state.offset - 1));
1623
+ return line2.endsWith("\r") ? line2.slice(0, -1) : line2;
1624
+ }
1625
+ }
1626
+ const line = decodeASCII(state.data.subarray(lineStart, state.offset));
1627
+ return line.endsWith("\r") ? line.slice(0, -1) : line;
1628
+ }
1629
+ function decodeASCII(data) {
1630
+ let line = "";
1631
+ for (const byte of data) {
1632
+ line += String.fromCharCode(byte);
1633
+ }
1634
+ return line;
1635
+ }
1636
+ function parseMetadataLine(metadata, line) {
1637
+ if (line.startsWith("COLORCORR=")) {
1638
+ const values = parseNumberList(line.slice("COLORCORR=".length), 3);
1639
+ if (values) {
1640
+ metadata.colorCorrection = values;
1641
+ }
1642
+ return;
1643
+ }
1644
+ if (line.startsWith("EXPOSURE=")) {
1645
+ const value = parseNumber(line.slice("EXPOSURE=".length));
1646
+ if (value !== null) {
1647
+ metadata.exposure = value;
1648
+ }
1649
+ return;
1650
+ }
1651
+ if (line.startsWith("GAMMA=")) {
1652
+ const value = parseNumber(line.slice("GAMMA=".length));
1653
+ if (value !== null) {
1654
+ metadata.gamma = value;
1655
+ }
1656
+ return;
1657
+ }
1658
+ if (line.startsWith("PIXASPECT=")) {
1659
+ const value = parseNumber(line.slice("PIXASPECT=".length));
1660
+ if (value !== null) {
1661
+ metadata.pixelAspectRatio = value;
1662
+ }
1663
+ return;
1664
+ }
1665
+ if (line.startsWith("PRIMARIES=")) {
1666
+ const values = parseNumberList(line.slice("PRIMARIES=".length), 8);
1667
+ if (values) {
1668
+ metadata.primaries = values;
1669
+ }
1670
+ return;
1671
+ }
1672
+ if (line.startsWith("SOFTWARE=")) {
1673
+ metadata.software = line.slice("SOFTWARE=".length).trim();
1674
+ return;
1675
+ }
1676
+ if (line.startsWith("VIEW=")) {
1677
+ metadata.view = line.slice("VIEW=".length).trim();
1678
+ }
1679
+ }
1680
+ function parseNumber(text) {
1681
+ const value = Number(text.trim());
1682
+ return Number.isFinite(value) ? value : null;
1683
+ }
1684
+ function parseNumberList(text, count) {
1685
+ const values = text.trim().split(/\s+/).map((value) => Number(value));
1686
+ if (values.length !== count || values.some((value) => !Number.isFinite(value))) {
1687
+ return null;
1688
+ }
1689
+ return values;
1690
+ }
1691
+ function hasMetadata(metadata) {
1692
+ return Object.keys(metadata).length > 0;
1693
+ }
1694
+
1695
+ // dist/radiance-hdr-loader.js
1696
+ var RadianceHDRLoader = {
1697
+ dataType: null,
1698
+ batchType: null,
1699
+ name: "Radiance HDR",
1700
+ id: "hdr",
1701
+ module: "textures",
1702
+ version: VERSION,
1703
+ extensions: ["hdr"],
1704
+ mimeTypes: ["image/vnd.radiance", "image/x-hdr", "application/octet-stream"],
1705
+ binary: true,
1706
+ tests: [isHDR],
1707
+ options: {
1708
+ hdr: {}
1709
+ },
1710
+ parseSync: parseHDR,
1711
+ parse: async (arrayBuffer) => parseHDR(arrayBuffer)
1014
1712
  };
1015
1713
 
1016
1714
  // dist/lib/parsers/parse-npy.js
@@ -1094,16 +1792,597 @@ var NPYLoader = {
1094
1792
  parse: async (arrayBuffer, options) => parseNPY(arrayBuffer, options)
1095
1793
  };
1096
1794
 
1795
+ // dist/lib/composite-image/parse-composite-image.js
1796
+ var import_loader_utils4 = require("@loaders.gl/loader-utils");
1797
+ var import_images = require("@loaders.gl/images");
1798
+
1799
+ // dist/lib/texture-api/async-deep-map.js
1800
+ var isObject = (value) => value && typeof value === "object";
1801
+ async function asyncDeepMap(tree, func, options = {}) {
1802
+ return await mapSubtree(tree, func, options);
1803
+ }
1804
+ async function mapSubtree(object, func, options) {
1805
+ if (Array.isArray(object)) {
1806
+ return await mapArray(object, func, options);
1807
+ }
1808
+ if (isObject(object)) {
1809
+ return await mapObject(object, func, options);
1810
+ }
1811
+ const url = object;
1812
+ return await func(url, options);
1813
+ }
1814
+ async function mapObject(object, func, options) {
1815
+ const promises = [];
1816
+ const values = {};
1817
+ for (const key in object) {
1818
+ const url = object[key];
1819
+ const promise = mapSubtree(url, func, options).then((value) => {
1820
+ values[key] = value;
1821
+ });
1822
+ promises.push(promise);
1823
+ }
1824
+ await Promise.all(promises);
1825
+ return values;
1826
+ }
1827
+ async function mapArray(urlArray, func, options = {}) {
1828
+ const promises = urlArray.map((url) => mapSubtree(url, func, options));
1829
+ return await Promise.all(promises);
1830
+ }
1831
+
1832
+ // dist/lib/composite-image/image-texture-cube.js
1833
+ var GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069;
1834
+ var GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070;
1835
+ var GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071;
1836
+ var GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072;
1837
+ var GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073;
1838
+ var GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074;
1839
+ var IMAGE_TEXTURE_CUBE_FACES = [
1840
+ {
1841
+ face: GL_TEXTURE_CUBE_MAP_POSITIVE_X,
1842
+ name: "+X",
1843
+ direction: "right",
1844
+ axis: "x",
1845
+ sign: "positive"
1846
+ },
1847
+ {
1848
+ face: GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
1849
+ name: "-X",
1850
+ direction: "left",
1851
+ axis: "x",
1852
+ sign: "negative"
1853
+ },
1854
+ { face: GL_TEXTURE_CUBE_MAP_POSITIVE_Y, name: "+Y", direction: "top", axis: "y", sign: "positive" },
1855
+ {
1856
+ face: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
1857
+ name: "-Y",
1858
+ direction: "bottom",
1859
+ axis: "y",
1860
+ sign: "negative"
1861
+ },
1862
+ {
1863
+ face: GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
1864
+ name: "+Z",
1865
+ direction: "front",
1866
+ axis: "z",
1867
+ sign: "positive"
1868
+ },
1869
+ { face: GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, name: "-Z", direction: "back", axis: "z", sign: "negative" }
1870
+ ];
1871
+
1872
+ // dist/lib/composite-image/parse-composite-image.js
1873
+ async function parseCompositeImageManifest(text, expectedShape, options = {}, context) {
1874
+ const manifest = parseCompositeImageManifestJSON(text);
1875
+ if (manifest.shape !== expectedShape) {
1876
+ throw new Error(`Expected ${expectedShape} manifest, got ${manifest.shape}`);
1877
+ }
1878
+ return await loadCompositeImageManifest(manifest, options, context);
1879
+ }
1880
+ function testCompositeImageManifestShape(text, shape) {
1881
+ try {
1882
+ return parseCompositeImageManifestJSON(text).shape === shape;
1883
+ } catch {
1884
+ return false;
1885
+ }
1886
+ }
1887
+ async function loadCompositeImageManifest(manifest, options = {}, context) {
1888
+ const normalizedOptions = normalizeCompositeImageManifestOptions(options);
1889
+ const urlTree = await getCompositeImageUrlTree(manifest, normalizedOptions, context);
1890
+ const imageData = await loadCompositeImageUrlTree(urlTree, normalizedOptions, context);
1891
+ return convertCompositeImageToTexture(manifest.shape, imageData);
1892
+ }
1893
+ async function loadCompositeImageUrlTree(urlTree, options = {}, context) {
1894
+ const normalizedOptions = normalizeCompositeImageOptions(options);
1895
+ return await asyncDeepMap(urlTree, async (url) => await loadCompositeImageMember(url, normalizedOptions, context));
1896
+ }
1897
+ async function loadCompositeImageMember(url, options = {}, context) {
1898
+ const resolvedUrl = resolveCompositeImageUrl(url, options, context);
1899
+ const fetch2 = getCompositeImageFetch(options, context);
1900
+ const response = await fetch2(resolvedUrl);
1901
+ const subloaderOptions = getCompositeImageSubloaderOptions(options);
1902
+ if (context) {
1903
+ const childContext = getCompositeImageMemberContext(resolvedUrl, response, context);
1904
+ return await (0, import_loader_utils4.parseFromContext)(response, [import_images.ImageLoader], subloaderOptions, childContext);
1905
+ }
1906
+ const arrayBuffer = await response.arrayBuffer();
1907
+ return await import_images.ImageLoader.parse(arrayBuffer, subloaderOptions);
1908
+ }
1909
+ async function getCompositeImageUrlTree(manifest, options = {}, context) {
1910
+ switch (manifest.shape) {
1911
+ case "image-texture":
1912
+ return await getImageTextureSource(manifest, options, context);
1913
+ case "image-texture-array":
1914
+ if (!Array.isArray(manifest.layers) || manifest.layers.length === 0) {
1915
+ throw new Error("image-texture-array manifest must define one or more layers");
1916
+ }
1917
+ return await Promise.all(manifest.layers.map(async (layer, index) => await getNormalizedImageTextureSource(layer, options, context, { index })));
1918
+ case "image-texture-cube":
1919
+ return await getImageTextureCubeUrls(manifest, options, context);
1920
+ case "image-texture-cube-array":
1921
+ if (!Array.isArray(manifest.layers) || manifest.layers.length === 0) {
1922
+ throw new Error("image-texture-cube-array manifest must define one or more layers");
1923
+ }
1924
+ return await Promise.all(manifest.layers.map(async (layer, index) => await getImageTextureCubeUrls(layer, options, context, { index })));
1925
+ default:
1926
+ throw new Error("Unsupported composite image manifest");
1927
+ }
1928
+ }
1929
+ function normalizeCompositeImageOptions(options = {}) {
1930
+ var _a;
1931
+ if ((_a = options.core) == null ? void 0 : _a.baseUrl) {
1932
+ return options;
1933
+ }
1934
+ const fallbackBaseUrl = options.baseUrl;
1935
+ if (!fallbackBaseUrl) {
1936
+ return options;
1937
+ }
1938
+ return {
1939
+ ...options,
1940
+ core: {
1941
+ ...options.core,
1942
+ baseUrl: fallbackBaseUrl
1943
+ }
1944
+ };
1945
+ }
1946
+ function resolveCompositeImageUrl(url, options = {}, context) {
1947
+ const resolvedUrl = (0, import_loader_utils4.resolvePath)(url);
1948
+ if (isAbsoluteCompositeImageUrl(url)) {
1949
+ return resolvedUrl;
1950
+ }
1951
+ const baseUrl = getCompositeImageBaseUrl(options, context);
1952
+ if (!baseUrl) {
1953
+ if (resolvedUrl !== url || url.startsWith("@")) {
1954
+ return resolvedUrl;
1955
+ }
1956
+ throw new Error(`Unable to resolve relative image URL ${url} without a base URL`);
1957
+ }
1958
+ return (0, import_loader_utils4.resolvePath)(joinCompositeImageUrl(baseUrl, url));
1959
+ }
1960
+ function parseCompositeImageManifestJSON(text) {
1961
+ const manifest = JSON.parse(text);
1962
+ if (!(manifest == null ? void 0 : manifest.shape)) {
1963
+ throw new Error("Composite image manifest must contain a shape field");
1964
+ }
1965
+ return manifest;
1966
+ }
1967
+ async function getImageTextureSource(manifest, options, context) {
1968
+ var _a;
1969
+ if ((manifest.image || manifest.mipmaps) && manifest.template) {
1970
+ throw new Error("image-texture manifest must define image, mipmaps, or template source");
1971
+ }
1972
+ if (manifest.image && manifest.mipmaps) {
1973
+ throw new Error("image-texture manifest must define image, mipmaps, or template source");
1974
+ }
1975
+ if (manifest.image) {
1976
+ return manifest.image;
1977
+ }
1978
+ if ((_a = manifest.mipmaps) == null ? void 0 : _a.length) {
1979
+ return manifest.mipmaps;
1980
+ }
1981
+ if (manifest.template) {
1982
+ return await expandImageTextureSource({ mipLevels: manifest.mipLevels ?? "auto", template: manifest.template }, options, context, {});
1983
+ }
1984
+ throw new Error("image-texture manifest must define image, mipmaps, or template source");
1985
+ }
1986
+ async function getImageTextureCubeUrls(manifest, options, context, templateOptions = {}) {
1987
+ var _a, _b;
1988
+ const urls = {};
1989
+ for (const { face, name, direction, axis, sign } of IMAGE_TEXTURE_CUBE_FACES) {
1990
+ const source = ((_a = manifest.faces) == null ? void 0 : _a[name]) || ((_b = manifest.faces) == null ? void 0 : _b[direction]);
1991
+ if (!source) {
1992
+ throw new Error(`image-texture-cube manifest is missing ${name} face`);
1993
+ }
1994
+ urls[face] = await getNormalizedImageTextureSource(source, options, context, {
1995
+ ...templateOptions,
1996
+ face: name,
1997
+ direction,
1998
+ axis,
1999
+ sign
2000
+ });
2001
+ }
2002
+ return urls;
2003
+ }
2004
+ async function getNormalizedImageTextureSource(source, options, context, templateOptions) {
2005
+ if (typeof source === "string") {
2006
+ return source;
2007
+ }
2008
+ if (Array.isArray(source) && source.length > 0) {
2009
+ return source;
2010
+ }
2011
+ if (isImageTextureTemplateSource(source)) {
2012
+ return await expandImageTextureSource(source, options, context, templateOptions);
2013
+ }
2014
+ throw new Error("Composite image source entries must be strings or non-empty mip arrays");
2015
+ }
2016
+ async function expandImageTextureSource(source, options, context, templateOptions) {
2017
+ const mipLevels = source.mipLevels === "auto" ? await getAutoMipLevels(source.template, options, context, templateOptions) : source.mipLevels;
2018
+ if (!Number.isFinite(mipLevels) || mipLevels <= 0) {
2019
+ throw new Error(`Invalid mipLevels value ${source.mipLevels}`);
2020
+ }
2021
+ const urls = [];
2022
+ for (let lod = 0; lod < mipLevels; lod++) {
2023
+ urls.push(expandTemplate(source.template, { ...templateOptions, lod }));
2024
+ }
2025
+ return urls;
2026
+ }
2027
+ async function getAutoMipLevels(template, options, context, templateOptions) {
2028
+ if (!template.includes("{lod}")) {
2029
+ throw new Error("Template sources with mipLevels: auto must include a {lod} placeholder");
2030
+ }
2031
+ const level0Url = expandTemplate(template, { ...templateOptions, lod: 0 });
2032
+ const image = await loadCompositeImageMember(level0Url, normalizeCompositeImageOptions(options), context);
2033
+ const { width, height } = (0, import_images.getImageSize)(image);
2034
+ return 1 + Math.floor(Math.log2(Math.max(width, height)));
2035
+ }
2036
+ function expandTemplate(template, templateOptions) {
2037
+ let expanded = "";
2038
+ for (let index = 0; index < template.length; index++) {
2039
+ const character = template[index];
2040
+ if (character === "\\") {
2041
+ const nextCharacter = template[index + 1];
2042
+ if (nextCharacter === "{" || nextCharacter === "}" || nextCharacter === "\\") {
2043
+ expanded += nextCharacter;
2044
+ index++;
2045
+ continue;
2046
+ }
2047
+ throw new Error(`Invalid escape sequence \\${nextCharacter || ""} in template ${template}`);
2048
+ }
2049
+ if (character === "}") {
2050
+ throw new Error(`Unexpected } in template ${template}`);
2051
+ }
2052
+ if (character !== "{") {
2053
+ expanded += character;
2054
+ continue;
2055
+ }
2056
+ const closingBraceIndex = findClosingBraceIndex(template, index + 1);
2057
+ if (closingBraceIndex < 0) {
2058
+ throw new Error(`Unterminated placeholder in template ${template}`);
2059
+ }
2060
+ const placeholder = template.slice(index + 1, closingBraceIndex);
2061
+ if (!/^[a-z][a-zA-Z0-9]*$/.test(placeholder)) {
2062
+ throw new Error(`Invalid placeholder {${placeholder}} in template ${template}`);
2063
+ }
2064
+ const value = getTemplateValue(placeholder, templateOptions);
2065
+ if (value === void 0) {
2066
+ throw new Error(`Template ${template} uses unsupported placeholder {${placeholder}} for this source`);
2067
+ }
2068
+ expanded += String(value);
2069
+ index = closingBraceIndex;
2070
+ }
2071
+ return expanded;
2072
+ }
2073
+ function findClosingBraceIndex(template, startIndex) {
2074
+ for (let index = startIndex; index < template.length; index++) {
2075
+ const character = template[index];
2076
+ if (character === "\\") {
2077
+ index++;
2078
+ continue;
2079
+ }
2080
+ if (character === "{") {
2081
+ throw new Error(`Nested placeholders are not supported in template ${template}`);
2082
+ }
2083
+ if (character === "}") {
2084
+ return index;
2085
+ }
2086
+ }
2087
+ return -1;
2088
+ }
2089
+ function getTemplateValue(placeholder, templateOptions) {
2090
+ switch (placeholder) {
2091
+ case "lod":
2092
+ return templateOptions.lod;
2093
+ case "index":
2094
+ return templateOptions.index;
2095
+ case "face":
2096
+ return templateOptions.face;
2097
+ case "direction":
2098
+ return templateOptions.direction;
2099
+ case "axis":
2100
+ return templateOptions.axis;
2101
+ case "sign":
2102
+ return templateOptions.sign;
2103
+ default:
2104
+ return void 0;
2105
+ }
2106
+ }
2107
+ function isImageTextureTemplateSource(source) {
2108
+ return typeof source === "object" && source !== null && !Array.isArray(source);
2109
+ }
2110
+ function getCompositeImageBaseUrl(options, context) {
2111
+ var _a;
2112
+ if (context == null ? void 0 : context.baseUrl) {
2113
+ return context.baseUrl;
2114
+ }
2115
+ if (options.baseUrl) {
2116
+ return stripTrailingSlash(options.baseUrl);
2117
+ }
2118
+ if ((_a = options.core) == null ? void 0 : _a.baseUrl) {
2119
+ return getSourceUrlDirectory(options.core.baseUrl);
2120
+ }
2121
+ return null;
2122
+ }
2123
+ function stripTrailingSlash(baseUrl) {
2124
+ if (baseUrl.endsWith("/")) {
2125
+ return baseUrl.slice(0, -1);
2126
+ }
2127
+ return baseUrl;
2128
+ }
2129
+ function getSourceUrlDirectory(baseUrl) {
2130
+ return stripTrailingSlash(import_loader_utils4.path.dirname(baseUrl));
2131
+ }
2132
+ function joinCompositeImageUrl(baseUrl, url) {
2133
+ if (isRequestLikeUrl(baseUrl)) {
2134
+ return new URL(url, `${stripTrailingSlash(baseUrl)}/`).toString();
2135
+ }
2136
+ const normalizedBaseUrl = baseUrl.startsWith("/") ? baseUrl : `/${baseUrl}`;
2137
+ const normalizedUrl = import_loader_utils4.path.resolve(normalizedBaseUrl, url);
2138
+ return baseUrl.startsWith("/") ? normalizedUrl : normalizedUrl.slice(1);
2139
+ }
2140
+ function isRequestLikeUrl(url) {
2141
+ return url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:") || url.startsWith("blob:");
2142
+ }
2143
+ function getCompositeImageFetch(options, context) {
2144
+ var _a;
2145
+ const fetchOption = options.fetch ?? ((_a = options.core) == null ? void 0 : _a.fetch);
2146
+ if (context == null ? void 0 : context.fetch) {
2147
+ return context.fetch;
2148
+ }
2149
+ if (typeof fetchOption === "function") {
2150
+ return fetchOption;
2151
+ }
2152
+ if (fetchOption && typeof fetchOption === "object") {
2153
+ return (url) => fetch(url, fetchOption);
2154
+ }
2155
+ return fetch;
2156
+ }
2157
+ function getCompositeImageSubloaderOptions(options) {
2158
+ const core = options.core;
2159
+ const rest = { ...options };
2160
+ delete rest.baseUrl;
2161
+ if (!(core == null ? void 0 : core.baseUrl)) {
2162
+ return rest;
2163
+ }
2164
+ const restCore = { ...core };
2165
+ delete restCore.baseUrl;
2166
+ return {
2167
+ ...rest,
2168
+ core: restCore
2169
+ };
2170
+ }
2171
+ function normalizeCompositeImageManifestOptions(options) {
2172
+ var _a;
2173
+ if (((_a = options.image) == null ? void 0 : _a.type) || typeof ImageBitmap === "undefined") {
2174
+ return options;
2175
+ }
2176
+ return {
2177
+ ...options,
2178
+ image: {
2179
+ ...options.image,
2180
+ type: "imagebitmap"
2181
+ }
2182
+ };
2183
+ }
2184
+ function getCompositeImageMemberContext(resolvedUrl, response, context) {
2185
+ const url = response.url || resolvedUrl;
2186
+ const [urlWithoutQueryString, queryString = ""] = url.split("?");
2187
+ return {
2188
+ ...context,
2189
+ url,
2190
+ response,
2191
+ filename: import_loader_utils4.path.filename(urlWithoutQueryString),
2192
+ baseUrl: import_loader_utils4.path.dirname(urlWithoutQueryString),
2193
+ queryString
2194
+ };
2195
+ }
2196
+ function convertCompositeImageToTexture(shape, imageData) {
2197
+ switch (shape) {
2198
+ case "image-texture": {
2199
+ const data = normalizeCompositeImageMember(imageData);
2200
+ return {
2201
+ shape: "texture",
2202
+ type: "2d",
2203
+ format: getCompositeTextureFormat(data),
2204
+ data
2205
+ };
2206
+ }
2207
+ case "image-texture-array": {
2208
+ const data = imageData.map((layer) => normalizeCompositeImageMember(layer));
2209
+ return {
2210
+ shape: "texture",
2211
+ type: "2d-array",
2212
+ format: getCompositeTextureFormat(data[0]),
2213
+ data
2214
+ };
2215
+ }
2216
+ case "image-texture-cube": {
2217
+ const data = IMAGE_TEXTURE_CUBE_FACES.map(({ face }) => normalizeCompositeImageMember(imageData[face]));
2218
+ return {
2219
+ shape: "texture",
2220
+ type: "cube",
2221
+ format: getCompositeTextureFormat(data[0]),
2222
+ data
2223
+ };
2224
+ }
2225
+ case "image-texture-cube-array": {
2226
+ const data = imageData.map((layer) => IMAGE_TEXTURE_CUBE_FACES.map(({ face }) => normalizeCompositeImageMember(layer[face])));
2227
+ return {
2228
+ shape: "texture",
2229
+ type: "cube-array",
2230
+ format: getCompositeTextureFormat(data[0][0]),
2231
+ data
2232
+ };
2233
+ }
2234
+ default:
2235
+ throw new Error(`Unsupported composite image shape ${shape}`);
2236
+ }
2237
+ }
2238
+ function normalizeCompositeImageMember(imageData) {
2239
+ if (Array.isArray(imageData)) {
2240
+ if (imageData.length === 0) {
2241
+ throw new Error("Composite image members must not be empty");
2242
+ }
2243
+ if (imageData.every(isTextureLevel)) {
2244
+ return imageData;
2245
+ }
2246
+ if (imageData.every(import_images.isImage)) {
2247
+ return imageData.map((image) => getTextureLevelFromImage(image));
2248
+ }
2249
+ if (imageData.every((entry) => Array.isArray(entry) && entry.every(isTextureLevel))) {
2250
+ if (imageData.length !== 1) {
2251
+ throw new Error("Composite image members must resolve to a single image or mip chain");
2252
+ }
2253
+ return imageData[0];
2254
+ }
2255
+ }
2256
+ if (isTexture(imageData)) {
2257
+ if (imageData.type !== "2d") {
2258
+ throw new Error(`Composite image members must resolve to 2d textures, got ${imageData.type}`);
2259
+ }
2260
+ return imageData.data;
2261
+ }
2262
+ if (isTextureLevel(imageData)) {
2263
+ return [imageData];
2264
+ }
2265
+ if ((0, import_images.isImage)(imageData)) {
2266
+ return [getTextureLevelFromImage(imageData)];
2267
+ }
2268
+ throw new Error("Composite image members must resolve to an image, mip chain, or texture");
2269
+ }
2270
+ function getTextureLevelFromImage(image) {
2271
+ const { width, height } = (0, import_images.getImageSize)(image);
2272
+ return {
2273
+ shape: "texture-level",
2274
+ compressed: false,
2275
+ width,
2276
+ height,
2277
+ imageBitmap: typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap ? image : void 0,
2278
+ data: new Uint8Array(0),
2279
+ textureFormat: "rgba8unorm"
2280
+ };
2281
+ }
2282
+ function getCompositeTextureFormat(textureLevels) {
2283
+ var _a;
2284
+ return ((_a = textureLevels[0]) == null ? void 0 : _a.textureFormat) || "rgba8unorm";
2285
+ }
2286
+ function isTextureLevel(textureLevel) {
2287
+ return Boolean(textureLevel && typeof textureLevel === "object" && "shape" in textureLevel && textureLevel.shape === "texture-level");
2288
+ }
2289
+ function isTexture(texture) {
2290
+ return Boolean(texture && typeof texture === "object" && "shape" in texture && texture.shape === "texture");
2291
+ }
2292
+ function isAbsoluteCompositeImageUrl(url) {
2293
+ return url.startsWith("data:") || url.startsWith("blob:") || url.startsWith("file:") || url.startsWith("http:") || url.startsWith("https:") || url.startsWith("/");
2294
+ }
2295
+
2296
+ // dist/texture-loader.js
2297
+ var TextureLoader = {
2298
+ dataType: null,
2299
+ batchType: null,
2300
+ id: "texture",
2301
+ name: "Texture",
2302
+ module: "textures",
2303
+ version: VERSION,
2304
+ extensions: [],
2305
+ mimeTypes: [],
2306
+ text: true,
2307
+ worker: false,
2308
+ testText: (text) => testCompositeImageManifestShape(text, "image-texture"),
2309
+ options: {
2310
+ image: {}
2311
+ },
2312
+ parse: async (arrayBuffer, options, context) => await parseCompositeImageManifest(new TextDecoder().decode(arrayBuffer), "image-texture", options, context),
2313
+ parseText: async (text, options, context) => await parseCompositeImageManifest(text, "image-texture", options, context)
2314
+ };
2315
+
2316
+ // dist/texture-array-loader.js
2317
+ var TextureArrayLoader = {
2318
+ dataType: null,
2319
+ batchType: null,
2320
+ id: "texture-array",
2321
+ name: "Texture Array",
2322
+ module: "textures",
2323
+ version: VERSION,
2324
+ extensions: [],
2325
+ mimeTypes: [],
2326
+ text: true,
2327
+ worker: false,
2328
+ testText: (text) => testCompositeImageManifestShape(text, "image-texture-array"),
2329
+ options: {
2330
+ image: {}
2331
+ },
2332
+ parse: async (arrayBuffer, options, context) => await parseCompositeImageManifest(new TextDecoder().decode(arrayBuffer), "image-texture-array", options, context),
2333
+ parseText: async (text, options, context) => await parseCompositeImageManifest(text, "image-texture-array", options, context)
2334
+ };
2335
+
2336
+ // dist/texture-cube-loader.js
2337
+ var TextureCubeLoader = {
2338
+ dataType: null,
2339
+ batchType: null,
2340
+ id: "texture-cube",
2341
+ name: "Texture Cube",
2342
+ module: "textures",
2343
+ version: VERSION,
2344
+ extensions: [],
2345
+ mimeTypes: [],
2346
+ text: true,
2347
+ worker: false,
2348
+ testText: (text) => testCompositeImageManifestShape(text, "image-texture-cube"),
2349
+ options: {
2350
+ image: {}
2351
+ },
2352
+ parse: async (arrayBuffer, options, context) => await parseCompositeImageManifest(new TextDecoder().decode(arrayBuffer), "image-texture-cube", options, context),
2353
+ parseText: async (text, options, context) => await parseCompositeImageManifest(text, "image-texture-cube", options, context)
2354
+ };
2355
+
2356
+ // dist/texture-cube-array-loader.js
2357
+ var TextureCubeArrayLoader = {
2358
+ dataType: null,
2359
+ batchType: null,
2360
+ id: "texture-cube-array",
2361
+ name: "Texture Cube Array",
2362
+ module: "textures",
2363
+ version: VERSION,
2364
+ extensions: [],
2365
+ mimeTypes: [],
2366
+ text: true,
2367
+ worker: false,
2368
+ testText: (text) => testCompositeImageManifestShape(text, "image-texture-cube-array"),
2369
+ options: {
2370
+ image: {}
2371
+ },
2372
+ parse: async (arrayBuffer, options, context) => await parseCompositeImageManifest(new TextDecoder().decode(arrayBuffer), "image-texture-cube-array", options, context),
2373
+ parseText: async (text, options, context) => await parseCompositeImageManifest(text, "image-texture-cube-array", options, context)
2374
+ };
2375
+
1097
2376
  // dist/lib/parsers/crunch-module-loader.js
1098
- var import_loader_utils3 = require("@loaders.gl/loader-utils");
1099
- var import_worker_utils2 = require("@loaders.gl/worker-utils");
2377
+ var import_loader_utils5 = require("@loaders.gl/loader-utils");
2378
+ var import_worker_utils3 = require("@loaders.gl/worker-utils");
1100
2379
  var CRUNCH_EXTERNAL_LIBRARIES = {
1101
2380
  /** Crunch decoder library. It is used as dynamically imported script */
1102
2381
  DECODER: "crunch.js"
1103
2382
  };
1104
2383
 
1105
2384
  // dist/lib/encoders/encode-texture.js
1106
- var import_worker_utils3 = require("@loaders.gl/worker-utils");
2385
+ var import_worker_utils4 = require("@loaders.gl/worker-utils");
1107
2386
  async function encodeImageURLToCompressedTextureURL(inputUrl, outputUrl, options) {
1108
2387
  const args = [
1109
2388
  // Note: our actual executable is `npx`, so `texture-compressor` is an argument
@@ -1119,7 +2398,7 @@ async function encodeImageURLToCompressedTextureURL(inputUrl, outputUrl, options
1119
2398
  "--output",
1120
2399
  outputUrl
1121
2400
  ];
1122
- const childProcess = new import_worker_utils3.ChildProcessProxy();
2401
+ const childProcess = new import_worker_utils4.ChildProcessProxy();
1123
2402
  await childProcess.start({
1124
2403
  command: "npx",
1125
2404
  arguments: args,
@@ -1153,9 +2432,10 @@ var CompressedTextureWriter = {
1153
2432
  };
1154
2433
 
1155
2434
  // dist/lib/encoders/encode-ktx2-basis-texture.js
2435
+ var import_worker_utils5 = require("@loaders.gl/worker-utils");
1156
2436
  async function encodeKTX2BasisTexture(image, options = {}) {
1157
2437
  const { useSRGB = false, qualityLevel = 10, encodeUASTC = false, mipmaps = false } = (options == null ? void 0 : options["ktx2-basis-writer"]) || {};
1158
- const { BasisEncoder } = await loadBasisEncoderModule(options);
2438
+ const { BasisEncoder } = await loadBasisEncoderModule((0, import_worker_utils5.extractLoadLibraryOptions)(options));
1159
2439
  const basisEncoder = new BasisEncoder();
1160
2440
  try {
1161
2441
  const basisFileData = new Uint8Array(image.width * image.height * 4);
@@ -1199,67 +2479,18 @@ var KTX2BasisWriter = {
1199
2479
  };
1200
2480
 
1201
2481
  // dist/lib/texture-api/load-image.js
1202
- var import_loader_utils5 = require("@loaders.gl/loader-utils");
1203
- var import_images = require("@loaders.gl/images");
2482
+ var import_loader_utils6 = require("@loaders.gl/loader-utils");
2483
+ var import_images2 = require("@loaders.gl/images");
1204
2484
 
1205
2485
  // dist/lib/texture-api/generate-url.js
1206
- var import_loader_utils4 = require("@loaders.gl/loader-utils");
1207
2486
  function generateUrl(getUrl, options, urlOptions) {
1208
- let url = typeof getUrl === "function" ? getUrl({ ...options, ...urlOptions }) : getUrl;
1209
- const baseUrl = options.baseUrl;
1210
- if (baseUrl) {
1211
- url = baseUrl[baseUrl.length - 1] === "/" ? `${baseUrl}${url}` : `${baseUrl}/${url}`;
1212
- }
1213
- return (0, import_loader_utils4.resolvePath)(url);
1214
- }
1215
-
1216
- // dist/lib/texture-api/async-deep-map.js
1217
- var isObject = (value) => value && typeof value === "object";
1218
- async function asyncDeepMap(tree, func, options = {}) {
1219
- return await mapSubtree(tree, func, options);
1220
- }
1221
- async function mapSubtree(object, func, options) {
1222
- if (Array.isArray(object)) {
1223
- return await mapArray(object, func, options);
1224
- }
1225
- if (isObject(object)) {
1226
- return await mapObject(object, func, options);
1227
- }
1228
- const url = object;
1229
- return await func(url, options);
1230
- }
1231
- async function mapObject(object, func, options) {
1232
- const promises = [];
1233
- const values = {};
1234
- for (const key in object) {
1235
- const url = object[key];
1236
- const promise = mapSubtree(url, func, options).then((value) => {
1237
- values[key] = value;
1238
- });
1239
- promises.push(promise);
1240
- }
1241
- await Promise.all(promises);
1242
- return values;
1243
- }
1244
- async function mapArray(urlArray, func, options = {}) {
1245
- const promises = urlArray.map((url) => mapSubtree(url, func, options));
1246
- return await Promise.all(promises);
1247
- }
1248
-
1249
- // dist/lib/texture-api/deep-load.js
1250
- async function deepLoad(urlTree, load, options) {
1251
- return await asyncDeepMap(urlTree, (url) => shallowLoad(url, load, options));
1252
- }
1253
- async function shallowLoad(url, load, options) {
1254
- const response = await fetch(url, options.fetch);
1255
- const arrayBuffer = await response.arrayBuffer();
1256
- return await load(arrayBuffer, options);
2487
+ return typeof getUrl === "function" ? getUrl({ ...options, ...urlOptions }) : getUrl;
1257
2488
  }
1258
2489
 
1259
2490
  // dist/lib/texture-api/load-image.js
1260
2491
  async function loadImageTexture(getUrl, options = {}) {
1261
2492
  const imageUrls = await getImageUrls(getUrl, options);
1262
- return await deepLoad(imageUrls, import_images.ImageLoader.parse, options);
2493
+ return await loadCompositeImageUrlTree(imageUrls, normalizeCompositeImageOptions(options));
1263
2494
  }
1264
2495
  async function getImageUrls(getUrl, options, urlOptions = {}) {
1265
2496
  const mipLevels = options && options.image && options.image.mipLevels || 0;
@@ -1267,14 +2498,15 @@ async function getImageUrls(getUrl, options, urlOptions = {}) {
1267
2498
  }
1268
2499
  async function getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions) {
1269
2500
  const urls = [];
2501
+ const normalizedOptions = normalizeCompositeImageOptions(options);
1270
2502
  if (mipLevels === "auto") {
1271
2503
  const url = generateUrl(getUrl, options, { ...urlOptions, lod: 0 });
1272
- const image = await shallowLoad(url, import_images.ImageLoader.parse, options);
1273
- const { width, height } = (0, import_images.getImageSize)(image);
2504
+ const image = await loadCompositeImageMember(url, normalizedOptions);
2505
+ const { width, height } = (0, import_images2.getImageSize)(image);
1274
2506
  mipLevels = getMipLevels({ width, height });
1275
2507
  urls.push(url);
1276
2508
  }
1277
- (0, import_loader_utils5.assert)(mipLevels > 0);
2509
+ (0, import_loader_utils6.assert)(mipLevels > 0);
1278
2510
  for (let mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {
1279
2511
  const url = generateUrl(getUrl, options, { ...urlOptions, lod: mipLevel });
1280
2512
  urls.push(url);
@@ -1286,10 +2518,9 @@ function getMipLevels(size) {
1286
2518
  }
1287
2519
 
1288
2520
  // dist/lib/texture-api/load-image-array.js
1289
- var import_images2 = require("@loaders.gl/images");
1290
2521
  async function loadImageTextureArray(count, getUrl, options = {}) {
1291
2522
  const imageUrls = await getImageArrayUrls(count, getUrl, options);
1292
- return await deepLoad(imageUrls, import_images2.ImageLoader.parse, options);
2523
+ return await loadCompositeImageUrlTree(imageUrls, normalizeCompositeImageOptions(options));
1293
2524
  }
1294
2525
  async function getImageArrayUrls(count, getUrl, options = {}) {
1295
2526
  const promises = [];
@@ -1301,27 +2532,12 @@ async function getImageArrayUrls(count, getUrl, options = {}) {
1301
2532
  }
1302
2533
 
1303
2534
  // dist/lib/texture-api/load-image-cube.js
1304
- var import_images3 = require("@loaders.gl/images");
1305
- var GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069;
1306
- var GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070;
1307
- var GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071;
1308
- var GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072;
1309
- var GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073;
1310
- var GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074;
1311
- var CUBE_FACES = [
1312
- { face: GL_TEXTURE_CUBE_MAP_POSITIVE_X, direction: "right", axis: "x", sign: "positive" },
1313
- { face: GL_TEXTURE_CUBE_MAP_NEGATIVE_X, direction: "left", axis: "x", sign: "negative" },
1314
- { face: GL_TEXTURE_CUBE_MAP_POSITIVE_Y, direction: "top", axis: "y", sign: "positive" },
1315
- { face: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, direction: "bottom", axis: "y", sign: "negative" },
1316
- { face: GL_TEXTURE_CUBE_MAP_POSITIVE_Z, direction: "front", axis: "z", sign: "positive" },
1317
- { face: GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, direction: "back", axis: "z", sign: "negative" }
1318
- ];
1319
2535
  async function getImageCubeUrls(getUrl, options) {
1320
2536
  const urls = {};
1321
2537
  const promises = [];
1322
2538
  let index = 0;
1323
- for (let i = 0; i < CUBE_FACES.length; ++i) {
1324
- const face = CUBE_FACES[index];
2539
+ for (let i = 0; i < IMAGE_TEXTURE_CUBE_FACES.length; ++i) {
2540
+ const face = IMAGE_TEXTURE_CUBE_FACES[index];
1325
2541
  const promise = getImageUrls(getUrl, options, { ...face, index: index++ }).then((url) => {
1326
2542
  urls[face.face] = url;
1327
2543
  });
@@ -1332,7 +2548,7 @@ async function getImageCubeUrls(getUrl, options) {
1332
2548
  }
1333
2549
  async function loadImageTextureCube(getUrl, options = {}) {
1334
2550
  const urls = await getImageCubeUrls(getUrl, options);
1335
- return await deepLoad(urls, import_images3.ImageLoader.parse, options);
2551
+ return await loadCompositeImageUrlTree(urls, normalizeCompositeImageOptions(options));
1336
2552
  }
1337
2553
 
1338
2554
  // dist/index.js