@loaders.gl/textures 3.1.0-alpha.4 → 3.1.0-beta.3

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 (271) hide show
  1. package/dist/basis-loader.d.ts +50 -0
  2. package/dist/basis-loader.d.ts.map +1 -0
  3. package/dist/basis-loader.js +40 -0
  4. package/dist/basis-worker.js +675 -2
  5. package/dist/bundle.d.ts +2 -0
  6. package/dist/bundle.d.ts.map +1 -0
  7. package/dist/bundle.js +2107 -0
  8. package/dist/compressed-texture-loader.d.ts +63 -0
  9. package/dist/compressed-texture-loader.d.ts.map +1 -0
  10. package/dist/compressed-texture-loader.js +64 -0
  11. package/dist/compressed-texture-worker.js +1179 -2
  12. package/dist/compressed-texture-writer.d.ts +25 -0
  13. package/dist/compressed-texture-writer.d.ts.map +1 -0
  14. package/dist/compressed-texture-writer.js +28 -0
  15. package/dist/crunch-loader.d.ts +21 -0
  16. package/dist/crunch-loader.d.ts.map +1 -0
  17. package/dist/crunch-loader.js +25 -0
  18. package/dist/crunch-worker.js +486 -2
  19. package/dist/es5/basis-loader.js +5 -13
  20. package/dist/es5/basis-loader.js.map +1 -1
  21. package/dist/es5/bundle.js +1 -1
  22. package/dist/es5/bundle.js.map +1 -1
  23. package/dist/es5/compressed-texture-loader.js +20 -59
  24. package/dist/es5/compressed-texture-loader.js.map +1 -1
  25. package/dist/es5/compressed-texture-writer.js +2 -2
  26. package/dist/es5/compressed-texture-writer.js.map +1 -1
  27. package/dist/es5/crunch-loader.js +2 -2
  28. package/dist/es5/crunch-loader.js.map +1 -1
  29. package/dist/es5/index.js +26 -18
  30. package/dist/es5/index.js.map +1 -1
  31. package/dist/es5/ktx2-basis-universal-texture-writer.js +29 -0
  32. package/dist/es5/ktx2-basis-universal-texture-writer.js.map +1 -0
  33. package/dist/es5/lib/encoders/encode-ktx.js +1 -1
  34. package/dist/es5/lib/encoders/encode-ktx.js.map +1 -1
  35. package/dist/es5/lib/encoders/encode-ktx2-basis-texture.js +43 -0
  36. package/dist/es5/lib/encoders/encode-ktx2-basis-texture.js.map +1 -0
  37. package/dist/es5/lib/encoders/encode-texture.js +13 -41
  38. package/dist/es5/lib/encoders/encode-texture.js.map +1 -1
  39. package/dist/es5/lib/{gl-constants.js → gl-extensions.js} +4 -4
  40. package/dist/es5/lib/gl-extensions.js.map +1 -0
  41. package/dist/es5/lib/parsers/basis-module-loader.js +51 -190
  42. package/dist/es5/lib/parsers/basis-module-loader.js.map +1 -1
  43. package/dist/es5/lib/parsers/crunch-module-loader.js +15 -71
  44. package/dist/es5/lib/parsers/crunch-module-loader.js.map +1 -1
  45. package/dist/es5/lib/parsers/parse-basis.js +86 -138
  46. package/dist/es5/lib/parsers/parse-basis.js.map +1 -1
  47. package/dist/es5/lib/parsers/parse-crunch.js +59 -80
  48. package/dist/es5/lib/parsers/parse-crunch.js.map +1 -1
  49. package/dist/es5/lib/parsers/parse-dds.js +39 -39
  50. package/dist/es5/lib/parsers/parse-dds.js.map +1 -1
  51. package/dist/es5/lib/parsers/parse-ktx.js +14 -16
  52. package/dist/es5/lib/parsers/parse-ktx.js.map +1 -1
  53. package/dist/es5/lib/parsers/parse-npy.js +27 -28
  54. package/dist/es5/lib/parsers/parse-npy.js.map +1 -1
  55. package/dist/es5/lib/parsers/parse-pvr.js +49 -49
  56. package/dist/es5/lib/parsers/parse-pvr.js.map +1 -1
  57. package/dist/es5/lib/texture-api/async-deep-map.js +27 -156
  58. package/dist/es5/lib/texture-api/async-deep-map.js.map +1 -1
  59. package/dist/es5/lib/texture-api/deep-load.js +6 -67
  60. package/dist/es5/lib/texture-api/deep-load.js.map +1 -1
  61. package/dist/es5/lib/texture-api/generate-url.js +4 -16
  62. package/dist/es5/lib/texture-api/generate-url.js.map +1 -1
  63. package/dist/es5/lib/texture-api/load-image-array.js +12 -76
  64. package/dist/es5/lib/texture-api/load-image-array.js.map +1 -1
  65. package/dist/es5/lib/texture-api/load-image-cube.js +27 -96
  66. package/dist/es5/lib/texture-api/load-image-cube.js.map +1 -1
  67. package/dist/es5/lib/texture-api/load-image.js +37 -146
  68. package/dist/es5/lib/texture-api/load-image.js.map +1 -1
  69. package/dist/es5/lib/texture-api/texture-api-types.js +2 -0
  70. package/dist/es5/lib/texture-api/texture-api-types.js.map +1 -0
  71. package/dist/es5/lib/utils/extract-mipmap-images.js +9 -9
  72. package/dist/es5/lib/utils/extract-mipmap-images.js.map +1 -1
  73. package/dist/es5/lib/utils/ktx-format-helper.js +68 -68
  74. package/dist/es5/lib/utils/ktx-format-helper.js.map +1 -1
  75. package/dist/es5/lib/utils/texture-formats.js +9 -27
  76. package/dist/es5/lib/utils/texture-formats.js.map +1 -1
  77. package/dist/es5/lib/utils/version.js +1 -1
  78. package/dist/es5/lib/utils/version.js.map +1 -1
  79. package/dist/es5/libs/README.md +2 -2
  80. package/dist/es5/libs/basis_encoder.js +1 -1
  81. package/dist/es5/libs/basis_transcoder.js +1 -1
  82. package/dist/es5/libs/crunch.js +1 -0
  83. package/dist/es5/npy-loader.js +7 -42
  84. package/dist/es5/npy-loader.js.map +1 -1
  85. package/dist/es5/workers/crunch-worker.js +2 -11
  86. package/dist/es5/workers/crunch-worker.js.map +1 -1
  87. package/dist/esm/index.js +2 -1
  88. package/dist/esm/index.js.map +1 -1
  89. package/dist/esm/ktx2-basis-universal-texture-writer.js +18 -0
  90. package/dist/esm/ktx2-basis-universal-texture-writer.js.map +1 -0
  91. package/dist/esm/lib/encoders/encode-ktx2-basis-texture.js +35 -0
  92. package/dist/esm/lib/encoders/encode-ktx2-basis-texture.js.map +1 -0
  93. package/dist/esm/lib/encoders/encode-texture.js +1 -1
  94. package/dist/esm/lib/encoders/encode-texture.js.map +1 -1
  95. package/dist/esm/lib/{gl-constants.js → gl-extensions.js} +2 -2
  96. package/dist/esm/lib/gl-extensions.js.map +1 -0
  97. package/dist/esm/lib/parsers/basis-module-loader.js +8 -3
  98. package/dist/esm/lib/parsers/basis-module-loader.js.map +1 -1
  99. package/dist/esm/lib/parsers/crunch-module-loader.js.map +1 -1
  100. package/dist/esm/lib/parsers/parse-basis.js +8 -8
  101. package/dist/esm/lib/parsers/parse-basis.js.map +1 -1
  102. package/dist/esm/lib/parsers/parse-crunch.js +4 -4
  103. package/dist/esm/lib/parsers/parse-crunch.js.map +1 -1
  104. package/dist/esm/lib/parsers/parse-dds.js +24 -24
  105. package/dist/esm/lib/parsers/parse-dds.js.map +1 -1
  106. package/dist/esm/lib/parsers/parse-ktx.js +2 -2
  107. package/dist/esm/lib/parsers/parse-ktx.js.map +1 -1
  108. package/dist/esm/lib/parsers/parse-npy.js +4 -2
  109. package/dist/esm/lib/parsers/parse-npy.js.map +1 -1
  110. package/dist/esm/lib/parsers/parse-pvr.js +28 -28
  111. package/dist/esm/lib/parsers/parse-pvr.js.map +1 -1
  112. package/dist/esm/lib/texture-api/async-deep-map.js.map +1 -1
  113. package/dist/esm/lib/texture-api/deep-load.js.map +1 -1
  114. package/dist/esm/lib/texture-api/generate-url.js +6 -14
  115. package/dist/esm/lib/texture-api/generate-url.js.map +1 -1
  116. package/dist/esm/lib/texture-api/load-image-array.js.map +1 -1
  117. package/dist/esm/lib/texture-api/load-image-cube.js.map +1 -1
  118. package/dist/esm/lib/texture-api/load-image.js +2 -5
  119. package/dist/esm/lib/texture-api/load-image.js.map +1 -1
  120. package/dist/esm/lib/texture-api/texture-api-types.js +2 -0
  121. package/dist/esm/lib/texture-api/texture-api-types.js.map +1 -0
  122. package/dist/esm/lib/utils/extract-mipmap-images.js.map +1 -1
  123. package/dist/esm/lib/utils/ktx-format-helper.js +67 -67
  124. package/dist/esm/lib/utils/ktx-format-helper.js.map +1 -1
  125. package/dist/esm/lib/utils/texture-formats.js +1 -1
  126. package/dist/esm/lib/utils/texture-formats.js.map +1 -1
  127. package/dist/esm/lib/utils/version.js +1 -1
  128. package/dist/esm/lib/utils/version.js.map +1 -1
  129. package/dist/esm/libs/README.md +2 -2
  130. package/dist/esm/libs/basis_encoder.js +1 -1
  131. package/dist/esm/libs/basis_transcoder.js +1 -1
  132. package/dist/esm/libs/crunch.js +1 -0
  133. package/dist/esm/npy-loader.js.map +1 -1
  134. package/dist/index.d.ts +16 -0
  135. package/dist/index.d.ts.map +1 -0
  136. package/dist/index.js +37 -0
  137. package/dist/ktx2-basis-universal-texture-writer.d.ts +22 -0
  138. package/dist/ktx2-basis-universal-texture-writer.d.ts.map +1 -0
  139. package/dist/ktx2-basis-universal-texture-writer.js +25 -0
  140. package/dist/lib/encoders/encode-ktx.d.ts +2 -0
  141. package/dist/lib/encoders/encode-ktx.d.ts.map +1 -0
  142. package/dist/lib/encoders/encode-ktx.js +10 -0
  143. package/dist/lib/encoders/encode-ktx2-basis-texture.d.ts +10 -0
  144. package/dist/lib/encoders/encode-ktx2-basis-texture.d.ts.map +1 -0
  145. package/dist/lib/encoders/encode-ktx2-basis-texture.js +41 -0
  146. package/dist/lib/encoders/encode-texture.d.ts +2 -0
  147. package/dist/lib/encoders/encode-texture.d.ts.map +1 -0
  148. package/dist/lib/encoders/encode-texture.js +30 -0
  149. package/dist/lib/gl-extensions.d.ts +61 -0
  150. package/dist/lib/gl-extensions.d.ts.map +1 -0
  151. package/dist/lib/gl-extensions.js +72 -0
  152. package/dist/lib/parsers/basis-module-loader.d.ts +13 -0
  153. package/dist/lib/parsers/basis-module-loader.d.ts.map +1 -0
  154. package/dist/lib/parsers/basis-module-loader.js +114 -0
  155. package/dist/lib/parsers/crunch-module-loader.d.ts +7 -0
  156. package/dist/lib/parsers/crunch-module-loader.d.ts.map +1 -0
  157. package/dist/lib/parsers/crunch-module-loader.js +35 -0
  158. package/dist/lib/parsers/parse-basis.d.ts +30 -0
  159. package/dist/lib/parsers/parse-basis.d.ts.map +1 -0
  160. package/dist/lib/parsers/parse-basis.js +245 -0
  161. package/dist/lib/parsers/parse-compressed-texture.d.ts +8 -0
  162. package/dist/lib/parsers/parse-compressed-texture.d.ts.map +1 -0
  163. package/dist/lib/parsers/parse-compressed-texture.js +26 -0
  164. package/dist/lib/parsers/parse-crunch.d.ts +9 -0
  165. package/dist/lib/parsers/parse-crunch.d.ts.map +1 -0
  166. package/dist/lib/parsers/parse-crunch.js +105 -0
  167. package/dist/lib/parsers/parse-dds.d.ts +28 -0
  168. package/dist/lib/parsers/parse-dds.d.ts.map +1 -0
  169. package/dist/lib/parsers/parse-dds.js +108 -0
  170. package/dist/lib/parsers/parse-ktx.d.ts +3 -0
  171. package/dist/lib/parsers/parse-ktx.d.ts.map +1 -0
  172. package/dist/lib/parsers/parse-ktx.js +46 -0
  173. package/dist/lib/parsers/parse-npy.d.ts +10 -0
  174. package/dist/lib/parsers/parse-npy.d.ts.map +1 -0
  175. package/dist/lib/parsers/parse-npy.js +85 -0
  176. package/dist/lib/parsers/parse-pvr.d.ts +15 -0
  177. package/dist/lib/parsers/parse-pvr.d.ts.map +1 -0
  178. package/dist/lib/parsers/parse-pvr.js +250 -0
  179. package/dist/lib/texture-api/async-deep-map.d.ts +5 -0
  180. package/dist/lib/texture-api/async-deep-map.d.ts.map +1 -0
  181. package/dist/lib/texture-api/async-deep-map.js +41 -0
  182. package/dist/lib/texture-api/deep-load.d.ts +5 -0
  183. package/dist/lib/texture-api/deep-load.d.ts.map +1 -0
  184. package/dist/lib/texture-api/deep-load.js +16 -0
  185. package/dist/lib/texture-api/generate-url.d.ts +3 -0
  186. package/dist/lib/texture-api/generate-url.d.ts.map +1 -0
  187. package/dist/lib/texture-api/generate-url.js +17 -0
  188. package/dist/lib/texture-api/load-image-array.d.ts +4 -0
  189. package/dist/lib/texture-api/load-image-array.d.ts.map +1 -0
  190. package/dist/lib/texture-api/load-image-array.js +21 -0
  191. package/dist/lib/texture-api/load-image-cube.d.ts +12 -0
  192. package/dist/lib/texture-api/load-image-cube.d.ts.map +1 -0
  193. package/dist/lib/texture-api/load-image-cube.js +47 -0
  194. package/dist/lib/texture-api/load-image.d.ts +8 -0
  195. package/dist/lib/texture-api/load-image.d.ts.map +1 -0
  196. package/dist/lib/texture-api/load-image.js +43 -0
  197. package/dist/lib/texture-api/texture-api-types.d.ts +10 -0
  198. package/dist/lib/texture-api/texture-api-types.d.ts.map +1 -0
  199. package/dist/lib/texture-api/texture-api-types.js +3 -0
  200. package/dist/lib/utils/extract-mipmap-images.d.ts +13 -0
  201. package/dist/lib/utils/extract-mipmap-images.d.ts.map +1 -0
  202. package/dist/lib/utils/extract-mipmap-images.js +50 -0
  203. package/dist/lib/utils/ktx-format-helper.d.ts +9 -0
  204. package/dist/lib/utils/ktx-format-helper.d.ts.map +1 -0
  205. package/dist/lib/utils/ktx-format-helper.js +125 -0
  206. package/dist/lib/utils/texture-formats.d.ts +8 -0
  207. package/dist/lib/utils/texture-formats.d.ts.map +1 -0
  208. package/dist/lib/utils/texture-formats.js +51 -0
  209. package/dist/lib/utils/version.d.ts +2 -0
  210. package/dist/lib/utils/version.d.ts.map +1 -0
  211. package/dist/lib/utils/version.js +8 -0
  212. package/dist/libs/README.md +2 -2
  213. package/dist/libs/basis_encoder.js +1 -1
  214. package/dist/libs/basis_transcoder.js +1 -1
  215. package/dist/libs/crunch.js +1 -0
  216. package/dist/npy-loader.d.ts +45 -0
  217. package/dist/npy-loader.d.ts.map +1 -0
  218. package/dist/npy-loader.js +34 -0
  219. package/dist/npy-worker.js +240 -2
  220. package/dist/types.d.ts +21 -0
  221. package/dist/types.d.ts.map +1 -0
  222. package/dist/types.js +2 -0
  223. package/dist/workers/basis-worker.d.ts +2 -0
  224. package/dist/workers/basis-worker.d.ts.map +1 -0
  225. package/dist/workers/basis-worker.js +5 -0
  226. package/dist/workers/compressed-texture-worker.d.ts +2 -0
  227. package/dist/workers/compressed-texture-worker.d.ts.map +1 -0
  228. package/dist/workers/compressed-texture-worker.js +5 -0
  229. package/dist/workers/crunch-worker.d.ts +21 -0
  230. package/dist/workers/crunch-worker.d.ts.map +1 -0
  231. package/dist/workers/crunch-worker.js +14 -0
  232. package/dist/workers/npy-worker.d.ts +2 -0
  233. package/dist/workers/npy-worker.d.ts.map +1 -0
  234. package/dist/workers/npy-worker.js +5 -0
  235. package/package.json +11 -11
  236. package/src/index.ts +2 -1
  237. package/src/ktx2-basis-universal-texture-writer.ts +27 -0
  238. package/src/lib/encoders/encode-ktx2-basis-texture.ts +44 -0
  239. package/src/lib/{gl-constants.ts → gl-extensions.ts} +1 -1
  240. package/src/lib/parsers/basis-module-loader.ts +12 -4
  241. package/src/lib/parsers/crunch-module-loader.ts +1 -0
  242. package/src/lib/parsers/parse-basis.js +32 -8
  243. package/src/lib/parsers/parse-crunch.ts +4 -4
  244. package/src/lib/parsers/parse-dds.ts +29 -26
  245. package/src/lib/parsers/parse-ktx.js +3 -6
  246. package/src/lib/parsers/parse-ktx.ts +47 -0
  247. package/src/lib/parsers/parse-npy.js +3 -17
  248. package/src/lib/parsers/parse-npy.ts +98 -0
  249. package/src/lib/parsers/parse-pvr.ts +90 -48
  250. package/src/lib/texture-api/async-deep-map.ts +15 -8
  251. package/src/lib/texture-api/deep-load.ts +7 -3
  252. package/src/lib/texture-api/generate-url.ts +10 -8
  253. package/src/lib/texture-api/load-image-array.ts +8 -2
  254. package/src/lib/texture-api/load-image-cube.ts +18 -4
  255. package/src/lib/texture-api/load-image.ts +15 -5
  256. package/src/lib/texture-api/texture-api-types.ts +12 -0
  257. package/src/lib/utils/extract-mipmap-images.ts +16 -3
  258. package/src/lib/utils/ktx-format-helper.ts +71 -71
  259. package/src/libs/README.md +2 -2
  260. package/src/libs/basis_encoder.js +1 -1
  261. package/src/libs/basis_transcoder.js +1 -1
  262. package/src/libs/crunch.js +1 -0
  263. package/src/npy-loader.ts +2 -2
  264. package/dist/basis-worker.js.map +0 -1
  265. package/dist/compressed-texture-worker.js.map +0 -1
  266. package/dist/crunch-worker.js.map +0 -1
  267. package/dist/dist.min.js +0 -2
  268. package/dist/dist.min.js.map +0 -1
  269. package/dist/es5/lib/gl-constants.js.map +0 -1
  270. package/dist/esm/lib/gl-constants.js.map +0 -1
  271. package/dist/npy-worker.js.map +0 -1
