@luma.gl/engine 10.0.0-alpha.9 → 10.0.0-beta.2

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 (681) hide show
  1. package/LICENSE +4 -4
  2. package/THIRD-PARTY-NOTICES.md +185 -0
  3. package/dist/animation/deform-positions.d.ts +1 -1
  4. package/dist/animation/deform-positions.d.ts.map +1 -1
  5. package/dist/animation/node-animation-binding.cjs +10 -0
  6. package/dist/animation/node-animation-binding.d.ts +1 -1
  7. package/dist/animation/node-animation-binding.d.ts.map +1 -1
  8. package/dist/animation/node-animation-binding.js +10 -0
  9. package/dist/animation/node-animation-binding.js.map +1 -1
  10. package/dist/animation/skin.cjs +4 -4
  11. package/dist/animation/skin.d.ts +1 -1
  12. package/dist/animation/skin.d.ts.map +1 -1
  13. package/dist/animation/skin.js +1 -1
  14. package/dist/animation/skin.js.map +1 -1
  15. package/dist/animation/texture-transform.cjs +7 -7
  16. package/dist/animation/texture-transform.js +1 -1
  17. package/dist/animation/texture-transform.js.map +1 -1
  18. package/dist/arrow/arrow-mesh-types.d.ts +1 -1
  19. package/dist/arrow/arrow-mesh-types.d.ts.map +1 -1
  20. package/dist/arrow/index.cjs.map +2 -2
  21. package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.cjs +2 -2
  22. package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.d.ts +1 -1
  23. package/dist/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.js +1 -1
  24. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.cjs +14 -15
  25. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.d.ts.map +1 -1
  26. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.js +23 -18
  27. package/dist/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.js.map +1 -1
  28. package/dist/arrow/renderers/text/renderers/arrow-text-shaders.cjs +1 -1
  29. package/dist/arrow/renderers/text/renderers/arrow-text-shaders.js +1 -1
  30. package/dist/arrow/renderers/text/renderers/arrow-text-shaders.js.map +1 -1
  31. package/dist/audio/audio-controller.cjs +6 -6
  32. package/dist/audio/audio-controller.d.ts +1 -1
  33. package/dist/audio/audio-controller.d.ts.map +1 -1
  34. package/dist/audio/audio-controller.js +1 -1
  35. package/dist/audio/audio-controller.js.map +1 -1
  36. package/dist/audio/audio-environment.cjs +6 -6
  37. package/dist/audio/audio-environment.d.ts +1 -1
  38. package/dist/audio/audio-environment.d.ts.map +1 -1
  39. package/dist/audio/audio-environment.js +1 -1
  40. package/dist/audio/audio-environment.js.map +1 -1
  41. package/dist/compute/computation.cjs +1 -1
  42. package/dist/compute/computation.d.ts +1 -1
  43. package/dist/compute/computation.d.ts.map +1 -1
  44. package/dist/compute/computation.js +1 -1
  45. package/dist/compute/computation.js.map +1 -1
  46. package/dist/compute/swap.d.ts +2 -2
  47. package/dist/compute/swap.d.ts.map +1 -1
  48. package/dist/compute/swap.js.map +1 -1
  49. package/dist/debug/pixel-data-utils.d.ts +1 -1
  50. package/dist/debug/pixel-data-utils.d.ts.map +1 -1
  51. package/dist/dist.dev.js +1087 -570
  52. package/dist/dist.min.js +74 -67
  53. package/dist/dynamic-texture/video-texture.cjs +1 -1
  54. package/dist/dynamic-texture/video-texture.d.ts +3 -3
  55. package/dist/dynamic-texture/video-texture.d.ts.map +1 -1
  56. package/dist/dynamic-texture/video-texture.js +1 -1
  57. package/dist/dynamic-texture/video-texture.js.map +1 -1
  58. package/dist/effects/index.cjs.map +1 -1
  59. package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
  60. package/dist/effects/passes/postprocessing/fxaa/fxaa.js +2 -1
  61. package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -1
  62. package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
  63. package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +2 -0
  64. package/dist/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -1
  65. package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
  66. package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js +2 -0
  67. package/dist/effects/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -1
  68. package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
  69. package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js +2 -0
  70. package/dist/effects/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -1
  71. package/dist/effects/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
  72. package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js +2 -0
  73. package/dist/effects/passes/postprocessing/image-adjust-filters/noise.js.map +1 -1
  74. package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
  75. package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js +2 -0
  76. package/dist/effects/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -1
  77. package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
  78. package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js +2 -0
  79. package/dist/effects/passes/postprocessing/image-adjust-filters/vibrance.js.map +1 -1
  80. package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
  81. package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js +2 -0
  82. package/dist/effects/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -1
  83. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts +1 -1
  84. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts.map +1 -1
  85. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts +1 -1
  86. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts.map +1 -1
  87. package/dist/effects/passes/screen-space/gtao.cjs +4 -4
  88. package/dist/effects/passes/screen-space/gtao.d.ts +1 -1
  89. package/dist/effects/passes/screen-space/gtao.d.ts.map +1 -1
  90. package/dist/effects/passes/screen-space/gtao.js +1 -1
  91. package/dist/effects/passes/screen-space/gtao.js.map +1 -1
  92. package/dist/effects/passes/screen-space/height-fog.d.ts +1 -1
  93. package/dist/effects/passes/screen-space/height-fog.d.ts.map +1 -1
  94. package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts +1 -1
  95. package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts.map +1 -1
  96. package/dist/effects/passes/screen-space/screen-space-reflections.d.ts +1 -1
  97. package/dist/effects/passes/screen-space/screen-space-reflections.d.ts.map +1 -1
  98. package/dist/effects/passes/screen-space/ssr-camera-temporal.d.ts +1 -1
  99. package/dist/effects/passes/screen-space/ssr-camera-temporal.d.ts.map +1 -1
  100. package/dist/experimental/controls/index.cjs +0 -3
  101. package/dist/experimental/controls/index.cjs.map +2 -2
  102. package/dist/experimental/controls/index.d.ts +0 -2
  103. package/dist/experimental/controls/index.d.ts.map +1 -1
  104. package/dist/experimental/controls/index.js +0 -1
  105. package/dist/experimental/controls/index.js.map +1 -1
  106. package/dist/experimental/webxr/webxr-input.d.ts +1 -1
  107. package/dist/experimental/webxr/webxr-input.d.ts.map +1 -1
  108. package/dist/experimental-controls.cjs +21 -0
  109. package/dist/experimental-controls.d.ts +2 -0
  110. package/dist/experimental-controls.d.ts.map +1 -0
  111. package/dist/experimental-controls.js +5 -0
  112. package/dist/experimental-controls.js.map +1 -0
  113. package/dist/experimental-materials.cjs +21 -0
  114. package/dist/experimental-materials.d.ts +2 -0
  115. package/dist/experimental-materials.d.ts.map +1 -0
  116. package/dist/experimental-materials.js +5 -0
  117. package/dist/experimental-materials.js.map +1 -0
  118. package/dist/experimental-textures.cjs +21 -0
  119. package/dist/experimental-textures.d.ts +2 -0
  120. package/dist/experimental-textures.d.ts.map +1 -0
  121. package/dist/experimental-textures.js +5 -0
  122. package/dist/experimental-textures.js.map +1 -0
  123. package/dist/{experimental/controls/orbit-controls.cjs → experimental-webxr.cjs} +5 -11
  124. package/dist/experimental-webxr.d.ts +2 -0
  125. package/dist/experimental-webxr.d.ts.map +1 -0
  126. package/dist/experimental-webxr.js +5 -0
  127. package/dist/experimental-webxr.js.map +1 -0
  128. package/dist/geometry/edge-geometry.d.ts +1 -1
  129. package/dist/geometry/edge-geometry.d.ts.map +1 -1
  130. package/dist/geometry/geometry-primitives.cjs +18 -17
  131. package/dist/geometry/geometry-primitives.d.ts +2 -2
  132. package/dist/geometry/geometry-primitives.d.ts.map +1 -1
  133. package/dist/geometry/geometry-primitives.js +3 -2
  134. package/dist/geometry/geometry-primitives.js.map +1 -1
  135. package/dist/geometry/geometry-table.d.ts +1 -1
  136. package/dist/geometry/geometry-table.d.ts.map +1 -1
  137. package/dist/geometry/geometry-utils.cjs +6 -6
  138. package/dist/geometry/geometry-utils.d.ts +2 -2
  139. package/dist/geometry/geometry-utils.d.ts.map +1 -1
  140. package/dist/geometry/geometry-utils.js +1 -1
  141. package/dist/geometry/geometry-utils.js.map +1 -1
  142. package/dist/geometry/geometry.cjs +2 -2
  143. package/dist/geometry/geometry.d.ts +4 -3
  144. package/dist/geometry/geometry.d.ts.map +1 -1
  145. package/dist/geometry/geometry.js +1 -1
  146. package/dist/geometry/geometry.js.map +1 -1
  147. package/dist/geometry/gpu-geometry.d.ts +1 -1
  148. package/dist/geometry/gpu-geometry.d.ts.map +1 -1
  149. package/dist/geometry/gpu-vector-geometry-adapter.d.ts +1 -1
  150. package/dist/geometry/gpu-vector-geometry-adapter.d.ts.map +1 -1
  151. package/dist/geometry/ring-geometry.cjs +6 -6
  152. package/dist/geometry/ring-geometry.d.ts +1 -1
  153. package/dist/geometry/ring-geometry.d.ts.map +1 -1
  154. package/dist/geometry/ring-geometry.js +2 -2
  155. package/dist/geometry/ring-geometry.js.map +1 -1
  156. package/dist/gltf/gltf/animations/animations.d.ts +1 -1
  157. package/dist/gltf/gltf/animations/animations.d.ts.map +1 -1
  158. package/dist/gltf/gltf/create-gltf-model.cjs +3 -0
  159. package/dist/gltf/gltf/create-gltf-model.d.ts +1 -1
  160. package/dist/gltf/gltf/create-gltf-model.d.ts.map +1 -1
  161. package/dist/gltf/gltf/create-gltf-model.js +4 -0
  162. package/dist/gltf/gltf/create-gltf-model.js.map +1 -1
  163. package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +80 -12
  164. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts +8 -1
  165. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -1
  166. package/dist/gltf/gltf/create-scenegraph-from-gltf.js +82 -14
  167. package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -1
  168. package/dist/gltf/gltf/gltf-animated-crowd.d.ts +2 -1
  169. package/dist/gltf/gltf/gltf-animated-crowd.d.ts.map +1 -1
  170. package/dist/gltf/gltf/gltf-animated-crowd.js.map +1 -1
  171. package/dist/gltf/gltf/gltf-billboard.cjs +6 -1
  172. package/dist/gltf/gltf/gltf-billboard.d.ts.map +1 -1
  173. package/dist/gltf/gltf/gltf-billboard.js +6 -1
  174. package/dist/gltf/gltf/gltf-billboard.js.map +1 -1
  175. package/dist/gltf/gltf/gltf-extension-support.cjs +2 -2
  176. package/dist/gltf/gltf/gltf-extension-support.js +2 -2
  177. package/dist/gltf/gltf/gltf-extension-support.js.map +1 -1
  178. package/dist/gltf/gltf/gltf-instancing.cjs +2 -2
  179. package/dist/gltf/gltf/gltf-instancing.d.ts +1 -1
  180. package/dist/gltf/gltf/gltf-instancing.d.ts.map +1 -1
  181. package/dist/gltf/gltf/gltf-instancing.js +1 -1
  182. package/dist/gltf/gltf/gltf-instancing.js.map +1 -1
  183. package/dist/gltf/gltf/gltf-lightmap.cjs +2 -2
  184. package/dist/gltf/gltf/gltf-lightmap.d.ts +1 -1
  185. package/dist/gltf/gltf/gltf-lightmap.d.ts.map +1 -1
  186. package/dist/gltf/gltf/gltf-lightmap.js +1 -1
  187. package/dist/gltf/gltf/gltf-lightmap.js.map +1 -1
  188. package/dist/gltf/index.cjs +2 -0
  189. package/dist/gltf/index.cjs.map +3 -3
  190. package/dist/gltf/index.d.ts +1 -1
  191. package/dist/gltf/index.d.ts.map +1 -1
  192. package/dist/gltf/index.js +1 -1
  193. package/dist/gltf/index.js.map +1 -1
  194. package/dist/gltf/parsers/parse-gltf-animations.cjs +8 -5
  195. package/dist/gltf/parsers/parse-gltf-animations.js +20 -5
  196. package/dist/gltf/parsers/parse-gltf-animations.js.map +1 -1
  197. package/dist/gltf/parsers/parse-gltf-lights.cjs +41 -77
  198. package/dist/gltf/parsers/parse-gltf-lights.d.ts +6 -2
  199. package/dist/gltf/parsers/parse-gltf-lights.d.ts.map +1 -1
  200. package/dist/gltf/parsers/parse-gltf-lights.js +35 -92
  201. package/dist/gltf/parsers/parse-gltf-lights.js.map +1 -1
  202. package/dist/gltf/parsers/parse-gltf-metadata.cjs +60 -0
  203. package/dist/gltf/parsers/parse-gltf-metadata.d.ts +5 -0
  204. package/dist/gltf/parsers/parse-gltf-metadata.d.ts.map +1 -0
  205. package/dist/gltf/parsers/parse-gltf-metadata.js +39 -0
  206. package/dist/gltf/parsers/parse-gltf-metadata.js.map +1 -0
  207. package/dist/gltf/parsers/parse-gltf.cjs +4 -1
  208. package/dist/gltf/parsers/parse-gltf.d.ts +10 -2
  209. package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
  210. package/dist/gltf/parsers/parse-gltf.js +3 -0
  211. package/dist/gltf/parsers/parse-gltf.js.map +1 -1
  212. package/dist/gltf/parsers/parse-pbr-material.cjs +40 -30
  213. package/dist/gltf/parsers/parse-pbr-material.d.ts +7 -2
  214. package/dist/gltf/parsers/parse-pbr-material.d.ts.map +1 -1
  215. package/dist/gltf/parsers/parse-pbr-material.js +18 -6
  216. package/dist/gltf/parsers/parse-pbr-material.js.map +1 -1
  217. package/dist/gltf/pbr/pbr-environment.cjs +21 -3
  218. package/dist/gltf/pbr/pbr-environment.d.ts +3 -0
  219. package/dist/gltf/pbr/pbr-environment.d.ts.map +1 -1
  220. package/dist/gltf/pbr/pbr-environment.js +19 -1
  221. package/dist/gltf/pbr/pbr-environment.js.map +1 -1
  222. package/dist/gltf/pbr/pbr-material.d.ts +3 -3
  223. package/dist/gltf/pbr/pbr-material.d.ts.map +1 -1
  224. package/dist/gltf/physics/export-state.cjs +8 -8
  225. package/dist/gltf/physics/export-state.js +1 -1
  226. package/dist/gltf/physics/export-state.js.map +1 -1
  227. package/dist/gltf/physics/index.cjs.map +2 -2
  228. package/dist/gltf/physics/mesh-snapshot.cjs +3 -3
  229. package/dist/gltf/physics/mesh-snapshot.js +1 -1
  230. package/dist/gltf/physics/mesh-snapshot.js.map +1 -1
  231. package/dist/gltf/physics/node-collision-geometry.cjs +3 -3
  232. package/dist/gltf/physics/node-collision-geometry.js +1 -1
  233. package/dist/gltf/physics/node-collision-geometry.js.map +1 -1
  234. package/dist/gltf/physics/parse-gltf-physics.cjs +10 -10
  235. package/dist/gltf/physics/parse-gltf-physics.js +1 -1
  236. package/dist/gltf/physics/parse-gltf-physics.js.map +1 -1
  237. package/dist/gltf/physics/parse-physics-joints.cjs +3 -3
  238. package/dist/gltf/physics/parse-physics-joints.d.ts +1 -1
  239. package/dist/gltf/physics/parse-physics-joints.d.ts.map +1 -1
  240. package/dist/gltf/physics/parse-physics-joints.js +1 -1
  241. package/dist/gltf/physics/parse-physics-joints.js.map +1 -1
  242. package/dist/gltf/physics/property-bindings.cjs +4 -4
  243. package/dist/gltf/physics/property-bindings.js +1 -1
  244. package/dist/gltf/physics/property-bindings.js.map +1 -1
  245. package/dist/gltf/types/gltf-json-schema.d.ts.map +1 -1
  246. package/dist/gltf/types/gltf-json-schema.js +1 -0
  247. package/dist/gltf/types/gltf-json-schema.js.map +1 -1
  248. package/dist/gltf/types/gltf-postprocessed-schema.d.ts.map +1 -1
  249. package/dist/gltf/types/gltf-postprocessed-schema.js +1 -0
  250. package/dist/gltf/types/gltf-postprocessed-schema.js.map +1 -1
  251. package/dist/graph/models/index.cjs.map +2 -2
  252. package/dist/graph/models/path/path-attribute-model.cjs +4 -1
  253. package/dist/graph/models/path/path-attribute-model.d.ts +3 -1
  254. package/dist/graph/models/path/path-attribute-model.d.ts.map +1 -1
  255. package/dist/graph/models/path/path-attribute-model.js +6 -1
  256. package/dist/graph/models/path/path-attribute-model.js.map +1 -1
  257. package/dist/graph/models/path/path-storage-model.cjs +12 -9
  258. package/dist/graph/models/path/path-storage-model.d.ts +4 -2
  259. package/dist/graph/models/path/path-storage-model.d.ts.map +1 -1
  260. package/dist/graph/models/path/path-storage-model.js +8 -3
  261. package/dist/graph/models/path/path-storage-model.js.map +1 -1
  262. package/dist/graph/models/polygon/polygon-attribute-model.cjs +4 -4
  263. package/dist/graph/models/polygon/polygon-attribute-model.d.ts +1 -1
  264. package/dist/graph/models/polygon/polygon-attribute-model.js +1 -1
  265. package/dist/graph/models/polygon/polygon-shaders.d.ts +1 -1
  266. package/dist/graph/models/polygon/polygon-storage-model.cjs +4 -4
  267. package/dist/graph/models/polygon/polygon-storage-model.d.ts +1 -1
  268. package/dist/graph/models/polygon/polygon-storage-model.js +1 -1
  269. package/dist/graph/physics/index.cjs.map +2 -2
  270. package/dist/graph/physics/index.d.ts +1 -1
  271. package/dist/graph/physics/index.d.ts.map +1 -1
  272. package/dist/graph/physics/physics-controller-geometry.cjs +8 -8
  273. package/dist/graph/physics/physics-controller-geometry.js +2 -2
  274. package/dist/graph/physics/physics-controller-geometry.js.map +1 -1
  275. package/dist/graph/physics/physics-controller.cjs +106 -0
  276. package/dist/graph/physics/physics-controller.d.ts +41 -3
  277. package/dist/graph/physics/physics-controller.d.ts.map +1 -1
  278. package/dist/graph/physics/physics-controller.js +106 -0
  279. package/dist/graph/physics/physics-controller.js.map +1 -1
  280. package/dist/graph/physics/physics-scenegraph.cjs +4 -4
  281. package/dist/graph/physics/physics-scenegraph.d.ts +1 -1
  282. package/dist/graph/physics/physics-scenegraph.d.ts.map +1 -1
  283. package/dist/graph/physics/physics-scenegraph.js +1 -1
  284. package/dist/graph/physics/physics-scenegraph.js.map +1 -1
  285. package/dist/graph/physics/scenegraph-instance.cjs +16 -2
  286. package/dist/graph/physics/scenegraph-instance.d.ts.map +1 -1
  287. package/dist/graph/physics/scenegraph-instance.js +17 -1
  288. package/dist/graph/physics/scenegraph-instance.js.map +1 -1
  289. package/dist/graph/physics/scenegraph-motion.cjs +7 -7
  290. package/dist/graph/physics/scenegraph-motion.d.ts +1 -1
  291. package/dist/graph/physics/scenegraph-motion.d.ts.map +1 -1
  292. package/dist/graph/physics/scenegraph-motion.js +1 -1
  293. package/dist/graph/physics/scenegraph-motion.js.map +1 -1
  294. package/dist/graph/physics/scenegraph-properties.cjs +3 -3
  295. package/dist/graph/physics/scenegraph-properties.js +1 -1
  296. package/dist/graph/physics/scenegraph-properties.js.map +1 -1
  297. package/dist/graph/physics/scenegraph-publication.cjs +5 -5
  298. package/dist/graph/physics/scenegraph-publication.d.ts +1 -1
  299. package/dist/graph/physics/scenegraph-publication.d.ts.map +1 -1
  300. package/dist/graph/physics/scenegraph-publication.js +1 -1
  301. package/dist/graph/physics/scenegraph-publication.js.map +1 -1
  302. package/dist/graph/tables/gpu-table-model.cjs +2 -2
  303. package/dist/graph/tables/gpu-table-model.d.ts +2 -1
  304. package/dist/graph/tables/gpu-table-model.d.ts.map +1 -1
  305. package/dist/graph/tables/gpu-table-model.js +2 -2
  306. package/dist/graph/tables/gpu-table-model.js.map +1 -1
  307. package/dist/graph/tables/index.cjs.map +2 -2
  308. package/dist/index.cjs +13 -0
  309. package/dist/index.cjs.map +3 -3
  310. package/dist/index.d.ts +5 -0
  311. package/dist/index.d.ts.map +1 -1
  312. package/dist/index.js +3 -0
  313. package/dist/index.js.map +1 -1
  314. package/dist/lighting/ambient-occlusion-pass.cjs +126 -0
  315. package/dist/lighting/ambient-occlusion-pass.d.ts +32 -0
  316. package/dist/lighting/ambient-occlusion-pass.d.ts.map +1 -0
  317. package/dist/lighting/ambient-occlusion-pass.js +108 -0
  318. package/dist/lighting/ambient-occlusion-pass.js.map +1 -0
  319. package/dist/lighting/clustered-light-grid.cjs +378 -0
  320. package/dist/lighting/clustered-light-grid.d.ts +94 -0
  321. package/dist/lighting/clustered-light-grid.d.ts.map +1 -0
  322. package/dist/lighting/clustered-light-grid.js +370 -0
  323. package/dist/lighting/clustered-light-grid.js.map +1 -0
  324. package/dist/lighting/contact-shadow-composite.cjs +80 -0
  325. package/dist/lighting/contact-shadow-composite.d.ts +6 -0
  326. package/dist/lighting/contact-shadow-composite.d.ts.map +1 -0
  327. package/dist/lighting/contact-shadow-composite.js +59 -0
  328. package/dist/lighting/contact-shadow-composite.js.map +1 -0
  329. package/dist/lighting/contact-shadow-pass.cjs +102 -0
  330. package/dist/lighting/contact-shadow-pass.d.ts +24 -0
  331. package/dist/lighting/contact-shadow-pass.d.ts.map +1 -0
  332. package/dist/lighting/contact-shadow-pass.js +85 -0
  333. package/dist/lighting/contact-shadow-pass.js.map +1 -0
  334. package/dist/lighting/index.cjs +128 -0
  335. package/dist/lighting/index.cjs.map +6 -0
  336. package/dist/lighting/index.d.ts +35 -0
  337. package/dist/lighting/index.d.ts.map +1 -0
  338. package/dist/lighting/index.js +22 -0
  339. package/dist/lighting/index.js.map +1 -0
  340. package/dist/lighting/lightmap-atlas.cjs +246 -0
  341. package/dist/lighting/lightmap-atlas.d.ts +53 -0
  342. package/dist/lighting/lightmap-atlas.d.ts.map +1 -0
  343. package/dist/lighting/lightmap-atlas.js +279 -0
  344. package/dist/lighting/lightmap-atlas.js.map +1 -0
  345. package/dist/lighting/lightmap-baker.cjs +238 -0
  346. package/dist/lighting/lightmap-baker.d.ts +62 -0
  347. package/dist/lighting/lightmap-baker.d.ts.map +1 -0
  348. package/dist/lighting/lightmap-baker.js +236 -0
  349. package/dist/lighting/lightmap-baker.js.map +1 -0
  350. package/dist/lighting/lightmap-data.cjs +117 -0
  351. package/dist/lighting/lightmap-data.d.ts +20 -0
  352. package/dist/lighting/lightmap-data.d.ts.map +1 -0
  353. package/dist/lighting/lightmap-data.js +110 -0
  354. package/dist/lighting/lightmap-data.js.map +1 -0
  355. package/dist/lighting/lightmap-environment.cjs +61 -0
  356. package/dist/lighting/lightmap-environment.d.ts +18 -0
  357. package/dist/lighting/lightmap-environment.d.ts.map +1 -0
  358. package/dist/lighting/lightmap-environment.js +46 -0
  359. package/dist/lighting/lightmap-environment.js.map +1 -0
  360. package/dist/lighting/pbr-environment.cjs +45 -0
  361. package/dist/lighting/pbr-environment.d.ts +25 -0
  362. package/dist/lighting/pbr-environment.d.ts.map +1 -0
  363. package/dist/lighting/pbr-environment.js +30 -0
  364. package/dist/lighting/pbr-environment.js.map +1 -0
  365. package/dist/lighting/pbr-material.cjs +75 -0
  366. package/dist/lighting/pbr-material.d.ts +33 -0
  367. package/dist/lighting/pbr-material.d.ts.map +1 -0
  368. package/dist/lighting/pbr-material.js +52 -0
  369. package/dist/lighting/pbr-material.js.map +1 -0
  370. package/dist/lighting/pbr-model.cjs +579 -0
  371. package/dist/lighting/pbr-model.d.ts +45 -0
  372. package/dist/lighting/pbr-model.d.ts.map +1 -0
  373. package/dist/lighting/pbr-model.js +545 -0
  374. package/dist/lighting/pbr-model.js.map +1 -0
  375. package/dist/lighting/pbr-surface-pass.cjs +116 -0
  376. package/dist/lighting/pbr-surface-pass.d.ts +35 -0
  377. package/dist/lighting/pbr-surface-pass.d.ts.map +1 -0
  378. package/dist/lighting/pbr-surface-pass.js +98 -0
  379. package/dist/lighting/pbr-surface-pass.js.map +1 -0
  380. package/dist/lighting/prefiltered-environment.cjs +275 -0
  381. package/dist/lighting/prefiltered-environment.d.ts +56 -0
  382. package/dist/lighting/prefiltered-environment.d.ts.map +1 -0
  383. package/dist/lighting/prefiltered-environment.js +264 -0
  384. package/dist/lighting/prefiltered-environment.js.map +1 -0
  385. package/dist/lighting/reflection-probe.cjs +321 -0
  386. package/dist/lighting/reflection-probe.d.ts +78 -0
  387. package/dist/lighting/reflection-probe.d.ts.map +1 -0
  388. package/dist/lighting/reflection-probe.js +298 -0
  389. package/dist/lighting/reflection-probe.js.map +1 -0
  390. package/dist/lighting/shadow-map-renderer.cjs +631 -0
  391. package/dist/lighting/shadow-map-renderer.d.ts +92 -0
  392. package/dist/lighting/shadow-map-renderer.d.ts.map +1 -0
  393. package/dist/lighting/shadow-map-renderer.js +622 -0
  394. package/dist/lighting/shadow-map-renderer.js.map +1 -0
  395. package/dist/lighting/shadow-quality.cjs +58 -0
  396. package/dist/lighting/shadow-quality.d.ts +13 -0
  397. package/dist/lighting/shadow-quality.d.ts.map +1 -0
  398. package/dist/lighting/shadow-quality.js +37 -0
  399. package/dist/lighting/shadow-quality.js.map +1 -0
  400. package/dist/material/material.cjs +3 -0
  401. package/dist/material/material.d.ts +2 -0
  402. package/dist/material/material.d.ts.map +1 -1
  403. package/dist/material/material.js +3 -0
  404. package/dist/material/material.js.map +1 -1
  405. package/dist/model/gpu-vector-model.cjs +20 -3
  406. package/dist/model/gpu-vector-model.d.ts +20 -2
  407. package/dist/model/gpu-vector-model.d.ts.map +1 -1
  408. package/dist/model/gpu-vector-model.js +21 -3
  409. package/dist/model/gpu-vector-model.js.map +1 -1
  410. package/dist/model/model.d.ts +1 -1
  411. package/dist/model/model.d.ts.map +1 -1
  412. package/dist/models/light-model-utils.cjs +4 -4
  413. package/dist/models/light-model-utils.d.ts +3 -2
  414. package/dist/models/light-model-utils.d.ts.map +1 -1
  415. package/dist/models/light-model-utils.js +3 -3
  416. package/dist/models/light-model-utils.js.map +1 -1
  417. package/dist/modules/picking/color-picking.d.ts +1 -1
  418. package/dist/modules/picking/index-color-picking.d.ts +1 -1
  419. package/dist/modules/picking/index-picking.d.ts +1 -1
  420. package/dist/modules/picking/legacy-color-picking.d.ts +1 -1
  421. package/dist/modules/picking/picking-uniforms.d.ts +1 -1
  422. package/dist/modules/picking/picking-uniforms.d.ts.map +1 -1
  423. package/dist/modules/picking/picking.d.ts +1 -1
  424. package/dist/scenegraph/controllers/area-light-controller.cjs +11 -11
  425. package/dist/scenegraph/controllers/area-light-controller.js +1 -1
  426. package/dist/scenegraph/controllers/area-light-controller.js.map +1 -1
  427. package/dist/scenegraph/controllers/billboard-controller.cjs +28 -28
  428. package/dist/scenegraph/controllers/billboard-controller.d.ts +2 -1
  429. package/dist/scenegraph/controllers/billboard-controller.d.ts.map +1 -1
  430. package/dist/scenegraph/controllers/billboard-controller.js +1 -1
  431. package/dist/scenegraph/controllers/billboard-controller.js.map +1 -1
  432. package/dist/scenegraph/controllers/joint-controller.cjs +5 -5
  433. package/dist/scenegraph/controllers/joint-controller.js +1 -1
  434. package/dist/scenegraph/controllers/joint-controller.js.map +1 -1
  435. package/dist/scenegraph/controllers/punctual-light-controller.cjs +121 -0
  436. package/dist/scenegraph/controllers/punctual-light-controller.d.ts +31 -0
  437. package/dist/scenegraph/controllers/punctual-light-controller.d.ts.map +1 -0
  438. package/dist/scenegraph/controllers/punctual-light-controller.js +117 -0
  439. package/dist/scenegraph/controllers/punctual-light-controller.js.map +1 -0
  440. package/dist/scenegraph/controllers/skin-controller.cjs +2 -2
  441. package/dist/scenegraph/controllers/skin-controller.js +1 -1
  442. package/dist/scenegraph/controllers/skin-controller.js.map +1 -1
  443. package/dist/scenegraph/group-node.cjs +14 -14
  444. package/dist/scenegraph/group-node.d.ts +2 -2
  445. package/dist/scenegraph/group-node.d.ts.map +1 -1
  446. package/dist/scenegraph/group-node.js +1 -1
  447. package/dist/scenegraph/group-node.js.map +1 -1
  448. package/dist/scenegraph/model-node.d.ts +1 -1
  449. package/dist/scenegraph/model-node.d.ts.map +1 -1
  450. package/dist/scenegraph/physics-transforms.cjs +2 -2
  451. package/dist/scenegraph/physics-transforms.d.ts +1 -1
  452. package/dist/scenegraph/physics-transforms.d.ts.map +1 -1
  453. package/dist/scenegraph/physics-transforms.js +1 -1
  454. package/dist/scenegraph/physics-transforms.js.map +1 -1
  455. package/dist/scenegraph/scene-metadata.cjs +43 -0
  456. package/dist/scenegraph/scene-metadata.d.ts +9 -0
  457. package/dist/scenegraph/scene-metadata.d.ts.map +1 -0
  458. package/dist/scenegraph/scene-metadata.js +21 -0
  459. package/dist/scenegraph/scene-metadata.js.map +1 -0
  460. package/dist/scenegraph/scenegraph-bounds.cjs +3 -3
  461. package/dist/scenegraph/scenegraph-bounds.d.ts +1 -1
  462. package/dist/scenegraph/scenegraph-bounds.d.ts.map +1 -1
  463. package/dist/scenegraph/scenegraph-bounds.js +1 -1
  464. package/dist/scenegraph/scenegraph-bounds.js.map +1 -1
  465. package/dist/scenegraph/scenegraph-interaction.cjs +99 -0
  466. package/dist/scenegraph/scenegraph-interaction.d.ts +47 -0
  467. package/dist/scenegraph/scenegraph-interaction.d.ts.map +1 -0
  468. package/dist/scenegraph/scenegraph-interaction.js +79 -0
  469. package/dist/scenegraph/scenegraph-interaction.js.map +1 -0
  470. package/dist/scenegraph/scenegraph-node.cjs +17 -7
  471. package/dist/scenegraph/scenegraph-node.d.ts +12 -1
  472. package/dist/scenegraph/scenegraph-node.d.ts.map +1 -1
  473. package/dist/scenegraph/scenegraph-node.js +11 -1
  474. package/dist/scenegraph/scenegraph-node.js.map +1 -1
  475. package/dist/scenegraph/transform-source.d.ts +1 -1
  476. package/dist/scenegraph/transform-source.d.ts.map +1 -1
  477. package/dist/text/experimental.cjs.map +1 -1
  478. package/dist/text/fonts/atlas/text-utils.cjs +1 -1
  479. package/dist/text/fonts/atlas/text-utils.js +1 -1
  480. package/dist/text/fonts/atlas/text-utils.js.map +1 -1
  481. package/dist/text/fonts/index.cjs.map +1 -1
  482. package/dist/text/index.cjs +2 -0
  483. package/dist/text/index.cjs.map +2 -2
  484. package/dist/text/index.d.ts +1 -1
  485. package/dist/text/index.d.ts.map +1 -1
  486. package/dist/text/index.js +1 -1
  487. package/dist/text/index.js.map +1 -1
  488. package/dist/text/text-2d/index.cjs +3 -0
  489. package/dist/text/text-2d/index.d.ts +1 -0
  490. package/dist/text/text-2d/index.d.ts.map +1 -1
  491. package/dist/text/text-2d/index.js +1 -0
  492. package/dist/text/text-2d/index.js.map +1 -1
  493. package/dist/text/text-2d/model-utils/text-code-point-source.cjs +41 -0
  494. package/dist/text/text-2d/model-utils/text-code-point-source.d.ts +8 -0
  495. package/dist/text/text-2d/model-utils/text-code-point-source.d.ts.map +1 -0
  496. package/dist/text/text-2d/model-utils/text-code-point-source.js +23 -0
  497. package/dist/text/text-2d/model-utils/text-code-point-source.js.map +1 -0
  498. package/dist/text/text-2d/models/text-attribute-model.cjs +4 -1
  499. package/dist/text/text-2d/models/text-attribute-model.d.ts +3 -1
  500. package/dist/text/text-2d/models/text-attribute-model.d.ts.map +1 -1
  501. package/dist/text/text-2d/models/text-attribute-model.js +6 -1
  502. package/dist/text/text-2d/models/text-attribute-model.js.map +1 -1
  503. package/dist/text/text-2d/models/text-dictionary-model.cjs +4 -1
  504. package/dist/text/text-2d/models/text-dictionary-model.d.ts +3 -1
  505. package/dist/text/text-2d/models/text-dictionary-model.d.ts.map +1 -1
  506. package/dist/text/text-2d/models/text-dictionary-model.js +6 -1
  507. package/dist/text/text-2d/models/text-dictionary-model.js.map +1 -1
  508. package/dist/text/text-2d/models/text-storage-model.cjs +4 -1
  509. package/dist/text/text-2d/models/text-storage-model.d.ts +3 -1
  510. package/dist/text/text-2d/models/text-storage-model.d.ts.map +1 -1
  511. package/dist/text/text-2d/models/text-storage-model.js +6 -1
  512. package/dist/text/text-2d/models/text-storage-model.js.map +1 -1
  513. package/dist/text/text-3d/extrude.cjs +15 -15
  514. package/dist/text/text-3d/extrude.js +1 -1
  515. package/dist/text/text-3d/extrude.js.map +1 -1
  516. package/dist/text/text-3d/index.cjs.map +2 -2
  517. package/dist/text/text-3d/paths/curves.cjs +5 -5
  518. package/dist/text/text-3d/paths/curves.d.ts +1 -1
  519. package/dist/text/text-3d/paths/curves.d.ts.map +1 -1
  520. package/dist/text/text-3d/paths/curves.js +1 -1
  521. package/dist/text/text-3d/paths/curves.js.map +1 -1
  522. package/dist/text/text-3d/paths/path.cjs +5 -5
  523. package/dist/text/text-3d/paths/path.d.ts +1 -1
  524. package/dist/text/text-3d/paths/path.d.ts.map +1 -1
  525. package/dist/text/text-3d/paths/path.js +1 -1
  526. package/dist/text/text-3d/paths/path.js.map +1 -1
  527. package/dist/text/text-3d/paths/shape-path.d.ts +1 -1
  528. package/dist/text/text-3d/paths/shape-path.d.ts.map +1 -1
  529. package/dist/text/text-3d/paths/shape-utils.cjs +2 -2
  530. package/dist/text/text-3d/paths/shape-utils.d.ts +1 -1
  531. package/dist/text/text-3d/paths/shape-utils.d.ts.map +1 -1
  532. package/dist/text/text-3d/paths/shape-utils.js +1 -1
  533. package/dist/text/text-3d/paths/shape-utils.js.map +1 -1
  534. package/licenses/cesium.txt +207 -0
  535. package/licenses/deck-community.txt +19 -0
  536. package/licenses/deck.txt +19 -0
  537. package/licenses/glfx.txt +19 -0
  538. package/licenses/gltf-loader-ts.txt +21 -0
  539. package/licenses/magenta-font.txt +13 -0
  540. package/licenses/nvidia-fxaa.txt +25 -0
  541. package/licenses/philogl.txt +19 -0
  542. package/licenses/spark.txt +21 -0
  543. package/licenses/three.txt +21 -0
  544. package/package.json +21 -13
  545. package/src/animation/deform-positions.ts +1 -1
  546. package/src/animation/node-animation-binding.ts +18 -1
  547. package/src/animation/skin.ts +2 -1
  548. package/src/animation/texture-transform.ts +1 -1
  549. package/src/arrow/arrow-geometry.ts +1 -1
  550. package/src/arrow/arrow-mesh-types.ts +1 -1
  551. package/src/arrow/renderers/path/conversion/arrow-path-storage-gpu-vectors.ts +1 -1
  552. package/src/arrow/renderers/polygon/renderers/arrow-polygon-renderer.ts +1 -1
  553. package/src/arrow/renderers/splats/conversion/make-gpu-splat-data-from-gltf.ts +24 -20
  554. package/src/arrow/renderers/text/renderers/arrow-text-shaders.ts +1 -1
  555. package/src/audio/audio-controller.ts +1 -1
  556. package/src/audio/audio-environment.ts +1 -1
  557. package/src/compute/computation.ts +2 -2
  558. package/src/compute/swap.ts +2 -2
  559. package/src/debug/pixel-data-utils.ts +1 -1
  560. package/src/dynamic-texture/video-texture.ts +9 -3
  561. package/src/effects/passes/postprocessing/fxaa/fxaa.ts +2 -1
  562. package/src/effects/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +2 -0
  563. package/src/effects/passes/postprocessing/image-adjust-filters/denoise.ts +2 -0
  564. package/src/effects/passes/postprocessing/image-adjust-filters/huesaturation.ts +2 -0
  565. package/src/effects/passes/postprocessing/image-adjust-filters/noise.ts +2 -0
  566. package/src/effects/passes/postprocessing/image-adjust-filters/sepia.ts +2 -0
  567. package/src/effects/passes/postprocessing/image-adjust-filters/vibrance.ts +2 -0
  568. package/src/effects/passes/postprocessing/image-adjust-filters/vignette.ts +2 -0
  569. package/src/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.ts +1 -1
  570. package/src/effects/passes/screen-space/clustered-volumetric-lighting.ts +1 -1
  571. package/src/effects/passes/screen-space/gtao.ts +1 -1
  572. package/src/effects/passes/screen-space/height-fog.ts +1 -1
  573. package/src/effects/passes/screen-space/screen-space-global-illumination.ts +1 -1
  574. package/src/effects/passes/screen-space/screen-space-reflections.ts +1 -1
  575. package/src/effects/passes/screen-space/ssr-camera-temporal.ts +1 -1
  576. package/src/experimental/controls/index.ts +0 -2
  577. package/src/experimental/webxr/webxr-input.ts +1 -1
  578. package/{dist/experimental/controls/orbit-controls.js → src/experimental-controls.ts} +2 -2
  579. package/src/experimental-materials.ts +5 -0
  580. package/src/experimental-textures.ts +5 -0
  581. package/src/experimental-webxr.ts +5 -0
  582. package/src/geometry/edge-geometry.ts +2 -2
  583. package/src/geometry/geometry-primitives.ts +6 -3
  584. package/src/geometry/geometry-table.ts +1 -1
  585. package/src/geometry/geometry-utils.ts +3 -3
  586. package/src/geometry/geometry.ts +7 -7
  587. package/src/geometry/gpu-geometry.ts +1 -1
  588. package/src/geometry/gpu-vector-geometry-adapter.ts +1 -1
  589. package/src/geometry/ring-geometry.ts +2 -2
  590. package/src/gltf/gltf/animations/animations.ts +8 -1
  591. package/src/gltf/gltf/create-gltf-model.ts +5 -1
  592. package/src/gltf/gltf/create-scenegraph-from-gltf.ts +98 -17
  593. package/src/gltf/gltf/gltf-animated-crowd.ts +2 -1
  594. package/src/gltf/gltf/gltf-billboard.ts +6 -1
  595. package/src/gltf/gltf/gltf-extension-support.ts +2 -2
  596. package/src/gltf/gltf/gltf-instancing.ts +1 -1
  597. package/src/gltf/gltf/gltf-lightmap.ts +1 -1
  598. package/src/gltf/index.ts +1 -0
  599. package/src/gltf/parsers/parse-gltf-animations.ts +22 -8
  600. package/src/gltf/parsers/parse-gltf-lights.ts +43 -131
  601. package/src/gltf/parsers/parse-gltf-metadata.ts +40 -0
  602. package/src/gltf/parsers/parse-gltf.ts +11 -2
  603. package/src/gltf/parsers/parse-pbr-material.ts +36 -8
  604. package/src/gltf/pbr/pbr-environment.ts +27 -1
  605. package/src/gltf/pbr/pbr-material.ts +8 -3
  606. package/src/gltf/physics/export-state.ts +1 -1
  607. package/src/gltf/physics/mesh-snapshot.ts +1 -1
  608. package/src/gltf/physics/node-collision-geometry.ts +1 -1
  609. package/src/gltf/physics/parse-gltf-physics.ts +1 -1
  610. package/src/gltf/physics/parse-physics-joints.ts +1 -1
  611. package/src/gltf/physics/property-bindings.ts +1 -1
  612. package/src/gltf/types/gltf-json-schema.ts +1 -0
  613. package/src/gltf/types/gltf-postprocessed-schema.ts +1 -0
  614. package/src/graph/models/path/path-attribute-model.ts +10 -1
  615. package/src/graph/models/path/path-storage-model.ts +13 -4
  616. package/src/graph/models/polygon/polygon-attribute-model.ts +1 -1
  617. package/src/graph/models/polygon/polygon-storage-model.ts +1 -1
  618. package/src/graph/physics/index.ts +1 -0
  619. package/src/graph/physics/physics-controller-geometry.ts +2 -2
  620. package/src/graph/physics/physics-controller.ts +155 -2
  621. package/src/graph/physics/physics-scenegraph.ts +1 -1
  622. package/src/graph/physics/scenegraph-instance.ts +27 -1
  623. package/src/graph/physics/scenegraph-motion.ts +1 -1
  624. package/src/graph/physics/scenegraph-properties.ts +1 -1
  625. package/src/graph/physics/scenegraph-publication.ts +1 -1
  626. package/src/graph/tables/gpu-table-model.ts +3 -2
  627. package/src/index.ts +17 -0
  628. package/src/lighting/ambient-occlusion-pass.ts +131 -0
  629. package/src/lighting/clustered-light-grid.ts +481 -0
  630. package/src/lighting/contact-shadow-composite.ts +67 -0
  631. package/src/lighting/contact-shadow-pass.ts +108 -0
  632. package/src/lighting/index.ts +125 -0
  633. package/src/lighting/lightmap-atlas.ts +348 -0
  634. package/src/lighting/lightmap-baker.ts +306 -0
  635. package/src/lighting/lightmap-data.ts +138 -0
  636. package/src/lighting/lightmap-environment.ts +70 -0
  637. package/src/lighting/pbr-environment.ts +55 -0
  638. package/src/lighting/pbr-material.ts +85 -0
  639. package/src/lighting/pbr-model.ts +608 -0
  640. package/src/lighting/pbr-surface-pass.ts +122 -0
  641. package/src/lighting/prefiltered-environment.ts +354 -0
  642. package/src/lighting/reflection-probe.ts +361 -0
  643. package/src/lighting/shadow-map-renderer.ts +918 -0
  644. package/src/lighting/shadow-quality.ts +50 -0
  645. package/src/material/material.ts +3 -0
  646. package/src/model/gpu-vector-model.ts +42 -4
  647. package/src/model/model.ts +1 -1
  648. package/src/models/light-model-utils.ts +5 -3
  649. package/src/modules/picking/legacy-picking-manager.ts +1 -1
  650. package/src/modules/picking/picking-uniforms.ts +1 -1
  651. package/src/scenegraph/controllers/area-light-controller.ts +1 -1
  652. package/src/scenegraph/controllers/billboard-controller.ts +2 -1
  653. package/src/scenegraph/controllers/joint-controller.ts +1 -1
  654. package/src/scenegraph/controllers/punctual-light-controller.ts +172 -0
  655. package/src/scenegraph/controllers/skin-controller.ts +1 -1
  656. package/src/scenegraph/group-node.ts +2 -2
  657. package/src/scenegraph/model-node.ts +1 -1
  658. package/src/scenegraph/physics-transforms.ts +1 -1
  659. package/src/scenegraph/scene-metadata.ts +23 -0
  660. package/src/scenegraph/scenegraph-bounds.ts +2 -2
  661. package/src/scenegraph/scenegraph-interaction.ts +131 -0
  662. package/src/scenegraph/scenegraph-node.ts +14 -1
  663. package/src/scenegraph/transform-source.ts +1 -1
  664. package/src/splats/README.md +1 -1
  665. package/src/text/fonts/atlas/text-utils.ts +1 -1
  666. package/src/text/index.ts +1 -0
  667. package/src/text/text-2d/index.ts +1 -0
  668. package/src/text/text-2d/model-utils/text-code-point-source.ts +34 -0
  669. package/src/text/text-2d/models/text-attribute-model.ts +10 -1
  670. package/src/text/text-2d/models/text-dictionary-model.ts +10 -1
  671. package/src/text/text-2d/models/text-storage-model.ts +10 -1
  672. package/src/text/text-3d/extrude.ts +1 -1
  673. package/src/text/text-3d/font.ts +1 -1
  674. package/src/text/text-3d/paths/curves.ts +1 -1
  675. package/src/text/text-3d/paths/path.ts +1 -1
  676. package/src/text/text-3d/paths/shape-path.ts +1 -1
  677. package/src/text/text-3d/paths/shape-utils.ts +2 -2
  678. package/dist/experimental/controls/orbit-controls.d.ts +0 -3
  679. package/dist/experimental/controls/orbit-controls.d.ts.map +0 -1
  680. package/dist/experimental/controls/orbit-controls.js.map +0 -1
  681. package/src/experimental/controls/orbit-controls.ts +0 -6
