@luma.gl/core 9.0.17 → 9.1.0-alpha.10

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 (248) hide show
  1. package/dist/adapter/adapter.d.ts +11 -0
  2. package/dist/adapter/adapter.d.ts.map +1 -0
  3. package/dist/adapter/adapter.js +8 -0
  4. package/dist/adapter/canvas-context.d.ts +5 -0
  5. package/dist/adapter/canvas-context.d.ts.map +1 -1
  6. package/dist/adapter/device.d.ts +23 -11
  7. package/dist/adapter/device.d.ts.map +1 -1
  8. package/dist/adapter/device.js +22 -20
  9. package/dist/adapter/luma.d.ts +70 -0
  10. package/dist/adapter/luma.d.ts.map +1 -0
  11. package/dist/adapter/luma.js +159 -0
  12. package/dist/adapter/resources/buffer.js +5 -5
  13. package/dist/adapter/resources/compute-pipeline.d.ts +2 -0
  14. package/dist/adapter/resources/compute-pipeline.d.ts.map +1 -1
  15. package/dist/adapter/resources/compute-pipeline.js +3 -0
  16. package/dist/adapter/resources/external-texture.d.ts +1 -1
  17. package/dist/adapter/resources/external-texture.d.ts.map +1 -1
  18. package/dist/adapter/resources/external-texture.js +1 -1
  19. package/dist/adapter/resources/framebuffer.d.ts +3 -3
  20. package/dist/adapter/resources/framebuffer.d.ts.map +1 -1
  21. package/dist/adapter/resources/framebuffer.js +2 -83
  22. package/dist/adapter/resources/render-pass.d.ts +2 -2
  23. package/dist/adapter/resources/render-pass.d.ts.map +1 -1
  24. package/dist/adapter/resources/render-pipeline.d.ts +2 -5
  25. package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
  26. package/dist/adapter/resources/resource.d.ts +3 -3
  27. package/dist/adapter/resources/resource.d.ts.map +1 -1
  28. package/dist/adapter/resources/resource.js +1 -1
  29. package/dist/adapter/resources/shader.d.ts +5 -2
  30. package/dist/adapter/resources/shader.d.ts.map +1 -1
  31. package/dist/adapter/resources/shader.js +15 -9
  32. package/dist/adapter/resources/texture-view.d.ts +1 -1
  33. package/dist/adapter/resources/texture-view.d.ts.map +1 -1
  34. package/dist/adapter/resources/texture.d.ts +144 -47
  35. package/dist/adapter/resources/texture.d.ts.map +1 -1
  36. package/dist/adapter/resources/texture.js +120 -12
  37. package/dist/adapter/resources/transform-feedback.d.ts +1 -1
  38. package/dist/adapter/resources/transform-feedback.d.ts.map +1 -1
  39. package/dist/adapter/resources/vertex-array.d.ts +1 -1
  40. package/dist/adapter/resources/vertex-array.d.ts.map +1 -1
  41. package/dist/adapter/resources/vertex-array.js +6 -2
  42. package/dist/adapter/types/{types.d.ts → attachments.d.ts} +7 -17
  43. package/dist/adapter/types/attachments.d.ts.map +1 -0
  44. package/dist/adapter/types/buffer-layout.d.ts +1 -1
  45. package/dist/adapter/types/buffer-layout.d.ts.map +1 -1
  46. package/dist/adapter/types/compiler-message.d.ts.map +1 -0
  47. package/dist/adapter/types/parameters.d.ts +4 -6
  48. package/dist/adapter/types/parameters.d.ts.map +1 -1
  49. package/dist/adapter/types/parameters.js +1 -0
  50. package/dist/adapter/types/shader-layout.d.ts +23 -3
  51. package/dist/adapter/types/shader-layout.d.ts.map +1 -1
  52. package/dist/adapter/types/uniforms.d.ts +4 -0
  53. package/dist/adapter/types/uniforms.d.ts.map +1 -0
  54. package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.d.ts +1 -1
  55. package/dist/adapter-utils/format-compiler-log.d.ts.map +1 -0
  56. package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.d.ts +4 -11
  57. package/dist/adapter-utils/get-attribute-from-layouts.d.ts.map +1 -0
  58. package/dist/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.js +10 -30
  59. package/dist/adapter-utils/is-uniform-value.d.ts +3 -0
  60. package/dist/adapter-utils/is-uniform-value.d.ts.map +1 -0
  61. package/dist/adapter-utils/is-uniform-value.js +7 -0
  62. package/dist/dist.dev.js +635 -821
  63. package/dist/dist.min.js +6 -6
  64. package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.d.ts +3 -3
  65. package/dist/gpu-type-utils/decode-attribute-type.d.ts.map +1 -0
  66. package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.d.ts +1 -1
  67. package/dist/gpu-type-utils/decode-data-type.d.ts.map +1 -0
  68. package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.d.ts +1 -1
  69. package/dist/gpu-type-utils/decode-shader-types.d.ts.map +1 -0
  70. package/dist/{adapter/type-utils → gpu-type-utils}/decode-shader-types.js +0 -2
  71. package/dist/gpu-type-utils/decode-texture-format.d.ts +43 -0
  72. package/dist/gpu-type-utils/decode-texture-format.d.ts.map +1 -0
  73. package/dist/{adapter/type-utils → gpu-type-utils}/decode-texture-format.js +67 -31
  74. package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.d.ts +1 -1
  75. package/dist/gpu-type-utils/decode-vertex-format.d.ts.map +1 -0
  76. package/dist/gpu-type-utils/shader-types.d.ts.map +1 -0
  77. package/dist/{adapter/types → gpu-type-utils}/texture-formats.d.ts +3 -5
  78. package/dist/gpu-type-utils/texture-formats.d.ts.map +1 -0
  79. package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.d.ts +2 -2
  80. package/dist/gpu-type-utils/vertex-format-from-attribute.d.ts.map +1 -0
  81. package/dist/gpu-type-utils/vertex-formats.d.ts.map +1 -0
  82. package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.d.ts +1 -1
  83. package/dist/gpu-type-utils/wgsl-utils.d.ts.map +1 -0
  84. package/dist/index.cjs +396 -567
  85. package/dist/index.cjs.map +4 -4
  86. package/dist/index.d.ts +28 -44
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +19 -37
  89. package/dist/{lib/uniforms → portable}/uniform-block.d.ts +3 -3
  90. package/dist/portable/uniform-block.d.ts.map +1 -0
  91. package/dist/{lib/uniforms → portable}/uniform-block.js +2 -2
  92. package/dist/{lib/uniforms → portable}/uniform-buffer-layout.d.ts +2 -2
  93. package/dist/portable/uniform-buffer-layout.d.ts.map +1 -0
  94. package/dist/{lib/uniforms → portable}/uniform-buffer-layout.js +6 -7
  95. package/dist/{lib/uniforms → portable}/uniform-store.d.ts +9 -4
  96. package/dist/portable/uniform-store.d.ts.map +1 -0
  97. package/dist/{lib/uniforms → portable}/uniform-store.js +11 -9
  98. package/dist/types.d.ts +0 -10
  99. package/dist/types.d.ts.map +1 -1
  100. package/dist/utils/array-equal.d.ts.map +1 -1
  101. package/dist/utils/array-equal.js +6 -7
  102. package/dist/utils/array-utils-flat.d.ts +1 -7
  103. package/dist/utils/array-utils-flat.d.ts.map +1 -1
  104. package/dist/utils/array-utils-flat.js +0 -23
  105. package/dist/utils/is-array.d.ts +3 -3
  106. package/dist/utils/is-array.d.ts.map +1 -1
  107. package/dist/utils/is-array.js +2 -2
  108. package/dist/utils/uid.d.ts +7 -0
  109. package/dist/utils/uid.d.ts.map +1 -0
  110. package/dist/utils/{utils.js → uid.js} +0 -11
  111. package/package.json +5 -5
  112. package/src/adapter/adapter.ts +16 -0
  113. package/src/adapter/canvas-context.ts +6 -0
  114. package/src/adapter/device.ts +52 -36
  115. package/src/adapter/luma.ts +219 -0
  116. package/src/adapter/resources/buffer.ts +5 -5
  117. package/src/adapter/resources/command-encoder.ts +1 -1
  118. package/src/adapter/resources/compute-pass.ts +3 -3
  119. package/src/adapter/resources/compute-pipeline.ts +6 -3
  120. package/src/adapter/resources/external-texture.ts +2 -2
  121. package/src/adapter/resources/framebuffer.ts +5 -92
  122. package/src/adapter/resources/query-set.ts +2 -2
  123. package/src/adapter/resources/render-pass.ts +11 -7
  124. package/src/adapter/resources/render-pipeline.ts +3 -6
  125. package/src/adapter/resources/resource.ts +7 -7
  126. package/src/adapter/resources/shader.ts +18 -11
  127. package/src/adapter/resources/texture-view.ts +5 -5
  128. package/src/adapter/resources/texture.ts +285 -76
  129. package/src/adapter/resources/transform-feedback.ts +1 -1
  130. package/src/adapter/resources/vertex-array.ts +7 -3
  131. package/src/adapter/types/{types.ts → attachments.ts} +10 -18
  132. package/src/adapter/types/buffer-layout.ts +1 -1
  133. package/src/adapter/types/parameters.ts +14 -14
  134. package/src/adapter/types/shader-layout.ts +31 -29
  135. package/src/adapter/types/uniforms.ts +10 -0
  136. package/src/{lib/compiler-log → adapter-utils}/format-compiler-log.ts +1 -1
  137. package/src/{adapter/attribute-utils → adapter-utils}/get-attribute-from-layouts.ts +18 -42
  138. package/src/adapter-utils/is-uniform-value.ts +10 -0
  139. package/src/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.ts +3 -3
  140. package/src/{adapter/type-utils → gpu-type-utils}/decode-data-type.ts +1 -1
  141. package/src/{adapter/type-utils → gpu-type-utils}/decode-shader-types.ts +1 -3
  142. package/src/{adapter/type-utils → gpu-type-utils}/decode-texture-format.ts +99 -39
  143. package/src/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.ts +1 -1
  144. package/src/{adapter/types → gpu-type-utils}/texture-formats.ts +3 -14
  145. package/src/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.ts +2 -2
  146. package/src/{adapter/type-utils → gpu-type-utils}/wgsl-utils.ts +1 -1
  147. package/src/index.ts +67 -83
  148. package/src/{lib/uniforms → portable}/uniform-block.ts +5 -5
  149. package/src/{lib/uniforms → portable}/uniform-buffer-layout.ts +9 -9
  150. package/src/{lib/uniforms → portable}/uniform-store.ts +20 -12
  151. package/src/types.ts +0 -12
  152. package/src/utils/array-equal.ts +6 -7
  153. package/src/utils/array-utils-flat.ts +1 -31
  154. package/src/utils/is-array.ts +5 -5
  155. package/src/utils/{utils.ts → uid.ts} +0 -12
  156. package/dist/adapter/attribute-utils/get-attribute-from-layouts.d.ts.map +0 -1
  157. package/dist/adapter/type-utils/decode-attribute-type.d.ts.map +0 -1
  158. package/dist/adapter/type-utils/decode-data-type.d.ts.map +0 -1
  159. package/dist/adapter/type-utils/decode-shader-types.d.ts.map +0 -1
  160. package/dist/adapter/type-utils/decode-texture-format.d.ts +0 -23
  161. package/dist/adapter/type-utils/decode-texture-format.d.ts.map +0 -1
  162. package/dist/adapter/type-utils/decode-vertex-format.d.ts.map +0 -1
  163. package/dist/adapter/type-utils/vertex-format-from-attribute.d.ts.map +0 -1
  164. package/dist/adapter/type-utils/wgsl-utils.d.ts.map +0 -1
  165. package/dist/adapter/types/accessor.d.ts +0 -23
  166. package/dist/adapter/types/accessor.d.ts.map +0 -1
  167. package/dist/adapter/types/shader-types.d.ts.map +0 -1
  168. package/dist/adapter/types/texture-formats.d.ts.map +0 -1
  169. package/dist/adapter/types/types.d.ts.map +0 -1
  170. package/dist/adapter/types/vertex-formats.d.ts.map +0 -1
  171. package/dist/init.d.ts +0 -5
  172. package/dist/init.d.ts.map +0 -1
  173. package/dist/init.js +0 -37
  174. package/dist/lib/compiler-log/compiler-message.d.ts.map +0 -1
  175. package/dist/lib/compiler-log/format-compiler-log.d.ts.map +0 -1
  176. package/dist/lib/compiler-log/get-shader-info.d.ts +0 -9
  177. package/dist/lib/compiler-log/get-shader-info.d.ts.map +0 -1
  178. package/dist/lib/compiler-log/get-shader-info.js +0 -29
  179. package/dist/lib/luma.d.ts +0 -38
  180. package/dist/lib/luma.d.ts.map +0 -1
  181. package/dist/lib/luma.js +0 -141
  182. package/dist/lib/uniforms/uniform-block.d.ts.map +0 -1
  183. package/dist/lib/uniforms/uniform-buffer-layout.d.ts.map +0 -1
  184. package/dist/lib/uniforms/uniform-store.d.ts.map +0 -1
  185. package/dist/lib/uniforms/uniform.d.ts +0 -10
  186. package/dist/lib/uniforms/uniform.d.ts.map +0 -1
  187. package/dist/lib/uniforms/uniform.js +0 -20
  188. package/dist/utils/assert.d.ts +0 -2
  189. package/dist/utils/assert.d.ts.map +0 -1
  190. package/dist/utils/assert.js +0 -10
  191. package/dist/utils/cast.d.ts +0 -3
  192. package/dist/utils/cast.d.ts.map +0 -1
  193. package/dist/utils/cast.js +0 -7
  194. package/dist/utils/check-props.d.ts +0 -7
  195. package/dist/utils/check-props.d.ts.map +0 -1
  196. package/dist/utils/check-props.js +0 -36
  197. package/dist/utils/deep-equal.d.ts +0 -9
  198. package/dist/utils/deep-equal.d.ts.map +0 -1
  199. package/dist/utils/deep-equal.js +0 -50
  200. package/dist/utils/format-value.d.ts +0 -7
  201. package/dist/utils/format-value.d.ts.map +0 -1
  202. package/dist/utils/format-value.js +0 -39
  203. package/dist/utils/load-file.d.ts +0 -35
  204. package/dist/utils/load-file.d.ts.map +0 -1
  205. package/dist/utils/load-file.js +0 -74
  206. package/dist/utils/random.d.ts +0 -5
  207. package/dist/utils/random.d.ts.map +0 -1
  208. package/dist/utils/random.js +0 -18
  209. package/dist/utils/request-animation-frame.d.ts +0 -3
  210. package/dist/utils/request-animation-frame.d.ts.map +0 -1
  211. package/dist/utils/request-animation-frame.js +0 -16
  212. package/dist/utils/stub-methods.d.ts +0 -2
  213. package/dist/utils/stub-methods.d.ts.map +0 -1
  214. package/dist/utils/stub-methods.js +0 -19
  215. package/dist/utils/utils.d.ts +0 -9
  216. package/dist/utils/utils.d.ts.map +0 -1
  217. package/src/adapter/types/accessor.ts +0 -37
  218. package/src/init.ts +0 -53
  219. package/src/lib/compiler-log/get-shader-info.ts +0 -42
  220. package/src/lib/luma.ts +0 -190
  221. package/src/lib/uniforms/uniform.ts +0 -31
  222. package/src/utils/assert.ts +0 -11
  223. package/src/utils/cast.ts +0 -8
  224. package/src/utils/check-props.ts +0 -82
  225. package/src/utils/deep-equal.ts +0 -51
  226. package/src/utils/format-value.ts +0 -47
  227. package/src/utils/load-file.ts +0 -91
  228. package/src/utils/random.ts +0 -21
  229. package/src/utils/request-animation-frame.ts +0 -19
  230. package/src/utils/stub-methods.ts +0 -29
  231. /package/dist/adapter/types/{accessor.js → attachments.js} +0 -0
  232. /package/dist/{lib/compiler-log → adapter/types}/compiler-message.d.ts +0 -0
  233. /package/dist/{lib/compiler-log → adapter/types}/compiler-message.js +0 -0
  234. /package/dist/adapter/types/{shader-types.js → uniforms.js} +0 -0
  235. /package/dist/{lib/compiler-log → adapter-utils}/format-compiler-log.js +0 -0
  236. /package/dist/{adapter/type-utils → gpu-type-utils}/decode-attribute-type.js +0 -0
  237. /package/dist/{adapter/type-utils → gpu-type-utils}/decode-data-type.js +0 -0
  238. /package/dist/{adapter/type-utils → gpu-type-utils}/decode-vertex-format.js +0 -0
  239. /package/dist/{adapter/types → gpu-type-utils}/shader-types.d.ts +0 -0
  240. /package/dist/{adapter/types/texture-formats.js → gpu-type-utils/shader-types.js} +0 -0
  241. /package/dist/{adapter/types/types.js → gpu-type-utils/texture-formats.js} +0 -0
  242. /package/dist/{adapter/type-utils → gpu-type-utils}/vertex-format-from-attribute.js +0 -0
  243. /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.d.ts +0 -0
  244. /package/dist/{adapter/types → gpu-type-utils}/vertex-formats.js +0 -0
  245. /package/dist/{adapter/type-utils → gpu-type-utils}/wgsl-utils.js +0 -0
  246. /package/src/{lib/compiler-log → adapter/types}/compiler-message.ts +0 -0
  247. /package/src/{adapter/types → gpu-type-utils}/shader-types.ts +0 -0
  248. /package/src/{adapter/types → gpu-type-utils}/vertex-formats.ts +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"compiler-message.d.ts","sourceRoot":"","sources":["../../../src/lib/compiler-log/compiler-message.ts"],"names":[],"mappings":"AAIA,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-compiler-log.d.ts","sourceRoot":"","sources":["../../../src/lib/compiler-log/format-compiler-log.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,8BAA2B;AAExD,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,eAAe,EAAE,EACrC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,6FAA6F;IAC7F,cAAc,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAC;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GACA,MAAM,CA+BR"}
