@luma.gl/engine 10.0.0-alpha.8 → 10.0.0-beta.1

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 (435) hide show
  1. package/LICENSE +4 -4
  2. package/THIRD-PARTY-NOTICES.md +185 -0
  3. package/dist/animation/node-animation-binding.cjs +10 -0
  4. package/dist/animation/node-animation-binding.d.ts +1 -1
  5. package/dist/animation/node-animation-binding.d.ts.map +1 -1
  6. package/dist/animation/node-animation-binding.js +10 -0
  7. package/dist/animation/node-animation-binding.js.map +1 -1
  8. package/dist/arrow/index.cjs +5 -0
  9. package/dist/arrow/index.cjs.map +3 -3
  10. package/dist/arrow/index.d.ts +1 -0
  11. package/dist/arrow/index.d.ts.map +1 -1
  12. package/dist/arrow/index.js +1 -0
  13. package/dist/arrow/index.js.map +1 -1
  14. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.cjs +161 -0
  15. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.d.ts +34 -0
  16. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.d.ts.map +1 -0
  17. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.js +164 -0
  18. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.js.map +1 -0
  19. package/dist/arrow/renderers/text/renderers/arrow-text-renderer.d.ts +1 -1
  20. package/dist/arrow/renderers/text/renderers/arrow-text-renderer.d.ts.map +1 -1
  21. package/dist/arrow/renderers/text/renderers/arrow-text-renderer.js.map +1 -1
  22. package/dist/arrow/renderers/text/renderers/arrow-text-shaders.cjs +10 -1
  23. package/dist/arrow/renderers/text/renderers/arrow-text-shaders.d.ts.map +1 -1
  24. package/dist/arrow/renderers/text/renderers/arrow-text-shaders.js +10 -3
  25. package/dist/arrow/renderers/text/renderers/arrow-text-shaders.js.map +1 -1
  26. package/dist/compute/computation.cjs +1 -1
  27. package/dist/compute/computation.js +1 -1
  28. package/dist/compute/computation.js.map +1 -1
  29. package/dist/compute/swap.d.ts +2 -2
  30. package/dist/compute/swap.d.ts.map +1 -1
  31. package/dist/compute/swap.js.map +1 -1
  32. package/dist/dist.dev.js +1149 -657
  33. package/dist/dist.min.js +76 -69
  34. package/dist/dynamic-texture/video-texture.cjs +1 -1
  35. package/dist/dynamic-texture/video-texture.d.ts +3 -3
  36. package/dist/dynamic-texture/video-texture.d.ts.map +1 -1
  37. package/dist/dynamic-texture/video-texture.js +1 -1
  38. package/dist/dynamic-texture/video-texture.js.map +1 -1
  39. package/dist/effects/index.cjs.map +1 -1
  40. package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
  41. package/dist/effects/passes/postprocessing/fxaa/fxaa.js +2 -1
  42. package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -1
  43. package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
  44. package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +2 -0
  45. package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -1
  46. package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
  47. package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js +2 -0
  48. package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -1
  49. package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
  50. package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js +2 -0
  51. package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -1
  52. package/dist/effects/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
  53. package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js +2 -0
  54. package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js.map +1 -1
  55. package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
  56. package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js +2 -0
  57. package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -1
  58. package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
  59. package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js +2 -0
  60. package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -1
  61. package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
  62. package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js +2 -0
  63. package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -1
  64. package/dist/geometry/gpu-vector-geometry-adapter.cjs +14 -0
  65. package/dist/geometry/gpu-vector-geometry-adapter.d.ts +7 -0
  66. package/dist/geometry/gpu-vector-geometry-adapter.d.ts.map +1 -1
  67. package/dist/geometry/gpu-vector-geometry-adapter.js +17 -0
  68. package/dist/geometry/gpu-vector-geometry-adapter.js.map +1 -1
  69. package/dist/geometry/gpu-vector-geometry.cjs +3 -0
  70. package/dist/geometry/gpu-vector-geometry.d.ts +2 -0
  71. package/dist/geometry/gpu-vector-geometry.d.ts.map +1 -1
  72. package/dist/geometry/gpu-vector-geometry.js +2 -0
  73. package/dist/geometry/gpu-vector-geometry.js.map +1 -1
  74. package/dist/gltf/gltf/animations/animations.d.ts +1 -1
  75. package/dist/gltf/gltf/animations/animations.d.ts.map +1 -1
  76. package/dist/gltf/gltf/create-gltf-model.cjs +3 -0
  77. package/dist/gltf/gltf/create-gltf-model.d.ts.map +1 -1
  78. package/dist/gltf/gltf/create-gltf-model.js +4 -0
  79. package/dist/gltf/gltf/create-gltf-model.js.map +1 -1
  80. package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +80 -12
  81. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts +8 -1
  82. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -1
  83. package/dist/gltf/gltf/create-scenegraph-from-gltf.js +82 -14
  84. package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -1
  85. package/dist/gltf/gltf/gltf-billboard.cjs +6 -1
  86. package/dist/gltf/gltf/gltf-billboard.d.ts.map +1 -1
  87. package/dist/gltf/gltf/gltf-billboard.js +6 -1
  88. package/dist/gltf/gltf/gltf-billboard.js.map +1 -1
  89. package/dist/gltf/gltf/gltf-extension-support.cjs +2 -2
  90. package/dist/gltf/gltf/gltf-extension-support.js +2 -2
  91. package/dist/gltf/gltf/gltf-extension-support.js.map +1 -1
  92. package/dist/gltf/index.cjs +2 -0
  93. package/dist/gltf/index.cjs.map +3 -3
  94. package/dist/gltf/index.d.ts +2 -2
  95. package/dist/gltf/index.d.ts.map +1 -1
  96. package/dist/gltf/index.js +1 -1
  97. package/dist/gltf/index.js.map +1 -1
  98. package/dist/gltf/parsers/parse-gltf-animations.cjs +8 -5
  99. package/dist/gltf/parsers/parse-gltf-animations.js +20 -5
  100. package/dist/gltf/parsers/parse-gltf-animations.js.map +1 -1
  101. package/dist/gltf/parsers/parse-gltf-lights.cjs +36 -72
  102. package/dist/gltf/parsers/parse-gltf-lights.d.ts +6 -2
  103. package/dist/gltf/parsers/parse-gltf-lights.d.ts.map +1 -1
  104. package/dist/gltf/parsers/parse-gltf-lights.js +34 -91
  105. package/dist/gltf/parsers/parse-gltf-lights.js.map +1 -1
  106. package/dist/gltf/parsers/parse-gltf-metadata.cjs +60 -0
  107. package/dist/gltf/parsers/parse-gltf-metadata.d.ts +5 -0
  108. package/dist/gltf/parsers/parse-gltf-metadata.d.ts.map +1 -0
  109. package/dist/gltf/parsers/parse-gltf-metadata.js +39 -0
  110. package/dist/gltf/parsers/parse-gltf-metadata.js.map +1 -0
  111. package/dist/gltf/parsers/parse-gltf.cjs +23 -14
  112. package/dist/gltf/parsers/parse-gltf.d.ts +12 -2
  113. package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
  114. package/dist/gltf/parsers/parse-gltf.js +21 -13
  115. package/dist/gltf/parsers/parse-gltf.js.map +1 -1
  116. package/dist/gltf/parsers/parse-pbr-material.cjs +13 -3
  117. package/dist/gltf/parsers/parse-pbr-material.d.ts +7 -2
  118. package/dist/gltf/parsers/parse-pbr-material.d.ts.map +1 -1
  119. package/dist/gltf/parsers/parse-pbr-material.js +17 -5
  120. package/dist/gltf/parsers/parse-pbr-material.js.map +1 -1
  121. package/dist/gltf/parsers/post-process-gltf.cjs +1 -0
  122. package/dist/gltf/parsers/post-process-gltf.d.ts.map +1 -1
  123. package/dist/gltf/parsers/post-process-gltf.js +1 -0
  124. package/dist/gltf/parsers/post-process-gltf.js.map +1 -1
  125. package/dist/gltf/pbr/pbr-environment.cjs +21 -3
  126. package/dist/gltf/pbr/pbr-environment.d.ts +3 -0
  127. package/dist/gltf/pbr/pbr-environment.d.ts.map +1 -1
  128. package/dist/gltf/pbr/pbr-environment.js +19 -1
  129. package/dist/gltf/pbr/pbr-environment.js.map +1 -1
  130. package/dist/gltf/pbr/pbr-material.d.ts +3 -3
  131. package/dist/gltf/pbr/pbr-material.d.ts.map +1 -1
  132. package/dist/gltf/types/gltf-json-schema.d.ts.map +1 -1
  133. package/dist/gltf/types/gltf-json-schema.js +1 -0
  134. package/dist/gltf/types/gltf-json-schema.js.map +1 -1
  135. package/dist/gltf/types/gltf-postprocessed-schema.d.ts +2 -0
  136. package/dist/gltf/types/gltf-postprocessed-schema.d.ts.map +1 -1
  137. package/dist/gltf/types/gltf-postprocessed-schema.js +1 -0
  138. package/dist/gltf/types/gltf-postprocessed-schema.js.map +1 -1
  139. package/dist/gltf/types/gltf-types.d.ts +19 -0
  140. package/dist/gltf/types/gltf-types.d.ts.map +1 -1
  141. package/dist/graph/models/index.cjs.map +1 -1
  142. package/dist/graph/models/path/path-attribute-model.cjs +4 -1
  143. package/dist/graph/models/path/path-attribute-model.d.ts +3 -1
  144. package/dist/graph/models/path/path-attribute-model.d.ts.map +1 -1
  145. package/dist/graph/models/path/path-attribute-model.js +6 -1
  146. package/dist/graph/models/path/path-attribute-model.js.map +1 -1
  147. package/dist/graph/models/path/path-storage-model.cjs +4 -1
  148. package/dist/graph/models/path/path-storage-model.d.ts +3 -1
  149. package/dist/graph/models/path/path-storage-model.d.ts.map +1 -1
  150. package/dist/graph/models/path/path-storage-model.js +6 -1
  151. package/dist/graph/models/path/path-storage-model.js.map +1 -1
  152. package/dist/graph/physics/index.cjs.map +2 -2
  153. package/dist/graph/physics/physics-controller.cjs +42 -0
  154. package/dist/graph/physics/physics-controller.d.ts +12 -1
  155. package/dist/graph/physics/physics-controller.d.ts.map +1 -1
  156. package/dist/graph/physics/physics-controller.js +41 -0
  157. package/dist/graph/physics/physics-controller.js.map +1 -1
  158. package/dist/graph/physics/scenegraph-instance.cjs +7 -0
  159. package/dist/graph/physics/scenegraph-instance.d.ts.map +1 -1
  160. package/dist/graph/physics/scenegraph-instance.js +8 -0
  161. package/dist/graph/physics/scenegraph-instance.js.map +1 -1
  162. package/dist/graph/tables/gpu-table-model.cjs +2 -2
  163. package/dist/graph/tables/gpu-table-model.d.ts +2 -1
  164. package/dist/graph/tables/gpu-table-model.d.ts.map +1 -1
  165. package/dist/graph/tables/gpu-table-model.js +2 -2
  166. package/dist/graph/tables/gpu-table-model.js.map +1 -1
  167. package/dist/graph/tables/index.cjs.map +1 -1
  168. package/dist/index.cjs +16 -0
  169. package/dist/index.cjs.map +3 -3
  170. package/dist/index.d.ts +6 -0
  171. package/dist/index.d.ts.map +1 -1
  172. package/dist/index.js +4 -0
  173. package/dist/index.js.map +1 -1
  174. package/dist/lighting/ambient-occlusion-pass.cjs +126 -0
  175. package/dist/lighting/ambient-occlusion-pass.d.ts +31 -0
  176. package/dist/lighting/ambient-occlusion-pass.d.ts.map +1 -0
  177. package/dist/lighting/ambient-occlusion-pass.js +108 -0
  178. package/dist/lighting/ambient-occlusion-pass.js.map +1 -0
  179. package/dist/lighting/clustered-light-grid.cjs +378 -0
  180. package/dist/lighting/clustered-light-grid.d.ts +94 -0
  181. package/dist/lighting/clustered-light-grid.d.ts.map +1 -0
  182. package/dist/lighting/clustered-light-grid.js +370 -0
  183. package/dist/lighting/clustered-light-grid.js.map +1 -0
  184. package/dist/lighting/contact-shadow-composite.cjs +80 -0
  185. package/dist/lighting/contact-shadow-composite.d.ts +6 -0
  186. package/dist/lighting/contact-shadow-composite.d.ts.map +1 -0
  187. package/dist/lighting/contact-shadow-composite.js +59 -0
  188. package/dist/lighting/contact-shadow-composite.js.map +1 -0
  189. package/dist/lighting/contact-shadow-pass.cjs +102 -0
  190. package/dist/lighting/contact-shadow-pass.d.ts +23 -0
  191. package/dist/lighting/contact-shadow-pass.d.ts.map +1 -0
  192. package/dist/lighting/contact-shadow-pass.js +85 -0
  193. package/dist/lighting/contact-shadow-pass.js.map +1 -0
  194. package/dist/lighting/index.cjs +128 -0
  195. package/dist/lighting/index.cjs.map +6 -0
  196. package/dist/lighting/index.d.ts +35 -0
  197. package/dist/lighting/index.d.ts.map +1 -0
  198. package/dist/lighting/index.js +22 -0
  199. package/dist/lighting/index.js.map +1 -0
  200. package/dist/lighting/lightmap-atlas.cjs +246 -0
  201. package/dist/lighting/lightmap-atlas.d.ts +53 -0
  202. package/dist/lighting/lightmap-atlas.d.ts.map +1 -0
  203. package/dist/lighting/lightmap-atlas.js +279 -0
  204. package/dist/lighting/lightmap-atlas.js.map +1 -0
  205. package/dist/lighting/lightmap-baker.cjs +238 -0
  206. package/dist/lighting/lightmap-baker.d.ts +62 -0
  207. package/dist/lighting/lightmap-baker.d.ts.map +1 -0
  208. package/dist/lighting/lightmap-baker.js +236 -0
  209. package/dist/lighting/lightmap-baker.js.map +1 -0
  210. package/dist/lighting/lightmap-data.cjs +117 -0
  211. package/dist/lighting/lightmap-data.d.ts +20 -0
  212. package/dist/lighting/lightmap-data.d.ts.map +1 -0
  213. package/dist/lighting/lightmap-data.js +110 -0
  214. package/dist/lighting/lightmap-data.js.map +1 -0
  215. package/dist/lighting/lightmap-environment.cjs +61 -0
  216. package/dist/lighting/lightmap-environment.d.ts +18 -0
  217. package/dist/lighting/lightmap-environment.d.ts.map +1 -0
  218. package/dist/lighting/lightmap-environment.js +46 -0
  219. package/dist/lighting/lightmap-environment.js.map +1 -0
  220. package/dist/lighting/pbr-environment.cjs +45 -0
  221. package/dist/lighting/pbr-environment.d.ts +25 -0
  222. package/dist/lighting/pbr-environment.d.ts.map +1 -0
  223. package/dist/lighting/pbr-environment.js +30 -0
  224. package/dist/lighting/pbr-environment.js.map +1 -0
  225. package/dist/lighting/pbr-material.cjs +75 -0
  226. package/dist/lighting/pbr-material.d.ts +33 -0
  227. package/dist/lighting/pbr-material.d.ts.map +1 -0
  228. package/dist/lighting/pbr-material.js +52 -0
  229. package/dist/lighting/pbr-material.js.map +1 -0
  230. package/dist/lighting/pbr-model.cjs +579 -0
  231. package/dist/lighting/pbr-model.d.ts +45 -0
  232. package/dist/lighting/pbr-model.d.ts.map +1 -0
  233. package/dist/lighting/pbr-model.js +545 -0
  234. package/dist/lighting/pbr-model.js.map +1 -0
  235. package/dist/lighting/pbr-surface-pass.cjs +116 -0
  236. package/dist/lighting/pbr-surface-pass.d.ts +35 -0
  237. package/dist/lighting/pbr-surface-pass.d.ts.map +1 -0
  238. package/dist/lighting/pbr-surface-pass.js +98 -0
  239. package/dist/lighting/pbr-surface-pass.js.map +1 -0
  240. package/dist/lighting/prefiltered-environment.cjs +275 -0
  241. package/dist/lighting/prefiltered-environment.d.ts +56 -0
  242. package/dist/lighting/prefiltered-environment.d.ts.map +1 -0
  243. package/dist/lighting/prefiltered-environment.js +264 -0
  244. package/dist/lighting/prefiltered-environment.js.map +1 -0
  245. package/dist/lighting/reflection-probe.cjs +321 -0
  246. package/dist/lighting/reflection-probe.d.ts +77 -0
  247. package/dist/lighting/reflection-probe.d.ts.map +1 -0
  248. package/dist/lighting/reflection-probe.js +298 -0
  249. package/dist/lighting/reflection-probe.js.map +1 -0
  250. package/dist/lighting/shadow-map-renderer.cjs +631 -0
  251. package/dist/lighting/shadow-map-renderer.d.ts +92 -0
  252. package/dist/lighting/shadow-map-renderer.d.ts.map +1 -0
  253. package/dist/lighting/shadow-map-renderer.js +622 -0
  254. package/dist/lighting/shadow-map-renderer.js.map +1 -0
  255. package/dist/lighting/shadow-quality.cjs +58 -0
  256. package/dist/lighting/shadow-quality.d.ts +13 -0
  257. package/dist/lighting/shadow-quality.d.ts.map +1 -0
  258. package/dist/lighting/shadow-quality.js +37 -0
  259. package/dist/lighting/shadow-quality.js.map +1 -0
  260. package/dist/material/material.cjs +3 -0
  261. package/dist/material/material.d.ts +2 -0
  262. package/dist/material/material.d.ts.map +1 -1
  263. package/dist/material/material.js +3 -0
  264. package/dist/material/material.js.map +1 -1
  265. package/dist/model/gpu-vector-bindings.cjs +10 -3
  266. package/dist/model/gpu-vector-bindings.d.ts +1 -1
  267. package/dist/model/gpu-vector-bindings.d.ts.map +1 -1
  268. package/dist/model/gpu-vector-bindings.js +12 -3
  269. package/dist/model/gpu-vector-bindings.js.map +1 -1
  270. package/dist/model/gpu-vector-draw-batches.cjs +4 -3
  271. package/dist/model/gpu-vector-draw-batches.d.ts +1 -1
  272. package/dist/model/gpu-vector-draw-batches.d.ts.map +1 -1
  273. package/dist/model/gpu-vector-draw-batches.js +4 -3
  274. package/dist/model/gpu-vector-draw-batches.js.map +1 -1
  275. package/dist/model/gpu-vector-model.cjs +42 -17
  276. package/dist/model/gpu-vector-model.d.ts +28 -4
  277. package/dist/model/gpu-vector-model.d.ts.map +1 -1
  278. package/dist/model/gpu-vector-model.js +49 -17
  279. package/dist/model/gpu-vector-model.js.map +1 -1
  280. package/dist/model/model.d.ts +1 -1
  281. package/dist/model/model.d.ts.map +1 -1
  282. package/dist/models/light-model-utils.cjs +2 -2
  283. package/dist/models/light-model-utils.d.ts +2 -1
  284. package/dist/models/light-model-utils.d.ts.map +1 -1
  285. package/dist/models/light-model-utils.js +2 -2
  286. package/dist/models/light-model-utils.js.map +1 -1
  287. package/dist/scenegraph/controllers/punctual-light-controller.cjs +121 -0
  288. package/dist/scenegraph/controllers/punctual-light-controller.d.ts +31 -0
  289. package/dist/scenegraph/controllers/punctual-light-controller.d.ts.map +1 -0
  290. package/dist/scenegraph/controllers/punctual-light-controller.js +117 -0
  291. package/dist/scenegraph/controllers/punctual-light-controller.js.map +1 -0
  292. package/dist/scenegraph/scene-metadata.cjs +43 -0
  293. package/dist/scenegraph/scene-metadata.d.ts +9 -0
  294. package/dist/scenegraph/scene-metadata.d.ts.map +1 -0
  295. package/dist/scenegraph/scene-metadata.js +21 -0
  296. package/dist/scenegraph/scene-metadata.js.map +1 -0
  297. package/dist/scenegraph/scenegraph-interaction.cjs +99 -0
  298. package/dist/scenegraph/scenegraph-interaction.d.ts +47 -0
  299. package/dist/scenegraph/scenegraph-interaction.d.ts.map +1 -0
  300. package/dist/scenegraph/scenegraph-interaction.js +79 -0
  301. package/dist/scenegraph/scenegraph-interaction.js.map +1 -0
  302. package/dist/scenegraph/scenegraph-node.cjs +10 -0
  303. package/dist/scenegraph/scenegraph-node.d.ts +10 -0
  304. package/dist/scenegraph/scenegraph-node.d.ts.map +1 -1
  305. package/dist/scenegraph/scenegraph-node.js +10 -0
  306. package/dist/scenegraph/scenegraph-node.js.map +1 -1
  307. package/dist/splats/index.cjs.map +1 -1
  308. package/dist/splats/splat-data.cjs +34 -23
  309. package/dist/splats/splat-data.d.ts.map +1 -1
  310. package/dist/splats/splat-data.js +34 -22
  311. package/dist/splats/splat-data.js.map +1 -1
  312. package/dist/text/experimental.cjs.map +1 -1
  313. package/dist/text/fonts/atlas/text-utils.cjs +1 -1
  314. package/dist/text/fonts/atlas/text-utils.js +1 -1
  315. package/dist/text/fonts/atlas/text-utils.js.map +1 -1
  316. package/dist/text/fonts/index.cjs.map +1 -1
  317. package/dist/text/index.cjs +2 -0
  318. package/dist/text/index.cjs.map +2 -2
  319. package/dist/text/index.d.ts +1 -1
  320. package/dist/text/index.d.ts.map +1 -1
  321. package/dist/text/index.js +1 -1
  322. package/dist/text/index.js.map +1 -1
  323. package/dist/text/text-2d/index.cjs +3 -0
  324. package/dist/text/text-2d/index.d.ts +1 -0
  325. package/dist/text/text-2d/index.d.ts.map +1 -1
  326. package/dist/text/text-2d/index.js +1 -0
  327. package/dist/text/text-2d/index.js.map +1 -1
  328. package/dist/text/text-2d/model-utils/text-code-point-source.cjs +41 -0
  329. package/dist/text/text-2d/model-utils/text-code-point-source.d.ts +8 -0
  330. package/dist/text/text-2d/model-utils/text-code-point-source.d.ts.map +1 -0
  331. package/dist/text/text-2d/model-utils/text-code-point-source.js +23 -0
  332. package/dist/text/text-2d/model-utils/text-code-point-source.js.map +1 -0
  333. package/dist/text/text-2d/models/text-attribute-model.cjs +4 -1
  334. package/dist/text/text-2d/models/text-attribute-model.d.ts +3 -1
  335. package/dist/text/text-2d/models/text-attribute-model.d.ts.map +1 -1
  336. package/dist/text/text-2d/models/text-attribute-model.js +6 -1
  337. package/dist/text/text-2d/models/text-attribute-model.js.map +1 -1
  338. package/dist/text/text-2d/models/text-dictionary-model.cjs +4 -1
  339. package/dist/text/text-2d/models/text-dictionary-model.d.ts +3 -1
  340. package/dist/text/text-2d/models/text-dictionary-model.d.ts.map +1 -1
  341. package/dist/text/text-2d/models/text-dictionary-model.js +6 -1
  342. package/dist/text/text-2d/models/text-dictionary-model.js.map +1 -1
  343. package/dist/text/text-2d/models/text-storage-model.cjs +4 -1
  344. package/dist/text/text-2d/models/text-storage-model.d.ts +3 -1
  345. package/dist/text/text-2d/models/text-storage-model.d.ts.map +1 -1
  346. package/dist/text/text-2d/models/text-storage-model.js +6 -1
  347. package/dist/text/text-2d/models/text-storage-model.js.map +1 -1
  348. package/licenses/cesium.txt +207 -0
  349. package/licenses/deck-community.txt +19 -0
  350. package/licenses/deck.txt +19 -0
  351. package/licenses/glfx.txt +19 -0
  352. package/licenses/gltf-loader-ts.txt +21 -0
  353. package/licenses/magenta-font.txt +13 -0
  354. package/licenses/nvidia-fxaa.txt +25 -0
  355. package/licenses/philogl.txt +19 -0
  356. package/licenses/spark.txt +21 -0
  357. package/licenses/three.txt +21 -0
  358. package/package.json +17 -9
  359. package/src/animation/node-animation-binding.ts +18 -1
  360. package/src/arrow/index.ts +6 -0
  361. package/src/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.ts +224 -0
  362. package/src/arrow/renderers/text/renderers/arrow-text-renderer.ts +1 -0
  363. package/src/arrow/renderers/text/renderers/arrow-text-shaders.ts +12 -5
  364. package/src/compute/computation.ts +1 -1
  365. package/src/compute/swap.ts +2 -2
  366. package/src/dynamic-texture/video-texture.ts +9 -3
  367. package/src/effects/passes/postprocessing/fxaa/fxaa.ts +2 -1
  368. package/src/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +2 -0
  369. package/src/effects/passes/postprocessing/image-adjust-filters/denoise.ts +2 -0
  370. package/src/effects/passes/postprocessing/image-adjust-filters/huesaturation.ts +2 -0
  371. package/src/effects/passes/postprocessing/image-adjust-filters/noise.ts +2 -0
  372. package/src/effects/passes/postprocessing/image-adjust-filters/sepia.ts +2 -0
  373. package/src/effects/passes/postprocessing/image-adjust-filters/vibrance.ts +2 -0
  374. package/src/effects/passes/postprocessing/image-adjust-filters/vignette.ts +2 -0
  375. package/src/geometry/gpu-vector-geometry-adapter.ts +19 -1
  376. package/src/geometry/gpu-vector-geometry.ts +3 -0
  377. package/src/gltf/gltf/animations/animations.ts +8 -1
  378. package/src/gltf/gltf/create-gltf-model.ts +4 -0
  379. package/src/gltf/gltf/create-scenegraph-from-gltf.ts +98 -17
  380. package/src/gltf/gltf/gltf-billboard.ts +6 -1
  381. package/src/gltf/gltf/gltf-extension-support.ts +2 -2
  382. package/src/gltf/index.ts +2 -0
  383. package/src/gltf/parsers/parse-gltf-animations.ts +22 -8
  384. package/src/gltf/parsers/parse-gltf-lights.ts +42 -130
  385. package/src/gltf/parsers/parse-gltf-metadata.ts +40 -0
  386. package/src/gltf/parsers/parse-gltf.ts +32 -16
  387. package/src/gltf/parsers/parse-pbr-material.ts +35 -7
  388. package/src/gltf/parsers/post-process-gltf.ts +1 -0
  389. package/src/gltf/pbr/pbr-environment.ts +27 -1
  390. package/src/gltf/pbr/pbr-material.ts +8 -3
  391. package/src/gltf/types/gltf-json-schema.ts +1 -0
  392. package/src/gltf/types/gltf-postprocessed-schema.ts +3 -0
  393. package/src/gltf/types/gltf-types.ts +20 -0
  394. package/src/graph/models/path/path-attribute-model.ts +10 -1
  395. package/src/graph/models/path/path-storage-model.ts +10 -1
  396. package/src/graph/physics/physics-controller.ts +55 -1
  397. package/src/graph/physics/scenegraph-instance.ts +10 -0
  398. package/src/graph/tables/gpu-table-model.ts +3 -2
  399. package/src/index.ts +19 -0
  400. package/src/lighting/ambient-occlusion-pass.ts +130 -0
  401. package/src/lighting/clustered-light-grid.ts +481 -0
  402. package/src/lighting/contact-shadow-composite.ts +67 -0
  403. package/src/lighting/contact-shadow-pass.ts +107 -0
  404. package/src/lighting/index.ts +125 -0
  405. package/src/lighting/lightmap-atlas.ts +348 -0
  406. package/src/lighting/lightmap-baker.ts +306 -0
  407. package/src/lighting/lightmap-data.ts +138 -0
  408. package/src/lighting/lightmap-environment.ts +70 -0
  409. package/src/lighting/pbr-environment.ts +55 -0
  410. package/src/lighting/pbr-material.ts +85 -0
  411. package/src/lighting/pbr-model.ts +608 -0
  412. package/src/lighting/pbr-surface-pass.ts +122 -0
  413. package/src/lighting/prefiltered-environment.ts +354 -0
  414. package/src/lighting/reflection-probe.ts +360 -0
  415. package/src/lighting/shadow-map-renderer.ts +918 -0
  416. package/src/lighting/shadow-quality.ts +50 -0
  417. package/src/material/material.ts +3 -0
  418. package/src/model/gpu-vector-bindings.ts +11 -3
  419. package/src/model/gpu-vector-draw-batches.ts +12 -10
  420. package/src/model/gpu-vector-model.ts +96 -20
  421. package/src/model/model.ts +1 -1
  422. package/src/models/light-model-utils.ts +3 -2
  423. package/src/scenegraph/controllers/punctual-light-controller.ts +172 -0
  424. package/src/scenegraph/scene-metadata.ts +23 -0
  425. package/src/scenegraph/scenegraph-interaction.ts +131 -0
  426. package/src/scenegraph/scenegraph-node.ts +12 -0
  427. package/src/splats/README.md +46 -0
  428. package/src/splats/splat-data.ts +53 -45
  429. package/src/text/fonts/atlas/text-utils.ts +1 -1
  430. package/src/text/index.ts +1 -0
  431. package/src/text/text-2d/index.ts +1 -0
  432. package/src/text/text-2d/model-utils/text-code-point-source.ts +34 -0
  433. package/src/text/text-2d/models/text-attribute-model.ts +10 -1
  434. package/src/text/text-2d/models/text-dictionary-model.ts +10 -1
  435. package/src/text/text-2d/models/text-storage-model.ts +10 -1