package/src/index.ts CHANGED
@@ -48,6 +48,7 @@ export {makeAnimationLoop} from './animation-loop/make-animation-loop';
48
48
  export type {OrbitControlsProps, OrbitPosition} from './controls/orbit-controls';
49
49
  export {OrbitControls} from './controls/orbit-controls';
50
50
 
51
+ export type {ModelDrawOptions} from './model/gpu-vector-model';
51
52
  export type {ModelProps} from './model/model';
52
53
  export {Model} from './model/model';
53
54
  export type {MaterialProps} from './material/material';
@@ -78,6 +79,17 @@ export {DirectionalLightModel} from './models/directional-light-model';
78
79
 
79
80
  // Scenegraph Core nodes
80
81
  export {ScenegraphNode} from './scenegraph/scenegraph-node';
82
+ export {
83
+ isScenegraphInteractionEnabled,
84
+ getFirstScenegraphInteractionHit,
85
+ ScenegraphInteractionManager
86
+ } from './scenegraph/scenegraph-interaction';
87
+ export type {
88
+ ScenegraphInteractionKind,
89
+ ScenegraphInteractionHit,
90
+ ScenegraphInteractionEvent
91
+ } from './scenegraph/scenegraph-interaction';
92
+ export {SceneMetadata} from './scenegraph/scene-metadata';
81
93
  export type {ScenegraphBounds} from './scenegraph/scenegraph-bounds';
