@luma.gl/engine 10.0.0-alpha.3 → 10.0.0-alpha.5

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 (673) hide show
  1. package/README.md +9 -0
  2. package/dist/animation/animation-clip.cjs +36 -0
  3. package/dist/animation/animation-interpolation.cjs +115 -0
  4. package/dist/animation/animation-mixer.cjs +302 -0
  5. package/dist/animation/animation-track.cjs +55 -0
  6. package/dist/animation/animator.cjs +75 -0
  7. package/dist/animation/deform-positions.cjs +69 -0
  8. package/dist/animation/deform-positions.d.ts +13 -0
  9. package/dist/animation/deform-positions.d.ts.map +1 -0
  10. package/dist/animation/deform-positions.js +49 -0
  11. package/dist/animation/deform-positions.js.map +1 -0
  12. package/dist/animation/key-frames.cjs +81 -0
  13. package/dist/animation/morph-targets.cjs +162 -0
  14. package/dist/animation/node-animation-binding.cjs +67 -0
  15. package/dist/animation/node-animation-binding.d.ts +9 -0
  16. package/dist/animation/node-animation-binding.d.ts.map +1 -0
  17. package/dist/animation/node-animation-binding.js +45 -0
  18. package/dist/animation/node-animation-binding.js.map +1 -0
  19. package/dist/animation/property-animation-binding.cjs +159 -0
  20. package/dist/animation/property-animation-binding.d.ts +29 -0
  21. package/dist/animation/property-animation-binding.d.ts.map +1 -0
  22. package/dist/animation/property-animation-binding.js +138 -0
  23. package/dist/animation/property-animation-binding.js.map +1 -0
  24. package/dist/animation/scenegraph-animator.cjs +122 -0
  25. package/dist/animation/scenegraph-animator.d.ts +37 -0
  26. package/dist/animation/scenegraph-animator.d.ts.map +1 -0
  27. package/dist/animation/scenegraph-animator.js +99 -0
  28. package/dist/animation/scenegraph-animator.js.map +1 -0
  29. package/dist/animation/skin.cjs +49 -0
  30. package/dist/animation/texture-transform.cjs +41 -0
  31. package/dist/animation/texture-transform.d.ts +8 -0
  32. package/dist/animation/texture-transform.d.ts.map +1 -0
  33. package/dist/animation/texture-transform.js +17 -0
  34. package/dist/animation/texture-transform.js.map +1 -0
  35. package/dist/animation/timeline.cjs +129 -0
  36. package/dist/animation-loop/animation-loop-template.cjs +33 -0
  37. package/dist/animation-loop/animation-loop.cjs +498 -0
  38. package/dist/animation-loop/animation-loop.d.ts +2 -1
  39. package/dist/animation-loop/animation-loop.d.ts.map +1 -1
  40. package/dist/animation-loop/animation-loop.js +9 -3
  41. package/dist/animation-loop/animation-loop.js.map +1 -1
  42. package/dist/animation-loop/animation-props.cjs +15 -0
  43. package/dist/animation-loop/make-animation-loop.cjs +104 -0
  44. package/dist/animation-loop/request-animation-frame.cjs +43 -0
  45. package/dist/application-utils/load-file.cjs +77 -0
  46. package/dist/application-utils/random.cjs +38 -0
  47. package/dist/audio/audio-controller.cjs +429 -0
  48. package/dist/audio/audio-controller.d.ts +146 -0
  49. package/dist/audio/audio-controller.d.ts.map +1 -0
  50. package/dist/audio/audio-controller.js +445 -0
  51. package/dist/audio/audio-controller.js.map +1 -0
  52. package/dist/audio/audio-environment.cjs +157 -0
  53. package/dist/audio/audio-environment.d.ts +49 -0
  54. package/dist/audio/audio-environment.d.ts.map +1 -0
  55. package/dist/audio/audio-environment.js +148 -0
  56. package/dist/audio/audio-environment.js.map +1 -0
  57. package/dist/audio/audio-graph.cjs +182 -0
  58. package/dist/audio/audio-graph.d.ts +58 -0
  59. package/dist/audio/audio-graph.d.ts.map +1 -0
  60. package/dist/audio/audio-graph.js +181 -0
  61. package/dist/audio/audio-graph.js.map +1 -0
  62. package/dist/compute/buffer-transform.cjs +146 -0
  63. package/dist/compute/buffer-transform.d.ts +15 -5
  64. package/dist/compute/buffer-transform.d.ts.map +1 -1
  65. package/dist/compute/buffer-transform.js +56 -12
  66. package/dist/compute/buffer-transform.js.map +1 -1
  67. package/dist/compute/computation.cjs +331 -0
  68. package/dist/compute/computation.d.ts +2 -4
  69. package/dist/compute/computation.d.ts.map +1 -1
  70. package/dist/compute/computation.js +3 -14
  71. package/dist/compute/computation.js.map +1 -1
  72. package/dist/compute/swap.cjs +132 -0
  73. package/dist/compute/texture-transform.cjs +142 -0
  74. package/dist/compute/texture-transform.d.ts +11 -7
  75. package/dist/compute/texture-transform.d.ts.map +1 -1
  76. package/dist/compute/texture-transform.js +16 -6
  77. package/dist/compute/texture-transform.js.map +1 -1
  78. package/dist/controls/orbit-controls.cjs +283 -0
  79. package/dist/controls/orbit-controls.d.ts +2 -0
  80. package/dist/controls/orbit-controls.d.ts.map +1 -1
  81. package/dist/controls/orbit-controls.js +2 -1
  82. package/dist/controls/orbit-controls.js.map +1 -1
  83. package/dist/debug/copy-texture-to-image.cjs +84 -0
  84. package/dist/debug/debug-framebuffer.cjs +113 -0
  85. package/dist/debug/debug-shader-layout.cjs +45 -0
  86. package/dist/debug/pixel-data-utils.cjs +54 -0
  87. package/dist/dist.dev.js +11517 -6015
  88. package/dist/dist.min.js +39 -35
  89. package/dist/dynamic-buffer/dynamic-buffer.cjs +39 -0
  90. package/dist/dynamic-buffer/dynamic-buffer.d.ts +1 -170
  91. package/dist/dynamic-buffer/dynamic-buffer.d.ts.map +1 -1
  92. package/dist/dynamic-buffer/dynamic-buffer.js +2 -312
  93. package/dist/dynamic-buffer/dynamic-buffer.js.map +1 -1
  94. package/dist/dynamic-texture/dynamic-texture.cjs +27 -0
  95. package/dist/dynamic-texture/dynamic-texture.d.ts +1 -114
  96. package/dist/dynamic-texture/dynamic-texture.d.ts.map +1 -1
  97. package/dist/dynamic-texture/dynamic-texture.js +2 -584
  98. package/dist/dynamic-texture/dynamic-texture.js.map +1 -1
  99. package/dist/dynamic-texture/texture-binding-source.cjs +31 -0
  100. package/dist/dynamic-texture/texture-binding-source.d.ts +1 -54
  101. package/dist/dynamic-texture/texture-binding-source.d.ts.map +1 -1
  102. package/dist/dynamic-texture/texture-binding-source.js +2 -51
  103. package/dist/dynamic-texture/texture-binding-source.js.map +1 -1
  104. package/dist/dynamic-texture/texture-data.cjs +53 -0
  105. package/dist/dynamic-texture/texture-data.d.ts +1 -145
  106. package/dist/dynamic-texture/texture-data.d.ts.map +1 -1
  107. package/dist/dynamic-texture/texture-data.js +2 -209
  108. package/dist/dynamic-texture/texture-data.js.map +1 -1
  109. package/dist/dynamic-texture/video-texture.cjs +269 -0
  110. package/dist/dynamic-texture/video-texture.d.ts +1 -1
  111. package/dist/dynamic-texture/video-texture.d.ts.map +1 -1
  112. package/dist/experimental/controls/comparison-splitter.cjs +231 -0
  113. package/dist/experimental/controls/comparison-splitter.d.ts +54 -0
  114. package/dist/experimental/controls/comparison-splitter.d.ts.map +1 -0
  115. package/dist/experimental/controls/comparison-splitter.js +215 -0
  116. package/dist/experimental/controls/comparison-splitter.js.map +1 -0
  117. package/dist/experimental/controls/flat-controller.cjs +301 -0
  118. package/dist/experimental/controls/flat-controller.d.ts +80 -0
  119. package/dist/experimental/controls/flat-controller.d.ts.map +1 -0
  120. package/dist/experimental/controls/flat-controller.js +295 -0
  121. package/dist/experimental/controls/flat-controller.js.map +1 -0
  122. package/dist/experimental/controls/index.cjs +35 -0
  123. package/dist/experimental/controls/index.cjs.map +6 -0
  124. package/dist/experimental/controls/index.d.ts +7 -0
  125. package/dist/experimental/controls/index.d.ts.map +1 -0
  126. package/dist/experimental/controls/index.js +7 -0
  127. package/dist/experimental/controls/index.js.map +1 -0
  128. package/dist/experimental/controls/orbit-controls.cjs +27 -0
  129. package/dist/experimental/controls/orbit-controls.d.ts +3 -0
  130. package/dist/experimental/controls/orbit-controls.d.ts.map +1 -0
  131. package/dist/experimental/controls/orbit-controls.js +5 -0
  132. package/dist/experimental/controls/orbit-controls.js.map +1 -0
  133. package/dist/experimental/materials/emissive-material.cjs +126 -0
  134. package/dist/experimental/materials/emissive-material.d.ts +38 -0
  135. package/dist/experimental/materials/emissive-material.d.ts.map +1 -0
  136. package/dist/experimental/materials/emissive-material.js +100 -0
  137. package/dist/experimental/materials/emissive-material.js.map +1 -0
  138. package/dist/experimental/materials/glass-material.cjs +570 -0
  139. package/dist/experimental/materials/glass-material.d.ts +107 -0
  140. package/dist/experimental/materials/glass-material.d.ts.map +1 -0
  141. package/dist/experimental/materials/glass-material.js +544 -0
  142. package/dist/experimental/materials/glass-material.js.map +1 -0
  143. package/dist/experimental/materials/glass-transmission.cjs +954 -0
  144. package/dist/experimental/materials/glass-transmission.d.ts +193 -0
  145. package/dist/experimental/materials/glass-transmission.d.ts.map +1 -0
  146. package/dist/experimental/materials/glass-transmission.js +928 -0
  147. package/dist/experimental/materials/glass-transmission.js.map +1 -0
  148. package/dist/experimental/materials/index.cjs +61 -0
  149. package/dist/experimental/materials/index.cjs.map +6 -0
  150. package/dist/experimental/materials/index.d.ts +14 -0
  151. package/dist/experimental/materials/index.d.ts.map +1 -0
  152. package/dist/experimental/materials/index.js +11 -0
  153. package/dist/experimental/materials/index.js.map +1 -0
  154. package/dist/experimental/materials/optical-caustics.cjs +201 -0
  155. package/dist/experimental/materials/optical-caustics.d.ts +69 -0
  156. package/dist/experimental/materials/optical-caustics.d.ts.map +1 -0
  157. package/dist/experimental/materials/optical-caustics.js +180 -0
  158. package/dist/experimental/materials/optical-caustics.js.map +1 -0
  159. package/dist/experimental/materials/optical-lighting.cjs +169 -0
  160. package/dist/experimental/materials/optical-lighting.d.ts +7 -0
  161. package/dist/experimental/materials/optical-lighting.d.ts.map +1 -0
  162. package/dist/experimental/materials/optical-lighting.js +144 -0
  163. package/dist/experimental/materials/optical-lighting.js.map +1 -0
  164. package/dist/experimental/materials/optical-point-lights.cjs +258 -0
  165. package/dist/experimental/materials/optical-point-lights.d.ts +68 -0
  166. package/dist/experimental/materials/optical-point-lights.d.ts.map +1 -0
  167. package/dist/experimental/materials/optical-point-lights.js +237 -0
  168. package/dist/experimental/materials/optical-point-lights.js.map +1 -0
  169. package/dist/experimental/materials/reflective-material.cjs +216 -0
  170. package/dist/experimental/materials/reflective-material.d.ts +46 -0
  171. package/dist/experimental/materials/reflective-material.d.ts.map +1 -0
  172. package/dist/experimental/materials/reflective-material.js +190 -0
  173. package/dist/experimental/materials/reflective-material.js.map +1 -0
  174. package/dist/experimental/textures/html-texture.cjs +221 -0
  175. package/dist/experimental/textures/html-texture.d.ts +85 -0
  176. package/dist/experimental/textures/html-texture.d.ts.map +1 -0
  177. package/dist/experimental/textures/html-texture.js +206 -0
  178. package/dist/experimental/textures/html-texture.js.map +1 -0
  179. package/dist/experimental/textures/index.cjs +33 -0
  180. package/dist/experimental/textures/index.cjs.map +6 -0
  181. package/dist/experimental/textures/index.d.ts +5 -0
  182. package/dist/experimental/textures/index.d.ts.map +1 -0
  183. package/dist/experimental/textures/index.js +7 -0
  184. package/dist/experimental/textures/index.js.map +1 -0
  185. package/dist/experimental/textures/packed-pixels.cjs +248 -0
  186. package/dist/experimental/textures/packed-pixels.d.ts +17 -0
  187. package/dist/experimental/textures/packed-pixels.d.ts.map +1 -0
  188. package/dist/experimental/textures/packed-pixels.js +237 -0
  189. package/dist/experimental/textures/packed-pixels.js.map +1 -0
  190. package/dist/experimental/textures/rgba-decoder.cjs +60 -0
  191. package/dist/experimental/textures/rgba-decoder.d.ts +29 -0
  192. package/dist/experimental/textures/rgba-decoder.d.ts.map +1 -0
  193. package/dist/experimental/textures/rgba-decoder.js +43 -0
  194. package/dist/experimental/textures/rgba-decoder.js.map +1 -0
  195. package/dist/experimental/webxr/index.cjs +38 -0
  196. package/dist/experimental/webxr/index.cjs.map +6 -0
  197. package/dist/experimental/webxr/index.d.ts +9 -0
  198. package/dist/experimental/webxr/index.d.ts.map +1 -0
  199. package/dist/experimental/webxr/index.js +8 -0
  200. package/dist/experimental/webxr/index.js.map +1 -0
  201. package/dist/experimental/webxr/webxr-animation-frame-provider.cjs +38 -0
  202. package/dist/experimental/webxr/webxr-animation-frame-provider.d.ts +9 -0
  203. package/dist/experimental/webxr/webxr-animation-frame-provider.d.ts.map +1 -0
  204. package/dist/experimental/webxr/webxr-animation-frame-provider.js +17 -0
  205. package/dist/experimental/webxr/webxr-animation-frame-provider.js.map +1 -0
  206. package/dist/experimental/webxr/webxr-camera-texture.cjs +157 -0
  207. package/dist/experimental/webxr/webxr-camera-texture.d.ts +48 -0
  208. package/dist/experimental/webxr/webxr-camera-texture.d.ts.map +1 -0
  209. package/dist/experimental/webxr/webxr-camera-texture.js +144 -0
  210. package/dist/experimental/webxr/webxr-camera-texture.js.map +1 -0
  211. package/dist/experimental/webxr/webxr-input.cjs +93 -0
  212. package/dist/experimental/webxr/webxr-input.d.ts +24 -0
  213. package/dist/experimental/webxr/webxr-input.d.ts.map +1 -0
  214. package/dist/experimental/webxr/webxr-input.js +70 -0
  215. package/dist/experimental/webxr/webxr-input.js.map +1 -0
  216. package/dist/experimental/webxr/webxr-manager.cjs +356 -0
  217. package/dist/experimental/webxr/webxr-manager.d.ts +91 -0
  218. package/dist/experimental/webxr/webxr-manager.d.ts.map +1 -0
  219. package/dist/experimental/webxr/webxr-manager.js +354 -0
  220. package/dist/experimental/webxr/webxr-manager.js.map +1 -0
  221. package/dist/experimental/webxr/webxr-types.cjs +15 -0
  222. package/dist/experimental/webxr/webxr-types.d.ts +152 -0
  223. package/dist/experimental/webxr/webxr-types.d.ts.map +1 -0
  224. package/dist/experimental/webxr/webxr-types.js +5 -0
  225. package/dist/experimental/webxr/webxr-types.js.map +1 -0
  226. package/dist/geometry/edge-geometry.cjs +171 -0
  227. package/dist/geometry/edge-geometry.d.ts +3 -2
  228. package/dist/geometry/edge-geometry.d.ts.map +1 -1
  229. package/dist/geometry/edge-geometry.js.map +1 -1
  230. package/dist/geometry/geometry-primitives.cjs +189 -0
  231. package/dist/geometry/geometry-primitives.d.ts +60 -0
  232. package/dist/geometry/geometry-primitives.d.ts.map +1 -0
  233. package/dist/geometry/geometry-primitives.js +161 -0
  234. package/dist/geometry/geometry-primitives.js.map +1 -0
  235. package/dist/geometry/geometry-table.cjs +15 -0
  236. package/dist/geometry/geometry-utils.cjs +147 -0
  237. package/dist/geometry/geometry-utils.d.ts +7 -15
  238. package/dist/geometry/geometry-utils.d.ts.map +1 -1
  239. package/dist/geometry/geometry-utils.js +9 -55
  240. package/dist/geometry/geometry-utils.js.map +1 -1
  241. package/dist/geometry/geometry.cjs +90 -0
  242. package/dist/geometry/geometry.d.ts +9 -69
  243. package/dist/geometry/geometry.d.ts.map +1 -1
  244. package/dist/geometry/geometry.js +27 -93
  245. package/dist/geometry/geometry.js.map +1 -1
  246. package/dist/geometry/gpu-geometry.cjs +130 -0
  247. package/dist/geometry/gpu-geometry.d.ts +4 -2
  248. package/dist/geometry/gpu-geometry.d.ts.map +1 -1
  249. package/dist/geometry/gpu-geometry.js +3 -3
  250. package/dist/geometry/gpu-geometry.js.map +1 -1
  251. package/dist/geometry/gpu-vector-geometry-adapter.cjs +88 -0
  252. package/dist/geometry/gpu-vector-geometry-adapter.d.ts +5 -0
  253. package/dist/geometry/gpu-vector-geometry-adapter.d.ts.map +1 -0
  254. package/dist/geometry/gpu-vector-geometry-adapter.js +73 -0
  255. package/dist/geometry/gpu-vector-geometry-adapter.js.map +1 -0
  256. package/dist/geometry/gpu-vector-geometry.cjs +40 -0
  257. package/dist/geometry/gpu-vector-geometry.d.ts +21 -0
  258. package/dist/geometry/gpu-vector-geometry.d.ts.map +1 -0
  259. package/dist/geometry/gpu-vector-geometry.js +19 -0
  260. package/dist/geometry/gpu-vector-geometry.js.map +1 -0
  261. package/dist/geometry/mesh-simplification.cjs +385 -0
  262. package/dist/geometry/ring-geometry.cjs +104 -0
  263. package/dist/geometry/ring-geometry.d.ts +17 -0
  264. package/dist/geometry/ring-geometry.d.ts.map +1 -0
  265. package/dist/geometry/ring-geometry.js +94 -0
  266. package/dist/geometry/ring-geometry.js.map +1 -0
  267. package/dist/geometry/stroke-geometry.cjs +171 -0
  268. package/dist/graph/models/index.cjs +66 -0
  269. package/dist/graph/models/index.cjs.map +6 -0
  270. package/dist/graph/models/index.d.ts +7 -0
  271. package/dist/graph/models/index.d.ts.map +1 -0
  272. package/dist/graph/models/index.js +10 -0
  273. package/dist/graph/models/index.js.map +1 -0
  274. package/dist/graph/models/path/path-attribute-model.cjs +421 -0
  275. package/dist/graph/models/path/path-attribute-model.d.ts +142 -0
  276. package/dist/graph/models/path/path-attribute-model.d.ts.map +1 -0
  277. package/dist/graph/models/path/path-attribute-model.js +409 -0
  278. package/dist/graph/models/path/path-attribute-model.js.map +1 -0
  279. package/dist/graph/models/path/path-storage-model.cjs +711 -0
  280. package/dist/graph/models/path/path-storage-model.d.ts +174 -0
  281. package/dist/graph/models/path/path-storage-model.d.ts.map +1 -0
  282. package/dist/graph/models/path/path-storage-model.js +720 -0
  283. package/dist/graph/models/path/path-storage-model.js.map +1 -0
  284. package/dist/graph/models/path/path-trips-storage-model.cjs +271 -0
  285. package/dist/graph/models/path/path-trips-storage-model.d.ts +58 -0
  286. package/dist/graph/models/path/path-trips-storage-model.d.ts.map +1 -0
  287. package/dist/graph/models/path/path-trips-storage-model.js +248 -0
  288. package/dist/graph/models/path/path-trips-storage-model.js.map +1 -0
  289. package/dist/graph/models/polygon/polygon-attribute-model.cjs +117 -0
  290. package/dist/graph/models/polygon/polygon-attribute-model.d.ts +53 -0
  291. package/dist/graph/models/polygon/polygon-attribute-model.d.ts.map +1 -0
  292. package/dist/graph/models/polygon/polygon-attribute-model.js +101 -0
  293. package/dist/graph/models/polygon/polygon-attribute-model.js.map +1 -0
  294. package/dist/graph/models/polygon/polygon-shaders.cjs +283 -0
  295. package/dist/graph/models/polygon/polygon-shaders.d.ts +77 -0
  296. package/dist/graph/models/polygon/polygon-shaders.d.ts.map +1 -0
  297. package/dist/graph/models/polygon/polygon-shaders.js +242 -0
  298. package/dist/graph/models/polygon/polygon-shaders.js.map +1 -0
  299. package/dist/graph/models/polygon/polygon-storage-model.cjs +111 -0
  300. package/dist/graph/models/polygon/polygon-storage-model.d.ts +53 -0
  301. package/dist/graph/models/polygon/polygon-storage-model.d.ts.map +1 -0
  302. package/dist/graph/models/polygon/polygon-storage-model.js +92 -0
  303. package/dist/graph/models/polygon/polygon-storage-model.js.map +1 -0
  304. package/dist/graph/physics/index.cjs +50 -0
  305. package/dist/graph/physics/index.cjs.map +6 -0
  306. package/dist/graph/physics/index.d.ts +12 -0
  307. package/dist/graph/physics/index.d.ts.map +1 -0
  308. package/dist/graph/physics/index.js +12 -0
  309. package/dist/graph/physics/index.js.map +1 -0
  310. package/dist/graph/physics/physics-scenegraph.cjs +92 -0
  311. package/dist/graph/physics/physics-scenegraph.d.ts +35 -0
  312. package/dist/graph/physics/physics-scenegraph.d.ts.map +1 -0
  313. package/dist/graph/physics/physics-scenegraph.js +80 -0
  314. package/dist/graph/physics/physics-scenegraph.js.map +1 -0
  315. package/dist/graph/physics/scenegraph-behaviors.cjs +164 -0
  316. package/dist/graph/physics/scenegraph-behaviors.d.ts +37 -0
  317. package/dist/graph/physics/scenegraph-behaviors.d.ts.map +1 -0
  318. package/dist/graph/physics/scenegraph-behaviors.js +145 -0
  319. package/dist/graph/physics/scenegraph-behaviors.js.map +1 -0
  320. package/dist/graph/physics/scenegraph-instance.cjs +246 -0
  321. package/dist/graph/physics/scenegraph-instance.d.ts +59 -0
  322. package/dist/graph/physics/scenegraph-instance.d.ts.map +1 -0
  323. package/dist/graph/physics/scenegraph-instance.js +241 -0
  324. package/dist/graph/physics/scenegraph-instance.js.map +1 -0
  325. package/dist/graph/physics/scenegraph-joints.cjs +51 -0
  326. package/dist/graph/physics/scenegraph-joints.d.ts +5 -0
  327. package/dist/graph/physics/scenegraph-joints.d.ts.map +1 -0
  328. package/dist/graph/physics/scenegraph-joints.js +31 -0
  329. package/dist/graph/physics/scenegraph-joints.js.map +1 -0
  330. package/dist/graph/physics/scenegraph-motion.cjs +177 -0
  331. package/dist/graph/physics/scenegraph-motion.d.ts +37 -0
  332. package/dist/graph/physics/scenegraph-motion.d.ts.map +1 -0
  333. package/dist/graph/physics/scenegraph-motion.js +168 -0
  334. package/dist/graph/physics/scenegraph-motion.js.map +1 -0
  335. package/dist/graph/physics/scenegraph-properties.cjs +170 -0
  336. package/dist/graph/physics/scenegraph-properties.d.ts +37 -0
  337. package/dist/graph/physics/scenegraph-properties.d.ts.map +1 -0
  338. package/dist/graph/physics/scenegraph-properties.js +186 -0
  339. package/dist/graph/physics/scenegraph-properties.js.map +1 -0
  340. package/dist/graph/physics/scenegraph-publication.cjs +112 -0
  341. package/dist/graph/physics/scenegraph-publication.d.ts +23 -0
  342. package/dist/graph/physics/scenegraph-publication.d.ts.map +1 -0
  343. package/dist/graph/physics/scenegraph-publication.js +99 -0
  344. package/dist/graph/physics/scenegraph-publication.js.map +1 -0
  345. package/dist/graph/physics/scenegraph-session.cjs +256 -0
  346. package/dist/graph/physics/scenegraph-session.d.ts +68 -0
  347. package/dist/graph/physics/scenegraph-session.d.ts.map +1 -0
  348. package/dist/graph/physics/scenegraph-session.js +249 -0
  349. package/dist/graph/physics/scenegraph-session.js.map +1 -0
  350. package/dist/graph/tables/gpu-table-geometry.cjs +84 -0
  351. package/dist/graph/tables/gpu-table-geometry.d.ts +32 -0
  352. package/dist/graph/tables/gpu-table-geometry.d.ts.map +1 -0
  353. package/dist/graph/tables/gpu-table-geometry.js +67 -0
  354. package/dist/graph/tables/gpu-table-geometry.js.map +1 -0
  355. package/dist/graph/tables/gpu-table-model.cjs +459 -0
  356. package/dist/graph/tables/gpu-table-model.d.ts +67 -0
  357. package/dist/graph/tables/gpu-table-model.d.ts.map +1 -0
  358. package/dist/graph/tables/gpu-table-model.js +457 -0
  359. package/dist/graph/tables/gpu-table-model.js.map +1 -0
  360. package/dist/graph/tables/gpu-table-transform.cjs +341 -0
  361. package/dist/graph/tables/gpu-table-transform.d.ts +61 -0
  362. package/dist/graph/tables/gpu-table-transform.d.ts.map +1 -0
  363. package/dist/graph/tables/gpu-table-transform.js +333 -0
  364. package/dist/graph/tables/gpu-table-transform.js.map +1 -0
  365. package/dist/graph/tables/index.cjs +33 -0
  366. package/dist/graph/tables/index.cjs.map +6 -0
  367. package/dist/graph/tables/index.d.ts +4 -0
  368. package/dist/graph/tables/index.d.ts.map +1 -0
  369. package/dist/graph/tables/index.js +7 -0
  370. package/dist/graph/tables/index.js.map +1 -0
  371. package/dist/index.cjs +303 -10629
  372. package/dist/index.cjs.map +3 -3
  373. package/dist/index.d.ts +46 -19
  374. package/dist/index.d.ts.map +1 -1
  375. package/dist/index.js +33 -10
  376. package/dist/index.js.map +1 -1
  377. package/dist/interactivity/interactivity.cjs +570 -0
  378. package/dist/interactivity/interactivity.d.ts +107 -0
  379. package/dist/interactivity/interactivity.d.ts.map +1 -0
  380. package/dist/interactivity/interactivity.js +575 -0
  381. package/dist/interactivity/interactivity.js.map +1 -0
  382. package/dist/interactivity/physics.cjs +15 -0
  383. package/dist/interactivity/physics.d.ts +12 -0
  384. package/dist/interactivity/physics.d.ts.map +1 -0
  385. package/dist/interactivity/physics.js +5 -0
  386. package/dist/interactivity/physics.js.map +1 -0
  387. package/dist/material/material-factory.cjs +99 -0
  388. package/dist/material/material-factory.d.ts +1 -1
  389. package/dist/material/material-factory.d.ts.map +1 -1
  390. package/dist/material/material.cjs +239 -0
  391. package/dist/material/material.d.ts +2 -2
  392. package/dist/material/material.d.ts.map +1 -1
  393. package/dist/material/material.js +2 -2
  394. package/dist/material/material.js.map +1 -1
  395. package/dist/model/gpu-vector-bindings.cjs +226 -0
  396. package/dist/model/gpu-vector-bindings.d.ts +36 -0
  397. package/dist/model/gpu-vector-bindings.d.ts.map +1 -0
  398. package/dist/model/gpu-vector-bindings.js +217 -0
  399. package/dist/model/gpu-vector-bindings.js.map +1 -0
  400. package/dist/model/gpu-vector-draw-batches.cjs +82 -0
  401. package/dist/model/gpu-vector-draw-batches.d.ts +5 -0
  402. package/dist/model/gpu-vector-draw-batches.d.ts.map +1 -0
  403. package/dist/model/gpu-vector-draw-batches.js +73 -0
  404. package/dist/model/gpu-vector-draw-batches.js.map +1 -0
  405. package/dist/model/gpu-vector-model-batches.cjs +94 -0
  406. package/dist/model/gpu-vector-model-batches.d.ts +41 -0
  407. package/dist/model/gpu-vector-model-batches.d.ts.map +1 -0
  408. package/dist/model/gpu-vector-model-batches.js +77 -0
  409. package/dist/model/gpu-vector-model-batches.js.map +1 -0
  410. package/dist/model/gpu-vector-model.cjs +1264 -0
  411. package/dist/model/gpu-vector-model.d.ts +352 -0
  412. package/dist/model/gpu-vector-model.d.ts.map +1 -0
  413. package/dist/model/gpu-vector-model.js +1375 -0
  414. package/dist/model/gpu-vector-model.js.map +1 -0
  415. package/dist/model/model.cjs +134 -0
  416. package/dist/model/model.d.ts +22 -306
  417. package/dist/model/model.d.ts.map +1 -1
  418. package/dist/model/model.js +68 -1092
  419. package/dist/model/model.js.map +1 -1
  420. package/dist/model/split-uniforms-and-bindings.cjs +44 -0
  421. package/dist/model/split-uniforms-and-bindings.d.ts +1 -1
  422. package/dist/model/split-uniforms-and-bindings.d.ts.map +1 -1
  423. package/dist/model/split-uniforms-and-bindings.js +5 -2
  424. package/dist/model/split-uniforms-and-bindings.js.map +1 -1
  425. package/dist/models/billboard-texture-model.cjs +167 -0
  426. package/dist/models/billboard-texture-model.d.ts +1 -1
  427. package/dist/models/billboard-texture-model.d.ts.map +1 -1
  428. package/dist/models/billboard-texture-model.js +1 -1
  429. package/dist/models/billboard-texture-model.js.map +1 -1
  430. package/dist/models/billboard-texture-module.cjs +61 -0
  431. package/dist/models/clip-space.cjs +103 -0
  432. package/dist/models/clip-space.d.ts +4 -1
  433. package/dist/models/clip-space.d.ts.map +1 -1
  434. package/dist/models/clip-space.js +16 -13
  435. package/dist/models/clip-space.js.map +1 -1
  436. package/dist/models/directional-light-model.cjs +45 -0
  437. package/dist/models/directional-light-model.js +1 -1
  438. package/dist/models/directional-light-model.js.map +1 -1
  439. package/dist/models/light-model-utils.cjs +426 -0
  440. package/dist/models/point-light-model.cjs +44 -0
  441. package/dist/models/point-light-model.js +1 -1
  442. package/dist/models/point-light-model.js.map +1 -1
  443. package/dist/models/spot-light-model.cjs +45 -0
  444. package/dist/models/spot-light-model.js +1 -1
  445. package/dist/models/spot-light-model.js.map +1 -1
  446. package/dist/modules/picking/color-picking.cjs +209 -0
  447. package/dist/modules/picking/color-picking.d.ts +1 -1
  448. package/dist/modules/picking/index-color-picking.cjs +230 -0
  449. package/dist/modules/picking/index-color-picking.d.ts +1 -1
  450. package/dist/modules/picking/index-picking.cjs +201 -0
  451. package/dist/modules/picking/index-picking.d.ts +1 -1
  452. package/dist/modules/picking/legacy-color-picking.cjs +28 -0
  453. package/dist/modules/picking/legacy-color-picking.d.ts +1 -1
  454. package/dist/modules/picking/legacy-picking-manager.cjs +92 -0
  455. package/dist/modules/picking/picking-manager.cjs +360 -0
  456. package/dist/modules/picking/picking-uniforms.cjs +140 -0
  457. package/dist/modules/picking/picking-uniforms.d.ts +1 -1
  458. package/dist/modules/picking/picking-uniforms.d.ts.map +1 -1
  459. package/dist/modules/picking/picking.cjs +43 -0
  460. package/dist/modules/picking/picking.d.ts +1 -1
  461. package/dist/passes/get-fragment-shader.cjs +119 -0
  462. package/dist/passes/shader-pass-renderer.cjs +722 -0
  463. package/dist/passes/shader-pass-renderer.d.ts +2 -2
  464. package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
  465. package/dist/passes/shader-pass-renderer.js +1 -1
  466. package/dist/passes/shader-pass-renderer.js.map +1 -1
  467. package/dist/passes/texture-transform-module.cjs +78 -0
  468. package/dist/scenegraph/controllers/area-light-controller.cjs +143 -0
  469. package/dist/scenegraph/controllers/area-light-controller.d.ts +31 -0
  470. package/dist/scenegraph/controllers/area-light-controller.d.ts.map +1 -0
  471. package/dist/scenegraph/controllers/area-light-controller.js +130 -0
  472. package/dist/scenegraph/controllers/area-light-controller.js.map +1 -0
  473. package/dist/scenegraph/controllers/billboard-controller.cjs +156 -0
  474. package/dist/scenegraph/controllers/billboard-controller.d.ts +45 -0
  475. package/dist/scenegraph/controllers/billboard-controller.d.ts.map +1 -0
  476. package/dist/scenegraph/controllers/billboard-controller.js +156 -0
  477. package/dist/scenegraph/controllers/billboard-controller.js.map +1 -0
  478. package/dist/scenegraph/controllers/joint-controller.cjs +71 -0
  479. package/dist/scenegraph/controllers/joint-controller.d.ts +30 -0
  480. package/dist/scenegraph/controllers/joint-controller.d.ts.map +1 -0
  481. package/dist/scenegraph/controllers/joint-controller.js +53 -0
  482. package/dist/scenegraph/controllers/joint-controller.js.map +1 -0
  483. package/dist/scenegraph/controllers/material-variants.cjs +61 -0
  484. package/dist/scenegraph/controllers/material-variants.d.ts +42 -0
  485. package/dist/scenegraph/controllers/material-variants.d.ts.map +1 -0
  486. package/dist/scenegraph/controllers/material-variants.js +40 -0
  487. package/dist/scenegraph/controllers/material-variants.js.map +1 -0
  488. package/dist/scenegraph/controllers/morph-controller.cjs +61 -0
  489. package/dist/scenegraph/controllers/morph-controller.d.ts +19 -0
  490. package/dist/scenegraph/controllers/morph-controller.d.ts.map +1 -0
  491. package/dist/scenegraph/controllers/morph-controller.js +41 -0
  492. package/dist/scenegraph/controllers/morph-controller.js.map +1 -0
  493. package/dist/scenegraph/controllers/skin-controller.cjs +111 -0
  494. package/dist/scenegraph/controllers/skin-controller.d.ts +36 -0
  495. package/dist/scenegraph/controllers/skin-controller.d.ts.map +1 -0
  496. package/dist/scenegraph/controllers/skin-controller.js +90 -0
  497. package/dist/scenegraph/controllers/skin-controller.js.map +1 -0
  498. package/dist/scenegraph/group-node.cjs +129 -0
  499. package/dist/scenegraph/model-node.cjs +68 -0
  500. package/dist/scenegraph/physics-transforms.cjs +95 -0
  501. package/dist/scenegraph/physics-transforms.d.ts +13 -0
  502. package/dist/scenegraph/physics-transforms.d.ts.map +1 -0
  503. package/dist/scenegraph/physics-transforms.js +72 -0
  504. package/dist/scenegraph/physics-transforms.js.map +1 -0
  505. package/dist/scenegraph/published-transforms.cjs +37 -0
  506. package/dist/scenegraph/published-transforms.d.ts +17 -0
  507. package/dist/scenegraph/published-transforms.d.ts.map +1 -0
  508. package/dist/scenegraph/published-transforms.js +16 -0
  509. package/dist/scenegraph/published-transforms.js.map +1 -0
  510. package/dist/scenegraph/scenegraph-bounds.cjs +51 -0
  511. package/dist/scenegraph/scenegraph-node.cjs +182 -0
  512. package/dist/shader-inputs.cjs +231 -0
  513. package/dist/shader-inputs.d.ts +1 -1
  514. package/dist/shader-inputs.d.ts.map +1 -1
  515. package/dist/utils/buffer-layout-helper.cjs +52 -0
  516. package/dist/utils/buffer-layout-order.cjs +37 -0
  517. package/dist/utils/deep-equal.cjs +65 -0
  518. package/dist/utils/get-platform-info.cjs +21 -0
  519. package/dist/utils/get-platform-info.d.ts +2 -0
  520. package/dist/utils/get-platform-info.d.ts.map +1 -0
  521. package/dist/utils/get-platform-info.js +5 -0
  522. package/dist/utils/get-platform-info.js.map +1 -0
  523. package/dist/utils/gpu-vector-batch-structure.cjs +45 -0
  524. package/dist/utils/gpu-vector-batch-structure.d.ts +12 -0
  525. package/dist/utils/gpu-vector-batch-structure.d.ts.map +1 -0
  526. package/dist/utils/gpu-vector-batch-structure.js +27 -0
  527. package/dist/utils/gpu-vector-batch-structure.js.map +1 -0
  528. package/dist/utils/shader-module-utils.cjs +148 -0
  529. package/dist/utils/uid.cjs +32 -0
  530. package/package.json +47 -8
  531. package/src/animation/deform-positions.ts +62 -0
  532. package/src/animation/node-animation-binding.ts +54 -0
  533. package/src/animation/property-animation-binding.ts +212 -0
  534. package/src/animation/scenegraph-animator.ts +117 -0
  535. package/src/animation/texture-transform.ts +59 -0
  536. package/src/animation-loop/animation-loop.ts +10 -3
  537. package/src/audio/audio-controller.ts +583 -0
  538. package/src/audio/audio-environment.ts +202 -0
  539. package/src/audio/audio-graph.ts +253 -0
  540. package/src/compute/buffer-transform.ts +71 -16
  541. package/src/compute/computation.ts +4 -19
  542. package/src/compute/texture-transform.ts +25 -12
  543. package/src/controls/orbit-controls.ts +4 -1
  544. package/src/dynamic-buffer/dynamic-buffer.ts +15 -449
  545. package/src/dynamic-texture/dynamic-texture.ts +5 -760
  546. package/src/dynamic-texture/texture-binding-source.ts +8 -90
  547. package/src/dynamic-texture/texture-data.ts +31 -340
  548. package/src/dynamic-texture/video-texture.ts +1 -1
  549. package/src/experimental/controls/comparison-splitter.ts +269 -0
  550. package/src/experimental/controls/flat-controller.ts +403 -0
  551. package/src/experimental/controls/index.ts +16 -0
  552. package/src/experimental/controls/orbit-controls.ts +6 -0
  553. package/src/experimental/materials/emissive-material.ts +120 -0
  554. package/src/experimental/materials/glass-material.ts +607 -0
  555. package/src/experimental/materials/glass-transmission.ts +1023 -0
  556. package/src/experimental/materials/index.ts +49 -0
  557. package/src/experimental/materials/optical-caustics.ts +234 -0
  558. package/src/experimental/materials/optical-lighting.ts +148 -0
  559. package/src/experimental/materials/optical-point-lights.ts +288 -0
  560. package/src/experimental/materials/reflective-material.ts +214 -0
  561. package/src/experimental/textures/html-texture.ts +285 -0
  562. package/src/experimental/textures/index.ts +8 -0
  563. package/src/experimental/textures/packed-pixels.ts +351 -0
  564. package/src/experimental/textures/rgba-decoder.ts +79 -0
  565. package/src/experimental/webxr/index.ts +21 -0
  566. package/src/experimental/webxr/webxr-animation-frame-provider.ts +22 -0
  567. package/src/experimental/webxr/webxr-camera-texture.ts +195 -0
  568. package/src/experimental/webxr/webxr-input.ts +117 -0
  569. package/src/experimental/webxr/webxr-manager.ts +524 -0
  570. package/src/experimental/webxr/webxr-types.ts +192 -0
  571. package/src/geometry/edge-geometry.ts +7 -3
  572. package/src/geometry/geometry-primitives.ts +226 -0
  573. package/src/geometry/geometry-utils.ts +16 -71
  574. package/src/geometry/geometry.ts +36 -163
  575. package/src/geometry/gpu-geometry.ts +9 -4
  576. package/src/geometry/gpu-vector-geometry-adapter.ts +78 -0
  577. package/src/geometry/gpu-vector-geometry.ts +33 -0
  578. package/src/geometry/ring-geometry.ts +117 -0
  579. package/src/graph/models/index.ts +45 -0
  580. package/src/graph/models/path/path-attribute-model.ts +563 -0
  581. package/src/graph/models/path/path-storage-model.ts +996 -0
  582. package/src/graph/models/path/path-trips-storage-model.ts +286 -0
  583. package/src/graph/models/polygon/polygon-attribute-model.ts +165 -0
  584. package/src/graph/models/polygon/polygon-shaders.ts +279 -0
  585. package/src/graph/models/polygon/polygon-storage-model.ts +146 -0
  586. package/src/graph/physics/index.ts +24 -0
  587. package/src/graph/physics/physics-scenegraph.ts +112 -0
  588. package/src/graph/physics/scenegraph-behaviors.ts +169 -0
  589. package/src/graph/physics/scenegraph-instance.ts +296 -0
  590. package/src/graph/physics/scenegraph-joints.ts +37 -0
  591. package/src/graph/physics/scenegraph-motion.ts +175 -0
  592. package/src/graph/physics/scenegraph-properties.ts +241 -0
  593. package/src/graph/physics/scenegraph-publication.ts +116 -0
  594. package/src/graph/physics/scenegraph-session.ts +317 -0
  595. package/src/graph/tables/gpu-table-geometry.ts +88 -0
  596. package/src/graph/tables/gpu-table-model.ts +661 -0
  597. package/src/graph/tables/gpu-table-transform.ts +497 -0
  598. package/src/graph/tables/index.ts +18 -0
  599. package/src/index.ts +144 -27
  600. package/src/interactivity/interactivity.ts +670 -0
  601. package/src/interactivity/physics.ts +19 -0
  602. package/src/material/material-factory.ts +1 -1
  603. package/src/material/material.ts +2 -2
  604. package/src/model/gpu-vector-bindings.ts +276 -0
  605. package/src/model/gpu-vector-draw-batches.ts +116 -0
  606. package/src/model/gpu-vector-model-batches.ts +142 -0
  607. package/src/model/gpu-vector-model.ts +1819 -0
  608. package/src/model/model.ts +91 -1444
  609. package/src/model/split-uniforms-and-bindings.ts +6 -3
  610. package/src/models/billboard-texture-model.ts +1 -1
  611. package/src/models/clip-space.ts +21 -14
  612. package/src/models/directional-light-model.ts +1 -1
  613. package/src/models/point-light-model.ts +1 -1
  614. package/src/models/spot-light-model.ts +1 -1
  615. package/src/modules/picking/legacy-picking-manager.ts +1 -1
  616. package/src/modules/picking/picking-uniforms.ts +1 -1
  617. package/src/passes/shader-pass-renderer.ts +2 -2
  618. package/src/scenegraph/controllers/area-light-controller.ts +152 -0
  619. package/src/scenegraph/controllers/billboard-controller.ts +204 -0
  620. package/src/scenegraph/controllers/joint-controller.ts +81 -0
  621. package/src/scenegraph/controllers/material-variants.ts +70 -0
  622. package/src/scenegraph/controllers/morph-controller.ts +61 -0
  623. package/src/scenegraph/controllers/skin-controller.ts +125 -0
  624. package/src/scenegraph/physics-transforms.ts +82 -0
  625. package/src/scenegraph/published-transforms.ts +18 -0
  626. package/src/shader-inputs.ts +1 -1
  627. package/src/utils/get-platform-info.ts +5 -0
  628. package/src/utils/gpu-vector-batch-structure.ts +36 -0
  629. package/dist/compute/kernel.d.ts +0 -54
  630. package/dist/compute/kernel.d.ts.map +0 -1
  631. package/dist/compute/kernel.js +0 -103
  632. package/dist/compute/kernel.js.map +0 -1
  633. package/dist/compute/render-kernel.d.ts +0 -65
  634. package/dist/compute/render-kernel.d.ts.map +0 -1
  635. package/dist/compute/render-kernel.js +0 -129
  636. package/dist/compute/render-kernel.js.map +0 -1
  637. package/dist/geometries/cone-geometry.d.ts +0 -12
  638. package/dist/geometries/cone-geometry.d.ts.map +0 -1
  639. package/dist/geometries/cone-geometry.js +0 -19
  640. package/dist/geometries/cone-geometry.js.map +0 -1
  641. package/dist/geometries/cube-geometry.d.ts +0 -14
  642. package/dist/geometries/cube-geometry.d.ts.map +0 -1
  643. package/dist/geometries/cube-geometry.js +0 -222
  644. package/dist/geometries/cube-geometry.js.map +0 -1
  645. package/dist/geometries/cylinder-geometry.d.ts +0 -11
  646. package/dist/geometries/cylinder-geometry.d.ts.map +0 -1
  647. package/dist/geometries/cylinder-geometry.js +0 -17
  648. package/dist/geometries/cylinder-geometry.js.map +0 -1
  649. package/dist/geometries/ico-sphere-geometry.d.ts +0 -11
  650. package/dist/geometries/ico-sphere-geometry.d.ts.map +0 -1
  651. package/dist/geometries/ico-sphere-geometry.js +0 -158
  652. package/dist/geometries/ico-sphere-geometry.js.map +0 -1
  653. package/dist/geometries/plane-geometry.d.ts +0 -20
  654. package/dist/geometries/plane-geometry.d.ts.map +0 -1
  655. package/dist/geometries/plane-geometry.js +0 -106
  656. package/dist/geometries/plane-geometry.js.map +0 -1
  657. package/dist/geometries/sphere-geometry.d.ts +0 -12
  658. package/dist/geometries/sphere-geometry.d.ts.map +0 -1
  659. package/dist/geometries/sphere-geometry.js +0 -88
  660. package/dist/geometries/sphere-geometry.js.map +0 -1
  661. package/dist/geometries/truncated-cone-geometry.d.ts +0 -23
  662. package/dist/geometries/truncated-cone-geometry.d.ts.map +0 -1
  663. package/dist/geometries/truncated-cone-geometry.js +0 -112
  664. package/dist/geometries/truncated-cone-geometry.js.map +0 -1
  665. package/src/compute/kernel.ts +0 -146
  666. package/src/compute/render-kernel.ts +0 -192
  667. package/src/geometries/cone-geometry.ts +0 -31
  668. package/src/geometries/cube-geometry.ts +0 -258
  669. package/src/geometries/cylinder-geometry.ts +0 -28
  670. package/src/geometries/ico-sphere-geometry.ts +0 -193
  671. package/src/geometries/plane-geometry.ts +0 -142
  672. package/src/geometries/sphere-geometry.ts +0 -113
  673. package/src/geometries/truncated-cone-geometry.ts +0 -145