@@ -1,9 +0,0 @@
1
- /** Information extracted from shader source code */
2
- export type ShaderInfo = {
3
- name: string;
4
- language: 'glsl' | 'wgsl';
5
- version: number;
6
- };
7
- /** Extracts information from shader source code */
8
- export declare function getShaderInfo(source: string, defaultName?: string): ShaderInfo;
9
- //# sourceMappingURL=get-shader-info.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-shader-info.d.ts","sourceRoot":"","sources":["../../../src/lib/compiler-log/get-shader-info.ts"],"names":[],"mappings":"AAOA,oDAAoD;AACpD,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,mDAAmD;AACnD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAM9E"}
@@ -1,29 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- /** Extracts information from shader source code */
5
- export function getShaderInfo(source, defaultName) {
6
- return {
7
- name: getShaderName(source, defaultName),
8
- language: 'glsl',
9
- version: getShaderVersion(source)
10
- };
11
- }
12
- /** Extracts GLSLIFY style naming of shaders: `#define SHADER_NAME ...` */
13
- function getShaderName(shader, defaultName = 'unnamed') {
14
- const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
15
- const match = SHADER_NAME_REGEXP.exec(shader);
16
- return match ? match[1] : defaultName;
17
- }
18
- /** returns GLSL shader version of given shader string */
19
- function getShaderVersion(source) {
20
- let version = 100;
21
- const words = source.match(/[^\s]+/g);
22
- if (words && words.length >= 2 && words[0] === '#version') {
23
- const v = parseInt(words[1], 10);
24
- if (Number.isFinite(v)) {
25
- version = v;
26
- }
27
- }
28
- return version;
29
- }
@@ -1,38 +0,0 @@
1
- import type { Log } from '@probe.gl/log';
2
- import type { DeviceProps } from "../adapter/device.js";
3
- import { Device } from "../adapter/device.js";
4
- import { StatsManager } from "../utils/stats-manager.js";
5
- /** Properties for creating a new device */
6
- export type CreateDeviceProps = DeviceProps & {
7
- /** Selects the type of device. `best-available` uses webgpu if available, then webgl. */
8
- type?: 'webgl' | 'webgpu' | 'unknown' | 'best-available';
9
- devices?: any[];
10
- };
11
- /** Properties for attaching an existing WebGL context or WebGPU device to a new luma Device */
12
- export type AttachDeviceProps = DeviceProps & {
13
- /** Externally created WebGL context or WebGPU device */
14
- handle: WebGL2RenderingContext;
15
- devices?: any[];
16
- };
17
- /**
18
- * Entry point to the luma.gl GPU abstraction
19
- * Register WebGPU and/or WebGL devices (controls application bundle size)
20
- * Run-time selection of the first available Device
21
- */
22
- export declare class luma {
23
- static defaultProps: Required<CreateDeviceProps>;
24
- /** Global stats for all devices */
25
- static stats: StatsManager;
26
- /** Global log */
27
- static log: Log;
28
- static registerDevices(deviceClasses: any[]): void;
29
- static getAvailableDevices(): string[];
30
- static getSupportedDevices(): string[];
31
- static setDefaultDeviceProps(props: CreateDeviceProps): void;
32
- /** Attach to an existing GPU API handle (WebGL2RenderingContext or GPUDevice). */
33
- static attachDevice(props: AttachDeviceProps): Promise<Device>;
34
- /** Creates a device. Asynchronously. */
35
- static createDevice(props?: CreateDeviceProps): Promise<Device>;
36
- static enforceWebGL2(enforce?: boolean): void;
37
- }
38
- //# sourceMappingURL=luma.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"luma.d.ts","sourceRoot":"","sources":["../../src/lib/luma.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,EAAC,WAAW,EAAC,6BAA0B;AACnD,OAAO,EAAC,MAAM,EAAC,6BAA0B;AACzC,OAAO,EAAC,YAAY,EAAC,kCAA+B;AAOpD,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,yFAAyF;IACzF,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,gBAAgB,CAAC;IACzD,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB,CAAC;AAEF,+FAA+F;AAC/F,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,wDAAwD;IACxD,MAAM,EAAE,sBAAsB,CAAC;IAC/B,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,IAAI;IACf,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAI9C;IAEF,mCAAmC;IACnC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAa;IAEvC,iBAAiB;IACjB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAO;IAEtB,MAAM,CAAC,eAAe,CAAC,aAAa,EAAE,GAAG,EAAE,GAAyB,IAAI;IAOxE,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAKtC,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAUtC,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAI5D,kFAAkF;WACrE,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCpE,wCAAwC;WAC3B,YAAY,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IA8CzE,MAAM,CAAC,aAAa,CAAC,OAAO,GAAE,OAAc,GAAG,IAAI;CAsBpD"}
package/dist/lib/luma.js DELETED
@@ -1,141 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- import { Device } from "../adapter/device.js";
5
- import { lumaStats } from "../utils/stats-manager.js";
6
- import { log } from "../utils/log.js";
7
- import { assert } from "../utils/assert.js";
8
- const deviceMap = new Map();
9
- /**
10
- * Entry point to the luma.gl GPU abstraction
11
- * Register WebGPU and/or WebGL devices (controls application bundle size)
12
- * Run-time selection of the first available Device
13
- */
14
- export class luma {
15
- static defaultProps = {
16
- ...Device.defaultProps,
17
- type: 'best-available',
18
- devices: undefined
19
- };
20
- /** Global stats for all devices */
21
- static stats = lumaStats;
22
- /** Global log */
23
- static log = log;
24
- static registerDevices(deviceClasses /* : typeof Device */) {
25
- for (const deviceClass of deviceClasses) {
26
- assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);
27
- deviceMap.set(deviceClass.type, deviceClass);
28
- }
29
- }
30
- static getAvailableDevices() {
31
- // @ts-expect-error
32
- return Array.from(deviceMap).map(Device => Device.type);
33
- }
34
- static getSupportedDevices() {
35
- return (Array.from(deviceMap)
36
- // @ts-expect-error
37
- .filter(Device => Device.isSupported())
38
- // @ts-expect-error
39
- .map(Device => Device.type));
40
- }
41
- static setDefaultDeviceProps(props) {
42
- Object.assign(Device.defaultProps, props);
43
- }
44
- /** Attach to an existing GPU API handle (WebGL2RenderingContext or GPUDevice). */
45
- static async attachDevice(props) {
46
- const devices = getDeviceMap(props.devices) || deviceMap;
47
- // WebGL
48
- if (props.handle instanceof WebGL2RenderingContext) {
49
- const WebGLDevice = devices.get('webgl');
50
- if (WebGLDevice) {
51
- return (await WebGLDevice.attach(props.handle));
52
- }
53
- }
54
- // TODO - WebGPU does not yet have a stable API
55
- // if (props.handle instanceof GPUDevice) {
56
- // const WebGPUDevice = devices.get('webgpu') as any;
57
- // if (WebGPUDevice) {
58
- // return (await WebGPUDevice.attach(props.handle)) as Device;
59
- // }
60
- // }
61
- // null
62
- if (props.handle === null) {
63
- const UnknownDevice = devices.get('unknown');
64
- if (UnknownDevice) {
65
- return (await UnknownDevice.attach(null));
66
- }
67
- }
68
- throw new Error('Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.');
69
- }
70
- /** Creates a device. Asynchronously. */
71
- static async createDevice(props = {}) {
72
- props = { ...luma.defaultProps, ...props };
73
- if (props.gl) {
74
- props.type = 'webgl';
75
- }
76
- const devices = getDeviceMap(props.devices) || deviceMap;
77
- switch (props.type) {
78
- case 'webgpu':
79
- let WebGPUDevice = devices.get('webgpu');
80
- if (WebGPUDevice) {
81
- return await WebGPUDevice.create(props);
82
- }
83
- break;
84
- case 'webgl':
85
- let WebGLDevice = devices.get('webgl');
86
- if (WebGLDevice) {
87
- return await WebGLDevice.create(props);
88
- }
89
- break;
90
- case 'unknown':
91
- const UnknownDevice = devices.get('unknown');
92
- if (UnknownDevice) {
93
- return await UnknownDevice.create(props);
94
- }
95
- break;
96
- case 'best-available':
97
- WebGPUDevice = devices.get('webgpu');
98
- if (WebGPUDevice?.isSupported?.()) {
99
- return await WebGPUDevice.create(props);
100
- }
101
- WebGLDevice = devices.get('webgl');
102
- if (WebGLDevice?.isSupported?.()) {
103
- return await WebGLDevice.create(props);
104
- }
105
- break;
106
- }
107
- throw new Error('No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.');
108
- }
109
- static enforceWebGL2(enforce = true) {
110
- const prototype = HTMLCanvasElement.prototype;
111
- if (!enforce && prototype.originalGetContext) {
112
- // Reset the original getContext function
113
- prototype.getContext = prototype.originalGetContext;
114
- prototype.originalGetContext = undefined;
115
- return;
116
- }
117
- // Store the original getContext function
118
- prototype.originalGetContext = prototype.getContext;
119
- // Override the getContext function
120
- prototype.getContext = function (contextId, options) {
121
- // Attempt to force WebGL2 for all WebGL1 contexts
122
- if (contextId === 'webgl' || contextId === 'experimental-webgl') {
123
- return this.originalGetContext('webgl2', options);
124
- }
125
- // For any other type, return the original context
126
- return this.originalGetContext(contextId, options);
127
- };
128
- }
129
- }
130
- /** Convert a list of devices to a map */
131
- function getDeviceMap(deviceClasses /* : typeof Device */) {
132
- if (!deviceClasses || deviceClasses?.length === 0) {
133
- return null;
134
- }
135
- const map = new Map();
136
- for (const deviceClass of deviceClasses) {
137
- // assert(deviceClass.type && deviceClass.isSupported && deviceClass.create);
138
- map.set(deviceClass.type, deviceClass);
139
- }
140
- return map;
141
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"uniform-block.d.ts","sourceRoot":"","sources":["../../../src/lib/uniforms/uniform-block.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAC,4CAAyC;AACxE,OAAO,KAAK,EAAC,YAAY,EAAC,qCAAkC;AAC5D,OAAO,EACL,YAAY,EACZ,WAAW,EAEZ,6CAA0C;AAG3C;;;GAGG;AACH,qBAAa,YAAY,CACvB,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;IAE7E,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,MAAM,CAAC,MAAM,SAAS,EAAE,YAAY,CAAC,CAA+C;IAC9F,gBAAgB,EAAE,MAAM,CAAC,MAAM,SAAS,EAAE,OAAO,CAAC,CAA0C;IAC5F,QAAQ,EAAE,OAAO,CAAQ;IAEzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAM;IACzD,WAAW,EAAE,MAAM,GAAG,KAAK,CAAiB;gBAEhC,KAAK,CAAC,EAAE;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,YAAY,CAAC;QAC5B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;KAC3E;IAmBD,4BAA4B;IAC5B,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;IAS/C,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpC,2BAA2B;IAC3B,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;IAO9C,2BAA2B;IAC3B,OAAO,CAAC,WAAW;CAQpB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"uniform-buffer-layout.d.ts","sourceRoot":"","sources":["../../../src/lib/uniforms/uniform-buffer-layout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,4CAAyC;AACxF,OAAO,KAAK,EAAC,YAAY,EAAC,qCAAkC;AAY5D;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,cAAc,CAAA;KAAC,CAAC,CAAM;IAE3F,mDAAmD;IACnD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,kEAAkE;gBACtD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAsB3D,2CAA2C;IAC3C,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,UAAU;IAqDhE,wDAAwD;IACxD,GAAG,CAAC,IAAI,EAAE,MAAM;IAIhB,0DAA0D;IAC1D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,SAAS;CAI9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"uniform-store.d.ts","sourceRoot":"","sources":["../../../src/lib/uniforms/uniform-store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAC,4CAAyC;AACxE,OAAO,KAAK,EAAC,YAAY,EAAC,qCAAkC;AAC5D,OAAO,KAAK,EAAC,MAAM,EAAC,gCAA6B;AACjD,OAAO,EAAC,MAAM,EAAC,0CAAuC;AACtD,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAC7C,OAAO,EAAC,mBAAmB,EAAC,mCAAgC;AAG5D;;;;;;GAMG;AACH,qBAAa,YAAY,CACvB,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAClE,MAAM,EACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CACxB;IAED,uDAAuD;IACvD,aAAa,qEAA8C;IAC3D,sEAAsE;IACtE,oBAAoB,8CAAqD;IACzE,mCAAmC;IACnC,cAAc,iCAAwC;IAEtD;;;OAGG;gBAED,MAAM,EAAE,MAAM,CACZ,MAAM,WAAW,EACjB;QACE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QACjD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KAChD,CACF;IAgBH,0CAA0C;IAC1C,OAAO,IAAI,IAAI;IAMf;;;OAGG;IACH,WAAW,CACT,QAAQ,EAAE,OAAO,CAAC;SAAE,KAAK,IAAI,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAAC,CAAC,GAC7E,IAAI;IAUP,4DAA4D;IAC5D,0BAA0B,CAAC,iBAAiB,EAAE,MAAM,WAAW,GAAG,MAAM;IAIxE,mEAAmE;IACnE,oBAAoB,CAAC,iBAAiB,EAAE,MAAM,WAAW,GAAG,UAAU;IAKtE;;;OAGG;IACH,mBAAmB,CACjB,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,MAAM,WAAW,EACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;SAAE,KAAK,IAAI,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAAC,CAAC,GAC9E,MAAM;IAeT,4GAA4G;IAC5G,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,WAAW,GAAG,MAAM;IAarF,4DAA4D;IAC5D,oBAAoB,IAAI,KAAK,GAAG,MAAM;IAYtC,qEAAqE;IACrE,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM;CAwB1E"}
@@ -1,10 +0,0 @@
1
- import type { UniformValue } from "../../adapter/types/types.js";
2
- import type { Binding } from "../../adapter/types/shader-layout.js";
3
- export declare function isUniformValue(value: unknown): boolean;
4
- type UniformsAndBindings = {
5
- bindings: Record<string, Binding>;
6
- uniforms: Record<string, UniformValue>;
7
- };
8
- export declare function splitUniformsAndBindings(uniforms: Record<string, Binding | UniformValue>): UniformsAndBindings;
9
- export {};
10
- //# sourceMappingURL=uniform.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uniform.d.ts","sourceRoot":"","sources":["../../../src/lib/uniforms/uniform.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,qCAAkC;AAC5D,OAAO,KAAK,EAAC,OAAO,EAAC,6CAA0C;AAG/D,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEtD;AAED,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACxC,CAAC;AACF,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,CAAC,GAC/C,mBAAmB,CAYrB"}
@@ -1,20 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- import { isNumberArray } from "../../utils/is-array.js";
5
- export function isUniformValue(value) {
6
- return isNumberArray(value) !== null || typeof value === 'number' || typeof value === 'boolean';
7
- }
8
- export function splitUniformsAndBindings(uniforms) {
9
- const result = { bindings: {}, uniforms: {} };
10
- Object.keys(uniforms).forEach(name => {
11
- const uniform = uniforms[name];
12
- if (isUniformValue(uniform)) {
13
- result.uniforms[name] = uniform;
14
- }
15
- else {
16
- result.bindings[name] = uniform;
17
- }
18
- });
19
- return result;
20
- }
@@ -1,2 +0,0 @@
1
- export declare function assert(condition: unknown, message?: string): void | never;
2
- //# sourceMappingURL=assert.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/utils/assert.ts"],"names":[],"mappings":"AAMA,wBAAgB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAIzE"}
@@ -1,10 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- // Recommendation is to ignore message but current test suite checks agains the
5
- // message so keep it for now.
6
- export function assert(condition, message) {
7
- if (!condition) {
8
- throw new Error(message || 'luma.gl: assertion failed.');
9
- }
10
- }
@@ -1,3 +0,0 @@
1
- /** Helper for type downcasts, e.g. Buffer -> WebGPUBuffer */
2
- export declare function cast<T>(value: any): T;
3
- //# sourceMappingURL=cast.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cast.d.ts","sourceRoot":"","sources":["../../src/utils/cast.ts"],"names":[],"mappings":"AAIA,6DAA6D;AAC7D,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAEjC"}
@@ -1,7 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- /** Helper for type downcasts, e.g. Buffer -> WebGPUBuffer */
5
- export function cast(value) {
6
- return value;
7
- }
@@ -1,7 +0,0 @@
1
- export type PropChecks = {
2
- removedProps?: Record<string, any>;
3
- replacedProps?: Record<string, string>;
4
- deprecatedProps?: Record<string, string>;
5
- };
6
- export declare function checkProps(className: string, props: Record<string, any>, propChecks: PropChecks): Record<string, unknown>;
7
- //# sourceMappingURL=check-props.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-props.d.ts","sourceRoot":"","sources":["../../src/utils/check-props.ts"],"names":[],"mappings":"AAoCA,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,UAAU,EAAE,UAAU,GACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmCzB"}
@@ -1,36 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- import { log } from "./log.js";
5
- export function checkProps(className, props, propChecks) {
6
- const { removedProps = {}, deprecatedProps = {}, replacedProps = {} } = propChecks;
7
- // removedProps: Removed props no longer supported
8
- // print error and link to upgrade guide
9
- for (const propName in removedProps) {
10
- if (propName in props) {
11
- const replacementProp = removedProps[propName];
12
- const replacement = replacementProp ? `${className}.${removedProps[propName]}` : 'N/A';
13
- log.removed(`${className}.${propName}`, replacement)();
14
- }
15
- }
16
- // deprecatedProps: Deprecated props that can not be autosubstituted
17
- // print warning and rely on caller to substitute
18
- for (const propName in deprecatedProps) {
19
- if (propName in props) {
20
- const replacementProp = deprecatedProps[propName];
21
- log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();
22
- }
23
- }
24
- // replacedProps: Deprecated props that can be autosubstituted
25
- // print warning and return updated props object
26
- let newProps = null;
27
- for (const [propName, replacementProp] of Object.entries(replacedProps)) {
28
- if (propName in props) {
29
- log.deprecated(`${className}.${propName}`, `${className}.${replacementProp}`)();
30
- newProps = newProps || Object.assign({}, props);
31
- newProps[replacementProp] = props[propName];
32
- delete newProps[propName];
33
- }
34
- }
35
- return newProps || props;
36
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Fast partial deep equal for prop.
3
- *
4
- * @param a Prop
5
- * @param b Prop to compare against `a`
6
- * @param depth Depth to which to recurse in nested Objects/Arrays. Use 0 (default) for shallow comparison, -1 for infinite depth
7
- */
8
- export declare function deepEqual(a: any, b: any, depth: number): boolean;
9
- //# sourceMappingURL=deep-equal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deep-equal.d.ts","sourceRoot":"","sources":["../../src/utils/deep-equal.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAsChE"}
@@ -1,50 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- /**
5
- * Fast partial deep equal for prop.
6
- *
7
- * @param a Prop
8
- * @param b Prop to compare against `a`
9
- * @param depth Depth to which to recurse in nested Objects/Arrays. Use 0 (default) for shallow comparison, -1 for infinite depth
10
- */
11
- /* eslint-disable complexity */
12
- export function deepEqual(a, b, depth) {
13
- if (a === b) {
14
- return true;
15
- }
16
- if (!depth || !a || !b) {
17
- return false;
18
- }
19
- if (Array.isArray(a)) {
20
- if (!Array.isArray(b) || a.length !== b.length) {
21
- return false;
22
- }
23
- for (let i = 0; i < a.length; i++) {
24
- if (!deepEqual(a[i], b[i], depth - 1)) {
25
- return false;
26
- }
27
- }
28
- return true;
29
- }
30
- if (Array.isArray(b)) {
31
- return false;
32
- }
33
- if (typeof a === 'object' && typeof b === 'object') {
34
- const aKeys = Object.keys(a);
35
- const bKeys = Object.keys(b);
36
- if (aKeys.length !== bKeys.length) {
37
- return false;
38
- }
39
- for (const key of aKeys) {
40
- if (!b.hasOwnProperty(key)) {
41
- return false;
42
- }
43
- if (!deepEqual(a[key], b[key], depth - 1)) {
44
- return false;
45
- }
46
- }
47
- return true;
48
- }
49
- return false;
50
- }
@@ -1,7 +0,0 @@
1
- import type { NumberArray } from "../types.js";
2
- /** TODO @deprecated - delete when confident that probe.gl logging implements all opts */
3
- export declare function formatValue(v: number | NumberArray | unknown, opts?: {
4
- isInteger?: boolean;
5
- size?: number;
6
- }): string;
7
- //# sourceMappingURL=format-value.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-value.d.ts","sourceRoot":"","sources":["../../src/utils/format-value.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,WAAW,EAAC,oBAAiB;AAgB1C,yFAAyF;AACzF,wBAAgB,WAAW,CACzB,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,EACjC,IAAI,GAAE;IAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAM,GAC9C,MAAM,CAqBR"}
@@ -1,39 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- /** TODO @deprecated - delete when confident that probe.gl logging implements all opts */
5
- function formatArrayValue(v, opts = {}) {
6
- const { maxElts = 16, size = 1 } = opts;
7
- let string = '[';
8
- for (let i = 0; i < v.length && i < maxElts; ++i) {
9
- if (i > 0) {
10
- string += `,${i % size === 0 ? ' ' : ''}`;
11
- }
12
- string += formatValue(v[i], opts);
13
- }
14
- const terminator = v.length > maxElts ? '...' : ']';
15
- return `${string}${terminator}`;
16
- }
17
- /** TODO @deprecated - delete when confident that probe.gl logging implements all opts */
18
- export function formatValue(v, opts = {}) {
19
- const EPSILON = 1e-16;
20
- const { isInteger = false } = opts;
21
- if (Array.isArray(v) || ArrayBuffer.isView(v)) {
22
- return formatArrayValue(v, opts);
23
- }
24
- if (typeof v !== 'number') {
25
- return String(v);
26
- }
27
- if (Math.abs(v) < EPSILON) {
28
- return isInteger ? '0' : '0.';
29
- }
30
- if (isInteger) {
31
- return v.toFixed(0);
32
- }
33
- if (Math.abs(v) > 100 && Math.abs(v) < 10000) {
34
- return v.toFixed(0);
35
- }
36
- const string = v.toPrecision(2);
37
- const decimal = string.indexOf('.0');
38
- return decimal === string.length - 2 ? string.slice(0, -1) : string;
39
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * Set a relative path prefix
3
- */
4
- export declare function setPathPrefix(prefix: string): void;
5
- /**
6
- * Reads raw file data. Respects setPathPrefix.
7
- */
8
- export declare function loadFile(url: string, options?: {
9
- dataType?: 'text' | 'arrayBuffer';
10
- } & RequestInit): Promise<any>;
11
- /**
12
- * Loads ImageBitmap asynchronously. Respects setPathPrefix.
13
- * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'
14
- * @returns a promise tracking the load
15
- */
16
- export declare function loadImageBitmap(url: string, opts?: {
17
- crossOrigin?: string;
18
- }): Promise<ImageBitmap>;
19
- /**
20
- * Loads image asynchronously. Respects setPathPrefix.
21
- * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'
22
- * @returns a promise tracking the load
23
- * @deprecated Use `loadImageBitmap()` unless you are supporting old versions of Safari.
24
- */
25
- export declare function loadImage(url: string, opts?: {
26
- crossOrigin?: string;
27
- }): Promise<HTMLImageElement>;
28
- /**
29
- * Load a script (identified by an url). When the url returns, the
30
- * content of this file is added into a new script element, attached to the DOM (body element)
31
- * @param scriptUrl defines the url of the script to laod
32
- * @param scriptId defines the id of the script element
33
- */
34
- export declare function loadScript(scriptUrl: string, scriptId?: string): Promise<Event>;
35
- //# sourceMappingURL=load-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-file.d.ts","sourceRoot":"","sources":["../../src/utils/load-file.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,QAE3C;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAAA;CAAC,GAAG,WAAW,GAC1D,OAAO,CAAC,GAAG,CAAC,CAKd;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAC,GAC5B,OAAO,CAAC,WAAW,CAAC,CAMtB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAC,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAY3B;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAmBrF"}
@@ -1,74 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- let pathPrefix = '';
5
- /**
6
- * Set a relative path prefix
7
- */
8
- export function setPathPrefix(prefix) {
9
- pathPrefix = prefix;
10
- }
11
- /**
12
- * Reads raw file data. Respects setPathPrefix.
13
- */
14
- export async function loadFile(url, options) {
15
- url = url.startsWith('http') ? url : pathPrefix + url;
16
- const dataType = options?.dataType || 'text';
17
- const response = await fetch(url, options);
18
- return await response[dataType]();
19
- }
20
- /**
21
- * Loads ImageBitmap asynchronously. Respects setPathPrefix.
22
- * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'
23
- * @returns a promise tracking the load
24
- */
25
- export async function loadImageBitmap(url, opts) {
26
- const image = new Image();
27
- image.crossOrigin = opts?.crossOrigin || 'anonymous';
28
- image.src = url.startsWith('http') ? url : pathPrefix + url;
29
- await image.decode();
30
- return await createImageBitmap(image);
31
- }
32
- /**
33
- * Loads image asynchronously. Respects setPathPrefix.
34
- * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous'
35
- * @returns a promise tracking the load
36
- * @deprecated Use `loadImageBitmap()` unless you are supporting old versions of Safari.
37
- */
38
- export async function loadImage(url, opts) {
39
- return await new Promise((resolve, reject) => {
40
- try {
41
- const image = new Image();
42
- image.onload = () => resolve(image);
43
- image.onerror = () => reject(new Error(`Could not load image ${url}.`));
44
- image.crossOrigin = opts?.crossOrigin || 'anonymous';
45
- image.src = url.startsWith('http') ? url : pathPrefix + url;
46
- }
47
- catch (error) {
48
- reject(error);
49
- }
50
- });
51
- }
52
- /**
53
- * Load a script (identified by an url). When the url returns, the
54
- * content of this file is added into a new script element, attached to the DOM (body element)
55
- * @param scriptUrl defines the url of the script to laod
56
- * @param scriptId defines the id of the script element
57
- */
58
- export async function loadScript(scriptUrl, scriptId) {
59
- const head = document.getElementsByTagName('head')[0];
60
- if (!head) {
61
- throw new Error('loadScript');
62
- }
63
- const script = document.createElement('script');
64
- script.setAttribute('type', 'text/javascript');
65
- script.setAttribute('src', scriptUrl);
66
- if (scriptId) {
67
- script.id = scriptId;
68
- }
69
- return new Promise((resolve, reject) => {
70
- script.onload = resolve;
71
- script.onerror = error => reject(new Error(`Unable to load script '${scriptUrl}': ${error}`));
72
- head.appendChild(script);
73
- });
74
- }
@@ -1,5 +0,0 @@
1
- /** Creates a deterministic pseudorandom number generator */
2
- export declare function makeRandomNumberGenerator(): () => number;
3
- /** Generates a deterministic pseudorandom number */
4
- export declare const random: () => number;
5
- //# sourceMappingURL=random.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/utils/random.ts"],"names":[],"mappings":"AAIA,4DAA4D;AAC5D,wBAAgB,yBAAyB,IAAI,MAAM,MAAM,CAQxD;AAMD,oDAAoD;AACpD,eAAO,MAAM,MAAM,QAfgC,MAeF,CAAC"}
@@ -1,18 +0,0 @@
1
- // luma.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- /** Creates a deterministic pseudorandom number generator */
5
- export function makeRandomNumberGenerator() {
6
- let s = 1;
7
- let c = 1;
8
- return () => {
9
- s = Math.sin(c * 17.23);
10
- c = Math.cos(s * 27.92);
11
- return fract(Math.abs(s * c) * 1432.71);
12
- };
13
- }
14
- function fract(n) {
15
- return n - Math.floor(n);
16
- }
17
- /** Generates a deterministic pseudorandom number */
18
- export const random = makeRandomNumberGenerator();
@@ -1,3 +0,0 @@
1
- export declare function requestAnimationFrame(callback: (time?: any) => void): any;
2
- export declare function cancelAnimationFrame(timerId: any): void;
3
- //# sourceMappingURL=request-animation-frame.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request-animation-frame.d.ts","sourceRoot":"","sources":["../../src/utils/request-animation-frame.ts"],"names":[],"mappings":"AAQA,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,GAAG,CAIzE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAIvD"}