82
94
  export type {
83
95
  DepthSortedTraversalContext,
@@ -237,6 +249,11 @@ export {
237
249
  type BillboardDrawEntry,
238
250
  type BillboardControllerProps
239
251
  } from './scenegraph/controllers/billboard-controller';
252
+ export {
253
+ PunctualLightController,
254
+ type PunctualLightBinding,
255
+ type PunctualLightDefinition
256
+ } from './scenegraph/controllers/punctual-light-controller';
240
257
  export {
241
258
  AreaLightController,
242
259
  type AreaLightDefinition,
@@ -0,0 +1,131 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
3
+
4
+ import {assert, type Device, type Texture} from '@luma.gl/core';
5
+ import type {CompositeShaderPass} from '@luma.gl/shaders';
6
+ import {Matrix4} from '@math.gl/core/matrix';
7
+ import {type NumberArray16} from '@math.gl/core/types';
8
+ import {ShaderPassRenderer} from '../passes/shader-pass-renderer';
9
+ import {ssaoEvaluate} from '../effects/passes/screen-space/ssao';
10
+ import {gtaoEvaluate} from '../effects/passes/screen-space/gtao';
11
+ import {depthAwareBlur} from '../effects/passes/screen-space/depth-aware-blur';
12
+
13
+ export type AmbientOcclusionMode = 'none' | 'ssao' | 'gtao';
14
+ export type AmbientOcclusionPassProps = {
15
+ mode?: AmbientOcclusionMode;
16
+ resolutionScale?: number;
17
+ };
18
+ export type AmbientOcclusionRenderOptions = {
19
+ depthTexture: Texture;
20
+ normalTexture: Texture;
21
+ projectionMatrix: Readonly<Matrix4 | NumberArray16>;
22
+ near: number;
23
+ far: number;
24
+ /** SSAO uses pixels; GTAO uses view-space scene units. */
25
+ radius?: number;
26
+ bias?: number;
27
+ intensity?: number;
28
+ };
29
+
30
+ /** Reuses the effects evaluators to produce ambient visibility, without color composition or history. */
31
+ export class AmbientOcclusionPass {
32
+ readonly device: Device;
33
+ readonly mode: AmbientOcclusionMode;
34
+ private readonly renderer: ShaderPassRenderer | null;
35
+ private readonly unoccluded: Texture;
36
+ private destroyed = false;
37
+
38
+ constructor(device: Device, props: AmbientOcclusionPassProps = {}) {
39
+ this.device = device;
40
+ this.mode = props.mode ?? 'gtao';
41
+ // Existing SSAO/GTAO evaluators support WebGPU. Callers can explicitly select none elsewhere.
42
+ assert(this.mode === 'none' || device.type === 'webgpu');
43
+ const scale = props.resolutionScale ?? 0.5;
44
+ // Resolution scale must describe a positive fractional input resolution.
45
+ assert(scale > 0 && scale <= 1);
46
+ this.unoccluded = device.createTexture({
47
+ width: 1,
48
+ height: 1,
49
+ data: new Uint8Array([255, 255, 255, 255])
50
+ });
51
+ if (this.mode === 'none') {
52
+ this.renderer = null;
53
+ return;
54
+ }
55
+ const evaluate = this.mode === 'ssao' ? ssaoEvaluate : gtaoEvaluate;
56
+ const shaderPass: CompositeShaderPass<'ambientOcclusionRaw' | 'ambientOcclusionScratch'> = {
57
+ name: 'ambientOcclusionVisibility',
58
+ renderTargets: {
59
+ ambientOcclusionRaw: {scale: [scale, scale], format: 'rgba8unorm'},
60
+ ambientOcclusionScratch: {scale: [scale, scale], format: 'rgba8unorm'}
61
+ },
62
+ steps: [
63
+ {shaderPass: evaluate, inputs: {sourceTexture: 'original'}, output: 'ambientOcclusionRaw'},
64
+ {
65
+ shaderPass: depthAwareBlur,
66
+ inputs: {sourceTexture: 'ambientOcclusionRaw'},
67
+ output: 'ambientOcclusionScratch',
68
+ uniforms: {direction: [1, 0]}
69
+ },
70
+ {
71
+ shaderPass: depthAwareBlur,
72
+ inputs: {sourceTexture: 'ambientOcclusionScratch'},
73
+ output: 'previous',
74
+ uniforms: {direction: [0, 1]}
75
+ }
76
+ ]
77
+ };
78
+ this.renderer = new ShaderPassRenderer(device, {
79
+ shaderPasses: [shaderPass],
80
+ colorFormat: 'rgba8unorm'
81
+ });
82
+ }
83
+
84
+ /** Borrows same-camera WebGPU hardware depth and encoded view normals; never submits. */
85
+ render(options: AmbientOcclusionRenderOptions): Texture {
86
+ // Even disabled passes must not be used after destruction.
87
+ assert(!this.destroyed);
88
+ if (!this.renderer) return this.unoccluded;
89
+ const {depthTexture, normalTexture} = options;
90
+ // Inputs must share the device and physical resolution.
91
+ assert(depthTexture.device === this.device && normalTexture.device === this.device);
92
+ assert(
93
+ depthTexture.width === normalTexture.width && depthTexture.height === normalTexture.height
94
+ );
95
+ const projectionMatrix = new Matrix4(options.projectionMatrix);
96
+ this.renderer.resize([normalTexture.width, normalTexture.height]);
97
+ const controls = {
98
+ ...(options.radius === undefined ? {} : {radius: options.radius}),
99
+ ...(options.bias === undefined ? {} : {bias: options.bias}),
100
+ ...(options.intensity === undefined ? {} : {intensity: options.intensity})
101
+ };
102
+ const result = this.renderer.renderToTexture({
103
+ sourceTexture: normalTexture,
104
+ bindings: {depthTexture, normalTexture},
105
+ uniforms: {
106
+ ssaoEvaluate: {
107
+ ...controls,
108
+ nearPlane: options.near,
109
+ farPlane: options.far,
110
+ useNormalTexture: 1
111
+ },
112
+ gtaoEvaluate: {
113
+ ...controls,
114
+ projectionMatrix,
115
+ inverseProjectionMatrix: new Matrix4(projectionMatrix).invert(),
116
+ frameIndex: 0
117
+ }
118
+ }
119
+ });
120
+ // Concrete inputs always produce a texture; deferred uploads are not accepted.
121
+ assert(result);
122
+ return result;
123
+ }
124
+
125
+ destroy(): void {
126
+ if (this.destroyed) return;
127
+ this.destroyed = true;
128
+ this.renderer?.destroy();
129
+ this.unoccluded.destroy();
130
+ }
131
+ }
@@ -0,0 +1,481 @@
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import type {CommandEncoder, Device} from '@luma.gl/core';
6
+ import {assert, Buffer} from '@luma.gl/core';
7
+ import {Computation} from '../compute/computation';
8
+ import type {Matrix4Like} from '@math.gl/core/matrix';
9
+
10
+ /** Byte layout of each point-light record. The grid ignores the consumer payload. */
11
+ export const CLUSTERED_POINT_LIGHT_LAYOUT = Object.freeze({
12
+ byteStride: 32,
13
+ positionByteOffset: 0,
14
+ radiusByteOffset: 12,
15
+ payloadByteOffset: 16
16
+ });
17
+
18
+ /** Compatibility name for the renderer-independent uniform snapshot. */
19
+ export type ClusteredLightGridShaderPassUniforms = ClusteredLightGridUniforms;
20
+
21
+ export const MAX_CLUSTERED_POINT_LIGHTS = 512;
22
+ export const DEFAULT_CLUSTER_DIMENSIONS = [16, 9, 24] as const;
23
+ export const DEFAULT_MAX_LIGHTS_PER_CLUSTER = 64;
24
+
25
+ const CLUSTER_WORKGROUP_SIZE = 64;
26
+ const CLUSTERED_LIGHT_GRID_UNIFORM_BYTE_LENGTH = 80;
27
+
28
+ /** Construction props for the fixed-capacity WebGPU light-cluster grid. */
29
+ export type ClusteredLightGridProps = {
30
+ /** Optional debug-resource prefix. */
31
+ id?: string;
32
+ /** Screen-x, screen-y, and logarithmic depth-slice counts. */
33
+ clusterDimensions?: readonly [number, number, number];
34
+ /** Maximum retained light indices in one cluster. */
35
+ maxLightsPerCluster?: number;
36
+ /** Maximum point-light records accepted by encode(). */
37
+ maxLightCount?: number;
38
+ };
39
+
40
+ /** Per-frame camera and light inputs used to rebuild the cluster lists. */
41
+ export type ClusteredLightGridEncodeOptions = {
42
+ /** View-space point-light records following CLUSTERED_POINT_LIGHT_LAYOUT. */
43
+ pointLights: Buffer;
44
+ /** Active prefix length in pointLights. */
45
+ pointLightCount: number;
46
+ /** Camera projection used to conservatively project light spheres into screen tiles. */
47
+ projectionMatrix: Readonly<Matrix4Like>;
48
+ /** Positive view-space near plane. */
49
+ nearPlane: number;
50
+ /** Positive view-space far plane. */
51
+ farPlane: number;
52
+ };
53
+
54
+ /** Storage bindings available to lighting consumers. */
55
+ export type ClusteredLightGridBindings = {
56
+ clusterLightCounts: Buffer;
57
+ clusterLightIndices: Buffer;
58
+ };
59
+
60
+ /** Uniform values available to lighting consumers to locate one pixel's cluster. */
61
+ export type ClusteredLightGridUniforms = {
62
+ clusterCountX: number;
63
+ clusterCountY: number;
64
+ clusterCountZ: number;
65
+ maxLightsPerCluster: number;
66
+ pointLightCount: number;
67
+ clusterNearPlane: number;
68
+ clusterFarPlane: number;
69
+ };
70
+
71
+ /**
72
+ * Builds fixed-capacity screen/depth light lists entirely on WebGPU.
73
+ *
74
+ * One compute invocation projects each view-space point-light sphere into the overlapping
75
+ * x/y/z cluster range and atomically marks its light bit. A second compute dispatch compacts
76
+ * each bit mask in stable light-index order. Indices beyond maxLightsPerCluster are
77
+ * intentionally dropped so the fullscreen lighting pass has a predictable loop bound without
78
+ * nondeterministic overflow shimmer.
79
+ */
80
+ export class ClusteredLightGrid {
81
+ readonly device: Device;
82
+ readonly id: string;
83
+ readonly clusterDimensions: readonly [number, number, number];
84
+ readonly maxLightsPerCluster: number;
85
+ readonly maxLightCount: number;
86
+ readonly clusterCount: number;
87
+ readonly clusterLightCounts: Buffer;
88
+ readonly clusterLightIndices: Buffer;
89
+
90
+ private readonly clusterLightBitMask: Buffer;
91
+ private readonly uniformBuffer: Buffer;
92
+ private readonly clearComputation: Computation;
93
+ private readonly binningComputation: Computation;
94
+ private readonly compactComputation: Computation;
95
+ private activePointLightCount = 0;
96
+ private depthRange: readonly [number, number] | null = null;
97
+ private destroyed = false;
98
+
99
+ constructor(device: Device, props: ClusteredLightGridProps = {}) {
100
+ if (device.type !== 'webgpu') {
101
+ throw new Error('ClusteredLightGrid requires WebGPU.');
102
+ }
103
+
104
+ this.device = device;
105
+ this.id = props.id || 'clustered-light-grid';
106
+ this.clusterDimensions = props.clusterDimensions ?? DEFAULT_CLUSTER_DIMENSIONS;
107
+ this.maxLightsPerCluster = props.maxLightsPerCluster ?? DEFAULT_MAX_LIGHTS_PER_CLUSTER;
108
+ this.maxLightCount = props.maxLightCount ?? MAX_CLUSTERED_POINT_LIGHTS;
109
+ validateClusteredLightGridProps(
110
+ this.clusterDimensions,
111
+ this.maxLightsPerCluster,
112
+ this.maxLightCount
113
+ );
114
+ this.clusterCount =
115
+ this.clusterDimensions[0] * this.clusterDimensions[1] * this.clusterDimensions[2];
116
+
117
+ this.clusterLightCounts = device.createBuffer({
118
+ id: `${this.id}-counts`,
119
+ byteLength: this.clusterCount * Uint32Array.BYTES_PER_ELEMENT,
120
+ usage: Buffer.STORAGE | Buffer.COPY_SRC
121
+ });
122
+ this.clusterLightIndices = device.createBuffer({
123
+ id: `${this.id}-indices`,
124
+ byteLength: this.clusterCount * this.maxLightsPerCluster * Uint32Array.BYTES_PER_ELEMENT,
125
+ usage: Buffer.STORAGE | Buffer.COPY_SRC
126
+ });
127
+ const lightWordCount = getLightWordCount(this.maxLightCount);
128
+ this.clusterLightBitMask = device.createBuffer({
129
+ id: `${this.id}-light-mask`,
130
+ byteLength: this.clusterCount * lightWordCount * Uint32Array.BYTES_PER_ELEMENT,
131
+ usage: Buffer.STORAGE
132
+ });
133
+ this.uniformBuffer = device.createBuffer({
134
+ id: `${this.id}-uniforms`,
135
+ byteLength: CLUSTERED_LIGHT_GRID_UNIFORM_BYTE_LENGTH,
136
+ usage: Buffer.UNIFORM | Buffer.COPY_DST
137
+ });
138
+
139
+ this.clearComputation = new Computation(device, {
140
+ id: `${this.id}-clear`,
141
+ source: getClearClusterLightBitMaskSource(this.clusterCount, lightWordCount),
142
+ shaderLayout: {
143
+ bindings: [{name: 'clusterLightBitMask', type: 'storage', group: 0, location: 0}]
144
+ }
145
+ });
146
+ this.clearComputation.setBindings({clusterLightBitMask: this.clusterLightBitMask});
147
+
148
+ this.binningComputation = new Computation(device, {
149
+ id: `${this.id}-bin`,
150
+ source: getClusterBinningSource(this.clusterDimensions, this.maxLightCount),
151
+ shaderLayout: {
152
+ bindings: [
153
+ {name: 'pointLights', type: 'read-only-storage', group: 0, location: 0},
154
+ {name: 'clusterLightBitMask', type: 'storage', group: 0, location: 1},
155
+ {name: 'clusteredLightGrid', type: 'uniform', group: 0, location: 2}
156
+ ]
157
+ }
158
+ });
159
+ this.compactComputation = new Computation(device, {
160
+ id: `${this.id}-compact`,
161
+ source: getCompactClusterLightListsSource(
162
+ this.clusterCount,
163
+ lightWordCount,
164
+ this.maxLightsPerCluster,
165
+ this.maxLightCount
166
+ ),
167
+ shaderLayout: {
168
+ bindings: [
169
+ {name: 'clusterLightBitMask', type: 'storage', group: 0, location: 0},
170
+ {name: 'clusterLightCounts', type: 'storage', group: 0, location: 1},
171
+ {name: 'clusterLightIndices', type: 'storage', group: 0, location: 2}
172
+ ]
173
+ }
174
+ });
175
+ }
176
+
177
+ /** Rebuilds cluster counts and light-index lists on the supplied command encoder. */
178
+ encode(commandEncoder: CommandEncoder, options: ClusteredLightGridEncodeOptions): void {
179
+ // Resources and encoder must be live and belong to this grid's device.
180
+ assert(!this.destroyed && !options.pointLights.destroyed && !commandEncoder.destroyed);
181
+ assert(options.pointLights.device === this.device && commandEncoder.device === this.device);
182
+ validateClusteredLightGridEncodeOptions(options, this.maxLightCount);
183
+ // The active prefix must fit in a storage buffer of complete point-light records.
184
+ assert(Boolean(options.pointLights.usage & Buffer.STORAGE));
185
+ assert(
186
+ options.pointLights.byteLength >=
187
+ Math.max(1, options.pointLightCount) * CLUSTERED_POINT_LIGHT_LAYOUT.byteStride
188
+ );
189
+ this.depthRange = [options.nearPlane, options.farPlane];
190
+ this.activePointLightCount = options.pointLightCount;
191
+ this.uniformBuffer.write(makeClusteredLightGridUniformData(options));
192
+ this.binningComputation.setBindings({
193
+ pointLights: options.pointLights,
194
+ clusterLightBitMask: this.clusterLightBitMask,
195
+ clusteredLightGrid: this.uniformBuffer
196
+ });
197
+ this.compactComputation.setBindings({
198
+ clusterLightBitMask: this.clusterLightBitMask,
199
+ clusterLightCounts: this.clusterLightCounts,
200
+ clusterLightIndices: this.clusterLightIndices
201
+ });
202
+ this.clearComputation.predraw(commandEncoder);
203
+ this.binningComputation.predraw(commandEncoder);
204
+ this.compactComputation.predraw(commandEncoder);
205
+
206
+ const computePass = commandEncoder.beginComputePass({id: `${this.id}-build`});
207
+ this.clearComputation.dispatch(
208
+ computePass,
209
+ Math.ceil(
210
+ (this.clusterCount * getLightWordCount(this.maxLightCount)) / CLUSTER_WORKGROUP_SIZE
211
+ )
212
+ );
213
+ this.binningComputation.dispatch(
214
+ computePass,
215
+ Math.max(1, Math.ceil(options.pointLightCount / CLUSTER_WORKGROUP_SIZE))
216
+ );
217
+ this.compactComputation.dispatch(
218
+ computePass,
219
+ Math.ceil(this.clusterCount / CLUSTER_WORKGROUP_SIZE)
220
+ );
221
+ computePass.end();
222
+ }
223
+
224
+ /** Returns the storage bindings available to lighting consumers. */
225
+ getBindings(): ClusteredLightGridBindings {
226
+ assert(!this.destroyed);
227
+ return {
228
+ clusterLightCounts: this.clusterLightCounts,
229
+ clusterLightIndices: this.clusterLightIndices
230
+ };
231
+ }
232
+
233
+ /** Compatibility accessor for shader-pass consumers. */
234
+ getShaderPassBindings(): ClusteredLightGridBindings {
235
+ return this.getBindings();
236
+ }
237
+
238
+ /** Returns a snapshot matching the latest encode. Encode before requesting uniforms. */
239
+ getUniforms(): ClusteredLightGridUniforms {
240
+ // A grid must be encoded before its camera/depth metadata can be consumed.
241
+ assert(!this.destroyed && this.depthRange);
242
+ return this.getShaderPassUniforms(this.depthRange[0], this.depthRange[1]);
243
+ }
244
+
245
+ /** Returns the scalar uniforms available to lighting consumers. */
246
+ getShaderPassUniforms(nearPlane: number, farPlane: number): ClusteredLightGridUniforms {
247
+ assert(!this.destroyed);
248
+ validateDepthRange(nearPlane, farPlane);
249
+ return {
250
+ clusterCountX: this.clusterDimensions[0],
251
+ clusterCountY: this.clusterDimensions[1],
252
+ clusterCountZ: this.clusterDimensions[2],
253
+ maxLightsPerCluster: this.maxLightsPerCluster,
254
+ pointLightCount: this.activePointLightCount,
255
+ clusterNearPlane: nearPlane,
256
+ clusterFarPlane: farPlane
257
+ };
258
+ }
259
+
260
+ destroy(): void {
261
+ if (this.destroyed) return;
262
+ this.destroyed = true;
263
+ this.clearComputation.destroy();
264
+ this.binningComputation.destroy();
265
+ this.compactComputation.destroy();
266
+ this.uniformBuffer.destroy();
267
+ this.clusterLightBitMask.destroy();
268
+ this.clusterLightCounts.destroy();
269
+ this.clusterLightIndices.destroy();
270
+ }
271
+ }
272
+
273
+ function getClearClusterLightBitMaskSource(clusterCount: number, lightWordCount: number): string {
274
+ return `\
275
+ const CLUSTER_LIGHT_MASK_WORD_COUNT: u32 = ${clusterCount * lightWordCount}u;
276
+ @group(0) @binding(0) var<storage, read_write> clusterLightBitMask: array<atomic<u32>>;
277
+ @compute @workgroup_size(${CLUSTER_WORKGROUP_SIZE}) fn main(
278
+ @builtin(global_invocation_id) globalId: vec3<u32>
279
+ ) {
280
+ if (globalId.x < CLUSTER_LIGHT_MASK_WORD_COUNT) {
281
+ atomicStore(&clusterLightBitMask[globalId.x], 0u);
282
+ }
283
+ }`;
284
+ }
285
+
286
+ function getClusterBinningSource(
287
+ clusterDimensions: readonly [number, number, number],
288
+ maxLightCount: number
289
+ ): string {
290
+ return `\
291
+ const CLUSTER_COUNT_X: u32 = ${clusterDimensions[0]}u;
292
+ const CLUSTER_COUNT_Y: u32 = ${clusterDimensions[1]}u;
293
+ const CLUSTER_COUNT_Z: u32 = ${clusterDimensions[2]}u;
294
+ const MAX_LIGHT_COUNT: u32 = ${maxLightCount}u;
295
+ const LIGHT_WORD_COUNT: u32 = ${getLightWordCount(maxLightCount)}u;
296
+
297
+ struct ClusteredLightGridUniforms {
298
+ projectionMatrix: mat4x4f,
299
+ depthRange: vec2f,
300
+ lightCount: u32,
301
+ padding: u32,
302
+ };
303
+
304
+ struct ClusteredLightGridPointLight {
305
+ positionRange: vec4f,
306
+ payload: vec4f,
307
+ };
308
+
309
+ @group(0) @binding(0) var<storage, read> pointLights: array<ClusteredLightGridPointLight>;
310
+ @group(0) @binding(1) var<storage, read_write> clusterLightBitMask: array<atomic<u32>>;
311
+ @group(0) @binding(2) var<uniform> clusteredLightGrid: ClusteredLightGridUniforms;
312
+
313
+ fn clusteredLightGrid_getCoordinate(value: f32, size: u32) -> u32 {
314
+ return min(u32(clamp(value, 0.0, 0.999999) * f32(size)), size - 1u);
315
+ }
316
+
317
+ fn clusteredLightGrid_getDepthSlice(distance: f32) -> u32 {
318
+ let normalizedDepth = clamp(
319
+ log(distance / clusteredLightGrid.depthRange.x) /
320
+ log(clusteredLightGrid.depthRange.y / clusteredLightGrid.depthRange.x),
321
+ 0.0,
322
+ 0.999999
323
+ );
324
+ return min(u32(normalizedDepth * f32(CLUSTER_COUNT_Z)), CLUSTER_COUNT_Z - 1u);
325
+ }
326
+
327
+ @compute @workgroup_size(${CLUSTER_WORKGROUP_SIZE}) fn main(
328
+ @builtin(global_invocation_id) globalId: vec3<u32>
329
+ ) {
330
+ let lightIndex = globalId.x;
331
+ let lightCount = min(clusteredLightGrid.lightCount, min(MAX_LIGHT_COUNT, arrayLength(&pointLights)));
332
+ if (lightIndex >= lightCount) {
333
+ return;
334
+ }
335
+
336
+ let light = pointLights[lightIndex];
337
+ let viewDepth = -light.positionRange.z;
338
+ let minimumDepth = max(clusteredLightGrid.depthRange.x, viewDepth - light.positionRange.w);
339
+ let maximumDepth = min(clusteredLightGrid.depthRange.y, viewDepth + light.positionRange.w);
340
+ if (maximumDepth < clusteredLightGrid.depthRange.x ||
341
+ minimumDepth > clusteredLightGrid.depthRange.y ||
342
+ maximumDepth < minimumDepth) {
343
+ return;
344
+ }
345
+
346
+ let isOrthographicProjection = abs(clusteredLightGrid.projectionMatrix[3][3]) > 0.5;
347
+ var minimumUv = vec2f(0.0);
348
+ var maximumUv = vec2f(0.999999);
349
+ // A sphere crossing the camera plane conservatively covers the viewport.
350
+ if (isOrthographicProjection || viewDepth > light.positionRange.w) {
351
+ let projectionScale = vec2f(clusteredLightGrid.projectionMatrix[0][0], clusteredLightGrid.projectionMatrix[1][1]);
352
+ let lower = projectionScale * (light.positionRange.xy - vec2f(light.positionRange.w));
353
+ let upper = projectionScale * (light.positionRange.xy + vec2f(light.positionRange.w));
354
+ var minimumNdc = min(lower, upper) + clusteredLightGrid.projectionMatrix[3].xy;
355
+ var maximumNdc = max(lower, upper) + clusteredLightGrid.projectionMatrix[3].xy;
356
+ if (!isOrthographicProjection) {
357
+ // Project the enclosing box at both depth extremes, including off-axis centers.
358
+ let nearestDepth = max(minimumDepth, clusteredLightGrid.depthRange.x);
359
+ let farthestDepth = max(maximumDepth, nearestDepth);
360
+ minimumNdc = min(min(lower / nearestDepth, upper / nearestDepth), min(lower / farthestDepth, upper / farthestDepth)) - clusteredLightGrid.projectionMatrix[2].xy;
361
+ maximumNdc = max(max(lower / nearestDepth, upper / nearestDepth), max(lower / farthestDepth, upper / farthestDepth)) - clusteredLightGrid.projectionMatrix[2].xy;
362
+ }
363
+ let unclampedMinimumUv = vec2f(minimumNdc.x * 0.5 + 0.5, 0.5 - maximumNdc.y * 0.5);
364
+ let unclampedMaximumUv = vec2f(maximumNdc.x * 0.5 + 0.5, 0.5 - minimumNdc.y * 0.5);
365
+ if (unclampedMaximumUv.x < 0.0 || unclampedMinimumUv.x > 1.0 ||
366
+ unclampedMaximumUv.y < 0.0 || unclampedMinimumUv.y > 1.0) {
367
+ return;
368
+ }
369
+
370
+ minimumUv = clamp(unclampedMinimumUv, vec2f(0.0), vec2f(0.999999));
371
+ maximumUv = clamp(unclampedMaximumUv, vec2f(0.0), vec2f(0.999999));
372
+ }
373
+ let minimumX = clusteredLightGrid_getCoordinate(minimumUv.x, CLUSTER_COUNT_X);
374
+ let maximumX = clusteredLightGrid_getCoordinate(maximumUv.x, CLUSTER_COUNT_X);
375
+ let minimumY = clusteredLightGrid_getCoordinate(minimumUv.y, CLUSTER_COUNT_Y);
376
+ let maximumY = clusteredLightGrid_getCoordinate(maximumUv.y, CLUSTER_COUNT_Y);
377
+ let minimumZ = clusteredLightGrid_getDepthSlice(minimumDepth);
378
+ let maximumZ = clusteredLightGrid_getDepthSlice(maximumDepth);
379
+ let lightWordIndex = lightIndex / 32u;
380
+ let lightBit = 1u << (lightIndex % 32u);
381
+
382
+ for (var depthSlice = minimumZ; depthSlice <= maximumZ; depthSlice++) {
383
+ for (var tileY = minimumY; tileY <= maximumY; tileY++) {
384
+ for (var tileX = minimumX; tileX <= maximumX; tileX++) {
385
+ let clusterIndex = (depthSlice * CLUSTER_COUNT_Y + tileY) * CLUSTER_COUNT_X + tileX;
386
+ atomicOr(&clusterLightBitMask[clusterIndex * LIGHT_WORD_COUNT + lightWordIndex], lightBit);
387
+ }
388
+ }
389
+ }
390
+ }`;
391
+ }
392
+
393
+ function getCompactClusterLightListsSource(
394
+ clusterCount: number,
395
+ lightWordCount: number,
396
+ maxLightsPerCluster: number,
397
+ maxLightCount: number
398
+ ): string {
399
+ return `\
400
+ const CLUSTER_COUNT: u32 = ${clusterCount}u;
401
+ const LIGHT_WORD_COUNT: u32 = ${lightWordCount}u;
402
+ const MAX_LIGHTS_PER_CLUSTER: u32 = ${maxLightsPerCluster}u;
403
+ const MAX_LIGHT_COUNT: u32 = ${maxLightCount}u;
404
+
405
+ @group(0) @binding(0) var<storage, read_write> clusterLightBitMask: array<atomic<u32>>;
406
+ @group(0) @binding(1) var<storage, read_write> clusterLightCounts: array<u32>;
407
+ @group(0) @binding(2) var<storage, read_write> clusterLightIndices: array<u32>;
408
+
409
+ @compute @workgroup_size(${CLUSTER_WORKGROUP_SIZE}) fn main(
410
+ @builtin(global_invocation_id) globalId: vec3<u32>
411
+ ) {
412
+ let clusterIndex = globalId.x;
413
+ if (clusterIndex >= CLUSTER_COUNT) {
414
+ return;
415
+ }
416
+
417
+ let maskOffset = clusterIndex * LIGHT_WORD_COUNT;
418
+ let indexOffset = clusterIndex * MAX_LIGHTS_PER_CLUSTER;
419
+ var lightCount = 0u;
420
+ for (var lightIndex = 0u; lightIndex < MAX_LIGHT_COUNT; lightIndex++) {
421
+ let lightWord = atomicLoad(&clusterLightBitMask[maskOffset + lightIndex / 32u]);
422
+ let lightBit = 1u << (lightIndex % 32u);
423
+ if ((lightWord & lightBit) != 0u) {
424
+ if (lightCount < MAX_LIGHTS_PER_CLUSTER) {
425
+ clusterLightIndices[indexOffset + lightCount] = lightIndex;
426
+ }
427
+ lightCount += 1u;
428
+ }
429
+ }
430
+ clusterLightCounts[clusterIndex] = lightCount;
431
+ }`;
432
+ }
433
+
434
+ function getLightWordCount(maxLightCount: number): number {
435
+ return Math.ceil(maxLightCount / 32);
436
+ }
437
+
438
+ function makeClusteredLightGridUniformData(options: ClusteredLightGridEncodeOptions): ArrayBuffer {
439
+ const data = new ArrayBuffer(CLUSTERED_LIGHT_GRID_UNIFORM_BYTE_LENGTH);
440
+ const floatValues = new Float32Array(data);
441
+ floatValues.set(options.projectionMatrix, 0);
442
+ floatValues[16] = options.nearPlane;
443
+ floatValues[17] = options.farPlane;
444
+ new Uint32Array(data)[18] = options.pointLightCount;
445
+ return data;
446
+ }
447
+
448
+ function validateClusteredLightGridProps(
449
+ clusterDimensions: readonly [number, number, number],
450
+ maxLightsPerCluster: number,
451
+ maxLightCount: number
452
+ ): void {
453
+ if (
454
+ clusterDimensions.some(dimension => !Number.isSafeInteger(dimension) || dimension < 1) ||
455
+ !Number.isSafeInteger(maxLightsPerCluster) ||
456
+ maxLightsPerCluster < 1 ||
457
+ !Number.isSafeInteger(maxLightCount) ||
458
+ maxLightCount < 1
459
+ ) {
460
+ throw new Error('Cluster dimensions and capacities must be positive safe integers.');
461
+ }
462
+ }
463
+
464
+ function validateClusteredLightGridEncodeOptions(
465
+ options: ClusteredLightGridEncodeOptions,
466
+ maxLightCount: number
467
+ ): void {
468
+ if (!Number.isSafeInteger(options.pointLightCount) || options.pointLightCount < 0) {
469
+ throw new Error('Point light count must be a non-negative safe integer.');
470
+ }
471
+ if (options.pointLightCount > maxLightCount) {
472
+ throw new Error('Point light count exceeds ClusteredLightGrid capacity.');
473
+ }
474
+ validateDepthRange(options.nearPlane, options.farPlane);
475
+ }
476
+
477
+ function validateDepthRange(nearPlane: number, farPlane: number): void {
478
+ if (!(nearPlane > 0) || !(farPlane > nearPlane)) {
479
+ throw new Error('Cluster depth range requires 0 < nearPlane < farPlane.');
480
+ }
481
+ }