@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,631 @@
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 shadow_map_renderer_exports = {};
19
+ __export(shadow_map_renderer_exports, {
20
+ ShadowMapRenderer: () => ShadowMapRenderer,
21
+ getDirectionalCascadeViews: () => getDirectionalCascadeViews,
22
+ getPointShadowViews: () => getPointShadowViews,
23
+ getPracticalCascadeSplits: () => getPracticalCascadeSplits,
24
+ getSpotShadowView: () => getSpotShadowView
25
+ });
26
+ module.exports = __toCommonJS(shadow_map_renderer_exports);
27
+ var import_core = require("@luma.gl/core");
28
+ var import_core2 = require("@math.gl/core");
29
+ var import_shadow_quality = require("./shadow-quality.cjs");
30
+ const MAX_DIRECTIONAL_LIGHTS = 1;
31
+ const MAX_SPOT_LIGHTS = 4;
32
+ const MAX_POINT_LIGHTS = 4;
33
+ const MAX_CASCADES = 4;
34
+ const POINT_FACE_COUNT = 6;
35
+ const DEFAULT_NEAR_PLANE = 0.1;
36
+ const OPENGL_TO_WEBGPU_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 1];
37
+ const IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
38
+ const POINT_FACE_ORIENTATIONS = [
39
+ { face: "+X", direction: [1, 0, 0], up: [0, -1, 0] },
40
+ { face: "-X", direction: [-1, 0, 0], up: [0, -1, 0] },
41
+ { face: "+Y", direction: [0, 1, 0], up: [0, 0, 1] },
42
+ { face: "-Y", direction: [0, -1, 0], up: [0, 0, -1] },
43
+ { face: "+Z", direction: [0, 0, 1], up: [0, -1, 0] },
44
+ { face: "-Z", direction: [0, 0, -1], up: [0, -1, 0] }
45
+ ];
46
+ let nextShadowResourceId = 0;
47
+ class ShadowMapRenderer {
48
+ device;
49
+ props;
50
+ inputProps;
51
+ resources;
52
+ destroyed = false;
53
+ constructor(device, props = {}) {
54
+ if (device.type !== "webgpu" && device.type !== "webgl") {
55
+ throw new Error("ShadowMapRenderer requires a WebGPU or WebGL2 device.");
56
+ }
57
+ this.device = device;
58
+ this.inputProps = { ...props };
59
+ this.props = resolveShadowMapRendererProps(device, this.inputProps);
60
+ this.resources = createShadowMapResources(device, this.props);
61
+ }
62
+ /** Reconfigures capacities or quality, rebuilding GPU resources only when their shape changes. */
63
+ setProps(props) {
64
+ this.assertNotDestroyed();
65
+ const nextInputProps = { ...this.inputProps, ...props };
66
+ const nextProps = resolveShadowMapRendererProps(this.device, nextInputProps);
67
+ const needsResourceRebuild = !resourcePropsEqual(this.props, nextProps);
68
+ this.inputProps = nextInputProps;
69
+ this.props = nextProps;
70
+ if (!needsResourceRebuild) {
71
+ return;
72
+ }
73
+ const previousResources = this.resources;
74
+ this.resources = createShadowMapResources(this.device, nextProps);
75
+ destroyShadowMapResources(previousResources);
76
+ }
77
+ /** Records all active shadow-map views and returns props ready for `ShaderInputs.setProps`. */
78
+ render(options) {
79
+ this.assertNotDestroyed();
80
+ validateShadowCamera(options.camera);
81
+ const directionalLights = options.directionalLights || [];
82
+ const spotLights = options.spotLights || [];
83
+ const pointLights = options.pointLights || [];
84
+ validateLightCount("directional", directionalLights.length, this.props.directionalLightCapacity);
85
+ validateLightCount("spot", spotLights.length, this.props.spotLightCapacity);
86
+ validateLightCount("point", pointLights.length, this.props.pointLightCapacity);
87
+ const directionalViews = [];
88
+ let cascadeSplits = padCascadeSplits([], options.camera.far);
89
+ if (directionalLights[0]) {
90
+ const light = resolveDirectionalLight(directionalLights[0], options.camera);
91
+ cascadeSplits = padCascadeSplits(getPracticalCascadeSplits(options.camera.near, light.shadowDistance, this.props.cascadeCount, light.cascadeSplitLambda), light.shadowDistance);
92
+ directionalViews.push(...getDirectionalCascadeViews(options.camera, light, cascadeSplits, this.props.cascadeCount, this.props.directionalMapSize));
93
+ directionalViews.forEach((view, cascadeIndex) => {
94
+ this.renderView({
95
+ framebuffer: this.resources.directionalFramebuffers[cascadeIndex],
96
+ view,
97
+ type: "directional",
98
+ lightIndex: 0,
99
+ cascadeIndex,
100
+ mapSize: this.props.directionalMapSize,
101
+ light,
102
+ drawShadowCasters: options.drawShadowCasters,
103
+ prepareShadowCasters: options.prepareShadowCasters
104
+ });
105
+ });
106
+ }
107
+ const spotViews = spotLights.map((light) => getSpotShadowView(resolveSpotLight(light)));
108
+ spotViews.forEach((view, lightIndex) => {
109
+ this.renderView({
110
+ framebuffer: this.resources.spotFramebuffers[lightIndex],
111
+ view,
112
+ type: "spot",
113
+ lightIndex,
114
+ mapSize: this.props.spotMapSize,
115
+ light: resolveSpotLight(spotLights[lightIndex]),
116
+ drawShadowCasters: options.drawShadowCasters,
117
+ prepareShadowCasters: options.prepareShadowCasters
118
+ });
119
+ });
120
+ const pointViews = pointLights.flatMap((light) => getPointShadowViews(resolvePointLight(light), this.device.type === "webgpu"));
121
+ pointLights.forEach((inputLight, lightIndex) => {
122
+ const light = resolvePointLight(inputLight);
123
+ for (let faceIndex = 0; faceIndex < POINT_FACE_COUNT; faceIndex++) {
124
+ const viewIndex = lightIndex * POINT_FACE_COUNT + faceIndex;
125
+ this.renderView({
126
+ framebuffer: this.resources.pointFramebuffers[viewIndex],
127
+ view: pointViews[viewIndex],
128
+ type: "point",
129
+ lightIndex,
130
+ pointFace: POINT_FACE_ORIENTATIONS[faceIndex].face,
131
+ mapSize: this.props.pointMapSize,
132
+ light,
133
+ drawShadowCasters: options.drawShadowCasters,
134
+ prepareShadowCasters: options.prepareShadowCasters
135
+ });
136
+ }
137
+ });
138
+ return {
139
+ quality: this.props.quality,
140
+ cascadeCount: this.props.cascadeCount,
141
+ cascadeSplits,
142
+ blockerSampleCount: this.props.blockerSampleCount,
143
+ filterSampleCount: this.props.filterSampleCount,
144
+ directionalLights: directionalLights.map((light) => resolveDirectionalLight(light, options.camera)),
145
+ spotLights: spotLights.map(resolveSpotLight),
146
+ pointLights: pointLights.map(resolvePointLight),
147
+ directionalViewProjectionMatrices: padMatrices(directionalViews.map((view) => view.viewProjectionMatrix), MAX_CASCADES),
148
+ spotViewProjectionMatrices: padMatrices(spotViews.map((view) => view.viewProjectionMatrix), MAX_SPOT_LIGHTS),
149
+ pointViewProjectionMatrices: padMatrices(pointViews.map((view) => view.viewProjectionMatrix), MAX_POINT_LIGHTS * POINT_FACE_COUNT),
150
+ directionalShadowTexture: this.resources.directionalTexture,
151
+ spotShadowTexture: this.resources.spotTexture,
152
+ pointShadowTexture: this.resources.pointTexture,
153
+ comparisonSampler: this.resources.comparisonSampler,
154
+ nonFilteringSampler: this.resources.nonFilteringSampler
155
+ };
156
+ }
157
+ /** Destroys all owned depth textures, views, framebuffers and samplers. */
158
+ destroy() {
159
+ if (this.destroyed) {
160
+ return;
161
+ }
162
+ this.destroyed = true;
163
+ destroyShadowMapResources(this.resources);
164
+ }
165
+ renderView(options) {
166
+ var _a;
167
+ const rasterParameters = Object.freeze({
168
+ depthWriteEnabled: true,
169
+ depthCompare: "less-equal",
170
+ depthBias: options.light.depthBias,
171
+ depthBiasSlopeScale: options.light.depthBiasSlopeScale,
172
+ cullMode: "back",
173
+ // Cube sampling uses top-left texel coordinates on WebGPU; its face projection flips Y.
174
+ frontFace: options.type === "point" && this.device.type === "webgpu" ? "cw" : "ccw"
175
+ });
176
+ const context = {
177
+ framebuffer: options.framebuffer,
178
+ type: options.type,
179
+ lightIndex: options.lightIndex,
180
+ cascadeIndex: options.cascadeIndex,
181
+ pointFace: options.pointFace,
182
+ camera: options.view.camera,
183
+ viewProjectionMatrix: options.view.viewProjectionMatrix,
184
+ mapSize: options.mapSize,
185
+ rasterParameters
186
+ };
187
+ (_a = options.prepareShadowCasters) == null ? void 0 : _a.call(options, context);
188
+ const renderPass = this.device.beginRenderPass({
189
+ id: makeShadowResourceId(`${options.type}-shadow-pass`),
190
+ framebuffer: options.framebuffer,
191
+ clearDepth: 1
192
+ });
193
+ try {
194
+ options.drawShadowCasters({
195
+ renderPass,
196
+ framebuffer: options.framebuffer,
197
+ type: options.type,
198
+ lightIndex: options.lightIndex,
199
+ cascadeIndex: options.cascadeIndex,
200
+ pointFace: options.pointFace,
201
+ camera: options.view.camera,
202
+ viewProjectionMatrix: options.view.viewProjectionMatrix,
203
+ mapSize: options.mapSize,
204
+ rasterParameters
205
+ });
206
+ } finally {
207
+ renderPass.end();
208
+ }
209
+ }
210
+ assertNotDestroyed() {
211
+ if (this.destroyed) {
212
+ throw new Error("ShadowMapRenderer has been destroyed.");
213
+ }
214
+ }
215
+ }
216
+ function getPracticalCascadeSplits(near, far, cascadeCount, lambda = 0.5) {
217
+ if (!(near > 0 && far > near)) {
218
+ throw new Error("Cascade split range requires 0 < near < far.");
219
+ }
220
+ if (!Number.isInteger(cascadeCount) || cascadeCount < 1 || cascadeCount > MAX_CASCADES) {
221
+ throw new Error(`Cascade count must be an integer from 1 to ${MAX_CASCADES}.`);
222
+ }
223
+ const clampedLambda = clamp(lambda, 0, 1);
224
+ const splits = [];
225
+ for (let splitIndex = 1; splitIndex <= cascadeCount; splitIndex++) {
226
+ const fraction = splitIndex / cascadeCount;
227
+ const logarithmic = near * Math.pow(far / near, fraction);
228
+ const uniform = near + (far - near) * fraction;
229
+ splits.push(uniform * (1 - clampedLambda) + logarithmic * clampedLambda);
230
+ }
231
+ return splits;
232
+ }
233
+ function getDirectionalCascadeViews(camera, light, cascadeSplits, cascadeCount, mapSize) {
234
+ const inverseViewProjection = new import_core2.Matrix4(camera.projectionMatrix).multiplyRight(camera.viewMatrix).invert();
235
+ const nearCorners = getNdcPlaneCorners(inverseViewProjection, camera.clipDepth === "zero-to-one" ? 0 : -1);
236
+ const farCorners = getNdcPlaneCorners(inverseViewProjection, 1);
237
+ const lightDirection = normalize3(light.direction);
238
+ const views = [];
239
+ let cascadeNear = camera.near;
240
+ for (let cascadeIndex = 0; cascadeIndex < cascadeCount; cascadeIndex++) {
241
+ const cascadeFar = cascadeSplits[cascadeIndex];
242
+ const nearFraction = (cascadeNear - camera.near) / (camera.far - camera.near);
243
+ const farFraction = (cascadeFar - camera.near) / (camera.far - camera.near);
244
+ const corners = [];
245
+ for (let cornerIndex = 0; cornerIndex < 4; cornerIndex++) {
246
+ corners.push(lerp3(nearCorners[cornerIndex], farCorners[cornerIndex], nearFraction));
247
+ corners.push(lerp3(nearCorners[cornerIndex], farCorners[cornerIndex], farFraction));
248
+ }
249
+ const center = average3(corners);
250
+ let radius = 0;
251
+ for (const corner of corners) {
252
+ radius = Math.max(radius, distance3(center, corner));
253
+ }
254
+ radius = Math.ceil(radius * 16) / 16;
255
+ const texelWorldSize = radius * 2 / mapSize;
256
+ const lightForward = scale3(lightDirection, -1);
257
+ const referenceUp = Math.abs(lightForward[1]) > 0.99 ? [0, 0, 1] : [0, 1, 0];
258
+ const lightRight = normalize3(cross3(lightForward, referenceUp));
259
+ const lightUp = normalize3(cross3(lightRight, lightForward));
260
+ const centerRight = dot3(center, lightRight);
261
+ const centerUp = dot3(center, lightUp);
262
+ const snappedCenter = add3(center, add3(scale3(lightRight, Math.round(centerRight / texelWorldSize) * texelWorldSize - centerRight), scale3(lightUp, Math.round(centerUp / texelWorldSize) * texelWorldSize - centerUp)));
263
+ const eye = add3(snappedCenter, scale3(lightDirection, radius + light.casterDistance));
264
+ const viewMatrix = new import_core2.Matrix4().lookAt({ eye, center: snappedCenter, up: lightUp });
265
+ const projectionMatrix = new import_core2.Matrix4(OPENGL_TO_WEBGPU_MATRIX).multiplyRight(new import_core2.Matrix4().ortho({
266
+ left: -radius,
267
+ right: radius,
268
+ bottom: -radius,
269
+ top: radius,
270
+ near: 0.01,
271
+ far: radius * 2 + light.casterDistance
272
+ }));
273
+ views.push({
274
+ camera: {
275
+ viewMatrix,
276
+ projectionMatrix,
277
+ near: 0.01,
278
+ far: radius * 2 + light.casterDistance,
279
+ clipDepth: "zero-to-one"
280
+ },
281
+ viewProjectionMatrix: new import_core2.Matrix4(projectionMatrix).multiplyRight(viewMatrix)
282
+ });
283
+ cascadeNear = cascadeFar;
284
+ }
285
+ return views;
286
+ }
287
+ function getSpotShadowView(light) {
288
+ const direction = normalize3(light.direction);
289
+ const up = Math.abs(direction[1]) > 0.99 ? [0, 0, 1] : [0, 1, 0];
290
+ const viewMatrix = new import_core2.Matrix4().lookAt({
291
+ eye: light.position,
292
+ center: add3(light.position, direction),
293
+ up
294
+ });
295
+ const projectionMatrix = new import_core2.Matrix4(OPENGL_TO_WEBGPU_MATRIX).multiplyRight(new import_core2.Matrix4().perspective({
296
+ fovy: light.outerConeAngle * 2,
297
+ aspect: 1,
298
+ near: light.nearPlane,
299
+ far: light.range
300
+ }));
301
+ return {
302
+ camera: {
303
+ viewMatrix,
304
+ projectionMatrix,
305
+ near: light.nearPlane,
306
+ far: light.range,
307
+ clipDepth: "zero-to-one"
308
+ },
309
+ viewProjectionMatrix: new import_core2.Matrix4(projectionMatrix).multiplyRight(viewMatrix)
310
+ };
311
+ }
312
+ function getPointShadowViews(light, invertY = false) {
313
+ const projectionMatrix = new import_core2.Matrix4(OPENGL_TO_WEBGPU_MATRIX).multiplyRight(new import_core2.Matrix4().perspective({
314
+ fovy: (0, import_core2.radians)(90),
315
+ aspect: 1,
316
+ near: light.nearPlane,
317
+ far: light.range
318
+ }));
319
+ if (invertY)
320
+ projectionMatrix.multiplyLeft(new import_core2.Matrix4().scale([1, -1, 1]));
321
+ return POINT_FACE_ORIENTATIONS.map((orientation) => {
322
+ const viewMatrix = new import_core2.Matrix4().lookAt({
323
+ eye: light.position,
324
+ center: add3(light.position, orientation.direction),
325
+ up: orientation.up
326
+ });
327
+ return {
328
+ camera: {
329
+ viewMatrix,
330
+ projectionMatrix,
331
+ near: light.nearPlane,
332
+ far: light.range,
333
+ clipDepth: "zero-to-one"
334
+ },
335
+ viewProjectionMatrix: new import_core2.Matrix4(projectionMatrix).multiplyRight(viewMatrix)
336
+ };
337
+ });
338
+ }
339
+ function resolveShadowMapRendererProps(device, props) {
340
+ const quality = props.quality || "balanced";
341
+ const qualitySettings = import_shadow_quality.SHADOW_QUALITY_SETTINGS[quality];
342
+ if (!qualitySettings) {
343
+ throw new Error(`Unknown shadow quality: ${String(quality)}.`);
344
+ }
345
+ const resolved = {
346
+ quality,
347
+ directionalLightCapacity: props.directionalLightCapacity ?? 1,
348
+ spotLightCapacity: props.spotLightCapacity ?? 1,
349
+ pointLightCapacity: props.pointLightCapacity ?? 1,
350
+ directionalMapSize: props.directionalMapSize ?? qualitySettings.directionalMapSize,
351
+ spotMapSize: props.spotMapSize ?? qualitySettings.spotMapSize,
352
+ pointMapSize: props.pointMapSize ?? qualitySettings.pointMapSize,
353
+ cascadeCount: qualitySettings.cascadeCount,
354
+ blockerSampleCount: qualitySettings.blockerSampleCount,
355
+ filterSampleCount: qualitySettings.filterSampleCount
356
+ };
357
+ validateCapacity("directionalLightCapacity", resolved.directionalLightCapacity, MAX_DIRECTIONAL_LIGHTS);
358
+ validateCapacity("spotLightCapacity", resolved.spotLightCapacity, MAX_SPOT_LIGHTS);
359
+ validateCapacity("pointLightCapacity", resolved.pointLightCapacity, MAX_POINT_LIGHTS);
360
+ validateMapSize(device, "directionalMapSize", resolved.directionalMapSize);
361
+ validateMapSize(device, "spotMapSize", resolved.spotMapSize);
362
+ validateMapSize(device, "pointMapSize", resolved.pointMapSize);
363
+ const pointLayers = Math.max(POINT_FACE_COUNT, resolved.pointLightCapacity * POINT_FACE_COUNT);
364
+ if (pointLayers > device.limits.maxTextureArrayLayers) {
365
+ throw new Error(`pointLightCapacity requires ${pointLayers} array layers, exceeding the device limit ${device.limits.maxTextureArrayLayers}.`);
366
+ }
367
+ return resolved;
368
+ }
369
+ function createShadowMapResources(device, props) {
370
+ const directionalLayers = Math.max(1, props.directionalLightCapacity * props.cascadeCount);
371
+ const spotLayers = Math.max(1, props.spotLightCapacity);
372
+ const pointLayers = Math.max(POINT_FACE_COUNT, props.pointLightCapacity * POINT_FACE_COUNT);
373
+ const comparisonSampler = device.createSampler({
374
+ id: makeShadowResourceId("shadow-comparison-sampler"),
375
+ type: "comparison-sampler",
376
+ compare: "less-equal",
377
+ minFilter: "linear",
378
+ magFilter: "linear",
379
+ addressModeU: "clamp-to-edge",
380
+ addressModeV: "clamp-to-edge",
381
+ addressModeW: "clamp-to-edge"
382
+ });
383
+ const nonFilteringSampler = device.createSampler({
384
+ id: makeShadowResourceId("shadow-depth-sampler"),
385
+ minFilter: "nearest",
386
+ magFilter: "nearest",
387
+ addressModeU: "clamp-to-edge",
388
+ addressModeV: "clamp-to-edge",
389
+ addressModeW: "clamp-to-edge"
390
+ });
391
+ const directionalTexture = createDepthArrayTexture(device, "directional-shadow-map", "2d-array", props.directionalMapSize, directionalLayers, nonFilteringSampler);
392
+ const spotTexture = createDepthArrayTexture(device, "spot-shadow-map", "2d-array", props.spotMapSize, spotLayers, nonFilteringSampler);
393
+ const pointTexture = createDepthArrayTexture(device, "point-shadow-map", device.type === "webgpu" ? "cube-array" : "2d-array", props.pointMapSize, pointLayers, nonFilteringSampler);
394
+ const attachmentViews = [];
395
+ const directionalFramebuffers = createLayerFramebuffers(device, directionalTexture, props.directionalMapSize, directionalLayers, attachmentViews);
396
+ const spotFramebuffers = createLayerFramebuffers(device, spotTexture, props.spotMapSize, spotLayers, attachmentViews);
397
+ const pointFramebuffers = createLayerFramebuffers(device, pointTexture, props.pointMapSize, pointLayers, attachmentViews);
398
+ return {
399
+ directionalTexture,
400
+ spotTexture,
401
+ pointTexture,
402
+ comparisonSampler,
403
+ nonFilteringSampler,
404
+ directionalFramebuffers,
405
+ spotFramebuffers,
406
+ pointFramebuffers,
407
+ attachmentViews
408
+ };
409
+ }
410
+ function createDepthArrayTexture(device, id, dimension, size, depth, sampler) {
411
+ return device.createTexture({
412
+ id: makeShadowResourceId(id),
413
+ dimension,
414
+ format: "depth32float",
415
+ width: size,
416
+ height: size,
417
+ depth,
418
+ sampler,
419
+ usage: import_core.Texture.SAMPLE | import_core.Texture.RENDER
420
+ });
421
+ }
422
+ function createLayerFramebuffers(device, texture, size, layerCount, views) {
423
+ return Array.from({ length: layerCount }, (_, layerIndex) => {
424
+ const view = texture.createView({
425
+ id: makeShadowResourceId("shadow-layer-view"),
426
+ format: texture.format,
427
+ dimension: "2d",
428
+ baseMipLevel: 0,
429
+ mipLevelCount: 1,
430
+ baseArrayLayer: layerIndex,
431
+ arrayLayerCount: 1
432
+ });
433
+ views.push(view);
434
+ return device.createFramebuffer({
435
+ id: makeShadowResourceId("shadow-layer-framebuffer"),
436
+ width: size,
437
+ height: size,
438
+ colorAttachments: [],
439
+ depthStencilAttachment: view
440
+ });
441
+ });
442
+ }
443
+ function destroyShadowMapResources(resources) {
444
+ for (const framebuffer of [
445
+ ...resources.directionalFramebuffers,
446
+ ...resources.spotFramebuffers,
447
+ ...resources.pointFramebuffers
448
+ ]) {
449
+ framebuffer.destroy();
450
+ }
451
+ for (const view of resources.attachmentViews) {
452
+ view.destroy();
453
+ }
454
+ resources.directionalTexture.destroy();
455
+ resources.spotTexture.destroy();
456
+ resources.pointTexture.destroy();
457
+ resources.comparisonSampler.destroy();
458
+ resources.nonFilteringSampler.destroy();
459
+ }
460
+ function resourcePropsEqual(first, second) {
461
+ return first.cascadeCount === second.cascadeCount && first.directionalLightCapacity === second.directionalLightCapacity && first.spotLightCapacity === second.spotLightCapacity && first.pointLightCapacity === second.pointLightCapacity && first.directionalMapSize === second.directionalMapSize && first.spotMapSize === second.spotMapSize && first.pointMapSize === second.pointMapSize;
462
+ }
463
+ function resolveDirectionalLight(light, camera) {
464
+ const shadowDistance = clamp(light.shadowDistance ?? camera.far, camera.near, camera.far);
465
+ return {
466
+ direction: normalize3(light.direction),
467
+ shadowDistance,
468
+ casterDistance: light.casterDistance ?? shadowDistance,
469
+ sourceAngularRadius: light.sourceAngularRadius ?? 465e-5,
470
+ cascadeSplitLambda: light.cascadeSplitLambda ?? 0.5,
471
+ cascadeBlendFraction: light.cascadeBlendFraction ?? 0.1,
472
+ farFadeFraction: light.farFadeFraction ?? 0.1,
473
+ normalBias: light.normalBias ?? 0.04,
474
+ depthBias: light.depthBias ?? 2,
475
+ depthBiasSlopeScale: light.depthBiasSlopeScale ?? 2,
476
+ strength: clamp(light.strength ?? 1, 0, 1)
477
+ };
478
+ }
479
+ function resolveSpotLight(light) {
480
+ validateRange("Spot shadow", light.range);
481
+ if (!(light.outerConeAngle > 0 && light.outerConeAngle < Math.PI / 2)) {
482
+ throw new Error("Spot shadow outerConeAngle must be between 0 and PI / 2 radians.");
483
+ }
484
+ return {
485
+ position: [...light.position],
486
+ direction: normalize3(light.direction),
487
+ range: light.range,
488
+ outerConeAngle: light.outerConeAngle,
489
+ nearPlane: resolveNearPlane(light.nearPlane, light.range),
490
+ sourceRadius: light.sourceRadius ?? 0.2,
491
+ normalBias: light.normalBias ?? 0.025,
492
+ depthBias: light.depthBias ?? 2,
493
+ depthBiasSlopeScale: light.depthBiasSlopeScale ?? 2,
494
+ strength: clamp(light.strength ?? 1, 0, 1)
495
+ };
496
+ }
497
+ function resolvePointLight(light) {
498
+ validateRange("Point shadow", light.range);
499
+ return {
500
+ position: [...light.position],
501
+ range: light.range,
502
+ nearPlane: resolveNearPlane(light.nearPlane, light.range),
503
+ sourceRadius: light.sourceRadius ?? 0.2,
504
+ normalBias: light.normalBias ?? 0.025,
505
+ depthBias: light.depthBias ?? 2,
506
+ depthBiasSlopeScale: light.depthBiasSlopeScale ?? 2,
507
+ strength: clamp(light.strength ?? 1, 0, 1)
508
+ };
509
+ }
510
+ function resolveNearPlane(nearPlane, range) {
511
+ const resolvedNearPlane = nearPlane ?? Math.max(DEFAULT_NEAR_PLANE, range / 1e3);
512
+ if (!(resolvedNearPlane > 0 && resolvedNearPlane < range)) {
513
+ throw new Error("Shadow nearPlane must be greater than zero and less than range.");
514
+ }
515
+ return resolvedNearPlane;
516
+ }
517
+ function validateShadowCamera(camera) {
518
+ if (!(camera.near > 0 && camera.far > camera.near)) {
519
+ throw new Error("ShadowCamera requires 0 < near < far.");
520
+ }
521
+ }
522
+ function validateCapacity(name, value, maximum) {
523
+ if (!Number.isInteger(value) || value < 0 || value > maximum) {
524
+ throw new Error(`${name} must be an integer from 0 to ${maximum}.`);
525
+ }
526
+ }
527
+ function validateMapSize(device, name, value) {
528
+ if (!Number.isInteger(value) || value < 1 || value > device.limits.maxTextureDimension2D) {
529
+ throw new Error(`${name} must be a positive integer no greater than ${device.limits.maxTextureDimension2D}.`);
530
+ }
531
+ }
532
+ function validateLightCount(type, count, capacity) {
533
+ if (count > capacity) {
534
+ throw new Error(`${type} shadow light count ${count} exceeds configured capacity ${capacity}.`);
535
+ }
536
+ }
537
+ function validateRange(label, range) {
538
+ if (!(range > 0 && Number.isFinite(range))) {
539
+ throw new Error(`${label} range must be a finite positive number.`);
540
+ }
541
+ }
542
+ function padCascadeSplits(splits, fallback) {
543
+ const result = splits.slice(0, MAX_CASCADES);
544
+ while (result.length < MAX_CASCADES) {
545
+ result.push(result[result.length - 1] ?? fallback);
546
+ }
547
+ return result;
548
+ }
549
+ function padMatrices(matrices, count) {
550
+ const result = matrices.slice(0, count);
551
+ while (result.length < count) {
552
+ result.push(IDENTITY_MATRIX);
553
+ }
554
+ return result;
555
+ }
556
+ function getNdcPlaneCorners(matrix, z) {
557
+ return [
558
+ transformHomogeneous(matrix, [-1, -1, z]),
559
+ transformHomogeneous(matrix, [1, -1, z]),
560
+ transformHomogeneous(matrix, [1, 1, z]),
561
+ transformHomogeneous(matrix, [-1, 1, z])
562
+ ];
563
+ }
564
+ function transformHomogeneous(matrix, point) {
565
+ const x = point[0];
566
+ const y = point[1];
567
+ const z = point[2];
568
+ const w = matrix[3] * x + matrix[7] * y + matrix[11] * z + matrix[15];
569
+ return [
570
+ (matrix[0] * x + matrix[4] * y + matrix[8] * z + matrix[12]) / w,
571
+ (matrix[1] * x + matrix[5] * y + matrix[9] * z + matrix[13]) / w,
572
+ (matrix[2] * x + matrix[6] * y + matrix[10] * z + matrix[14]) / w
573
+ ];
574
+ }
575
+ function normalize3(vector) {
576
+ const length = Math.hypot(vector[0], vector[1], vector[2]);
577
+ if (!(length > 0)) {
578
+ throw new Error("Shadow light direction must be non-zero.");
579
+ }
580
+ return [vector[0] / length, vector[1] / length, vector[2] / length];
581
+ }
582
+ function add3(first, second) {
583
+ return [first[0] + second[0], first[1] + second[1], first[2] + second[2]];
584
+ }
585
+ function scale3(vector, scale) {
586
+ return [vector[0] * scale, vector[1] * scale, vector[2] * scale];
587
+ }
588
+ function dot3(first, second) {
589
+ return first[0] * second[0] + first[1] * second[1] + first[2] * second[2];
590
+ }
591
+ function cross3(first, second) {
592
+ return [
593
+ first[1] * second[2] - first[2] * second[1],
594
+ first[2] * second[0] - first[0] * second[2],
595
+ first[0] * second[1] - first[1] * second[0]
596
+ ];
597
+ }
598
+ function lerp3(first, second, t) {
599
+ return [
600
+ first[0] + (second[0] - first[0]) * t,
601
+ first[1] + (second[1] - first[1]) * t,
602
+ first[2] + (second[2] - first[2]) * t
603
+ ];
604
+ }
605
+ function average3(vectors) {
606
+ const sum = [0, 0, 0];
607
+ for (const vector of vectors) {
608
+ sum[0] += vector[0];
609
+ sum[1] += vector[1];
610
+ sum[2] += vector[2];
611
+ }
612
+ return scale3(sum, 1 / vectors.length);
613
+ }
614
+ function distance3(first, second) {
615
+ return Math.hypot(first[0] - second[0], first[1] - second[1], first[2] - second[2]);
616
+ }
617
+ function clamp(value, minimum, maximum) {
618
+ return Math.max(minimum, Math.min(maximum, value));
619
+ }
620
+ function makeShadowResourceId(prefix) {
621
+ nextShadowResourceId += 1;
622
+ return `${prefix}-${nextShadowResourceId}`;
623
+ }
624
+ // Annotate the CommonJS export names for ESM import in node:
625
+ 0 && (module.exports = {
626
+ ShadowMapRenderer,
627
+ getDirectionalCascadeViews,
628
+ getPointShadowViews,
629
+ getPracticalCascadeSplits,
630
+ getSpotShadowView
631
+ });