@luma.gl/engine 10.0.0-alpha.4 → 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 (605) 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 +11756 -5632
  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/geometry-primitives.cjs +189 -0
  228. package/dist/geometry/geometry-primitives.d.ts +6 -0
  229. package/dist/geometry/geometry-primitives.d.ts.map +1 -1
  230. package/dist/geometry/geometry-primitives.js +8 -0
  231. package/dist/geometry/geometry-primitives.js.map +1 -1
  232. package/dist/geometry/geometry-table.cjs +15 -0
  233. package/dist/geometry/geometry-utils.cjs +147 -0
  234. package/dist/geometry/geometry.cjs +90 -0
  235. package/dist/geometry/gpu-geometry.cjs +130 -0
  236. package/dist/geometry/gpu-vector-geometry-adapter.cjs +88 -0
  237. package/dist/geometry/gpu-vector-geometry-adapter.d.ts +5 -0
  238. package/dist/geometry/gpu-vector-geometry-adapter.d.ts.map +1 -0
  239. package/dist/geometry/gpu-vector-geometry-adapter.js +73 -0
  240. package/dist/geometry/gpu-vector-geometry-adapter.js.map +1 -0
  241. package/dist/geometry/gpu-vector-geometry.cjs +40 -0
  242. package/dist/geometry/gpu-vector-geometry.d.ts +21 -0
  243. package/dist/geometry/gpu-vector-geometry.d.ts.map +1 -0
  244. package/dist/geometry/gpu-vector-geometry.js +19 -0
  245. package/dist/geometry/gpu-vector-geometry.js.map +1 -0
  246. package/dist/geometry/mesh-simplification.cjs +385 -0
  247. package/dist/geometry/ring-geometry.cjs +104 -0
  248. package/dist/geometry/ring-geometry.d.ts +17 -0
  249. package/dist/geometry/ring-geometry.d.ts.map +1 -0
  250. package/dist/geometry/ring-geometry.js +94 -0
  251. package/dist/geometry/ring-geometry.js.map +1 -0
  252. package/dist/geometry/stroke-geometry.cjs +171 -0
  253. package/dist/graph/models/index.cjs +66 -0
  254. package/dist/graph/models/index.cjs.map +6 -0
  255. package/dist/graph/models/index.d.ts +7 -0
  256. package/dist/graph/models/index.d.ts.map +1 -0
  257. package/dist/graph/models/index.js +10 -0
  258. package/dist/graph/models/index.js.map +1 -0
  259. package/dist/graph/models/path/path-attribute-model.cjs +421 -0
  260. package/dist/graph/models/path/path-attribute-model.d.ts +142 -0
  261. package/dist/graph/models/path/path-attribute-model.d.ts.map +1 -0
  262. package/dist/graph/models/path/path-attribute-model.js +409 -0
  263. package/dist/graph/models/path/path-attribute-model.js.map +1 -0
  264. package/dist/graph/models/path/path-storage-model.cjs +711 -0
  265. package/dist/graph/models/path/path-storage-model.d.ts +174 -0
  266. package/dist/graph/models/path/path-storage-model.d.ts.map +1 -0
  267. package/dist/graph/models/path/path-storage-model.js +720 -0
  268. package/dist/graph/models/path/path-storage-model.js.map +1 -0
  269. package/dist/graph/models/path/path-trips-storage-model.cjs +271 -0
  270. package/dist/graph/models/path/path-trips-storage-model.d.ts +58 -0
  271. package/dist/graph/models/path/path-trips-storage-model.d.ts.map +1 -0
  272. package/dist/graph/models/path/path-trips-storage-model.js +248 -0
  273. package/dist/graph/models/path/path-trips-storage-model.js.map +1 -0
  274. package/dist/graph/models/polygon/polygon-attribute-model.cjs +117 -0
  275. package/dist/graph/models/polygon/polygon-attribute-model.d.ts +53 -0
  276. package/dist/graph/models/polygon/polygon-attribute-model.d.ts.map +1 -0
  277. package/dist/graph/models/polygon/polygon-attribute-model.js +101 -0
  278. package/dist/graph/models/polygon/polygon-attribute-model.js.map +1 -0
  279. package/dist/graph/models/polygon/polygon-shaders.cjs +283 -0
  280. package/dist/graph/models/polygon/polygon-shaders.d.ts +77 -0
  281. package/dist/graph/models/polygon/polygon-shaders.d.ts.map +1 -0
  282. package/dist/graph/models/polygon/polygon-shaders.js +242 -0
  283. package/dist/graph/models/polygon/polygon-shaders.js.map +1 -0
  284. package/dist/graph/models/polygon/polygon-storage-model.cjs +111 -0
  285. package/dist/graph/models/polygon/polygon-storage-model.d.ts +53 -0
  286. package/dist/graph/models/polygon/polygon-storage-model.d.ts.map +1 -0
  287. package/dist/graph/models/polygon/polygon-storage-model.js +92 -0
  288. package/dist/graph/models/polygon/polygon-storage-model.js.map +1 -0
  289. package/dist/graph/physics/index.cjs +50 -0
  290. package/dist/graph/physics/index.cjs.map +6 -0
  291. package/dist/graph/physics/index.d.ts +12 -0
  292. package/dist/graph/physics/index.d.ts.map +1 -0
  293. package/dist/graph/physics/index.js +12 -0
  294. package/dist/graph/physics/index.js.map +1 -0
  295. package/dist/graph/physics/physics-scenegraph.cjs +92 -0
  296. package/dist/graph/physics/physics-scenegraph.d.ts +35 -0
  297. package/dist/graph/physics/physics-scenegraph.d.ts.map +1 -0
  298. package/dist/graph/physics/physics-scenegraph.js +80 -0
  299. package/dist/graph/physics/physics-scenegraph.js.map +1 -0
  300. package/dist/graph/physics/scenegraph-behaviors.cjs +164 -0
  301. package/dist/graph/physics/scenegraph-behaviors.d.ts +37 -0
  302. package/dist/graph/physics/scenegraph-behaviors.d.ts.map +1 -0
  303. package/dist/graph/physics/scenegraph-behaviors.js +145 -0
  304. package/dist/graph/physics/scenegraph-behaviors.js.map +1 -0
  305. package/dist/graph/physics/scenegraph-instance.cjs +246 -0
  306. package/dist/graph/physics/scenegraph-instance.d.ts +59 -0
  307. package/dist/graph/physics/scenegraph-instance.d.ts.map +1 -0
  308. package/dist/graph/physics/scenegraph-instance.js +241 -0
  309. package/dist/graph/physics/scenegraph-instance.js.map +1 -0
  310. package/dist/graph/physics/scenegraph-joints.cjs +51 -0
  311. package/dist/graph/physics/scenegraph-joints.d.ts +5 -0
  312. package/dist/graph/physics/scenegraph-joints.d.ts.map +1 -0
  313. package/dist/graph/physics/scenegraph-joints.js +31 -0
  314. package/dist/graph/physics/scenegraph-joints.js.map +1 -0
  315. package/dist/graph/physics/scenegraph-motion.cjs +177 -0
  316. package/dist/graph/physics/scenegraph-motion.d.ts +37 -0
  317. package/dist/graph/physics/scenegraph-motion.d.ts.map +1 -0
  318. package/dist/graph/physics/scenegraph-motion.js +168 -0
  319. package/dist/graph/physics/scenegraph-motion.js.map +1 -0
  320. package/dist/graph/physics/scenegraph-properties.cjs +170 -0
  321. package/dist/graph/physics/scenegraph-properties.d.ts +37 -0
  322. package/dist/graph/physics/scenegraph-properties.d.ts.map +1 -0
  323. package/dist/graph/physics/scenegraph-properties.js +186 -0
  324. package/dist/graph/physics/scenegraph-properties.js.map +1 -0
  325. package/dist/graph/physics/scenegraph-publication.cjs +112 -0
  326. package/dist/graph/physics/scenegraph-publication.d.ts +23 -0
  327. package/dist/graph/physics/scenegraph-publication.d.ts.map +1 -0
  328. package/dist/graph/physics/scenegraph-publication.js +99 -0
  329. package/dist/graph/physics/scenegraph-publication.js.map +1 -0
  330. package/dist/graph/physics/scenegraph-session.cjs +256 -0
  331. package/dist/graph/physics/scenegraph-session.d.ts +68 -0
  332. package/dist/graph/physics/scenegraph-session.d.ts.map +1 -0
  333. package/dist/graph/physics/scenegraph-session.js +249 -0
  334. package/dist/graph/physics/scenegraph-session.js.map +1 -0
  335. package/dist/graph/tables/gpu-table-geometry.cjs +84 -0
  336. package/dist/graph/tables/gpu-table-geometry.d.ts +32 -0
  337. package/dist/graph/tables/gpu-table-geometry.d.ts.map +1 -0
  338. package/dist/graph/tables/gpu-table-geometry.js +67 -0
  339. package/dist/graph/tables/gpu-table-geometry.js.map +1 -0
  340. package/dist/graph/tables/gpu-table-model.cjs +459 -0
  341. package/dist/graph/tables/gpu-table-model.d.ts +67 -0
  342. package/dist/graph/tables/gpu-table-model.d.ts.map +1 -0
  343. package/dist/graph/tables/gpu-table-model.js +457 -0
  344. package/dist/graph/tables/gpu-table-model.js.map +1 -0
  345. package/dist/graph/tables/gpu-table-transform.cjs +341 -0
  346. package/dist/graph/tables/gpu-table-transform.d.ts +61 -0
  347. package/dist/graph/tables/gpu-table-transform.d.ts.map +1 -0
  348. package/dist/graph/tables/gpu-table-transform.js +333 -0
  349. package/dist/graph/tables/gpu-table-transform.js.map +1 -0
  350. package/dist/graph/tables/index.cjs +33 -0
  351. package/dist/graph/tables/index.cjs.map +6 -0
  352. package/dist/graph/tables/index.d.ts +4 -0
  353. package/dist/graph/tables/index.d.ts.map +1 -0
  354. package/dist/graph/tables/index.js +7 -0
  355. package/dist/graph/tables/index.js.map +1 -0
  356. package/dist/index.cjs +303 -9569
  357. package/dist/index.cjs.map +3 -3
  358. package/dist/index.d.ts +32 -5
  359. package/dist/index.d.ts.map +1 -1
  360. package/dist/index.js +26 -3
  361. package/dist/index.js.map +1 -1
  362. package/dist/interactivity/interactivity.cjs +570 -0
  363. package/dist/interactivity/interactivity.d.ts +107 -0
  364. package/dist/interactivity/interactivity.d.ts.map +1 -0
  365. package/dist/interactivity/interactivity.js +575 -0
  366. package/dist/interactivity/interactivity.js.map +1 -0
  367. package/dist/interactivity/physics.cjs +15 -0
  368. package/dist/interactivity/physics.d.ts +12 -0
  369. package/dist/interactivity/physics.d.ts.map +1 -0
  370. package/dist/interactivity/physics.js +5 -0
  371. package/dist/interactivity/physics.js.map +1 -0
  372. package/dist/material/material-factory.cjs +99 -0
  373. package/dist/material/material-factory.d.ts +1 -1
  374. package/dist/material/material-factory.d.ts.map +1 -1
  375. package/dist/material/material.cjs +239 -0
  376. package/dist/material/material.d.ts +2 -2
  377. package/dist/material/material.d.ts.map +1 -1
  378. package/dist/material/material.js +2 -2
  379. package/dist/material/material.js.map +1 -1
  380. package/dist/model/gpu-vector-bindings.cjs +226 -0
  381. package/dist/model/gpu-vector-bindings.d.ts +36 -0
  382. package/dist/model/gpu-vector-bindings.d.ts.map +1 -0
  383. package/dist/model/gpu-vector-bindings.js +217 -0
  384. package/dist/model/gpu-vector-bindings.js.map +1 -0
  385. package/dist/model/gpu-vector-draw-batches.cjs +82 -0
  386. package/dist/model/gpu-vector-draw-batches.d.ts +5 -0
  387. package/dist/model/gpu-vector-draw-batches.d.ts.map +1 -0
  388. package/dist/model/gpu-vector-draw-batches.js +73 -0
  389. package/dist/model/gpu-vector-draw-batches.js.map +1 -0
  390. package/dist/model/gpu-vector-model-batches.cjs +94 -0
  391. package/dist/model/gpu-vector-model-batches.d.ts +41 -0
  392. package/dist/model/gpu-vector-model-batches.d.ts.map +1 -0
  393. package/dist/model/gpu-vector-model-batches.js +77 -0
  394. package/dist/model/gpu-vector-model-batches.js.map +1 -0
  395. package/dist/model/gpu-vector-model.cjs +1264 -0
  396. package/dist/model/gpu-vector-model.d.ts +352 -0
  397. package/dist/model/gpu-vector-model.d.ts.map +1 -0
  398. package/dist/model/gpu-vector-model.js +1375 -0
  399. package/dist/model/gpu-vector-model.js.map +1 -0
  400. package/dist/model/model.cjs +134 -0
  401. package/dist/model/model.d.ts +21 -305
  402. package/dist/model/model.d.ts.map +1 -1
  403. package/dist/model/model.js +68 -1092
  404. package/dist/model/model.js.map +1 -1
  405. package/dist/model/split-uniforms-and-bindings.cjs +44 -0
  406. package/dist/model/split-uniforms-and-bindings.d.ts +1 -1
  407. package/dist/model/split-uniforms-and-bindings.d.ts.map +1 -1
  408. package/dist/model/split-uniforms-and-bindings.js +5 -2
  409. package/dist/model/split-uniforms-and-bindings.js.map +1 -1
  410. package/dist/models/billboard-texture-model.cjs +167 -0
  411. package/dist/models/billboard-texture-model.d.ts +1 -1
  412. package/dist/models/billboard-texture-model.d.ts.map +1 -1
  413. package/dist/models/billboard-texture-model.js +1 -1
  414. package/dist/models/billboard-texture-model.js.map +1 -1
  415. package/dist/models/billboard-texture-module.cjs +61 -0
  416. package/dist/models/clip-space.cjs +103 -0
  417. package/dist/models/directional-light-model.cjs +45 -0
  418. package/dist/models/light-model-utils.cjs +426 -0
  419. package/dist/models/point-light-model.cjs +44 -0
  420. package/dist/models/spot-light-model.cjs +45 -0
  421. package/dist/modules/picking/color-picking.cjs +209 -0
  422. package/dist/modules/picking/color-picking.d.ts +1 -1
  423. package/dist/modules/picking/index-color-picking.cjs +230 -0
  424. package/dist/modules/picking/index-color-picking.d.ts +1 -1
  425. package/dist/modules/picking/index-picking.cjs +201 -0
  426. package/dist/modules/picking/index-picking.d.ts +1 -1
  427. package/dist/modules/picking/legacy-color-picking.cjs +28 -0
  428. package/dist/modules/picking/legacy-color-picking.d.ts +1 -1
  429. package/dist/modules/picking/legacy-picking-manager.cjs +92 -0
  430. package/dist/modules/picking/picking-manager.cjs +360 -0
  431. package/dist/modules/picking/picking-uniforms.cjs +140 -0
  432. package/dist/modules/picking/picking-uniforms.d.ts +1 -1
  433. package/dist/modules/picking/picking-uniforms.d.ts.map +1 -1
  434. package/dist/modules/picking/picking.cjs +43 -0
  435. package/dist/modules/picking/picking.d.ts +1 -1
  436. package/dist/passes/get-fragment-shader.cjs +119 -0
  437. package/dist/passes/shader-pass-renderer.cjs +722 -0
  438. package/dist/passes/shader-pass-renderer.d.ts +2 -2
  439. package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
  440. package/dist/passes/shader-pass-renderer.js +1 -1
  441. package/dist/passes/shader-pass-renderer.js.map +1 -1
  442. package/dist/passes/texture-transform-module.cjs +78 -0
  443. package/dist/scenegraph/controllers/area-light-controller.cjs +143 -0
  444. package/dist/scenegraph/controllers/area-light-controller.d.ts +31 -0
  445. package/dist/scenegraph/controllers/area-light-controller.d.ts.map +1 -0
  446. package/dist/scenegraph/controllers/area-light-controller.js +130 -0
  447. package/dist/scenegraph/controllers/area-light-controller.js.map +1 -0
  448. package/dist/scenegraph/controllers/billboard-controller.cjs +156 -0
  449. package/dist/scenegraph/controllers/billboard-controller.d.ts +45 -0
  450. package/dist/scenegraph/controllers/billboard-controller.d.ts.map +1 -0
  451. package/dist/scenegraph/controllers/billboard-controller.js +156 -0
  452. package/dist/scenegraph/controllers/billboard-controller.js.map +1 -0
  453. package/dist/scenegraph/controllers/joint-controller.cjs +71 -0
  454. package/dist/scenegraph/controllers/joint-controller.d.ts +30 -0
  455. package/dist/scenegraph/controllers/joint-controller.d.ts.map +1 -0
  456. package/dist/scenegraph/controllers/joint-controller.js +53 -0
  457. package/dist/scenegraph/controllers/joint-controller.js.map +1 -0
  458. package/dist/scenegraph/controllers/material-variants.cjs +61 -0
  459. package/dist/scenegraph/controllers/material-variants.d.ts +42 -0
  460. package/dist/scenegraph/controllers/material-variants.d.ts.map +1 -0
  461. package/dist/scenegraph/controllers/material-variants.js +40 -0
  462. package/dist/scenegraph/controllers/material-variants.js.map +1 -0
  463. package/dist/scenegraph/controllers/morph-controller.cjs +61 -0
  464. package/dist/scenegraph/controllers/morph-controller.d.ts +19 -0
  465. package/dist/scenegraph/controllers/morph-controller.d.ts.map +1 -0
  466. package/dist/scenegraph/controllers/morph-controller.js +41 -0
  467. package/dist/scenegraph/controllers/morph-controller.js.map +1 -0
  468. package/dist/scenegraph/controllers/skin-controller.cjs +111 -0
  469. package/dist/scenegraph/controllers/skin-controller.d.ts +36 -0
  470. package/dist/scenegraph/controllers/skin-controller.d.ts.map +1 -0
  471. package/dist/scenegraph/controllers/skin-controller.js +90 -0
  472. package/dist/scenegraph/controllers/skin-controller.js.map +1 -0
  473. package/dist/scenegraph/group-node.cjs +129 -0
  474. package/dist/scenegraph/model-node.cjs +68 -0
  475. package/dist/scenegraph/physics-transforms.cjs +95 -0
  476. package/dist/scenegraph/physics-transforms.d.ts +13 -0
  477. package/dist/scenegraph/physics-transforms.d.ts.map +1 -0
  478. package/dist/scenegraph/physics-transforms.js +72 -0
  479. package/dist/scenegraph/physics-transforms.js.map +1 -0
  480. package/dist/scenegraph/published-transforms.cjs +37 -0
  481. package/dist/scenegraph/published-transforms.d.ts +17 -0
  482. package/dist/scenegraph/published-transforms.d.ts.map +1 -0
  483. package/dist/scenegraph/published-transforms.js +16 -0
  484. package/dist/scenegraph/published-transforms.js.map +1 -0
  485. package/dist/scenegraph/scenegraph-bounds.cjs +51 -0
  486. package/dist/scenegraph/scenegraph-node.cjs +182 -0
  487. package/dist/shader-inputs.cjs +231 -0
  488. package/dist/shader-inputs.d.ts +1 -1
  489. package/dist/shader-inputs.d.ts.map +1 -1
  490. package/dist/utils/buffer-layout-helper.cjs +52 -0
  491. package/dist/utils/buffer-layout-order.cjs +37 -0
  492. package/dist/utils/deep-equal.cjs +65 -0
  493. package/dist/utils/get-platform-info.cjs +21 -0
  494. package/dist/utils/get-platform-info.d.ts +2 -0
  495. package/dist/utils/get-platform-info.d.ts.map +1 -0
  496. package/dist/utils/get-platform-info.js +5 -0
  497. package/dist/utils/get-platform-info.js.map +1 -0
  498. package/dist/utils/gpu-vector-batch-structure.cjs +45 -0
  499. package/dist/utils/gpu-vector-batch-structure.d.ts +12 -0
  500. package/dist/utils/gpu-vector-batch-structure.d.ts.map +1 -0
  501. package/dist/utils/gpu-vector-batch-structure.js +27 -0
  502. package/dist/utils/gpu-vector-batch-structure.js.map +1 -0
  503. package/dist/utils/shader-module-utils.cjs +148 -0
  504. package/dist/utils/uid.cjs +32 -0
  505. package/package.json +45 -7
  506. package/src/animation/deform-positions.ts +62 -0
  507. package/src/animation/node-animation-binding.ts +54 -0
  508. package/src/animation/property-animation-binding.ts +212 -0
  509. package/src/animation/scenegraph-animator.ts +117 -0
  510. package/src/animation/texture-transform.ts +59 -0
  511. package/src/animation-loop/animation-loop.ts +10 -3
  512. package/src/audio/audio-controller.ts +583 -0
  513. package/src/audio/audio-environment.ts +202 -0
  514. package/src/audio/audio-graph.ts +253 -0
  515. package/src/compute/buffer-transform.ts +71 -16
  516. package/src/compute/computation.ts +4 -19
  517. package/src/compute/texture-transform.ts +25 -12
  518. package/src/controls/orbit-controls.ts +4 -1
  519. package/src/dynamic-buffer/dynamic-buffer.ts +15 -449
  520. package/src/dynamic-texture/dynamic-texture.ts +5 -760
  521. package/src/dynamic-texture/texture-binding-source.ts +8 -90
  522. package/src/dynamic-texture/texture-data.ts +31 -340
  523. package/src/dynamic-texture/video-texture.ts +1 -1
  524. package/src/experimental/controls/comparison-splitter.ts +269 -0
  525. package/src/experimental/controls/flat-controller.ts +403 -0
  526. package/src/experimental/controls/index.ts +16 -0
  527. package/src/experimental/controls/orbit-controls.ts +6 -0
  528. package/src/experimental/materials/emissive-material.ts +120 -0
  529. package/src/experimental/materials/glass-material.ts +607 -0
  530. package/src/experimental/materials/glass-transmission.ts +1023 -0
  531. package/src/experimental/materials/index.ts +49 -0
  532. package/src/experimental/materials/optical-caustics.ts +234 -0
  533. package/src/experimental/materials/optical-lighting.ts +148 -0
  534. package/src/experimental/materials/optical-point-lights.ts +288 -0
  535. package/src/experimental/materials/reflective-material.ts +214 -0
  536. package/src/experimental/textures/html-texture.ts +285 -0
  537. package/src/experimental/textures/index.ts +8 -0
  538. package/src/experimental/textures/packed-pixels.ts +351 -0
  539. package/src/experimental/textures/rgba-decoder.ts +79 -0
  540. package/src/experimental/webxr/index.ts +21 -0
  541. package/src/experimental/webxr/webxr-animation-frame-provider.ts +22 -0
  542. package/src/experimental/webxr/webxr-camera-texture.ts +195 -0
  543. package/src/experimental/webxr/webxr-input.ts +117 -0
  544. package/src/experimental/webxr/webxr-manager.ts +524 -0
  545. package/src/experimental/webxr/webxr-types.ts +192 -0
  546. package/src/geometry/geometry-primitives.ts +11 -0
  547. package/src/geometry/gpu-vector-geometry-adapter.ts +78 -0
  548. package/src/geometry/gpu-vector-geometry.ts +33 -0
  549. package/src/geometry/ring-geometry.ts +117 -0
  550. package/src/graph/models/index.ts +45 -0
  551. package/src/graph/models/path/path-attribute-model.ts +563 -0
  552. package/src/graph/models/path/path-storage-model.ts +996 -0
  553. package/src/graph/models/path/path-trips-storage-model.ts +286 -0
  554. package/src/graph/models/polygon/polygon-attribute-model.ts +165 -0
  555. package/src/graph/models/polygon/polygon-shaders.ts +279 -0
  556. package/src/graph/models/polygon/polygon-storage-model.ts +146 -0
  557. package/src/graph/physics/index.ts +24 -0
  558. package/src/graph/physics/physics-scenegraph.ts +112 -0
  559. package/src/graph/physics/scenegraph-behaviors.ts +169 -0
  560. package/src/graph/physics/scenegraph-instance.ts +296 -0
  561. package/src/graph/physics/scenegraph-joints.ts +37 -0
  562. package/src/graph/physics/scenegraph-motion.ts +175 -0
  563. package/src/graph/physics/scenegraph-properties.ts +241 -0
  564. package/src/graph/physics/scenegraph-publication.ts +116 -0
  565. package/src/graph/physics/scenegraph-session.ts +317 -0
  566. package/src/graph/tables/gpu-table-geometry.ts +88 -0
  567. package/src/graph/tables/gpu-table-model.ts +661 -0
  568. package/src/graph/tables/gpu-table-transform.ts +497 -0
  569. package/src/graph/tables/index.ts +18 -0
  570. package/src/index.ts +130 -13
  571. package/src/interactivity/interactivity.ts +670 -0
  572. package/src/interactivity/physics.ts +19 -0
  573. package/src/material/material-factory.ts +1 -1
  574. package/src/material/material.ts +2 -2
  575. package/src/model/gpu-vector-bindings.ts +276 -0
  576. package/src/model/gpu-vector-draw-batches.ts +116 -0
  577. package/src/model/gpu-vector-model-batches.ts +142 -0
  578. package/src/model/gpu-vector-model.ts +1819 -0
  579. package/src/model/model.ts +91 -1444
  580. package/src/model/split-uniforms-and-bindings.ts +6 -3
  581. package/src/models/billboard-texture-model.ts +1 -1
  582. package/src/modules/picking/legacy-picking-manager.ts +1 -1
  583. package/src/modules/picking/picking-uniforms.ts +1 -1
  584. package/src/passes/shader-pass-renderer.ts +2 -2
  585. package/src/scenegraph/controllers/area-light-controller.ts +152 -0
  586. package/src/scenegraph/controllers/billboard-controller.ts +204 -0
  587. package/src/scenegraph/controllers/joint-controller.ts +81 -0
  588. package/src/scenegraph/controllers/material-variants.ts +70 -0
  589. package/src/scenegraph/controllers/morph-controller.ts +61 -0
  590. package/src/scenegraph/controllers/skin-controller.ts +125 -0
  591. package/src/scenegraph/physics-transforms.ts +82 -0
  592. package/src/scenegraph/published-transforms.ts +18 -0
  593. package/src/shader-inputs.ts +1 -1
  594. package/src/utils/get-platform-info.ts +5 -0
  595. package/src/utils/gpu-vector-batch-structure.ts +36 -0
  596. package/dist/compute/kernel.d.ts +0 -54
  597. package/dist/compute/kernel.d.ts.map +0 -1
  598. package/dist/compute/kernel.js +0 -103
  599. package/dist/compute/kernel.js.map +0 -1
  600. package/dist/compute/render-kernel.d.ts +0 -65
  601. package/dist/compute/render-kernel.d.ts.map +0 -1
  602. package/dist/compute/render-kernel.js +0 -129
  603. package/dist/compute/render-kernel.js.map +0 -1
  604. package/src/compute/kernel.ts +0 -146
  605. package/src/compute/render-kernel.ts +0 -192
