@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
@@ -1,3 +1,4 @@
1
+ // loaders.gl, MIT license
1
2
  /*
2
3
  Asynchronously maps a deep structure of values (e.g. objects and arrays of urls).
3
4
 
@@ -13,35 +14,41 @@ E.g. a mipmapped cubemap
13
14
  ]
14
15
  }
15
16
  */
17
+ export type Options = Record<string, any>;
18
+ export type Func = (url: string, options: Options) => unknown;
16
19
 
17
- const isObject = (value) => value && typeof value === 'object';
20
+ const isObject = (value: any): boolean => value && typeof value === 'object';
18
21
 
19
22
  // Loads a deep structure of urls (objects and arrays of urls)
20
23
  // Returns an object with six key-value pairs containing the images (or image mip arrays)
21
24
  // for each cube face
22
- export async function asyncDeepMap(tree, func, options = {}) {
25
+ export async function asyncDeepMap(tree: unknown, func: Func, options: Options = {}) {
23
26
  return await mapSubtree(tree, func, options);
24
27
  }
25
28
 
26
- export async function mapSubtree(object, func, options) {
29
+ export async function mapSubtree(object: unknown, func: Func, options: Options) {
27
30
  if (Array.isArray(object)) {
28
31
  return await mapArray(object, func, options);
29
32
  }
30
33
 
31
34
  if (isObject(object)) {
32
- return await mapObject(object, func, options);
35
+ return await mapObject(object as object, func, options);
33
36
  }
34
37
 
35
38
  // TODO - ignore non-urls, non-arraybuffers?
36
- const url = object;
39
+ const url = object as string;
37
40
  return await func(url, options);
38
41
  }
39
42
 
40
43
  // HELPERS
41
44
 
42
- async function mapObject(object, func, options) {
45
+ async function mapObject(
46
+ object: Record<string, any>,
47
+ func: Func,
48
+ options: Options
49
+ ): Promise<Record<string, any>> {
43
50
  const promises: Promise<any>[] = [];
44
- const values = {};
51
+ const values: Record<string, any> = {};
45
52
 
46
53
  for (const key in object) {
47
54
  const url = object[key];
@@ -56,7 +63,7 @@ async function mapObject(object, func, options) {
56
63
  return values;
57
64
  }
58
65
 
59
- async function mapArray(urlArray, func, options = {}) {
66
+ async function mapArray(urlArray: string[], func: Func, options = {}): Promise<any[]> {
60
67
  const promises = urlArray.map((url) => mapSubtree(url, func, options));
61
68
  return await Promise.all(promises);
62
69
  }
@@ -1,10 +1,14 @@
1
+ // loaders.gl, MIT license
1
2
  import {asyncDeepMap} from './async-deep-map';
2
3
 
3
- export async function deepLoad(urlTree, load, options) {
4
- return await asyncDeepMap(urlTree, (url) => shallowLoad(url, load, options));
4
+ export type LoadOptions = Record<string, any>;
5
+ export type Load = (data: ArrayBuffer, options: Record<string, any>) => Promise<any>;
6
+
7
+ export async function deepLoad(urlTree: unknown, load: Load, options: LoadOptions) {
8
+ return await asyncDeepMap(urlTree, (url: string) => shallowLoad(url, load, options));
5
9
  }
6
10
 
7
- export async function shallowLoad(url, load, options) {
11
+ export async function shallowLoad(url: string, load: Load, options: LoadOptions): Promise<any> {
8
12
  // console.error('loading', url);
9
13
  const response = await fetch(url, options.fetch);
10
14
  const arrayBuffer = await response.arrayBuffer();
@@ -1,16 +1,18 @@
1
- import {resolvePath, assert} from '@loaders.gl/loader-utils';
1
+ // loaders.gl, MIT license
2
+ import {resolvePath} from '@loaders.gl/loader-utils';
3
+ import type {GetUrl, UrlOptions} from './texture-api-types';
2
4
 
3
5
  // Generate a url by calling getUrl with mix of options, applying options.baseUrl
4
- export function generateUrl(getUrl, options, urlOptions) {
6
+ export function generateUrl(
7
+ getUrl: string | GetUrl,
8
+ options: UrlOptions,
9
+ urlOptions: Record<string, any>
10
+ ): string {
5
11
  // Get url
6
- let url = getUrl;
7
- if (typeof getUrl === 'function') {
8
- url = getUrl({...options, ...urlOptions});
9
- }
10
- assert(typeof url === 'string');
12
+ let url = typeof getUrl === 'function' ? getUrl({...options, ...urlOptions}) : getUrl;
11
13
 
12
14
  // Apply options.baseUrl
13
- const {baseUrl} = options;
15
+ const baseUrl = options.baseUrl;
14
16
  if (baseUrl) {
15
17
  url = baseUrl[baseUrl.length - 1] === '/' ? `${baseUrl}${url}` : `${baseUrl}/${url}`;
16
18
  }
@@ -1,13 +1,19 @@
1
+ // loaders.gl, MIT license
1
2
  import {ImageLoader} from '@loaders.gl/images';
3
+ import type {GetUrl} from './texture-api-types';
2
4
  import {getImageUrls} from './load-image';
3
5
  import {deepLoad} from './deep-load';
4
6
 
5
- export async function loadImageTextureArray(count, getUrl, options = {}) {
7
+ export async function loadImageTextureArray(
8
+ count: number,
9
+ getUrl: GetUrl,
10
+ options = {}
11
+ ): Promise<any> {
6
12
  const imageUrls = await getImageArrayUrls(count, getUrl, options);
7
13
  return await deepLoad(imageUrls, ImageLoader.parse, options);
8
14
  }
9
15
 
10
- export async function getImageArrayUrls(count, getUrl, options = {}) {
16
+ export async function getImageArrayUrls(count: number, getUrl: GetUrl, options = {}): Promise<any> {
11
17
  const promises: Promise<any>[] = [];
12
18
  for (let index = 0; index < count; index++) {
13
19
  const promise = getImageUrls(getUrl, options, {index});
@@ -1,4 +1,6 @@
1
+ // loaders.gl, MIT license
1
2
  import {ImageLoader} from '@loaders.gl/images';
3
+ import type {GetUrl, UrlOptions} from './texture-api-types';
2
4
  import {getImageUrls} from './load-image';
3
5
  import {deepLoad} from './deep-load';
4
6
 
@@ -19,11 +21,20 @@ const CUBE_FACES = [
19
21
  {face: GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, direction: 'back', axis: 'z', sign: 'negative'}
20
22
  ];
21
23
 
24
+ export type ImageCubeTexture = {
25
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X: any;
26
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_X: any;
27
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Y: any;
28
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: any;
29
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Z: any;
30
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: any;
31
+ };
32
+
22
33
  // Returns an object with six key-value pairs containing the urls (or url mip arrays)
23
34
  // for each cube face
24
- export async function getImageCubeUrls(getUrl, options) {
35
+ export async function getImageCubeUrls(getUrl: GetUrl, options: UrlOptions) {
25
36
  // Calculate URLs
26
- const urls = {};
37
+ const urls: Record<number, string | string[]> = {};
27
38
  const promises: Promise<any>[] = [];
28
39
 
29
40
  let index = 0;
@@ -42,7 +53,10 @@ export async function getImageCubeUrls(getUrl, options) {
42
53
 
43
54
  // Returns an object with six key-value pairs containing the images (or image mip arrays)
44
55
  // for each cube face
45
- export async function loadImageTextureCube(getUrl, options = {}) {
56
+ export async function loadImageTextureCube(
57
+ getUrl: GetUrl,
58
+ options = {}
59
+ ): Promise<ImageCubeTexture> {
46
60
  const urls = await getImageCubeUrls(getUrl, options);
47
- return await deepLoad(urls, ImageLoader.parse, options);
61
+ return (await deepLoad(urls, ImageLoader.parse, options)) as ImageCubeTexture;
48
62
  }
@@ -1,21 +1,31 @@
1
1
  import {assert} from '@loaders.gl/loader-utils';
2
2
  import {ImageLoader, getImageSize} from '@loaders.gl/images';
3
+ import type {GetUrl, UrlOptions} from './texture-api-types';
3
4
  import {generateUrl} from './generate-url';
4
5
  import {deepLoad, shallowLoad} from './deep-load';
5
6
 
6
- export async function loadImageTexture(getUrl, options = {}) {
7
+ export async function loadImageTexture(getUrl: string | GetUrl, options = {}): Promise<any> {
7
8
  const imageUrls = await getImageUrls(getUrl, options);
8
9
  return await deepLoad(imageUrls, ImageLoader.parse, options);
9
10
  }
10
11
 
11
- export async function getImageUrls(getUrl, options, urlOptions = {}) {
12
+ export async function getImageUrls(
13
+ getUrl: string | GetUrl,
14
+ options: any,
15
+ urlOptions: UrlOptions = {}
16
+ ): Promise<any> {
12
17
  const mipLevels = (options && options.image && options.image.mipLevels) || 0;
13
18
  return mipLevels !== 0
14
19
  ? await getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions)
15
20
  : generateUrl(getUrl, options, urlOptions);
16
21
  }
17
22
 
18
- async function getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions): Promise<string[]> {
23
+ async function getMipmappedImageUrls(
24
+ getUrl: string | GetUrl,
25
+ mipLevels: number | 'auto',
26
+ options: any,
27
+ urlOptions: UrlOptions
28
+ ): Promise<string[]> {
19
29
  const urls: string[] = [];
20
30
 
21
31
  // If no mip levels supplied, we need to load the level 0 image and calculate based on size
@@ -42,6 +52,6 @@ async function getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions): Pr
42
52
  }
43
53
 
44
54
  // Calculates number of mipmaps based on texture size (log2)
45
- export function getMipLevels({width, height}) {
46
- return 1 + Math.floor(Math.log2(Math.max(width, height)));
55
+ export function getMipLevels(size: {width: number; height: number}): number {
56
+ return 1 + Math.floor(Math.log2(Math.max(size.width, size.height)));
47
57
  }
@@ -0,0 +1,12 @@
1
+ // loaders.gl, MIT license
2
+
3
+ export type {ImageType} from '@loaders.gl/images';
4
+
5
+ export type UrlOptions = {
6
+ baseUrl?: string;
7
+ index?: number;
8
+ face?: number;
9
+ lod?: number;
10
+ direction?: string;
11
+ };
12
+ export type GetUrl = (options: UrlOptions) => string;
@@ -11,7 +11,7 @@ import {CompressedTextureExtractOptions, TextureLevel} from '../../types';
11
11
  * @returns Array of the texture levels
12
12
  */
13
13
  export function extractMipmapImages(
14
- data: Uint8Array | Array<Object>,
14
+ data: Uint8Array | object[],
15
15
  options: CompressedTextureExtractOptions
16
16
  ): TextureLevel[] {
17
17
  const images = new Array(options.mipMapLevels);
@@ -21,7 +21,9 @@ export function extractMipmapImages(
21
21
  let offset = 0;
22
22
 
23
23
  for (let i = 0; i < options.mipMapLevels; ++i) {
24
+ // @ts-expect-error
24
25
  const levelSize = getLevelSize(options, levelWidth, levelHeight, data, i);
26
+ // @ts-expect-error
25
27
  const levelData = getLevelData(data, i, offset, levelSize);
26
28
 
27
29
  images[i] = {
@@ -41,7 +43,12 @@ export function extractMipmapImages(
41
43
  return images;
42
44
  }
43
45
 
44
- function getLevelData(data, index, offset, levelSize) {
46
+ function getLevelData(
47
+ data: Uint8Array,
48
+ index: number,
49
+ offset: number,
50
+ levelSize: number
51
+ ): Uint8Array {
45
52
  if (!Array.isArray(data)) {
46
53
  return new Uint8Array(data.buffer, data.byteOffset + offset, levelSize);
47
54
  }
@@ -49,7 +56,13 @@ function getLevelData(data, index, offset, levelSize) {
49
56
  return data[index].levelData;
50
57
  }
51
58
 
52
- function getLevelSize(options, levelWidth, levelHeight, data, index) {
59
+ function getLevelSize(
60
+ options: CompressedTextureExtractOptions,
61
+ levelWidth: number,
62
+ levelHeight: number,
63
+ data: Uint8Array[] | object[],
64
+ index: number
65
+ ): number {
53
66
  if (!Array.isArray(data)) {
54
67
  return options.sizeFunction(levelWidth, levelHeight);
55
68
  }
@@ -1,123 +1,123 @@
1
- import {GL} from '../gl-constants';
1
+ import {GL_EXTENSIONS_CONSTANTS} from '../gl-extensions';
2
2
 
3
- const VULKAN_TO_WEBGL_FORMAT_MAP = {
4
- 131: GL.COMPRESSED_RGB_S3TC_DXT1_EXT,
5
- 132: GL.COMPRESSED_SRGB_S3TC_DXT1_EXT,
6
- 133: GL.COMPRESSED_RGBA_S3TC_DXT1_EXT,
7
- 134: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
8
- 135: GL.COMPRESSED_RGBA_S3TC_DXT3_EXT,
9
- 136: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
10
- 137: GL.COMPRESSED_RGBA_S3TC_DXT5_EXT,
11
- 138: GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
12
- 139: GL.COMPRESSED_RED_RGTC1_EXT,
13
- 140: GL.COMPRESSED_SIGNED_RED_RGTC1_EXT,
14
- 141: GL.COMPRESSED_RED_GREEN_RGTC2_EXT,
15
- 142: GL.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
16
- 147: GL.COMPRESSED_RGB8_ETC2,
17
- 148: GL.COMPRESSED_SRGB8_ETC2,
18
- 149: GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
19
- 150: GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
20
- 151: GL.COMPRESSED_RGBA8_ETC2_EAC,
21
- 152: GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
22
- 153: GL.COMPRESSED_R11_EAC,
23
- 154: GL.COMPRESSED_SIGNED_R11_EAC,
24
- 155: GL.COMPRESSED_RG11_EAC,
25
- 156: GL.COMPRESSED_SIGNED_RG11_EAC,
3
+ const VULKAN_TO_WEBGL_FORMAT_MAP: Record<number, number> = {
4
+ 131: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT,
5
+ 132: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_S3TC_DXT1_EXT,
6
+ 133: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT1_EXT,
7
+ 134: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
8
+ 135: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT3_EXT,
9
+ 136: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
10
+ 137: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
11
+ 138: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
12
+ 139: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_RGTC1_EXT,
13
+ 140: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_RGTC1_EXT,
14
+ 141: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RED_GREEN_RGTC2_EXT,
15
+ 142: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
16
+ 147: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_ETC2,
17
+ 148: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ETC2,
18
+ 149: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
19
+ 150: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
20
+ 151: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA8_ETC2_EAC,
21
+ 152: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
22
+ 153: GL_EXTENSIONS_CONSTANTS.COMPRESSED_R11_EAC,
23
+ 154: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_R11_EAC,
24
+ 155: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RG11_EAC,
25
+ 156: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SIGNED_RG11_EAC,
26
26
  // @ts-ignore
27
- 157: GL.COMPRESSED_RGBA_ASTC_4x4_KHR,
27
+ 157: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
28
28
  // @ts-ignore
29
- 158: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
29
+ 158: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
30
30
  // @ts-ignore
31
- 159: GL.COMPRESSED_RGBA_ASTC_5x4_KHR,
31
+ 159: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
32
32
  // @ts-ignore
33
- 160: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,
33
+ 160: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,
34
34
  // @ts-ignore
35
- 161: GL.COMPRESSED_RGBA_ASTC_5x5_KHR,
35
+ 161: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
36
36
  // @ts-ignore
37
- 162: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
37
+ 162: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
38
38
  // @ts-ignore
39
- 163: GL.COMPRESSED_RGBA_ASTC_6x5_KHR,
39
+ 163: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
40
40
  // @ts-ignore
41
- 164: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
41
+ 164: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
42
42
  // @ts-ignore
43
- 165: GL.COMPRESSED_RGBA_ASTC_6x6_KHR,
43
+ 165: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
44
44
  // @ts-ignore
45
- 166: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
45
+ 166: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
46
46
  // @ts-ignore
47
- 167: GL.COMPRESSED_RGBA_ASTC_8x5_KHR,
47
+ 167: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
48
48
  // @ts-ignore
49
- 168: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
49
+ 168: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
50
50
  // @ts-ignore
51
- 169: GL.COMPRESSED_RGBA_ASTC_8x6_KHR,
51
+ 169: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
52
52
  // @ts-ignore
53
- 170: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
53
+ 170: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
54
54
  // @ts-ignore
55
- 171: GL.COMPRESSED_RGBA_ASTC_8x8_KHR,
55
+ 171: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
56
56
  // @ts-ignore
57
- 172: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
57
+ 172: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
58
58
  // @ts-ignore
59
- 173: GL.COMPRESSED_RGBA_ASTC_10x5_KHR,
59
+ 173: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
60
60
  // @ts-ignore
61
- 174: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
61
+ 174: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
62
62
  // @ts-ignore
63
- 175: GL.COMPRESSED_RGBA_ASTC_10x6_KHR,
63
+ 175: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
64
64
  // @ts-ignore
65
- 176: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
65
+ 176: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
66
66
  // @ts-ignore
67
- 177: GL.COMPRESSED_RGBA_ASTC_10x8_KHR,
67
+ 177: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
68
68
  // @ts-ignore
69
- 178: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
69
+ 178: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
70
70
  // @ts-ignore
71
- 179: GL.COMPRESSED_RGBA_ASTC_10x10_KHR,
71
+ 179: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
72
72
  // @ts-ignore
73
- 180: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
73
+ 180: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
74
74
  // @ts-ignore
75
- 181: GL.COMPRESSED_RGBA_ASTC_12x10_KHR,
75
+ 181: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
76
76
  // @ts-ignore
77
- 182: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
77
+ 182: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
78
78
  // @ts-ignore
79
- 183: GL.COMPRESSED_RGBA_ASTC_12x12_KHR,
79
+ 183: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR,
80
80
  // @ts-ignore
81
- 184: GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
82
- 1000054000: GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
83
- 1000054001: GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
81
+ 184: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
82
+ 1000054000: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
83
+ 1000054001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
84
84
  // @ts-ignore
85
- 1000066000: GL.COMPRESSED_RGBA_ASTC_4x4_KHR,
85
+ 1000066000: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
86
86
  // @ts-ignore
87
- 1000066001: GL.COMPRESSED_RGBA_ASTC_5x4_KHR,
87
+ 1000066001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
88
88
  // @ts-ignore
89
- 1000066002: GL.COMPRESSED_RGBA_ASTC_5x5_KHR,
89
+ 1000066002: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
90
90
  // @ts-ignore
91
- 1000066003: GL.COMPRESSED_RGBA_ASTC_6x5_KHR,
91
+ 1000066003: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
92
92
  // @ts-ignore
93
- 1000066004: GL.COMPRESSED_RGBA_ASTC_6x6_KHR,
93
+ 1000066004: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
94
94
  // @ts-ignore
95
- 1000066005: GL.COMPRESSED_RGBA_ASTC_8x5_KHR,
95
+ 1000066005: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
96
96
  // @ts-ignore
97
- 1000066006: GL.COMPRESSED_RGBA_ASTC_8x6_KHR,
97
+ 1000066006: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
98
98
  // @ts-ignore
99
- 1000066007: GL.COMPRESSED_RGBA_ASTC_8x8_KHR,
99
+ 1000066007: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
100
100
  // @ts-ignore
101
- 1000066008: GL.COMPRESSED_RGBA_ASTC_10x5_KHR,
101
+ 1000066008: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
102
102
  // @ts-ignore
103
- 1000066009: GL.COMPRESSED_RGBA_ASTC_10x6_KHR,
103
+ 1000066009: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
104
104
  // @ts-ignore
105
- 1000066010: GL.COMPRESSED_RGBA_ASTC_10x8_KHR,
105
+ 1000066010: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
106
106
  // @ts-ignore
107
- 1000066011: GL.COMPRESSED_RGBA_ASTC_10x10_KHR,
107
+ 1000066011: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
108
108
  // @ts-ignore
109
- 1000066012: GL.COMPRESSED_RGBA_ASTC_12x10_KHR,
109
+ 1000066012: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
110
110
  // @ts-ignore
111
- 1000066013: GL.COMPRESSED_RGBA_ASTC_12x12_KHR
111
+ 1000066013: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR
112
112
  };
113
113
 
114
114
  /**
115
115
  * Returns WebGl format based on Vulkan format
116
116
  * Vulkan to WebGl format mapping provided here http://github.khronos.org/KTX-Specification/#formatMapping
117
117
  * Vulkan name to format number mapping provided here: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkFormat.html
118
- * @param {Number} vkFormat
119
- * @returns {Number}
118
+ * @param vkFormat
119
+ * @returns WebGL / OpenGL constant
120
120
  */
121
- export function mapVkFormatToWebGL(vkFormat) {
121
+ export function mapVkFormatToWebGL(vkFormat: number): number {
122
122
  return VULKAN_TO_WEBGL_FORMAT_MAP[vkFormat];
123
123
  }
@@ -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
 
package/src/npy-loader.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';
1
+ import type {Loader, LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
2
2
  import {VERSION} from './lib/utils/version';
3
3
  import {parseNPY} from './lib/parsers/parse-npy';
4
4
 
@@ -28,7 +28,7 @@ export const NPYWorkerLoader = {
28
28
  export const NPYLoader = {
29
29
  ...NPYWorkerLoader,
30
30
  parseSync: parseNPY,
31
- parse: async (arrayBuffer, options) => parseNPY(arrayBuffer, options)
31
+ parse: async (arrayBuffer: ArrayBuffer, options?: LoaderOptions) => parseNPY(arrayBuffer, options)
32
32
  };
33
33
 
34
34
  // TYPE TESTS - TODO find a better way than exporting junk