@@ -0,0 +1,5 @@
1
+ export declare type Options = Record<string, any>;
2
+ export declare type Func = (url: string, options: Options) => unknown;
3
+ export declare function asyncDeepMap(tree: unknown, func: Func, options?: Options): Promise<unknown>;
4
+ export declare function mapSubtree(object: unknown, func: Func, options: Options): Promise<unknown>;
5
+ //# sourceMappingURL=async-deep-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-deep-map.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/async-deep-map.ts"],"names":[],"mappings":"AAgBA,oBAAY,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC1C,oBAAY,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;AAO9D,wBAAsB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,OAAY,oBAElF;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,oBAY7E"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapSubtree = exports.asyncDeepMap = void 0;
4
+ const isObject = (value) => value && typeof value === 'object';
5
+ // Loads a deep structure of urls (objects and arrays of urls)
6
+ // Returns an object with six key-value pairs containing the images (or image mip arrays)
7
+ // for each cube face
8
+ async function asyncDeepMap(tree, func, options = {}) {
9
+ return await mapSubtree(tree, func, options);
10
+ }
11
+ exports.asyncDeepMap = asyncDeepMap;
12
+ async function mapSubtree(object, func, options) {
13
+ if (Array.isArray(object)) {
14
+ return await mapArray(object, func, options);
15
+ }
16
+ if (isObject(object)) {
17
+ return await mapObject(object, func, options);
18
+ }
19
+ // TODO - ignore non-urls, non-arraybuffers?
20
+ const url = object;
21
+ return await func(url, options);
22
+ }
23
+ exports.mapSubtree = mapSubtree;
24
+ // HELPERS
25
+ async function mapObject(object, func, options) {
26
+ const promises = [];
27
+ const values = {};
28
+ for (const key in object) {
29
+ const url = object[key];
30
+ const promise = mapSubtree(url, func, options).then((value) => {
31
+ values[key] = value;
32
+ });
33
+ promises.push(promise);
34
+ }
35
+ await Promise.all(promises);
36
+ return values;
37
+ }
38
+ async function mapArray(urlArray, func, options = {}) {
39
+ const promises = urlArray.map((url) => mapSubtree(url, func, options));
40
+ return await Promise.all(promises);
41
+ }
@@ -0,0 +1,5 @@
1
+ export declare type LoadOptions = Record<string, any>;
2
+ export declare type Load = (data: ArrayBuffer, options: Record<string, any>) => Promise<any>;
3
+ export declare function deepLoad(urlTree: unknown, load: Load, options: LoadOptions): Promise<unknown>;
4
+ export declare function shallowLoad(url: string, load: Load, options: LoadOptions): Promise<any>;
5
+ //# sourceMappingURL=deep-load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deep-load.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/deep-load.ts"],"names":[],"mappings":"AAGA,oBAAY,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC9C,oBAAY,IAAI,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAErF,wBAAsB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,oBAEhF;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAK7F"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shallowLoad = exports.deepLoad = void 0;
4
+ // loaders.gl, MIT license
5
+ const async_deep_map_1 = require("./async-deep-map");
6
+ async function deepLoad(urlTree, load, options) {
7
+ return await (0, async_deep_map_1.asyncDeepMap)(urlTree, (url) => shallowLoad(url, load, options));
8
+ }
9
+ exports.deepLoad = deepLoad;
10
+ async function shallowLoad(url, load, options) {
11
+ // console.error('loading', url);
12
+ const response = await fetch(url, options.fetch);
13
+ const arrayBuffer = await response.arrayBuffer();
14
+ return await load(arrayBuffer, options);
15
+ }
16
+ exports.shallowLoad = shallowLoad;
@@ -0,0 +1,3 @@
1
+ import type { GetUrl, UrlOptions } from './texture-api-types';
2
+ export declare function generateUrl(getUrl: string | GetUrl, options: UrlOptions, urlOptions: Record<string, any>): string;
3
+ //# sourceMappingURL=generate-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-url.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/generate-url.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAG5D,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC9B,MAAM,CAWR"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateUrl = void 0;
4
+ // loaders.gl, MIT license
5
+ const loader_utils_1 = require("@loaders.gl/loader-utils");
6
+ // Generate a url by calling getUrl with mix of options, applying options.baseUrl
7
+ function generateUrl(getUrl, options, urlOptions) {
8
+ // Get url
9
+ let url = typeof getUrl === 'function' ? getUrl({ ...options, ...urlOptions }) : getUrl;
10
+ // Apply options.baseUrl
11
+ const baseUrl = options.baseUrl;
12
+ if (baseUrl) {
13
+ url = baseUrl[baseUrl.length - 1] === '/' ? `${baseUrl}${url}` : `${baseUrl}/${url}`;
14
+ }
15
+ return (0, loader_utils_1.resolvePath)(url);
16
+ }
17
+ exports.generateUrl = generateUrl;
@@ -0,0 +1,4 @@
1
+ import type { GetUrl } from './texture-api-types';
2
+ export declare function loadImageTextureArray(count: number, getUrl: GetUrl, options?: {}): Promise<any>;
3
+ export declare function getImageArrayUrls(count: number, getUrl: GetUrl, options?: {}): Promise<any>;
4
+ //# sourceMappingURL=load-image-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-image-array.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/load-image-array.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAIhD,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,KAAK,GACX,OAAO,CAAC,GAAG,CAAC,CAGd;AAED,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAOjG"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getImageArrayUrls = exports.loadImageTextureArray = void 0;
4
+ // loaders.gl, MIT license
5
+ const images_1 = require("@loaders.gl/images");
6
+ const load_image_1 = require("./load-image");
7
+ const deep_load_1 = require("./deep-load");
8
+ async function loadImageTextureArray(count, getUrl, options = {}) {
9
+ const imageUrls = await getImageArrayUrls(count, getUrl, options);
10
+ return await (0, deep_load_1.deepLoad)(imageUrls, images_1.ImageLoader.parse, options);
11
+ }
12
+ exports.loadImageTextureArray = loadImageTextureArray;
13
+ async function getImageArrayUrls(count, getUrl, options = {}) {
14
+ const promises = [];
15
+ for (let index = 0; index < count; index++) {
16
+ const promise = (0, load_image_1.getImageUrls)(getUrl, options, { index });
17
+ promises.push(promise);
18
+ }
19
+ return await Promise.all(promises);
20
+ }
21
+ exports.getImageArrayUrls = getImageArrayUrls;
@@ -0,0 +1,12 @@
1
+ import type { GetUrl, UrlOptions } from './texture-api-types';
2
+ export declare type ImageCubeTexture = {
3
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X: any;
4
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_X: any;
5
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Y: any;
6
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: any;
7
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Z: any;
8
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: any;
9
+ };
10
+ export declare function getImageCubeUrls(getUrl: GetUrl, options: UrlOptions): Promise<Record<number, string | string[]>>;
11
+ export declare function loadImageTextureCube(getUrl: GetUrl, options?: {}): Promise<ImageCubeTexture>;
12
+ //# sourceMappingURL=load-image-cube.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-image-cube.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/load-image-cube.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAqB5D,oBAAY,gBAAgB,GAAG;IAC7B,8BAA8B,EAAE,GAAG,CAAC;IACpC,8BAA8B,EAAE,GAAG,CAAC;IACpC,8BAA8B,EAAE,GAAG,CAAC;IACpC,8BAA8B,EAAE,GAAG,CAAC;IACpC,8BAA8B,EAAE,GAAG,CAAC;IACpC,8BAA8B,EAAE,GAAG,CAAC;CACrC,CAAC;AAIF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,8CAiBzE;AAID,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,OAAO,KAAK,GACX,OAAO,CAAC,gBAAgB,CAAC,CAG3B"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadImageTextureCube = exports.getImageCubeUrls = void 0;
4
+ // loaders.gl, MIT license
5
+ const images_1 = require("@loaders.gl/images");
6
+ const load_image_1 = require("./load-image");
7
+ const deep_load_1 = require("./deep-load");
8
+ // Returned map will be have keys corresponding to GL cubemap constants
9
+ const GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
10
+ const GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
11
+ const GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
12
+ const GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
13
+ const GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
14
+ const GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851a;
15
+ const CUBE_FACES = [
16
+ { face: GL_TEXTURE_CUBE_MAP_POSITIVE_X, direction: 'right', axis: 'x', sign: 'positive' },
17
+ { face: GL_TEXTURE_CUBE_MAP_NEGATIVE_X, direction: 'left', axis: 'x', sign: 'negative' },
18
+ { face: GL_TEXTURE_CUBE_MAP_POSITIVE_Y, direction: 'top', axis: 'y', sign: 'positive' },
19
+ { face: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, direction: 'bottom', axis: 'y', sign: 'negative' },
20
+ { face: GL_TEXTURE_CUBE_MAP_POSITIVE_Z, direction: 'front', axis: 'z', sign: 'positive' },
21
+ { face: GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, direction: 'back', axis: 'z', sign: 'negative' }
22
+ ];
23
+ // Returns an object with six key-value pairs containing the urls (or url mip arrays)
24
+ // for each cube face
25
+ async function getImageCubeUrls(getUrl, options) {
26
+ // Calculate URLs
27
+ const urls = {};
28
+ const promises = [];
29
+ let index = 0;
30
+ for (let i = 0; i < CUBE_FACES.length; ++i) {
31
+ const face = CUBE_FACES[index];
32
+ const promise = (0, load_image_1.getImageUrls)(getUrl, options, { ...face, index: index++ }).then((url) => {
33
+ urls[face.face] = url;
34
+ });
35
+ promises.push(promise);
36
+ }
37
+ await Promise.all(promises);
38
+ return urls;
39
+ }
40
+ exports.getImageCubeUrls = getImageCubeUrls;
41
+ // Returns an object with six key-value pairs containing the images (or image mip arrays)
42
+ // for each cube face
43
+ async function loadImageTextureCube(getUrl, options = {}) {
44
+ const urls = await getImageCubeUrls(getUrl, options);
45
+ return (await (0, deep_load_1.deepLoad)(urls, images_1.ImageLoader.parse, options));
46
+ }
47
+ exports.loadImageTextureCube = loadImageTextureCube;
@@ -0,0 +1,8 @@
1
+ import type { GetUrl, UrlOptions } from './texture-api-types';
2
+ export declare function loadImageTexture(getUrl: string | GetUrl, options?: {}): Promise<any>;
3
+ export declare function getImageUrls(getUrl: string | GetUrl, options: any, urlOptions?: UrlOptions): Promise<any>;
4
+ export declare function getMipLevels(size: {
5
+ width: number;
6
+ height: number;
7
+ }): number;
8
+ //# sourceMappingURL=load-image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-image.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/load-image.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAI5D,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAG1F;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,EAAE,GAAG,EACZ,UAAU,GAAE,UAAe,GAC1B,OAAO,CAAC,GAAG,CAAC,CAKd;AAkCD,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,GAAG,MAAM,CAE1E"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMipLevels = exports.getImageUrls = exports.loadImageTexture = void 0;
4
+ const loader_utils_1 = require("@loaders.gl/loader-utils");
5
+ const images_1 = require("@loaders.gl/images");
6
+ const generate_url_1 = require("./generate-url");
7
+ const deep_load_1 = require("./deep-load");
8
+ async function loadImageTexture(getUrl, options = {}) {
9
+ const imageUrls = await getImageUrls(getUrl, options);
10
+ return await (0, deep_load_1.deepLoad)(imageUrls, images_1.ImageLoader.parse, options);
11
+ }
12
+ exports.loadImageTexture = loadImageTexture;
13
+ async function getImageUrls(getUrl, options, urlOptions = {}) {
14
+ const mipLevels = (options && options.image && options.image.mipLevels) || 0;
15
+ return mipLevels !== 0
16
+ ? await getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions)
17
+ : (0, generate_url_1.generateUrl)(getUrl, options, urlOptions);
18
+ }
19
+ exports.getImageUrls = getImageUrls;
20
+ async function getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions) {
21
+ const urls = [];
22
+ // If no mip levels supplied, we need to load the level 0 image and calculate based on size
23
+ if (mipLevels === 'auto') {
24
+ const url = (0, generate_url_1.generateUrl)(getUrl, options, { ...urlOptions, lod: 0 });
25
+ const image = await (0, deep_load_1.shallowLoad)(url, images_1.ImageLoader.parse, options);
26
+ const { width, height } = (0, images_1.getImageSize)(image);
27
+ mipLevels = getMipLevels({ width, height });
28
+ // TODO - push image and make `deepLoad` pass through non-url values, avoid loading twice?
29
+ urls.push(url);
30
+ }
31
+ // We now know how many mipLevels we need, remaining image urls can now be constructed
32
+ (0, loader_utils_1.assert)(mipLevels > 0);
33
+ for (let mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {
34
+ const url = (0, generate_url_1.generateUrl)(getUrl, options, { ...urlOptions, lod: mipLevel });
35
+ urls.push(url);
36
+ }
37
+ return urls;
38
+ }
39
+ // Calculates number of mipmaps based on texture size (log2)
40
+ function getMipLevels(size) {
41
+ return 1 + Math.floor(Math.log2(Math.max(size.width, size.height)));
42
+ }
43
+ exports.getMipLevels = getMipLevels;
@@ -0,0 +1,10 @@
1
+ export type { ImageType } from '@loaders.gl/images';
2
+ export declare type UrlOptions = {
3
+ baseUrl?: string;
4
+ index?: number;
5
+ face?: number;
6
+ lod?: number;
7
+ direction?: string;
8
+ };
9
+ export declare type GetUrl = (options: UrlOptions) => string;
10
+ //# sourceMappingURL=texture-api-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"texture-api-types.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/texture-api-types.ts"],"names":[],"mappings":"AAEA,YAAY,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAElD,oBAAY,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AACF,oBAAY,MAAM,GAAG,CAAC,OAAO,EAAE,UAAU,KAAK,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // loaders.gl, MIT license
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { CompressedTextureExtractOptions, TextureLevel } from '../../types';
2
+ /**
3
+ * Extract mipmap images from compressed texture buffer
4
+ * @param data - binary data of compressed texture or Array of level objects
5
+ * @param options.mipMapLevels - number of mipmap level inside image
6
+ * @param options.width - width of 0 - level
7
+ * @param options.height - height of 0 - level
8
+ * @param options.sizeFunction - format-related function to calculate level size in bytes
9
+ * @param options.internalFormat - WebGL compatible format code
10
+ * @returns Array of the texture levels
11
+ */
12
+ export declare function extractMipmapImages(data: Uint8Array | object[], options: CompressedTextureExtractOptions): TextureLevel[];
13
+ //# sourceMappingURL=extract-mipmap-images.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-mipmap-images.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/extract-mipmap-images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,+BAA+B,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAE1E;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,GAAG,MAAM,EAAE,EAC3B,OAAO,EAAE,+BAA+B,GACvC,YAAY,EAAE,CA4BhB"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractMipmapImages = void 0;
4
+ /**
5
+ * Extract mipmap images from compressed texture buffer
6
+ * @param data - binary data of compressed texture or Array of level objects
7
+ * @param options.mipMapLevels - number of mipmap level inside image
8
+ * @param options.width - width of 0 - level
9
+ * @param options.height - height of 0 - level
10
+ * @param options.sizeFunction - format-related function to calculate level size in bytes
11
+ * @param options.internalFormat - WebGL compatible format code
12
+ * @returns Array of the texture levels
13
+ */
14
+ function extractMipmapImages(data, options) {
15
+ const images = new Array(options.mipMapLevels);
16
+ let levelWidth = options.width;
17
+ let levelHeight = options.height;
18
+ let offset = 0;
19
+ for (let i = 0; i < options.mipMapLevels; ++i) {
20
+ // @ts-expect-error
21
+ const levelSize = getLevelSize(options, levelWidth, levelHeight, data, i);
22
+ // @ts-expect-error
23
+ const levelData = getLevelData(data, i, offset, levelSize);
24
+ images[i] = {
25
+ compressed: true,
26
+ format: options.internalFormat,
27
+ data: levelData,
28
+ width: levelWidth,
29
+ height: levelHeight,
30
+ levelSize
31
+ };
32
+ levelWidth = Math.max(1, levelWidth >> 1);
33
+ levelHeight = Math.max(1, levelHeight >> 1);
34
+ offset += levelSize;
35
+ }
36
+ return images;
37
+ }
38
+ exports.extractMipmapImages = extractMipmapImages;
39
+ function getLevelData(data, index, offset, levelSize) {
40
+ if (!Array.isArray(data)) {
41
+ return new Uint8Array(data.buffer, data.byteOffset + offset, levelSize);
42
+ }
43
+ return data[index].levelData;
44
+ }
45
+ function getLevelSize(options, levelWidth, levelHeight, data, index) {
46
+ if (!Array.isArray(data)) {
47
+ return options.sizeFunction(levelWidth, levelHeight);
48
+ }
49
+ return options.sizeFunction(data[index]);
50
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns WebGl format based on Vulkan format
3
+ * Vulkan to WebGl format mapping provided here http://github.khronos.org/KTX-Specification/#formatMapping
4
+ * Vulkan name to format number mapping provided here: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkFormat.html
5
+ * @param vkFormat
6
+ * @returns WebGL / OpenGL constant
7
+ */
8
+ export declare function mapVkFormatToWebGL(vkFormat: number): number;
9
+ //# sourceMappingURL=ktx-format-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ktx-format-helper.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/ktx-format-helper.ts"],"names":[],"mappings":"AAiHA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3D"}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapVkFormatToWebGL = void 0;
4
+ const gl_extensions_1 = require("../gl-extensions");
5
+ const VULKAN_TO_WEBGL_FORMAT_MAP = {
6
+ 131: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT,
7
+ 132: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_S3TC_DXT1_EXT,
8
+ 133: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT1_EXT,
9
+ 134: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
10
+ 135: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT,
11
+ 136: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
12
+ 137: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
13
+ 138: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
14
+ 139: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_RGTC1_EXT,
15
+ 140: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_RGTC1_EXT,
16
+ 141: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_GREEN_RGTC2_EXT,
17
+ 142: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
18
+ 147: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_ETC2,
19
+ 148: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ETC2,
20
+ 149: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
21
+ 150: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
22
+ 151: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA8_ETC2_EAC,
23
+ 152: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
24
+ 153: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_R11_EAC,
25
+ 154: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_R11_EAC,
26
+ 155: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC,
27
+ 156: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RG11_EAC,
28
+ // @ts-ignore
29
+ 157: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
30
+ // @ts-ignore
31
+ 158: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
32
+ // @ts-ignore
33
+ 159: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
34
+ // @ts-ignore
35
+ 160: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,
36
+ // @ts-ignore
37
+ 161: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
38
+ // @ts-ignore
39
+ 162: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
40
+ // @ts-ignore
41
+ 163: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
42
+ // @ts-ignore
43
+ 164: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
44
+ // @ts-ignore
45
+ 165: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
46
+ // @ts-ignore
47
+ 166: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
48
+ // @ts-ignore
49
+ 167: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
50
+ // @ts-ignore
51
+ 168: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
52
+ // @ts-ignore
53
+ 169: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
54
+ // @ts-ignore
55
+ 170: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
56
+ // @ts-ignore
57
+ 171: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
58
+ // @ts-ignore
59
+ 172: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
60
+ // @ts-ignore
61
+ 173: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
62
+ // @ts-ignore
63
+ 174: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
64
+ // @ts-ignore
65
+ 175: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
66
+ // @ts-ignore
67
+ 176: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
68
+ // @ts-ignore
69
+ 177: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
70
+ // @ts-ignore
71
+ 178: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
72
+ // @ts-ignore
73
+ 179: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
74
+ // @ts-ignore
75
+ 180: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
76
+ // @ts-ignore
77
+ 181: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
78
+ // @ts-ignore
79
+ 182: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
80
+ // @ts-ignore
81
+ 183: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR,
82
+ // @ts-ignore
83
+ 184: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
84
+ 1000054000: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
85
+ 1000054001: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
86
+ // @ts-ignore
87
+ 1000066000: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
88
+ // @ts-ignore
89
+ 1000066001: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
90
+ // @ts-ignore
91
+ 1000066002: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
92
+ // @ts-ignore
93
+ 1000066003: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
94
+ // @ts-ignore
95
+ 1000066004: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
96
+ // @ts-ignore
97
+ 1000066005: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
98
+ // @ts-ignore
99
+ 1000066006: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
100
+ // @ts-ignore
101
+ 1000066007: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
102
+ // @ts-ignore
103
+ 1000066008: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
104
+ // @ts-ignore
105
+ 1000066009: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
106
+ // @ts-ignore
107
+ 1000066010: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
108
+ // @ts-ignore
109
+ 1000066011: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
110
+ // @ts-ignore
111
+ 1000066012: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
112
+ // @ts-ignore
113
+ 1000066013: gl_extensions_1.GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR
114
+ };
115
+ /**
116
+ * Returns WebGl format based on Vulkan format
117
+ * Vulkan to WebGl format mapping provided here http://github.khronos.org/KTX-Specification/#formatMapping
118
+ * Vulkan name to format number mapping provided here: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkFormat.html
119
+ * @param vkFormat
120
+ * @returns WebGL / OpenGL constant
121
+ */
122
+ function mapVkFormatToWebGL(vkFormat) {
123
+ return VULKAN_TO_WEBGL_FORMAT_MAP[vkFormat];
124
+ }
125
+ exports.mapVkFormatToWebGL = mapVkFormatToWebGL;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns a list of formats.
3
+ * Creates a temporary WebGLRenderingContext if none is provided.
4
+ *
5
+ * @param gl - Optional context.
6
+ */
7
+ export declare function getSupportedGPUTextureFormats(gl?: WebGLRenderingContext): Set<string>;
8
+ //# sourceMappingURL=texture-formats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"texture-formats.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/texture-formats.ts"],"names":[],"mappings":"AAmBA;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,EAAE,CAAC,EAAE,qBAAqB,GAAG,GAAG,CAAC,MAAM,CAAC,CAiBrF"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSupportedGPUTextureFormats = void 0;
4
+ const BROWSER_PREFIXES = ['', 'WEBKIT_', 'MOZ_'];
5
+ const WEBGL_EXTENSIONS = {
6
+ /* eslint-disable camelcase */
7
+ WEBGL_compressed_texture_s3tc: 'dxt',
8
+ WEBGL_compressed_texture_s3tc_srgb: 'dxt-srgb',
9
+ WEBGL_compressed_texture_etc1: 'etc1',
10
+ WEBGL_compressed_texture_etc: 'etc2',
11
+ WEBGL_compressed_texture_pvrtc: 'pvrtc',
12
+ WEBGL_compressed_texture_atc: 'atc',
13
+ WEBGL_compressed_texture_astc: 'astc',
14
+ EXT_texture_compression_rgtc: 'rgtc'
15
+ /* eslint-enable camelcase */
16
+ };
17
+ let formats = null;
18
+ /**
19
+ * Returns a list of formats.
20
+ * Creates a temporary WebGLRenderingContext if none is provided.
21
+ *
22
+ * @param gl - Optional context.
23
+ */
24
+ function getSupportedGPUTextureFormats(gl) {
25
+ if (!formats) {
26
+ gl = gl || getWebGLContext() || undefined;
27
+ formats = new Set();
28
+ for (const prefix of BROWSER_PREFIXES) {
29
+ for (const extension in WEBGL_EXTENSIONS) {
30
+ if (gl && gl.getExtension(`${prefix}${extension}`)) {
31
+ const gpuTextureFormat = WEBGL_EXTENSIONS[extension];
32
+ formats.add(gpuTextureFormat);
33
+ }
34
+ }
35
+ }
36
+ }
37
+ return formats;
38
+ }
39
+ exports.getSupportedGPUTextureFormats = getSupportedGPUTextureFormats;
40
+ /**
41
+ * @returns {WebGLRenderingContext?}
42
+ */
43
+ function getWebGLContext() {
44
+ try {
45
+ const canvas = document.createElement('canvas');
46
+ return canvas.getContext('webgl');
47
+ }
48
+ catch (error) {
49
+ return null;
50
+ }
51
+ }
@@ -0,0 +1,2 @@
1
+ export declare const VERSION: any;
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,KAA4D,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VERSION = void 0;
4
+ // Version constant cannot be imported, it needs to correspond to the build version of **this** module.
5
+ // __VERSION__ is injected by babel-plugin-version-inline
6
+ // TODO: use 'latest' instead of 'beta' when 3.0.0 version is released as 'latest'
7
+ // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
+ exports.VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
@@ -1,6 +1,6 @@
1
- # Basis decoder
1
+ # Basis transcoder/encoder
2
2
 
3
- Version 1.12
3
+ Version 1.15
4
4
 
5
5
  [Website](https://github.com/BinomialLLC/basis_universal)
6
6
 
@@ -1,4 +1,4 @@
1
-
1
+ // @ts-nocheck
2
2
  var BASIS = (function() {
3
3
  var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
4
4
  if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
@@ -1,4 +1,4 @@
1
-
1
+ // @ts-nocheck
2
2
  var BASIS = (function () {
3
3
  var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
4
4
  if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  // Shim to provide workers a usable "window" object.
2
3
  window = this;
3
4