@@ -0,0 +1,279 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import type {Device, ShaderLayout} from '@luma.gl/core';
6
+ import {ShaderInputs} from '../../../shader-inputs';
7
+ import {getIndexPickingModule, indexPicking} from '../../../index';
8
+ import type {ShaderModule} from '@luma.gl/shadertools';
9
+
10
+ /** Uniforms that project prepared polygon positions into clip space. */
11
+ export type PolygonViewportUniforms = {
12
+ center: [number, number];
13
+ scale: number;
14
+ aspect: number;
15
+ };
16
+
17
+ /** Shader module used by filled polygon models. */
18
+ export const polygonViewport: ShaderModule<PolygonViewportUniforms> = {
19
+ name: 'polygonViewport',
20
+ uniformTypes: {
21
+ center: 'vec2<f32>',
22
+ scale: 'f32',
23
+ aspect: 'f32'
24
+ }
25
+ };
26
+
27
+ /** Merges required polygon shader modules with caller additions, replacing defaults by name. */
28
+ export function mergePolygonShaderModules(
29
+ defaultModules: unknown[],
30
+ hostModules: {name: string}[]
31
+ ): unknown[] {
32
+ const hostModuleNames = new Set(hostModules.map(module => module.name));
33
+ return [
34
+ ...defaultModules.filter(module => {
35
+ const moduleName = (module as {name?: string}).name;
36
+ return !moduleName || !hostModuleNames.has(moduleName);
37
+ }),
38
+ ...hostModules
39
+ ];
40
+ }
41
+
42
+ /** Shader inputs accepted by filled polygon models. */
43
+ export type PolygonShaderInputs = ShaderInputs<{
44
+ polygonViewport: typeof polygonViewport.props;
45
+ picking: typeof indexPicking.props;
46
+ }>;
47
+
48
+ /** Shader attribute layout consumed by attribute-backed filled polygon models. */
49
+ export const POLYGON_ATTRIBUTE_SHADER_LAYOUT = {
50
+ attributes: [
51
+ {name: 'positions', location: 0, type: 'vec4<f32>'},
52
+ {name: 'colors', location: 1, type: 'vec4<f32>'},
53
+ {name: 'rowIndices', location: 2, type: 'u32'}
54
+ ],
55
+ bindings: []
56
+ } satisfies ShaderLayout;
57
+
58
+ /** Shader layout consumed by storage-backed filled polygon models. */
59
+ export const POLYGON_STORAGE_SHADER_LAYOUT = {
60
+ attributes: [],
61
+ bindings: [
62
+ {name: 'polygonPositions', type: 'read-only-storage', group: 0, location: 0},
63
+ {name: 'polygonColors', type: 'read-only-storage', group: 0, location: 1},
64
+ {name: 'polygonRowIndices', type: 'read-only-storage', group: 0, location: 2}
65
+ ]
66
+ } satisfies ShaderLayout;
67
+
68
+ /** WebGPU shader source for attribute-backed filled polygon models. */
69
+ export const POLYGON_ATTRIBUTE_WGSL_SHADER = /* wgsl */ `\
70
+ struct PolygonViewportUniforms {
71
+ center : vec2<f32>,
72
+ scale : f32,
73
+ aspect : f32,
74
+ };
75
+
76
+ @group(0) @binding(auto) var<uniform> polygonViewport : PolygonViewportUniforms;
77
+
78
+ struct VertexInputs {
79
+ @location(0) positions : vec4<f32>,
80
+ @location(1) colors : vec4<f32>,
81
+ @location(2) rowIndices : u32,
82
+ };
83
+
84
+ struct FragmentInputs {
85
+ @builtin(position) Position : vec4<f32>,
86
+ @location(0) color : vec4<f32>,
87
+ @interpolate(flat, either)
88
+ @location(1) objectIndex : i32,
89
+ };
90
+
91
+ struct PickingFragmentOutputs {
92
+ @location(0) fragColor : vec4<f32>,
93
+ @location(1) pickingColor : vec2<i32>,
94
+ };
95
+
96
+ fn projectPolygonPosition(position : vec4<f32>) -> vec4<f32> {
97
+ let centered = (position.xy - polygonViewport.center) * polygonViewport.scale;
98
+ return vec4<f32>(centered.x / max(polygonViewport.aspect, 0.2), centered.y, 0.0, 1.0);
99
+ }
100
+
101
+ @vertex
102
+ fn vertexMain(inputs : VertexInputs) -> FragmentInputs {
103
+ var outputs : FragmentInputs;
104
+ outputs.Position = projectPolygonPosition(inputs.positions);
105
+ outputs.color = inputs.colors;
106
+ outputs.objectIndex = i32(inputs.rowIndices);
107
+ return outputs;
108
+ }
109
+
110
+ @fragment
111
+ fn fragmentMain(inputs : FragmentInputs) -> @location(0) vec4<f32> {
112
+ return picking_filterHighlightColor(inputs.color, inputs.objectIndex);
113
+ }
114
+
115
+ @fragment
116
+ fn fragmentPicking(inputs : FragmentInputs) -> PickingFragmentOutputs {
117
+ var outputs : PickingFragmentOutputs;
118
+ outputs.fragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0);
119
+ outputs.pickingColor = picking_getPickingColor(inputs.objectIndex);
120
+ return outputs;
121
+ }
122
+ `;
123
+
124
+ /** WebGPU shader source for storage-backed filled polygon models. */
125
+ export const POLYGON_STORAGE_WGSL_SHADER = /* wgsl */ `\
126
+ @group(0) @binding(auto) var<storage, read> polygonPositions : array<vec4<f32>>;
127
+ @group(0) @binding(auto) var<storage, read> polygonColors : array<u32>;
128
+ @group(0) @binding(auto) var<storage, read> polygonRowIndices : array<u32>;
129
+
130
+ struct PolygonViewportUniforms {
131
+ center : vec2<f32>,
132
+ scale : f32,
133
+ aspect : f32,
134
+ };
135
+
136
+ @group(0) @binding(auto) var<uniform> polygonViewport : PolygonViewportUniforms;
137
+
138
+ struct FragmentInputs {
139
+ @builtin(position) Position : vec4<f32>,
140
+ @location(0) color : vec4<f32>,
141
+ @interpolate(flat, either)
142
+ @location(1) objectIndex : i32,
143
+ };
144
+
145
+ struct PickingFragmentOutputs {
146
+ @location(0) fragColor : vec4<f32>,
147
+ @location(1) pickingColor : vec2<i32>,
148
+ };
149
+
150
+ fn unpackPolygonColor(colorWord : u32) -> vec4<f32> {
151
+ return vec4<f32>(
152
+ f32(colorWord & 0xffu),
153
+ f32((colorWord >> 8u) & 0xffu),
154
+ f32((colorWord >> 16u) & 0xffu),
155
+ f32((colorWord >> 24u) & 0xffu)
156
+ ) / 255.0;
157
+ }
158
+
159
+ fn projectPolygonPosition(position : vec4<f32>) -> vec4<f32> {
160
+ let centered = (position.xy - polygonViewport.center) * polygonViewport.scale;
161
+ return vec4<f32>(centered.x / max(polygonViewport.aspect, 0.2), centered.y, 0.0, 1.0);
162
+ }
163
+
164
+ @vertex
165
+ fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> FragmentInputs {
166
+ var outputs : FragmentInputs;
167
+ outputs.Position = projectPolygonPosition(polygonPositions[vertexIndex]);
168
+ outputs.color = unpackPolygonColor(polygonColors[gpuTable_getRowIndex(
169
+ vertexIndex,
170
+ gpuTableColumns.polygonColorsRowMultiplier
171
+ )]);
172
+ outputs.objectIndex = i32(polygonRowIndices[vertexIndex]);
173
+ return outputs;
174
+ }
175
+
176
+ @fragment
177
+ fn fragmentMain(inputs : FragmentInputs) -> @location(0) vec4<f32> {
178
+ return picking_filterHighlightColor(inputs.color, inputs.objectIndex);
179
+ }
180
+
181
+ @fragment
182
+ fn fragmentPicking(inputs : FragmentInputs) -> PickingFragmentOutputs {
183
+ var outputs : PickingFragmentOutputs;
184
+ outputs.fragColor = vec4<f32>(0.0, 0.0, 0.0, 0.0);
185
+ outputs.pickingColor = picking_getPickingColor(inputs.objectIndex);
186
+ return outputs;
187
+ }
188
+ `;
189
+
190
+ /** WebGL vertex shader source for attribute-backed filled polygon models. */
191
+ export const POLYGON_ATTRIBUTE_VS_GLSL = /* glsl */ `\
192
+ #version 300 es
193
+ precision highp float;
194
+ precision highp int;
195
+
196
+ in vec4 positions;
197
+ in vec4 colors;
198
+ in uint rowIndices;
199
+
200
+ uniform polygonViewportUniforms {
201
+ vec2 center;
202
+ float scale;
203
+ float aspect;
204
+ } polygonViewport;
205
+
206
+ out vec4 vColor;
207
+
208
+ void main(void) {
209
+ vec2 centered = (positions.xy - polygonViewport.center) * polygonViewport.scale;
210
+ gl_Position = vec4(centered.x / max(polygonViewport.aspect, 0.2), centered.y, 0.0, 1.0);
211
+ vColor = colors;
212
+ picking_setObjectIndex(int(rowIndices));
213
+ }
214
+ `;
215
+
216
+ /** WebGL fragment shader source for filled polygon models. */
217
+ export const POLYGON_FS_GLSL = /* glsl */ `\
218
+ #version 300 es
219
+ precision highp float;
220
+
221
+ in vec4 vColor;
222
+ out vec4 fragColor;
223
+
224
+ void main(void) {
225
+ fragColor = picking_filterColor(vColor);
226
+ }
227
+ `;
228
+
229
+ /** WebGL integer picking fragment shader source for filled polygon models. */
230
+ export const POLYGON_PICKING_FS_GLSL = /* glsl */ `\
231
+ #version 300 es
232
+ precision highp float;
233
+ precision highp int;
234
+
235
+ layout(location = 0) out vec4 fragColor;
236
+ layout(location = 1) out ivec4 pickingColor;
237
+
238
+ void main(void) {
239
+ fragColor = vec4(0.0);
240
+ pickingColor = picking_getPickingColor();
241
+ }
242
+ `;
243
+
244
+ /** Creates shared shader inputs for filled polygon render and picking models. */
245
+ export function createPolygonShaderInputs(
246
+ device: Device,
247
+ pickingModule = getIndexPickingModule(device)
248
+ ): PolygonShaderInputs {
249
+ const shaderInputs: PolygonShaderInputs = new ShaderInputs<{
250
+ polygonViewport: typeof polygonViewport.props;
251
+ picking: typeof indexPicking.props;
252
+ }>({
253
+ polygonViewport,
254
+ picking: pickingModule
255
+ });
256
+ shaderInputs.setProps({picking: {indexMode: 'attribute', batchIndex: 0}});
257
+ return shaderInputs;
258
+ }
259
+
260
+ const DEFAULT_RENDER_PARAMETERS = {
261
+ depthWriteEnabled: false,
262
+ blend: true,
263
+ blendColorOperation: 'add',
264
+ blendAlphaOperation: 'add',
265
+ blendColorSrcFactor: 'src-alpha',
266
+ blendColorDstFactor: 'one-minus-src-alpha',
267
+ blendAlphaSrcFactor: 'one',
268
+ blendAlphaDstFactor: 'one-minus-src-alpha'
269
+ } as const satisfies Record<string, unknown>;
270
+
271
+ const PICKING_RENDER_PARAMETERS = {
272
+ depthWriteEnabled: false,
273
+ blend: false
274
+ } as const satisfies Record<string, unknown>;
275
+
276
+ /** Returns the default render parameters for normal or picking polygon draws. */
277
+ export function getPolygonPickingParameters(picking: boolean): Record<string, unknown> {
278
+ return picking ? PICKING_RENDER_PARAMETERS : DEFAULT_RENDER_PARAMETERS;
279
+ }
@@ -0,0 +1,146 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import {type Device} from '@luma.gl/core';
6
+ import {getIndexPickingModule, indexPicking, supportsIndexPicking} from '../../../index';
7
+ import {GPUTableModel, type GPUTableModelProps} from '@luma.gl/engine/tables';
8
+ import {GPURecordBatch} from '@luma.gl/graph/gpu-tables';
9
+ import {GPUConstant} from '@luma.gl/gpgpu/gpu-data';
10
+ import type {GPUTypeMap} from '@luma.gl/graph/gpu-tables';
11
+ import {GPUTable} from '@luma.gl/graph/gpu-tables';
12
+ import {getGPUVectorData} from '@luma.gl/gpgpu/gpu-data';
13
+ import {
14
+ assertPolygonGPUVectorInputs,
15
+ POLYGON_GPU_INPUT_SCHEMA,
16
+ type PolygonBatchProps
17
+ } from '@luma.gl/graph/experimental/models';
18
+ import {
19
+ getPolygonPickingParameters,
20
+ mergePolygonShaderModules,
21
+ POLYGON_STORAGE_SHADER_LAYOUT,
22
+ POLYGON_STORAGE_WGSL_SHADER,
23
+ type PolygonShaderInputs
24
+ } from './polygon-shaders';
25
+
26
+ /** Flat props accepted by the GPU-only storage-backed filled polygon model. */
27
+ export type PolygonStorageModelProps = Omit<GPUTableModelProps, 'table' | 'tableCount'> &
28
+ PolygonBatchProps & {
29
+ /** Shader inputs shared by render and picking polygon models. */
30
+ shaderInputs: PolygonShaderInputs;
31
+ /** Whether to configure the model for a picking pass. Defaults to `false`. */
32
+ picking?: boolean;
33
+ };
34
+
35
+ type PreparedPolygonStorageModel = {
36
+ table: GPUTable;
37
+ modelProps: GPUTableModelProps;
38
+ };
39
+
40
+ /** GPU-only filled polygon model consuming tessellated vectors through storage bindings. */
41
+ export class PolygonStorageModel extends GPUTableModel {
42
+ /** Prepared GPU vectors consumed by the storage-backed filled polygon model. */
43
+ static readonly gpuInputSchema = POLYGON_GPU_INPUT_SCHEMA;
44
+
45
+ readonly polygonTable: GPUTable;
46
+
47
+ /** Creates a storage-backed filled polygon model from prepared GPU vectors. */
48
+ constructor(device: Device, props: PolygonStorageModelProps) {
49
+ if (device.type !== 'webgpu') {
50
+ throw new Error('PolygonStorageModel is WebGPU-only');
51
+ }
52
+ const prepared = preparePolygonStorageModel(device, props);
53
+ super(device, prepared.modelProps);
54
+ this.polygonTable = prepared.table;
55
+ }
56
+
57
+ /** Appends one retained prepared polygon batch without repacking its GPU buffers. */
58
+ addBatch(props: PolygonBatchProps): void {
59
+ assertPolygonBatchColorMode(this.polygonTable, props.colors);
60
+ this.polygonTable.addBatch(createPolygonStorageRecordBatch(props));
61
+ this.setTable(this.polygonTable);
62
+ this.setNeedsRedraw('Polygon batch added');
63
+ }
64
+ }
65
+
66
+ function preparePolygonStorageModel(
67
+ device: Device,
68
+ props: PolygonStorageModelProps
69
+ ): PreparedPolygonStorageModel {
70
+ const {
71
+ positions,
72
+ colors,
73
+ rowIndices,
74
+ indices,
75
+ sourceInfo,
76
+ nullCount,
77
+ picking = false,
78
+ parameters,
79
+ shaderInputs,
80
+ ...modelProps
81
+ } = props;
82
+ const table = createPolygonStorageTable({
83
+ positions,
84
+ colors,
85
+ rowIndices,
86
+ indices,
87
+ sourceInfo,
88
+ nullCount
89
+ });
90
+ const indexPickingSupported = supportsIndexPicking(device);
91
+
92
+ return {
93
+ table,
94
+ modelProps: {
95
+ ...modelProps,
96
+ source: modelProps.source ?? POLYGON_STORAGE_WGSL_SHADER,
97
+ ...(picking && indexPickingSupported ? {fragmentEntryPoint: 'fragmentPicking'} : {}),
98
+ modules: mergePolygonShaderModules(
99
+ [picking && indexPickingSupported ? indexPicking : getIndexPickingModule(device)],
100
+ modelProps.modules ?? []
101
+ ) as never,
102
+ shaderLayout: modelProps.shaderLayout ?? POLYGON_STORAGE_SHADER_LAYOUT,
103
+ shaderInputs,
104
+ table,
105
+ tableCount: 'none',
106
+ gpuInputSchema: POLYGON_GPU_INPUT_SCHEMA,
107
+ topology: 'triangle-list',
108
+ ...(picking && indexPickingSupported
109
+ ? {
110
+ colorAttachmentFormats: ['rgba8unorm', 'rg32sint'] as const,
111
+ depthStencilAttachmentFormat: 'depth24plus' as const
112
+ }
113
+ : {}),
114
+ parameters: parameters ?? getPolygonPickingParameters(picking)
115
+ }
116
+ };
117
+ }
118
+
119
+ function createPolygonStorageTable(props: PolygonBatchProps): GPUTable {
120
+ const batch = createPolygonStorageRecordBatch(props);
121
+ return new GPUTable({
122
+ batches: [batch],
123
+ constants: props.colors instanceof GPUConstant ? {colors: props.colors} : undefined
124
+ });
125
+ }
126
+
127
+ function createPolygonStorageRecordBatch(props: PolygonBatchProps): GPURecordBatch {
128
+ const {sourceInfo, nullCount = 0, colors, ...vectors} = props;
129
+ assertPolygonGPUVectorInputs('PolygonStorageModel', {...vectors, colors});
130
+ const varyingVectors = colors instanceof GPUConstant ? vectors : {...vectors, colors};
131
+ return new GPURecordBatch<GPUTypeMap>({
132
+ gpuData: Object.fromEntries(
133
+ Object.entries(varyingVectors).map(([name, vector]) => [name, getGPUVectorData(vector)])
134
+ ),
135
+ bufferLayout: [],
136
+ sourceInfo,
137
+ nullCount
138
+ });
139
+ }
140
+
141
+ function assertPolygonBatchColorMode(table: GPUTable, colors: PolygonBatchProps['colors']): void {
142
+ const tableUsesConstant = Boolean(table.gpuConstants['colors']);
143
+ if (tableUsesConstant !== colors instanceof GPUConstant) {
144
+ throw new Error('PolygonStorageModel appended batches must use the same color input mode');
145
+ }
146
+ }
@@ -0,0 +1,24 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ export {
6
+ PhysicsGeometryNode,
7
+ makePhysicsScenegraph,
8
+ type PhysicsGeometryNodeProps,
9
+ type PhysicsScenegraphSnapshot
10
+ } from './physics-scenegraph';
11
+ export {makeRigidBodyJointsFromScenegraph} from './scenegraph-joints';
12
+ export {ScenegraphPhysicsBehaviors} from './scenegraph-behaviors';
13
+ export type {ScenegraphPhysicsBehaviorProps} from './scenegraph-behaviors';
14
+ export {ScenegraphPhysicsMotion, type ScenegraphPhysicsColliderTarget} from './scenegraph-motion';
15
+ export {ScenegraphPhysicsProperties, type PhysicsPropertyTarget} from './scenegraph-properties';
16
+ export {
17
+ ScenegraphPhysicsInstance,
18
+ type ScenegraphPhysicsDefinition,
19
+ type ScenegraphPhysicsCapture
20
+ } from './scenegraph-instance';
21
+ export {ScenegraphPhysicsPublication} from './scenegraph-publication';
22
+ export type {ScenegraphPhysicsRenderBinding} from './scenegraph-publication';
23
+ export {ScenegraphPhysicsSession} from './scenegraph-session';
24
+ export type {ScenegraphPhysicsScene, ScenegraphPhysicsSessionCapture} from './scenegraph-session';
@@ -0,0 +1,112 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ import {CubeGeometry, GroupNode, ScenegraphNode, type Geometry} from '../../index';
5
+ import {Matrix4} from '@math.gl/core';
6
+ import {makeConvexHullGeometry, makeTriangleMeshGeometry} from '@luma.gl/graph/gpu-physics';
7
+ import {normalizeRigidBodyRotation, type GPURigidBody} from '@luma.gl/graph/gpu-physics';
8
+ import type {GPURigidBodyBounds} from '@luma.gl/graph/gpu-physics';
9
+
10
+ export type PhysicsGeometryNodeProps = ConstructorParameters<typeof ScenegraphNode>[0] & {
11
+ geometry: Geometry;
12
+ /** Explicit world-space body, or false to opt out. Default: infer from geometry. */
13
+ collision?: GPURigidBody | false;
14
+ body?: {
15
+ mode?: 'static' | 'dynamic' | 'kinematic';
16
+ mass?: number;
17
+ restitution?: number;
18
+ friction?: number;
19
+ };
20
+ /** Concave surfaces must be requested explicitly; defaults to convex hull cooking. */
21
+ geometryMode?: 'convex-hull' | 'triangle-mesh';
22
+ };
23
+
24
+ /** Retains CPU geometry for both renderer creation and physics cooking. */
25
+ export class PhysicsGeometryNode extends ScenegraphNode {
26
+ readonly geometry: Geometry;
27
+ readonly physics: PhysicsGeometryNodeProps;
28
+ constructor(props: PhysicsGeometryNodeProps) {
29
+ super(props);
30
+ this.geometry = props.geometry;
31
+ this.physics = props;
32
+ }
33
+ }
34
+
35
+ export type PhysicsScenegraphSnapshot = {
36
+ bodies: GPURigidBody[];
37
+ publicationBounds: GPURigidBodyBounds[];
38
+ bindings: {node: ScenegraphNode; body: number; localMatrix: Matrix4}[];
39
+ };
40
+
41
+ /** Snapshot authored geometry and accumulated transforms. Rebuild explicitly after topology/geometry edits. */
42
+ export function makePhysicsScenegraph(root: GroupNode): PhysicsScenegraphSnapshot {
43
+ const result: PhysicsScenegraphSnapshot = {bodies: [], publicationBounds: [], bindings: []};
44
+ const identifiers = new Set<string>();
45
+ root.traverse((node, {worldMatrix}) => {
46
+ if (!(node instanceof PhysicsGeometryNode) || node.physics.collision === false) return;
47
+ if (identifiers.has(node.id)) throw new Error('Duplicate physics node');
48
+ identifiers.add(node.id);
49
+ const world = new Matrix4(worldMatrix).multiplyRight(node.matrix);
50
+ const override = node.physics.collision;
51
+ const position = override?.position ?? ([world[12], world[13], world[14]] as const);
52
+ const bodyMatrix = new Matrix4()
53
+ .translate(position)
54
+ .multiplyRight(
55
+ new Matrix4().fromQuaternion(normalizeRigidBodyRotation(override?.orientation))
56
+ );
57
+ const localMatrix = new Matrix4(bodyMatrix).invert().multiplyRight(world);
58
+ const attribute = node.geometry.attributes['POSITION'];
59
+ if (!attribute || attribute.size !== 3 || attribute.value.length < 9)
60
+ throw new Error('Invalid physics geometry');
61
+ const vertices: number[] = [];
62
+ for (let index = 0; index < attribute.value.length; index += 3)
63
+ vertices.push(
64
+ ...localMatrix.transformAsPoint([
65
+ attribute.value[index],
66
+ attribute.value[index + 1],
67
+ attribute.value[index + 2]
68
+ ])
69
+ );
70
+ const minimum: [number, number, number] = [Infinity, Infinity, Infinity];
71
+ const maximum: [number, number, number] = [-Infinity, -Infinity, -Infinity];
72
+ for (let index = 0; index < vertices.length; index++) {
73
+ minimum[index % 3] = Math.min(minimum[index % 3], vertices[index]);
74
+ maximum[index % 3] = Math.max(maximum[index % 3], vertices[index]);
75
+ }
76
+ if (![...minimum, ...maximum].every(Number.isFinite))
77
+ throw new Error('Invalid geometry transform');
78
+ const centeredBox =
79
+ node.geometry instanceof CubeGeometry &&
80
+ [1, 2, 4, 6, 8, 9, 12, 13, 14].every(index => Math.abs(localMatrix[index]) < 1e-8);
81
+ const makeShape = () =>
82
+ centeredBox
83
+ ? {type: 'box' as const, halfExtents: maximum}
84
+ : node.physics.geometryMode === 'triangle-mesh'
85
+ ? {
86
+ type: 'triangle-mesh' as const,
87
+ geometry: makeTriangleMeshGeometry(
88
+ vertices,
89
+ node.geometry.indices
90
+ ? Array.from(node.geometry.indices.value)
91
+ : Array.from({length: vertices.length / 3}, (_, index) => index)
92
+ )
93
+ }
94
+ : {type: 'convex-hull' as const, geometry: makeConvexHullGeometry(vertices)};
95
+ const mode =
96
+ node.physics.body?.mode ?? ((node.physics.body?.mass ?? 0) === 0 ? 'static' : 'dynamic');
97
+ result.bindings.push({node, body: result.bodies.length, localMatrix});
98
+ result.bodies.push(
99
+ override
100
+ ? structuredClone(override)
101
+ : {
102
+ position,
103
+ shape: makeShape(),
104
+ mode,
105
+ mass: mode === 'static' ? 0 : 1,
106
+ ...node.physics.body
107
+ }
108
+ );
109
+ result.publicationBounds.push([minimum, maximum]);
110
+ });
111
+ return result;
112
+ }