@@ -0,0 +1,378 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var clustered_light_grid_exports = {};
19
+ __export(clustered_light_grid_exports, {
20
+ CLUSTERED_POINT_LIGHT_LAYOUT: () => CLUSTERED_POINT_LIGHT_LAYOUT,
21
+ ClusteredLightGrid: () => ClusteredLightGrid,
22
+ DEFAULT_CLUSTER_DIMENSIONS: () => DEFAULT_CLUSTER_DIMENSIONS,
23
+ DEFAULT_MAX_LIGHTS_PER_CLUSTER: () => DEFAULT_MAX_LIGHTS_PER_CLUSTER,
24
+ MAX_CLUSTERED_POINT_LIGHTS: () => MAX_CLUSTERED_POINT_LIGHTS
25
+ });
26
+ module.exports = __toCommonJS(clustered_light_grid_exports);
27
+ var import_core = require("@luma.gl/core");
28
+ var import_computation = require("../compute/computation.cjs");
29
+ const CLUSTERED_POINT_LIGHT_LAYOUT = Object.freeze({
30
+ byteStride: 32,
31
+ positionByteOffset: 0,
32
+ radiusByteOffset: 12,
33
+ payloadByteOffset: 16
34
+ });
35
+ const MAX_CLUSTERED_POINT_LIGHTS = 512;
36
+ const DEFAULT_CLUSTER_DIMENSIONS = [16, 9, 24];
37
+ const DEFAULT_MAX_LIGHTS_PER_CLUSTER = 64;
38
+ const CLUSTER_WORKGROUP_SIZE = 64;
39
+ const CLUSTERED_LIGHT_GRID_UNIFORM_BYTE_LENGTH = 80;
40
+ class ClusteredLightGrid {
41
+ device;
42
+ id;
43
+ clusterDimensions;
44
+ maxLightsPerCluster;
45
+ maxLightCount;
46
+ clusterCount;
47
+ clusterLightCounts;
48
+ clusterLightIndices;
49
+ clusterLightBitMask;
50
+ uniformBuffer;
51
+ clearComputation;
52
+ binningComputation;
53
+ compactComputation;
54
+ activePointLightCount = 0;
55
+ depthRange = null;
56
+ destroyed = false;
57
+ constructor(device, props = {}) {
58
+ if (device.type !== "webgpu") {
59
+ throw new Error("ClusteredLightGrid requires WebGPU.");
60
+ }
61
+ this.device = device;
62
+ this.id = props.id || "clustered-light-grid";
63
+ this.clusterDimensions = props.clusterDimensions ?? DEFAULT_CLUSTER_DIMENSIONS;
64
+ this.maxLightsPerCluster = props.maxLightsPerCluster ?? DEFAULT_MAX_LIGHTS_PER_CLUSTER;
65
+ this.maxLightCount = props.maxLightCount ?? MAX_CLUSTERED_POINT_LIGHTS;
66
+ validateClusteredLightGridProps(this.clusterDimensions, this.maxLightsPerCluster, this.maxLightCount);
67
+ this.clusterCount = this.clusterDimensions[0] * this.clusterDimensions[1] * this.clusterDimensions[2];
68
+ this.clusterLightCounts = device.createBuffer({
69
+ id: `${this.id}-counts`,
70
+ byteLength: this.clusterCount * Uint32Array.BYTES_PER_ELEMENT,
71
+ usage: import_core.Buffer.STORAGE | import_core.Buffer.COPY_SRC
72
+ });
73
+ this.clusterLightIndices = device.createBuffer({
74
+ id: `${this.id}-indices`,
75
+ byteLength: this.clusterCount * this.maxLightsPerCluster * Uint32Array.BYTES_PER_ELEMENT,
76
+ usage: import_core.Buffer.STORAGE | import_core.Buffer.COPY_SRC
77
+ });
78
+ const lightWordCount = getLightWordCount(this.maxLightCount);
79
+ this.clusterLightBitMask = device.createBuffer({
80
+ id: `${this.id}-light-mask`,
81
+ byteLength: this.clusterCount * lightWordCount * Uint32Array.BYTES_PER_ELEMENT,
82
+ usage: import_core.Buffer.STORAGE
83
+ });
84
+ this.uniformBuffer = device.createBuffer({
85
+ id: `${this.id}-uniforms`,
86
+ byteLength: CLUSTERED_LIGHT_GRID_UNIFORM_BYTE_LENGTH,
87
+ usage: import_core.Buffer.UNIFORM | import_core.Buffer.COPY_DST
88
+ });
89
+ this.clearComputation = new import_computation.Computation(device, {
90
+ id: `${this.id}-clear`,
91
+ source: getClearClusterLightBitMaskSource(this.clusterCount, lightWordCount),
92
+ shaderLayout: {
93
+ bindings: [{ name: "clusterLightBitMask", type: "storage", group: 0, location: 0 }]
94
+ }
95
+ });
96
+ this.clearComputation.setBindings({ clusterLightBitMask: this.clusterLightBitMask });
97
+ this.binningComputation = new import_computation.Computation(device, {
98
+ id: `${this.id}-bin`,
99
+ source: getClusterBinningSource(this.clusterDimensions, this.maxLightCount),
100
+ shaderLayout: {
101
+ bindings: [
102
+ { name: "pointLights", type: "read-only-storage", group: 0, location: 0 },
103
+ { name: "clusterLightBitMask", type: "storage", group: 0, location: 1 },
104
+ { name: "clusteredLightGrid", type: "uniform", group: 0, location: 2 }
105
+ ]
106
+ }
107
+ });
108
+ this.compactComputation = new import_computation.Computation(device, {
109
+ id: `${this.id}-compact`,
110
+ source: getCompactClusterLightListsSource(this.clusterCount, lightWordCount, this.maxLightsPerCluster, this.maxLightCount),
111
+ shaderLayout: {
112
+ bindings: [
113
+ { name: "clusterLightBitMask", type: "storage", group: 0, location: 0 },
114
+ { name: "clusterLightCounts", type: "storage", group: 0, location: 1 },
115
+ { name: "clusterLightIndices", type: "storage", group: 0, location: 2 }
116
+ ]
117
+ }
118
+ });
119
+ }
120
+ /** Rebuilds cluster counts and light-index lists on the supplied command encoder. */
121
+ encode(commandEncoder, options) {
122
+ (0, import_core.assert)(!this.destroyed && !options.pointLights.destroyed && !commandEncoder.destroyed);
123
+ (0, import_core.assert)(options.pointLights.device === this.device && commandEncoder.device === this.device);
124
+ validateClusteredLightGridEncodeOptions(options, this.maxLightCount);
125
+ (0, import_core.assert)(Boolean(options.pointLights.usage & import_core.Buffer.STORAGE));
126
+ (0, import_core.assert)(options.pointLights.byteLength >= Math.max(1, options.pointLightCount) * CLUSTERED_POINT_LIGHT_LAYOUT.byteStride);
127
+ this.depthRange = [options.nearPlane, options.farPlane];
128
+ this.activePointLightCount = options.pointLightCount;
129
+ this.uniformBuffer.write(makeClusteredLightGridUniformData(options));
130
+ this.binningComputation.setBindings({
131
+ pointLights: options.pointLights,
132
+ clusterLightBitMask: this.clusterLightBitMask,
133
+ clusteredLightGrid: this.uniformBuffer
134
+ });
135
+ this.compactComputation.setBindings({
136
+ clusterLightBitMask: this.clusterLightBitMask,
137
+ clusterLightCounts: this.clusterLightCounts,
138
+ clusterLightIndices: this.clusterLightIndices
139
+ });
140
+ this.clearComputation.predraw(commandEncoder);
141
+ this.binningComputation.predraw(commandEncoder);
142
+ this.compactComputation.predraw(commandEncoder);
143
+ const computePass = commandEncoder.beginComputePass({ id: `${this.id}-build` });
144
+ this.clearComputation.dispatch(computePass, Math.ceil(this.clusterCount * getLightWordCount(this.maxLightCount) / CLUSTER_WORKGROUP_SIZE));
145
+ this.binningComputation.dispatch(computePass, Math.max(1, Math.ceil(options.pointLightCount / CLUSTER_WORKGROUP_SIZE)));
146
+ this.compactComputation.dispatch(computePass, Math.ceil(this.clusterCount / CLUSTER_WORKGROUP_SIZE));
147
+ computePass.end();
148
+ }
149
+ /** Returns the storage bindings available to lighting consumers. */
150
+ getBindings() {
151
+ (0, import_core.assert)(!this.destroyed);
152
+ return {
153
+ clusterLightCounts: this.clusterLightCounts,
154
+ clusterLightIndices: this.clusterLightIndices
155
+ };
156
+ }
157
+ /** Compatibility accessor for shader-pass consumers. */
158
+ getShaderPassBindings() {
159
+ return this.getBindings();
160
+ }
161
+ /** Returns a snapshot matching the latest encode. Encode before requesting uniforms. */
162
+ getUniforms() {
163
+ (0, import_core.assert)(!this.destroyed && this.depthRange);
164
+ return this.getShaderPassUniforms(this.depthRange[0], this.depthRange[1]);
165
+ }
166
+ /** Returns the scalar uniforms available to lighting consumers. */
167
+ getShaderPassUniforms(nearPlane, farPlane) {
168
+ (0, import_core.assert)(!this.destroyed);
169
+ validateDepthRange(nearPlane, farPlane);
170
+ return {
171
+ clusterCountX: this.clusterDimensions[0],
172
+ clusterCountY: this.clusterDimensions[1],
173
+ clusterCountZ: this.clusterDimensions[2],
174
+ maxLightsPerCluster: this.maxLightsPerCluster,
175
+ pointLightCount: this.activePointLightCount,
176
+ clusterNearPlane: nearPlane,
177
+ clusterFarPlane: farPlane
178
+ };
179
+ }
180
+ destroy() {
181
+ if (this.destroyed)
182
+ return;
183
+ this.destroyed = true;
184
+ this.clearComputation.destroy();
185
+ this.binningComputation.destroy();
186
+ this.compactComputation.destroy();
187
+ this.uniformBuffer.destroy();
188
+ this.clusterLightBitMask.destroy();
189
+ this.clusterLightCounts.destroy();
190
+ this.clusterLightIndices.destroy();
191
+ }
192
+ }
193
+ function getClearClusterLightBitMaskSource(clusterCount, lightWordCount) {
194
+ return `const CLUSTER_LIGHT_MASK_WORD_COUNT: u32 = ${clusterCount * lightWordCount}u;
195
+ @group(0) @binding(0) var<storage, read_write> clusterLightBitMask: array<atomic<u32>>;
196
+ @compute @workgroup_size(${CLUSTER_WORKGROUP_SIZE}) fn main(
197
+ @builtin(global_invocation_id) globalId: vec3<u32>
198
+ ) {
199
+ if (globalId.x < CLUSTER_LIGHT_MASK_WORD_COUNT) {
200
+ atomicStore(&clusterLightBitMask[globalId.x], 0u);
201
+ }
202
+ }`;
203
+ }
204
+ function getClusterBinningSource(clusterDimensions, maxLightCount) {
205
+ return `const CLUSTER_COUNT_X: u32 = ${clusterDimensions[0]}u;
206
+ const CLUSTER_COUNT_Y: u32 = ${clusterDimensions[1]}u;
207
+ const CLUSTER_COUNT_Z: u32 = ${clusterDimensions[2]}u;
208
+ const MAX_LIGHT_COUNT: u32 = ${maxLightCount}u;
209
+ const LIGHT_WORD_COUNT: u32 = ${getLightWordCount(maxLightCount)}u;
210
+
211
+ struct ClusteredLightGridUniforms {
212
+ projectionMatrix: mat4x4f,
213
+ depthRange: vec2f,
214
+ lightCount: u32,
215
+ padding: u32,
216
+ };
217
+
218
+ struct ClusteredLightGridPointLight {
219
+ positionRange: vec4f,
220
+ payload: vec4f,
221
+ };
222
+
223
+ @group(0) @binding(0) var<storage, read> pointLights: array<ClusteredLightGridPointLight>;
224
+ @group(0) @binding(1) var<storage, read_write> clusterLightBitMask: array<atomic<u32>>;
225
+ @group(0) @binding(2) var<uniform> clusteredLightGrid: ClusteredLightGridUniforms;
226
+
227
+ fn clusteredLightGrid_getCoordinate(value: f32, size: u32) -> u32 {
228
+ return min(u32(clamp(value, 0.0, 0.999999) * f32(size)), size - 1u);
229
+ }
230
+
231
+ fn clusteredLightGrid_getDepthSlice(distance: f32) -> u32 {
232
+ let normalizedDepth = clamp(
233
+ log(distance / clusteredLightGrid.depthRange.x) /
234
+ log(clusteredLightGrid.depthRange.y / clusteredLightGrid.depthRange.x),
235
+ 0.0,
236
+ 0.999999
237
+ );
238
+ return min(u32(normalizedDepth * f32(CLUSTER_COUNT_Z)), CLUSTER_COUNT_Z - 1u);
239
+ }
240
+
241
+ @compute @workgroup_size(${CLUSTER_WORKGROUP_SIZE}) fn main(
242
+ @builtin(global_invocation_id) globalId: vec3<u32>
243
+ ) {
244
+ let lightIndex = globalId.x;
245
+ let lightCount = min(clusteredLightGrid.lightCount, min(MAX_LIGHT_COUNT, arrayLength(&pointLights)));
246
+ if (lightIndex >= lightCount) {
247
+ return;
248
+ }
249
+
250
+ let light = pointLights[lightIndex];
251
+ let viewDepth = -light.positionRange.z;
252
+ let minimumDepth = max(clusteredLightGrid.depthRange.x, viewDepth - light.positionRange.w);
253
+ let maximumDepth = min(clusteredLightGrid.depthRange.y, viewDepth + light.positionRange.w);
254
+ if (maximumDepth < clusteredLightGrid.depthRange.x ||
255
+ minimumDepth > clusteredLightGrid.depthRange.y ||
256
+ maximumDepth < minimumDepth) {
257
+ return;
258
+ }
259
+
260
+ let isOrthographicProjection = abs(clusteredLightGrid.projectionMatrix[3][3]) > 0.5;
261
+ var minimumUv = vec2f(0.0);
262
+ var maximumUv = vec2f(0.999999);
263
+ // A sphere crossing the camera plane conservatively covers the viewport.
264
+ if (isOrthographicProjection || viewDepth > light.positionRange.w) {
265
+ let projectionScale = vec2f(clusteredLightGrid.projectionMatrix[0][0], clusteredLightGrid.projectionMatrix[1][1]);
266
+ let lower = projectionScale * (light.positionRange.xy - vec2f(light.positionRange.w));
267
+ let upper = projectionScale * (light.positionRange.xy + vec2f(light.positionRange.w));
268
+ var minimumNdc = min(lower, upper) + clusteredLightGrid.projectionMatrix[3].xy;
269
+ var maximumNdc = max(lower, upper) + clusteredLightGrid.projectionMatrix[3].xy;
270
+ if (!isOrthographicProjection) {
271
+ // Project the enclosing box at both depth extremes, including off-axis centers.
272
+ let nearestDepth = max(minimumDepth, clusteredLightGrid.depthRange.x);
273
+ let farthestDepth = max(maximumDepth, nearestDepth);
274
+ minimumNdc = min(min(lower / nearestDepth, upper / nearestDepth), min(lower / farthestDepth, upper / farthestDepth)) - clusteredLightGrid.projectionMatrix[2].xy;
275
+ maximumNdc = max(max(lower / nearestDepth, upper / nearestDepth), max(lower / farthestDepth, upper / farthestDepth)) - clusteredLightGrid.projectionMatrix[2].xy;
276
+ }
277
+ let unclampedMinimumUv = vec2f(minimumNdc.x * 0.5 + 0.5, 0.5 - maximumNdc.y * 0.5);
278
+ let unclampedMaximumUv = vec2f(maximumNdc.x * 0.5 + 0.5, 0.5 - minimumNdc.y * 0.5);
279
+ if (unclampedMaximumUv.x < 0.0 || unclampedMinimumUv.x > 1.0 ||
280
+ unclampedMaximumUv.y < 0.0 || unclampedMinimumUv.y > 1.0) {
281
+ return;
282
+ }
283
+
284
+ minimumUv = clamp(unclampedMinimumUv, vec2f(0.0), vec2f(0.999999));
285
+ maximumUv = clamp(unclampedMaximumUv, vec2f(0.0), vec2f(0.999999));
286
+ }
287
+ let minimumX = clusteredLightGrid_getCoordinate(minimumUv.x, CLUSTER_COUNT_X);
288
+ let maximumX = clusteredLightGrid_getCoordinate(maximumUv.x, CLUSTER_COUNT_X);
289
+ let minimumY = clusteredLightGrid_getCoordinate(minimumUv.y, CLUSTER_COUNT_Y);
290
+ let maximumY = clusteredLightGrid_getCoordinate(maximumUv.y, CLUSTER_COUNT_Y);
291
+ let minimumZ = clusteredLightGrid_getDepthSlice(minimumDepth);
292
+ let maximumZ = clusteredLightGrid_getDepthSlice(maximumDepth);
293
+ let lightWordIndex = lightIndex / 32u;
294
+ let lightBit = 1u << (lightIndex % 32u);
295
+
296
+ for (var depthSlice = minimumZ; depthSlice <= maximumZ; depthSlice++) {
297
+ for (var tileY = minimumY; tileY <= maximumY; tileY++) {
298
+ for (var tileX = minimumX; tileX <= maximumX; tileX++) {
299
+ let clusterIndex = (depthSlice * CLUSTER_COUNT_Y + tileY) * CLUSTER_COUNT_X + tileX;
300
+ atomicOr(&clusterLightBitMask[clusterIndex * LIGHT_WORD_COUNT + lightWordIndex], lightBit);
301
+ }
302
+ }
303
+ }
304
+ }`;
305
+ }
306
+ function getCompactClusterLightListsSource(clusterCount, lightWordCount, maxLightsPerCluster, maxLightCount) {
307
+ return `const CLUSTER_COUNT: u32 = ${clusterCount}u;
308
+ const LIGHT_WORD_COUNT: u32 = ${lightWordCount}u;
309
+ const MAX_LIGHTS_PER_CLUSTER: u32 = ${maxLightsPerCluster}u;
310
+ const MAX_LIGHT_COUNT: u32 = ${maxLightCount}u;
311
+
312
+ @group(0) @binding(0) var<storage, read_write> clusterLightBitMask: array<atomic<u32>>;
313
+ @group(0) @binding(1) var<storage, read_write> clusterLightCounts: array<u32>;
314
+ @group(0) @binding(2) var<storage, read_write> clusterLightIndices: array<u32>;
315
+
316
+ @compute @workgroup_size(${CLUSTER_WORKGROUP_SIZE}) fn main(
317
+ @builtin(global_invocation_id) globalId: vec3<u32>
318
+ ) {
319
+ let clusterIndex = globalId.x;
320
+ if (clusterIndex >= CLUSTER_COUNT) {
321
+ return;
322
+ }
323
+
324
+ let maskOffset = clusterIndex * LIGHT_WORD_COUNT;
325
+ let indexOffset = clusterIndex * MAX_LIGHTS_PER_CLUSTER;
326
+ var lightCount = 0u;
327
+ for (var lightIndex = 0u; lightIndex < MAX_LIGHT_COUNT; lightIndex++) {
328
+ let lightWord = atomicLoad(&clusterLightBitMask[maskOffset + lightIndex / 32u]);
329
+ let lightBit = 1u << (lightIndex % 32u);
330
+ if ((lightWord & lightBit) != 0u) {
331
+ if (lightCount < MAX_LIGHTS_PER_CLUSTER) {
332
+ clusterLightIndices[indexOffset + lightCount] = lightIndex;
333
+ }
334
+ lightCount += 1u;
335
+ }
336
+ }
337
+ clusterLightCounts[clusterIndex] = lightCount;
338
+ }`;
339
+ }
340
+ function getLightWordCount(maxLightCount) {
341
+ return Math.ceil(maxLightCount / 32);
342
+ }
343
+ function makeClusteredLightGridUniformData(options) {
344
+ const data = new ArrayBuffer(CLUSTERED_LIGHT_GRID_UNIFORM_BYTE_LENGTH);
345
+ const floatValues = new Float32Array(data);
346
+ floatValues.set(options.projectionMatrix, 0);
347
+ floatValues[16] = options.nearPlane;
348
+ floatValues[17] = options.farPlane;
349
+ new Uint32Array(data)[18] = options.pointLightCount;
350
+ return data;
351
+ }
352
+ function validateClusteredLightGridProps(clusterDimensions, maxLightsPerCluster, maxLightCount) {
353
+ if (clusterDimensions.some((dimension) => !Number.isSafeInteger(dimension) || dimension < 1) || !Number.isSafeInteger(maxLightsPerCluster) || maxLightsPerCluster < 1 || !Number.isSafeInteger(maxLightCount) || maxLightCount < 1) {
354
+ throw new Error("Cluster dimensions and capacities must be positive safe integers.");
355
+ }
356
+ }
357
+ function validateClusteredLightGridEncodeOptions(options, maxLightCount) {
358
+ if (!Number.isSafeInteger(options.pointLightCount) || options.pointLightCount < 0) {
359
+ throw new Error("Point light count must be a non-negative safe integer.");
360
+ }
361
+ if (options.pointLightCount > maxLightCount) {
362
+ throw new Error("Point light count exceeds ClusteredLightGrid capacity.");
363
+ }
364
+ validateDepthRange(options.nearPlane, options.farPlane);
365
+ }
366
+ function validateDepthRange(nearPlane, farPlane) {
367
+ if (!(nearPlane > 0) || !(farPlane > nearPlane)) {
368
+ throw new Error("Cluster depth range requires 0 < nearPlane < farPlane.");
369
+ }
370
+ }
371
+ // Annotate the CommonJS export names for ESM import in node:
372
+ 0 && (module.exports = {
373
+ CLUSTERED_POINT_LIGHT_LAYOUT,
374
+ ClusteredLightGrid,
375
+ DEFAULT_CLUSTER_DIMENSIONS,
376
+ DEFAULT_MAX_LIGHTS_PER_CLUSTER,
377
+ MAX_CLUSTERED_POINT_LIGHTS
378
+ });
@@ -0,0 +1,94 @@
1
+ import type { CommandEncoder, Device } from '@luma.gl/core';
2
+ import { Buffer } from '@luma.gl/core';
3
+ import type { Matrix4Like } from '@math.gl/core';
4
+ /** Byte layout of each point-light record. The grid ignores the consumer payload. */
5
+ export declare const CLUSTERED_POINT_LIGHT_LAYOUT: Readonly<{
6
+ byteStride: 32;
7
+ positionByteOffset: 0;
8
+ radiusByteOffset: 12;
9
+ payloadByteOffset: 16;
10
+ }>;
11
+ /** Compatibility name for the renderer-independent uniform snapshot. */
12
+ export type ClusteredLightGridShaderPassUniforms = ClusteredLightGridUniforms;
13
+ export declare const MAX_CLUSTERED_POINT_LIGHTS = 512;
14
+ export declare const DEFAULT_CLUSTER_DIMENSIONS: readonly [16, 9, 24];
15
+ export declare const DEFAULT_MAX_LIGHTS_PER_CLUSTER = 64;
16
+ /** Construction props for the fixed-capacity WebGPU light-cluster grid. */
17
+ export type ClusteredLightGridProps = {
18
+ /** Optional debug-resource prefix. */
19
+ id?: string;
20
+ /** Screen-x, screen-y, and logarithmic depth-slice counts. */
21
+ clusterDimensions?: readonly [number, number, number];
22
+ /** Maximum retained light indices in one cluster. */
23
+ maxLightsPerCluster?: number;
24
+ /** Maximum point-light records accepted by encode(). */
25
+ maxLightCount?: number;
26
+ };
27
+ /** Per-frame camera and light inputs used to rebuild the cluster lists. */
28
+ export type ClusteredLightGridEncodeOptions = {
29
+ /** View-space point-light records following CLUSTERED_POINT_LIGHT_LAYOUT. */
30
+ pointLights: Buffer;
31
+ /** Active prefix length in pointLights. */
32
+ pointLightCount: number;
33
+ /** Camera projection used to conservatively project light spheres into screen tiles. */
34
+ projectionMatrix: Readonly<Matrix4Like>;
35
+ /** Positive view-space near plane. */
36
+ nearPlane: number;
37
+ /** Positive view-space far plane. */
38
+ farPlane: number;
39
+ };
40
+ /** Storage bindings available to lighting consumers. */
41
+ export type ClusteredLightGridBindings = {
42
+ clusterLightCounts: Buffer;
43
+ clusterLightIndices: Buffer;
44
+ };
45
+ /** Uniform values available to lighting consumers to locate one pixel's cluster. */
46
+ export type ClusteredLightGridUniforms = {
47
+ clusterCountX: number;
48
+ clusterCountY: number;
49
+ clusterCountZ: number;
50
+ maxLightsPerCluster: number;
51
+ pointLightCount: number;
52
+ clusterNearPlane: number;
53
+ clusterFarPlane: number;
54
+ };
55
+ /**
56
+ * Builds fixed-capacity screen/depth light lists entirely on WebGPU.
57
+ *
58
+ * One compute invocation projects each view-space point-light sphere into the overlapping
59
+ * x/y/z cluster range and atomically marks its light bit. A second compute dispatch compacts
60
+ * each bit mask in stable light-index order. Indices beyond maxLightsPerCluster are
61
+ * intentionally dropped so the fullscreen lighting pass has a predictable loop bound without
62
+ * nondeterministic overflow shimmer.
63
+ */
64
+ export declare class ClusteredLightGrid {
65
+ readonly device: Device;
66
+ readonly id: string;
67
+ readonly clusterDimensions: readonly [number, number, number];
68
+ readonly maxLightsPerCluster: number;
69
+ readonly maxLightCount: number;
70
+ readonly clusterCount: number;
71
+ readonly clusterLightCounts: Buffer;
72
+ readonly clusterLightIndices: Buffer;
73
+ private readonly clusterLightBitMask;
74
+ private readonly uniformBuffer;
75
+ private readonly clearComputation;
76
+ private readonly binningComputation;
77
+ private readonly compactComputation;
78
+ private activePointLightCount;
79
+ private depthRange;
80
+ private destroyed;
81
+ constructor(device: Device, props?: ClusteredLightGridProps);
82
+ /** Rebuilds cluster counts and light-index lists on the supplied command encoder. */
83
+ encode(commandEncoder: CommandEncoder, options: ClusteredLightGridEncodeOptions): void;
84
+ /** Returns the storage bindings available to lighting consumers. */
85
+ getBindings(): ClusteredLightGridBindings;
86
+ /** Compatibility accessor for shader-pass consumers. */
87
+ getShaderPassBindings(): ClusteredLightGridBindings;
88
+ /** Returns a snapshot matching the latest encode. Encode before requesting uniforms. */
89
+ getUniforms(): ClusteredLightGridUniforms;
90
+ /** Returns the scalar uniforms available to lighting consumers. */
91
+ getShaderPassUniforms(nearPlane: number, farPlane: number): ClusteredLightGridUniforms;
92
+ destroy(): void;
93
+ }
94
+ //# sourceMappingURL=clustered-light-grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clustered-light-grid.d.ts","sourceRoot":"","sources":["../../src/lighting/clustered-light-grid.ts"],"names":[],"mappings":"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"}