@@ -4,6 +4,7 @@
4
4
 
5
5
  import {assert} from '@luma.gl/core';
6
6
  import type {TypedArray} from '@math.gl/core';
7
+ import type {Geometry as MathGeometry} from '@math.gl/geometry';
7
8
  import {Geometry, type GeometryAttribute} from './geometry';
8
9
 
9
10
  export type MakeEdgeGeometryOptions = {
@@ -22,7 +23,7 @@ type Edge = {start: number; end: number; normal: Position; faceCount: number; cr
22
23
 
23
24
  /** Extracts boundary, crease, and non-manifold edges from a triangle-list CPU geometry. */
24
25
  export function makeEdgeGeometry(
25
- geometry: Geometry,
26
+ geometry: MathGeometry,
26
27
  options: MakeEdgeGeometryOptions = {}
27
28
  ): Geometry {
28
29
  const {angleThreshold = 30, weldTolerance = 0, positionAttribute = 'POSITION'} = options;
@@ -141,7 +142,7 @@ export function makeEdgeGeometry(
141
142
 
142
143
  /** Classifies adjacent meshes together to suppress coplanar tile seams and duplicate edges. */
143
144
  export function makeEdgeGeometryFromGeometries(
144
- geometries: readonly Geometry[],
145
+ geometries: readonly MathGeometry[],
145
146
  options: MakeEdgeGeometryOptions = {}
146
147
  ): Geometry {
147
148
  // A batch needs at least one source to define its position storage type.
@@ -188,7 +189,10 @@ export function makeEdgeGeometryFromGeometries(
188
189
  );
189
190
  }
190
191
 
191
- function getTrianglePositions(geometry: Geometry, positionAttribute: string): GeometryAttribute {
192
+ function getTrianglePositions(
193
+ geometry: MathGeometry,
194
+ positionAttribute: string
195
+ ): GeometryAttribute {
192
196
  const positions = geometry.attributes[positionAttribute];
193
197
  // Edge extraction requires packed xyz positions and complete triangle-list primitives.
194
198
  assert(geometry.topology === 'triangle-list' && positions?.size === 3);
@@ -0,0 +1,226 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import {
6
+ CubeGeometry as MathCubeGeometry,
7
+ SphereGeometry as MathSphereGeometry,
8
+ IcoSphereGeometry as MathIcoSphereGeometry,
9
+ PlaneGeometry as MathPlaneGeometry,
10
+ TruncatedConeGeometry as MathTruncatedConeGeometry,
11
+ unpackIndexedGeometry,
12
+ type Geometry as MathGeometry,
13
+ type GeometryAttributeInput,
14
+ type SphereGeometryProps,
15
+ type IcoSphereGeometryProps,
16
+ type TruncatedConeGeometryProps
17
+ } from '@math.gl/geometry';
18
+ import {TorusGeometry as MathTorusGeometry, type TorusGeometryProps} from '@math.gl/geometry';
19
+ import {Geometry} from './geometry';
20
+
21
+ export type {TorusGeometryProps};
22
+
23
+ /** Shared math.gl tessellation, including open partial sweeps around the Y axis. */
24
+ export class TorusGeometry extends Geometry {
25
+ constructor(props: TorusGeometryProps = {}) {
26
+ const source = new MathTorusGeometry(props);
27
+ super({...source, attributes: source.attributes});
28
+ }
29
+ }
30
+
31
+ export type {SphereGeometryProps, IcoSphereGeometryProps, TruncatedConeGeometryProps};
32
+
33
+ export type CubeGeometryProps = {
34
+ id?: string;
35
+ indices?: boolean;
36
+ attributes?: Record<string, GeometryAttributeInput>;
37
+ };
38
+
39
+ /** Compatibility defaults and face metadata over the math.gl box tessellator. */
40
+ export class CubeGeometry extends Geometry {
41
+ constructor(props: CubeGeometryProps = {}) {
42
+ const source = new MathCubeGeometry({size: 2});
43
+ const faceIndices = new Uint32Array(24);
44
+ // The renderer's semantic face order is +Z, -Z, +Y, -Y, +X, -X.
45
+ const faceOrder = [4, 5, 2, 3, 0, 1];
46
+ for (let vertexIndex = 0; vertexIndex < faceIndices.length; vertexIndex++) {
47
+ faceIndices[vertexIndex] = faceOrder[Math.floor(vertexIndex / 4)];
48
+ }
49
+ source.attributes['faceIndex'] = {size: 1, value: faceIndices};
50
+ if (props.indices === false) {
51
+ source.attributes['COLOR_0'] = {
52
+ size: 3,
53
+ value: new Float32Array(
54
+ Array.from(source.attributes['POSITION'].value, value => (value + 1) / 2)
55
+ )
56
+ };
57
+ }
58
+ const data = props.indices === false ? unpackIndexedGeometry(source) : source;
59
+ super({
60
+ id: props.id,
61
+ topology: source.topology,
62
+ indices: props.indices === false ? undefined : source.indices,
63
+ attributes: mergeAttributes(data.attributes, props.attributes)
64
+ });
65
+ }
66
+ }
67
+
68
+ export class SphereGeometry extends Geometry {
69
+ constructor(props: SphereGeometryProps = {}) {
70
+ const source = new MathSphereGeometry({
71
+ ...props,
72
+ attributes: undefined,
73
+ radius: props.radius ?? 1
74
+ });
75
+ // Retain the legacy longitude-to-UV mapping while math.gl tessellates the sphere.
76
+ for (const name of ['POSITION', 'NORMAL']) {
77
+ const values = source.attributes[name].value;
78
+ for (let index = 0; index < values.length; index += 3) {
79
+ const horizontal = values[index];
80
+ values[index] = values[index + 2];
81
+ values[index + 2] = horizontal;
82
+ }
83
+ }
84
+ const indices = source.indices?.value;
85
+ if (indices) {
86
+ for (let index = 0; index < indices.length; index += 3) {
87
+ const second = indices[index + 1];
88
+ indices[index + 1] = indices[index + 2];
89
+ indices[index + 2] = second;
90
+ }
91
+ }
92
+ super({...source, attributes: {...source.attributes, ...props.attributes}});
93
+ }
94
+ }
95
+
96
+ export class IcoSphereGeometry extends Geometry {
97
+ constructor(props: IcoSphereGeometryProps = {}) {
98
+ const source = new MathIcoSphereGeometry({...props, radius: props.radius ?? 1});
99
+ super({...source, attributes: source.attributes});
100
+ }
101
+ }
102
+
103
+ export class TruncatedConeGeometry extends Geometry {
104
+ constructor(props: TruncatedConeGeometryProps = {}) {
105
+ const source = new MathTruncatedConeGeometry({...props, bottomRadius: props.bottomRadius ?? 1});
106
+ super({...source, attributes: source.attributes});
107
+ }
108
+ }
109
+
110
+ export type CylinderGeometryProps = Omit<
111
+ TruncatedConeGeometryProps,
112
+ 'topRadius' | 'bottomRadius'
113
+ > & {
114
+ radius?: number;
115
+ };
116
+
117
+ export class CylinderGeometry extends TruncatedConeGeometry {
118
+ constructor(props: CylinderGeometryProps = {}) {
119
+ const radius = props.radius ?? 1;
120
+ super({...props, topRadius: radius, bottomRadius: radius});
121
+ }
122
+ }
123
+
124
+ export type ConeGeometryProps = Omit<
125
+ TruncatedConeGeometryProps,
126
+ 'topRadius' | 'bottomRadius' | 'topCap' | 'bottomCap'
127
+ > & {radius?: number; cap?: boolean};
128
+
129
+ export class ConeGeometry extends TruncatedConeGeometry {
130
+ constructor(props: ConeGeometryProps = {}) {
131
+ const cap = props.cap ?? true;
132
+ super({...props, topRadius: 0, bottomRadius: props.radius ?? 1, topCap: cap, bottomCap: cap});
133
+ }
134
+ }
135
+
136
+ export type PlaneGeometryProps = {
137
+ id?: string;
138
+ radius?: number;
139
+ attributes?: Record<string, GeometryAttributeInput>;
140
+ type?: 'x,y' | 'x,z' | 'y,z';
141
+ offset?: number;
142
+ flipCull?: boolean;
143
+ unpack?: boolean;
144
+ xlen?: number;
145
+ ylen?: number;
146
+ zlen?: number;
147
+ nx?: number;
148
+ ny?: number;
149
+ nz?: number;
150
+ };
151
+
152
+ /** Adapts legacy plane axes and facing to math.gl's XZ plane. */
153
+ export class PlaneGeometry extends Geometry {
154
+ constructor(props: PlaneGeometryProps = {}) {
155
+ const {type = 'x,y', offset = 0, flipCull = false} = props;
156
+ const planeAxes = {
157
+ 'x,y': {sizeX: props.xlen, sizeZ: props.ylen, nx: props.nx, nz: props.ny},
158
+ 'x,z': {sizeX: props.xlen, sizeZ: props.zlen, nx: props.nx, nz: props.nz},
159
+ 'y,z': {sizeX: props.ylen, sizeZ: props.zlen, nx: props.ny, nz: props.nz}
160
+ }[type];
161
+ // Only the three legacy axis pairs are supported.
162
+ if (!planeAxes) throw new Error('Invalid plane axes');
163
+ const source = new MathPlaneGeometry({
164
+ sizeX: planeAxes.sizeX || 1,
165
+ sizeZ: planeAxes.sizeZ || 1,
166
+ nx: planeAxes.nx || 1,
167
+ nz: planeAxes.nz || 1
168
+ });
169
+ orientPlane(source, type, offset, flipCull);
170
+ const data = props.unpack ? unpackIndexedGeometry(source) : source;
171
+ super({
172
+ id: props.id,
173
+ topology: source.topology,
174
+ indices: props.unpack ? undefined : source.indices,
175
+ attributes: mergeAttributes(data.attributes, props.attributes)
176
+ });
177
+ }
178
+ }
179
+
180
+ function orientPlane(
181
+ geometry: MathGeometry,
182
+ type: NonNullable<PlaneGeometryProps['type']>,
183
+ offset: number,
184
+ flipCull: boolean
185
+ ): void {
186
+ const positions = geometry.attributes['POSITION'].value;
187
+ const normals = geometry.attributes['NORMAL'].value;
188
+ const texCoords = geometry.attributes['TEXCOORD_0'].value;
189
+ for (let vertexIndex = 0; vertexIndex < positions.length / 3; vertexIndex++) {
190
+ const positionIndex = vertexIndex * 3;
191
+ const horizontal = Number(positions[positionIndex]) * (flipCull ? -1 : 1);
192
+ const vertical = -Number(positions[positionIndex + 2]);
193
+ const normal = flipCull ? 1 : -1;
194
+ if (type === 'x,y') {
195
+ positions.set([horizontal, vertical, offset], positionIndex);
196
+ normals.set([0, 0, normal], positionIndex);
197
+ } else if (type === 'x,z') {
198
+ positions.set([horizontal, offset, vertical], positionIndex);
199
+ normals.set([0, normal, 0], positionIndex);
200
+ } else {
201
+ positions.set([offset, horizontal, vertical], positionIndex);
202
+ normals.set([normal, 0, 0], positionIndex);
203
+ }
204
+ if (flipCull) texCoords[vertexIndex * 2] = 1 - Number(texCoords[vertexIndex * 2]);
205
+ }
206
+ // The legacy XY and YZ planes face the negative perpendicular axis.
207
+ if (type !== 'x,z' && geometry.indices) {
208
+ const indices = geometry.indices.value;
209
+ for (let index = 0; index < indices.length; index += 3) {
210
+ const second = indices[index + 1];
211
+ indices[index + 1] = indices[index + 2];
212
+ indices[index + 2] = second;
213
+ }
214
+ }
215
+ }
216
+
217
+ function mergeAttributes(
218
+ source: Record<string, GeometryAttributeInput | undefined>,
219
+ overrides: Record<string, GeometryAttributeInput> = {}
220
+ ): Record<string, GeometryAttributeInput> {
221
+ const attributes: Record<string, GeometryAttributeInput> = {};
222
+ for (const [name, attribute] of Object.entries(source)) {
223
+ if (attribute) attributes[name] = attribute;
224
+ }
225
+ return {...attributes, ...overrides};
226
+ }
@@ -2,9 +2,11 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- import type {VertexFormat} from '@luma.gl/core';
5
+ import type {BufferLayout, VertexFormat} from '@luma.gl/core';
6
6
  import {vertexFormatDecoder} from '@luma.gl/core';
7
7
  import type {TypedArray} from '@math.gl/core';
8
+ import type {Geometry as MathGeometry} from '@math.gl/geometry';
9
+ export {unpackIndexedGeometry} from '@math.gl/geometry';
8
10
  import {Geometry, getGeometryShaderAttributeName, type GeometryAttribute} from './geometry';
9
11
 
10
12
  type TypedArrayConstructor = {
@@ -13,11 +15,6 @@ type TypedArrayConstructor = {
13
15
  readonly BYTES_PER_ELEMENT: number;
14
16
  };
15
17
 
16
- type GeometryLike = {
17
- indices?: GeometryAttribute;
18
- attributes: Record<string, GeometryAttribute | undefined>;
19
- };
20
-
21
18
  /** Options for {@link makeInterleavedGeometry}. */
22
19
  export type MakeInterleavedGeometryOptions = {
23
20
  /** Name of the packed geometry buffer. Defaults to `geometry`. */
@@ -44,48 +41,6 @@ type InterleavedAttribute = {
44
41
  byteLength: number;
45
42
  };
46
43
 
47
- /**
48
- * Expands indexed geometry attributes into non-indexed attributes.
49
- *
50
- * The returned object keeps the original attribute keys and replaces each non-constant attribute
51
- * with data expanded through the index buffer. The `indices` field is intentionally omitted from
52
- * the returned geometry-like object.
53
- */
54
- export function unpackIndexedGeometry<T extends GeometryLike>(geometry: T): GeometryLike {
55
- const {indices, attributes} = geometry;
56
- if (!indices) {
57
- return geometry;
58
- }
59
-
60
- const vertexCount = indices.value.length;
61
- const unpackedAttributes: Record<string, GeometryAttribute> = {};
62
-
63
- for (const attributeName in attributes) {
64
- const attribute = attributes[attributeName];
65
- if (!attribute) {
66
- continue; // eslint-disable-line
67
- }
68
- const {value, size} = attribute;
69
- const constant = attribute['constant'];
70
- if (constant || !size) {
71
- continue; // eslint-disable-line
72
- }
73
- const ArrayType = value.constructor as TypedArrayConstructor;
74
- const unpackedValue = new ArrayType(vertexCount * size);
75
- for (let x = 0; x < vertexCount; ++x) {
76
- const index = indices.value[x];
77
- for (let i = 0; i < size; i++) {
78
- unpackedValue[x * size + i] = value[index * size + i];
79
- }
80
- }
81
- unpackedAttributes[attributeName] = {size, value: unpackedValue};
82
- }
83
-
84
- return {
85
- attributes: Object.assign({}, attributes, unpackedAttributes)
86
- };
87
- }
88
-
89
44
  /**
90
45
  * Packs a CPU {@link Geometry} into one interleaved vertex buffer.
91
46
  *
@@ -95,7 +50,7 @@ export function unpackIndexedGeometry<T extends GeometryLike>(geometry: T): Geom
95
50
  * idempotent and returns the original instance.
96
51
  */
97
52
  export function makeInterleavedGeometry(
98
- geometry: Geometry,
53
+ geometry: MathGeometry & {bufferLayout?: BufferLayout[]},
99
54
  options: MakeInterleavedGeometryOptions = {}
100
55
  ): Geometry {
101
56
  const bufferName = options.bufferName || 'geometry';
@@ -183,8 +138,11 @@ export function makeInterleavedGeometry(
183
138
  });
184
139
  }
185
140
 
186
- function isInterleavedGeometry(geometry: Geometry, bufferName: string): boolean {
187
- if (geometry.bufferLayout.length !== 1) {
141
+ function isInterleavedGeometry(
142
+ geometry: MathGeometry & {bufferLayout?: BufferLayout[]},
143
+ bufferName: string
144
+ ): geometry is Geometry {
145
+ if (geometry.bufferLayout?.length !== 1) {
188
146
  return false;
189
147
  }
190
148
 
@@ -197,13 +155,16 @@ function isInterleavedGeometry(geometry: Geometry, bufferName: string): boolean
197
155
  }
198
156
 
199
157
  function getInterleavedSourceAttributes(
200
- geometry: Geometry,
158
+ geometry: MathGeometry,
201
159
  attributeNames?: string[]
202
160
  ): Array<[string, GeometryAttribute | undefined]> {
203
- if (attributeNames) {
204
- return attributeNames.map(attributeName => [attributeName, geometry.attributes[attributeName]]);
161
+ const attributes = new Map<string, [string, GeometryAttribute]>();
162
+ const sourceNames = attributeNames || Object.keys(geometry.attributes);
163
+ for (const name of sourceNames) {
164
+ const attribute = geometry.attributes[name];
165
+ if (attribute) attributes.set(getGeometryShaderAttributeName(name), [name, attribute]);
205
166
  }
206
- return Object.entries(geometry.attributes);
167
+ return Array.from(attributes.values());
207
168
  }
208
169
 
209
170
  function writeInterleavedAttribute(
@@ -236,19 +197,3 @@ function writeInterleavedAttribute(
236
197
  function alignTo(byteOffset: number, alignment: number): number {
237
198
  return Math.ceil(byteOffset / alignment) * alignment;
238
199
  }
239
-
240
- // export function calculateVertexNormals(positions: Float32Array): Uint8Array {
241
- // let normals = new Uint8Array(positions.length / 3);
242
-
243
- // for (let i = 0; i < positions.length; i++) {
244
- // const vec1 = new Vector3(positions.subarray(i * 3, i + 0, i + 3));
245
- // const vec2 = new Vector3(positions.subarray(i + 3, i + 6));
246
- // const vec3 = new Vector3(positions.subarray(i + 6, i + 9));
247
-
248
- // const normal = new Vector3(vec1).cross(vec2).normalize();
249
- // normals.set(normal[0], i + 4);
250
- // normals.set(normal[1], i + 4 + 1);
251
- // normals.set(normal[2], i + 2);
252
- // }
253
- // const normal = new Vector3(vec1).cross(vec2).normalize();
254
- // }
@@ -2,181 +2,54 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- import type {TypedArray} from '@math.gl/core';
6
- import type {BufferLayout, PrimitiveTopology} from '@luma.gl/core';
5
+ import {Geometry as MathGeometry, type GeometryProps as MathGeometryProps} from '@math.gl/geometry';
6
+ import type {BufferLayout} from '@luma.gl/core';
7
7
  import {vertexFormatDecoder} from '@luma.gl/core';
8
- import {uid} from '../utils/uid';
8
+ import type {GeometryAttribute} from '@math.gl/geometry';
9
9
 
10
- /** CPU-side attribute data accepted by {@link Geometry}. */
11
- export type GeometryAttributeInput = GeometryAttribute | TypedArray;
10
+ export type {
11
+ GeometryAttribute,
12
+ GeometryAttributeInput,
13
+ GeometryAttributes
14
+ } from '@math.gl/geometry';
12
15
 
13
- /** Properties used to create a {@link Geometry}. */
14
- export type GeometryProps = {
15
- /** Application-provided identifier. */
16
- id?: string;
17
- /** Determines how vertices are assembled into primitives. */
18
- topology: 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip';
19
- /** Draw vertex count. Auto-calculated from attributes or indices when omitted. */
20
- vertexCount?: number;
21
- /** CPU attributes, keyed by caller-provided names such as glTF mesh attribute semantics. */
22
- attributes: Record<string, GeometryAttributeInput>;
23
- /**
24
- * Maps geometry buffers to shader attributes.
25
- *
26
- * If omitted, the constructor creates one shader-facing buffer layout entry for each attribute.
27
- * Explicit buffer layouts are preserved unchanged.
28
- */
29
- bufferLayout?: BufferLayout[];
30
- /** Optional index data. Indices are always stored separately from vertex attributes. */
31
- indices?: GeometryAttribute | TypedArray;
32
- };
16
+ /** Legacy engine geometry properties, including caller-owned shader layout metadata. */
17
+ export type GeometryProps = MathGeometryProps & {bufferLayout?: BufferLayout[]};
33
18
 
34
- /** Attributes returned by {@link Geometry.getAttributes}. */
35
- export type GeometryAttributes = Record<string, GeometryAttribute | undefined> & {
36
- /** Optional index attribute, included when the geometry is indexed. */
37
- indices?: GeometryAttribute & {size: 1; value: Uint32Array | Uint16Array};
38
- };
39
-
40
- /** Typed-array backed CPU geometry attribute. */
41
- export type GeometryAttribute = {
42
- /** Number of typed-array elements per vertex. */
43
- size?: number;
44
- /** Attribute data. */
45
- value: TypedArray;
46
- /** Additional attribute metadata consumed by geometry utilities. */
47
- [key: string]: any;
48
- };
49
-
50
- /**
51
- * CPU-side geometry container.
52
- *
53
- * `Geometry` stores typed-array vertex data, optional index data, and an always-populated
54
- * `bufferLayout` that describes how its attributes map to shader inputs. CPU attribute names are
55
- * preserved as supplied; synthesized buffer layouts map supported glTF-style names such as
56
- * `POSITION` and `TEXCOORD_0` to default shader names such as `positions` and `texCoords`.
57
- */
58
- export class Geometry {
59
- /** Application-provided or generated identifier. */
60
- readonly id: string;
61
-
62
- /** Determines how vertices are assembled into primitives. */
63
- readonly topology?: PrimitiveTopology;
64
-
65
- /** Resolved draw vertex count. */
66
- readonly vertexCount: number;
67
-
68
- /** Optional index attribute. */
69
- readonly indices?: GeometryAttribute;
70
-
71
- /** CPU attributes, keyed by caller-provided source attribute name. */
72
- readonly attributes: Record<string, GeometryAttribute | undefined>;
73
-
74
- /** Buffer layout matching the geometry attributes. Always populated. */
19
+ /** Compatibility adapter for math.gl CPU geometry with engine shader layout metadata. */
20
+ export class Geometry extends MathGeometry {
75
21
  readonly bufferLayout: BufferLayout[];
76
22
 
77
- /** Application-owned metadata. */
78
- userData: Record<string, unknown> = {};
79
-
80
- /** Creates a CPU geometry and wraps raw typed arrays into attribute records. */
81
23
  constructor(props: GeometryProps) {
82
- const {attributes = {}, indices = null, vertexCount = null} = props;
83
-
84
- this.id = props.id || uid('geometry');
85
- this.topology = props.topology;
86
-
87
- if (indices) {
88
- this.indices = ArrayBuffer.isView(indices) ? {value: indices, size: 1} : indices;
24
+ const attributes: MathGeometryProps['attributes'] = {};
25
+ const sourceNames = new Map<string, string>();
26
+ for (const [name, attribute] of Object.entries(props.attributes)) {
27
+ const shaderName = getGeometryShaderAttributeName(name);
28
+ const previousName = sourceNames.get(shaderName);
29
+ if (previousName) delete attributes[previousName];
30
+ sourceNames.set(shaderName, name);
31
+ attributes[name] = attribute;
89
32
  }
90
-
91
- this.attributes = {};
92
-
93
- for (const [attributeName, attributeValue] of Object.entries(attributes)) {
94
- // Wrap "unwrapped" arrays and try to autodetect their type
95
- const attribute: GeometryAttribute = ArrayBuffer.isView(attributeValue)
96
- ? {value: attributeValue}
97
- : attributeValue;
98
-
99
- if (!ArrayBuffer.isView(attribute.value)) {
100
- throw new Error(
101
- `${this._print(attributeName)}: must be typed array or object with value as typed array`
102
- );
103
- }
104
-
105
- if ((attributeName === 'POSITION' || attributeName === 'positions') && !attribute.size) {
106
- attribute.size = 3;
107
- }
108
-
109
- // Move indices to separate field
110
- if (attributeName === 'indices') {
111
- if (this.indices) {
112
- throw new Error('Multiple indices detected');
113
- }
114
- this.indices = attribute;
115
- } else {
116
- const shaderAttributeName = getGeometryShaderAttributeName(attributeName);
117
- const storedAttributeName = Object.keys(this.attributes).find(
118
- name => getGeometryShaderAttributeName(name) === shaderAttributeName
119
- );
120
- if (storedAttributeName) {
121
- delete this.attributes[storedAttributeName];
122
- }
123
- this.attributes[attributeName] = attribute;
33
+ const sourceIndices = props.indices;
34
+ const indices =
35
+ sourceIndices instanceof Uint8Array
36
+ ? new Uint16Array(sourceIndices)
37
+ : sourceIndices &&
38
+ !ArrayBuffer.isView(sourceIndices) &&
39
+ sourceIndices.value instanceof Uint8Array
40
+ ? {...sourceIndices, value: new Uint16Array(sourceIndices.value)}
41
+ : sourceIndices;
42
+ super({...props, attributes, indices});
43
+ // Preserve legacy descriptor identity while math.gl owns normalization and validation.
44
+ for (const [name, input] of Object.entries(attributes)) {
45
+ if (!ArrayBuffer.isView(input) && Object.isExtensible(input) && name !== 'indices') {
46
+ Object.assign(input, this.attributes[name]);
47
+ this.attributes[name] = input;
124
48
  }
125
49
  }
126
-
127
- if (this.indices && this.indices['isIndexed'] !== undefined) {
128
- this.indices = Object.assign({}, this.indices);
129
- delete this.indices['isIndexed'];
130
- }
131
-
132
- this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);
133
50
  this.bufferLayout =
134
51
  props.bufferLayout || getBufferLayoutFromGeometryAttributes(this.attributes);
135
52
  }
136
-
137
- /** Returns the resolved draw vertex count. */
138
- getVertexCount(): number {
139
- return this.vertexCount;
140
- }
141
-
142
- /** Returns all attributes, including `indices` when index data is present. */
143
- getAttributes(): GeometryAttributes {
144
- return (
145
- this.indices ? {indices: this.indices, ...this.attributes} : this.attributes
146
- ) as GeometryAttributes;
147
- }
148
-
149
- // PRIVATE
150
-
151
- _print(attributeName: string): string {
152
- return `Geometry ${this.id} attribute ${attributeName}`;
153
- }
154
-
155
- _setAttributes(attributes: Record<string, GeometryAttribute>, indices: any): this {
156
- return this;
157
- }
158
-
159
- _calculateVertexCount(
160
- attributes: Record<string, GeometryAttribute | undefined>,
161
- indices?: GeometryAttribute
162
- ): number {
163
- if (indices) {
164
- return indices.value.length;
165
- }
166
- let vertexCount = Infinity;
167
- for (const attribute of Object.values(attributes)) {
168
- if (!attribute) {
169
- continue; // eslint-disable-line no-continue
170
- }
171
- const {value, size, constant} = attribute;
172
- if (!constant && value && size !== undefined && size >= 1) {
173
- vertexCount = Math.min(vertexCount, value.length / size);
174
- }
175
- }
176
-
177
- // assert(Number.isFinite(vertexCount));
178
- return vertexCount;
179
- }
180
53
  }
181
54
 
182
55
  /**
@@ -202,7 +75,7 @@ export function getGeometryShaderAttributeName(attributeName: string): string {
202
75
  }
203
76
  }
204
77
 
205
- function getBufferLayoutFromGeometryAttributes(
78
+ export function getBufferLayoutFromGeometryAttributes(
206
79
  attributes: Record<string, GeometryAttribute | undefined>
207
80
  ): BufferLayout[] {
208
81
  const bufferLayout: BufferLayout[] = [];
@@ -4,7 +4,11 @@
4
4
 
5
5
  import type {PrimitiveTopology, BufferLayout} from '@luma.gl/core';
6
6
  import {Device, Buffer} from '@luma.gl/core';
7
- import {type Geometry, getGeometryShaderAttributeName} from '../geometry/geometry';
7
+ import type {Geometry} from '@math.gl/geometry';
8
+ import {
9
+ getBufferLayoutFromGeometryAttributes,
10
+ getGeometryShaderAttributeName
11
+ } from '../geometry/geometry';
8
12
  import {makeInterleavedGeometry} from './geometry-utils';
9
13
  import {uid} from '../utils/uid';
10
14
 
@@ -143,12 +147,12 @@ export function getIndexBufferFromGeometry(device: Device, geometry: Geometry):
143
147
  */
144
148
  export function getAttributeBuffersFromGeometry(
145
149
  device: Device,
146
- geometry: Geometry
150
+ geometry: Geometry & {bufferLayout?: BufferLayout[]}
147
151
  ): {attributes: Record<string, Buffer>; bufferLayout: BufferLayout[]; vertexCount: number} {
148
152
  const attributes: Record<string, Buffer> = {};
149
153
  for (const [attributeName, attribute] of Object.entries(geometry.attributes)) {
150
154
  const name =
151
- geometry.bufferLayout.find(bufferLayout => bufferLayout.name === attributeName)?.name ||
155
+ geometry.bufferLayout?.find(bufferLayout => bufferLayout.name === attributeName)?.name ||
152
156
  getGeometryShaderAttributeName(attributeName);
153
157
  if (attribute) {
154
158
  attributes[name] = device.createBuffer({
@@ -160,7 +164,8 @@ export function getAttributeBuffersFromGeometry(
160
164
 
161
165
  return {
162
166
  attributes,
163
- bufferLayout: geometry.bufferLayout,
167
+ bufferLayout:
168
+ geometry.bufferLayout || getBufferLayoutFromGeometryAttributes(geometry.attributes),
164
169
  vertexCount: geometry.vertexCount
165
170
  };
166
171
  }