@luma.gl/engine 10.0.0-beta.4 → 10.0.0-rc.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 (473) hide show
  1. package/THIRD-PARTY-NOTICES.md +82 -0
  2. package/dist/animation/animation-track.d.ts +7 -0
  3. package/dist/animation/animation-track.d.ts.map +1 -1
  4. package/dist/animation/animation-track.js.map +1 -1
  5. package/dist/animation/node-animation-binding.cjs +1 -0
  6. package/dist/animation/node-animation-binding.d.ts +2 -1
  7. package/dist/animation/node-animation-binding.d.ts.map +1 -1
  8. package/dist/animation/node-animation-binding.js +6 -0
  9. package/dist/animation/node-animation-binding.js.map +1 -1
  10. package/dist/animation/scenegraph-gpu-animation-layout.cjs +99 -0
  11. package/dist/animation/scenegraph-gpu-animation-layout.d.ts +69 -0
  12. package/dist/animation/scenegraph-gpu-animation-layout.d.ts.map +1 -0
  13. package/dist/animation/scenegraph-gpu-animation-layout.js +90 -0
  14. package/dist/animation/scenegraph-gpu-animation-layout.js.map +1 -0
  15. package/dist/animation/scenegraph-gpu-animation.cjs +281 -0
  16. package/dist/animation/scenegraph-gpu-animation.d.ts +54 -0
  17. package/dist/animation/scenegraph-gpu-animation.d.ts.map +1 -0
  18. package/dist/animation/scenegraph-gpu-animation.js +274 -0
  19. package/dist/animation/scenegraph-gpu-animation.js.map +1 -0
  20. package/dist/arrow/arrow-picking.cjs +4 -3
  21. package/dist/arrow/arrow-picking.d.ts +15 -5
  22. package/dist/arrow/arrow-picking.d.ts.map +1 -1
  23. package/dist/arrow/arrow-picking.js +16 -5
  24. package/dist/arrow/arrow-picking.js.map +1 -1
  25. package/dist/arrow/index.cjs.map +1 -1
  26. package/dist/audio/audio-controller.cjs +6 -2
  27. package/dist/audio/audio-controller.d.ts.map +1 -1
  28. package/dist/audio/audio-controller.js +6 -2
  29. package/dist/audio/audio-controller.js.map +1 -1
  30. package/dist/audio/audio-graph.cjs +26 -2
  31. package/dist/audio/audio-graph.d.ts +9 -0
  32. package/dist/audio/audio-graph.d.ts.map +1 -1
  33. package/dist/audio/audio-graph.js +35 -10
  34. package/dist/audio/audio-graph.js.map +1 -1
  35. package/dist/dist.dev.js +1689 -1094
  36. package/dist/dist.min.js +69 -70
  37. package/dist/effects/glfx-effects.cjs +261 -0
  38. package/dist/effects/glfx-effects.d.ts +959 -0
  39. package/dist/effects/glfx-effects.d.ts.map +1 -0
  40. package/dist/effects/glfx-effects.js +200 -0
  41. package/dist/effects/glfx-effects.js.map +1 -0
  42. package/dist/effects/graph/gpu-effect-operation.cjs +402 -0
  43. package/dist/effects/graph/gpu-effect-operation.d.ts +101 -0
  44. package/dist/effects/graph/gpu-effect-operation.d.ts.map +1 -0
  45. package/dist/effects/graph/gpu-effect-operation.js +410 -0
  46. package/dist/effects/graph/gpu-effect-operation.js.map +1 -0
  47. package/dist/effects/graph/temporal-graph-history.cjs +48 -0
  48. package/dist/effects/graph/temporal-graph-history.d.ts +17 -0
  49. package/dist/effects/graph/temporal-graph-history.d.ts.map +1 -0
  50. package/dist/effects/graph/temporal-graph-history.js +30 -0
  51. package/dist/effects/graph/temporal-graph-history.js.map +1 -0
  52. package/dist/effects/index.cjs +117 -30
  53. package/dist/effects/index.cjs.map +3 -3
  54. package/dist/effects/index.d.ts +34 -18
  55. package/dist/effects/index.d.ts.map +1 -1
  56. package/dist/effects/index.js +31 -18
  57. package/dist/effects/index.js.map +1 -1
  58. package/dist/effects/passes/postprocessing/fxaa/fxaa.cjs +9 -2
  59. package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts +19 -0
  60. package/dist/effects/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
  61. package/dist/effects/passes/postprocessing/fxaa/fxaa.js +6 -0
  62. package/dist/effects/passes/postprocessing/fxaa/fxaa.js.map +1 -1
  63. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.cjs +9 -2
  64. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts +41 -0
  65. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.d.ts.map +1 -1
  66. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js +6 -0
  67. package/dist/effects/passes/postprocessing/image-adjust-filters/tone-mapping.js.map +1 -1
  68. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.cjs +200 -13
  69. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts +992 -6
  70. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.d.ts.map +1 -1
  71. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js +199 -10
  72. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.js.map +1 -1
  73. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts +3 -3
  74. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.d.ts.map +1 -1
  75. package/dist/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.js.map +1 -1
  76. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.cjs +41 -40
  77. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts +116 -8
  78. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.d.ts.map +1 -1
  79. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js +38 -37
  80. package/dist/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.js.map +1 -1
  81. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.cjs +83 -66
  82. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts +470 -2
  83. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.d.ts.map +1 -1
  84. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js +80 -62
  85. package/dist/effects/passes/screen-space/clustered-volumetric-lighting.js.map +1 -1
  86. package/dist/effects/passes/screen-space/copy-pass.cjs +7 -0
  87. package/dist/effects/passes/screen-space/copy-pass.d.ts +1 -0
  88. package/dist/effects/passes/screen-space/copy-pass.d.ts.map +1 -1
  89. package/dist/effects/passes/screen-space/copy-pass.js +4 -0
  90. package/dist/effects/passes/screen-space/copy-pass.js.map +1 -1
  91. package/dist/effects/passes/screen-space/depth-aware-blur.cjs +14 -5
  92. package/dist/effects/passes/screen-space/depth-aware-blur.d.ts +125 -17
  93. package/dist/effects/passes/screen-space/depth-aware-blur.d.ts.map +1 -1
  94. package/dist/effects/passes/screen-space/depth-aware-blur.js +11 -3
  95. package/dist/effects/passes/screen-space/depth-aware-blur.js.map +1 -1
  96. package/dist/effects/passes/screen-space/dof.cjs +19 -3
  97. package/dist/effects/passes/screen-space/dof.d.ts +181 -0
  98. package/dist/effects/passes/screen-space/dof.d.ts.map +1 -1
  99. package/dist/effects/passes/screen-space/dof.js +17 -3
  100. package/dist/effects/passes/screen-space/dof.js.map +1 -1
  101. package/dist/effects/passes/screen-space/gtao.cjs +82 -62
  102. package/dist/effects/passes/screen-space/gtao.d.ts +608 -3
  103. package/dist/effects/passes/screen-space/gtao.d.ts.map +1 -1
  104. package/dist/effects/passes/screen-space/gtao.js +83 -60
  105. package/dist/effects/passes/screen-space/gtao.js.map +1 -1
  106. package/dist/effects/passes/screen-space/hdr-auto-exposure.cjs +103 -79
  107. package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts +225 -3
  108. package/dist/effects/passes/screen-space/hdr-auto-exposure.d.ts.map +1 -1
  109. package/dist/effects/passes/screen-space/hdr-auto-exposure.js +102 -77
  110. package/dist/effects/passes/screen-space/hdr-auto-exposure.js.map +1 -1
  111. package/dist/effects/passes/screen-space/height-fog.cjs +14 -0
  112. package/dist/effects/passes/screen-space/height-fog.d.ts +71 -0
  113. package/dist/effects/passes/screen-space/height-fog.d.ts.map +1 -1
  114. package/dist/effects/passes/screen-space/height-fog.js +16 -3
  115. package/dist/effects/passes/screen-space/height-fog.js.map +1 -1
  116. package/dist/effects/passes/screen-space/motion-blur.cjs +7 -8
  117. package/dist/effects/passes/screen-space/motion-blur.d.ts +41 -2
  118. package/dist/effects/passes/screen-space/motion-blur.d.ts.map +1 -1
  119. package/dist/effects/passes/screen-space/motion-blur.js +6 -6
  120. package/dist/effects/passes/screen-space/motion-blur.js.map +1 -1
  121. package/dist/effects/passes/screen-space/outlines.cjs +143 -18
  122. package/dist/effects/passes/screen-space/outlines.d.ts +162 -3
  123. package/dist/effects/passes/screen-space/outlines.d.ts.map +1 -1
  124. package/dist/effects/passes/screen-space/outlines.js +137 -15
  125. package/dist/effects/passes/screen-space/outlines.js.map +1 -1
  126. package/dist/effects/passes/screen-space/screen-space-global-illumination.cjs +70 -61
  127. package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts +309 -2
  128. package/dist/effects/passes/screen-space/screen-space-global-illumination.d.ts.map +1 -1
  129. package/dist/effects/passes/screen-space/screen-space-global-illumination.js +69 -59
  130. package/dist/effects/passes/screen-space/screen-space-global-illumination.js.map +1 -1
  131. package/dist/effects/passes/screen-space/screen-space-reflections.cjs +151 -83
  132. package/dist/effects/passes/screen-space/screen-space-reflections.d.ts +778 -7
  133. package/dist/effects/passes/screen-space/screen-space-reflections.d.ts.map +1 -1
  134. package/dist/effects/passes/screen-space/screen-space-reflections.js +148 -79
  135. package/dist/effects/passes/screen-space/screen-space-reflections.js.map +1 -1
  136. package/dist/effects/passes/screen-space/selection-outline.cjs +12 -2
  137. package/dist/effects/passes/screen-space/selection-outline.d.ts +44 -0
  138. package/dist/effects/passes/screen-space/selection-outline.d.ts.map +1 -1
  139. package/dist/effects/passes/screen-space/selection-outline.js +9 -0
  140. package/dist/effects/passes/screen-space/selection-outline.js.map +1 -1
  141. package/dist/effects/passes/screen-space/ssao.cjs +69 -44
  142. package/dist/effects/passes/screen-space/ssao.d.ts +648 -3
  143. package/dist/effects/passes/screen-space/ssao.d.ts.map +1 -1
  144. package/dist/effects/passes/screen-space/ssao.js +67 -42
  145. package/dist/effects/passes/screen-space/ssao.js.map +1 -1
  146. package/dist/effects/passes/screen-space/temporal-antialiasing.cjs +42 -30
  147. package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts +107 -6
  148. package/dist/effects/passes/screen-space/temporal-antialiasing.d.ts.map +1 -1
  149. package/dist/effects/passes/screen-space/temporal-antialiasing.js +40 -27
  150. package/dist/effects/passes/screen-space/temporal-antialiasing.js.map +1 -1
  151. package/dist/effects/passes/screen-space/temporal-frame.cjs +34 -0
  152. package/dist/effects/passes/screen-space/temporal-frame.d.ts +23 -0
  153. package/dist/effects/passes/screen-space/temporal-frame.d.ts.map +1 -0
  154. package/dist/effects/passes/screen-space/temporal-frame.js +16 -0
  155. package/dist/effects/passes/screen-space/temporal-frame.js.map +1 -0
  156. package/dist/effects/passes/screen-space/volumetric-fog.cjs +25 -22
  157. package/dist/effects/passes/screen-space/volumetric-fog.d.ts +161 -2
  158. package/dist/effects/passes/screen-space/volumetric-fog.d.ts.map +1 -1
  159. package/dist/effects/passes/screen-space/volumetric-fog.js +27 -21
  160. package/dist/effects/passes/screen-space/volumetric-fog.js.map +1 -1
  161. package/dist/effects/temporal-upscale/index.cjs +40 -0
  162. package/dist/effects/temporal-upscale/index.d.ts +5 -0
  163. package/dist/effects/temporal-upscale/index.d.ts.map +1 -0
  164. package/dist/effects/temporal-upscale/index.js +6 -0
  165. package/dist/effects/temporal-upscale/index.js.map +1 -0
  166. package/dist/effects/temporal-upscale/temporal-math.cjs +202 -0
  167. package/dist/effects/temporal-upscale/temporal-math.d.ts +101 -0
  168. package/dist/effects/temporal-upscale/temporal-math.d.ts.map +1 -0
  169. package/dist/effects/temporal-upscale/temporal-math.js +202 -0
  170. package/dist/effects/temporal-upscale/temporal-math.js.map +1 -0
  171. package/dist/effects/temporal-upscale/temporal-upscale-shaders.cjs +353 -0
  172. package/dist/effects/temporal-upscale/temporal-upscale-shaders.d.ts +7 -0
  173. package/dist/effects/temporal-upscale/temporal-upscale-shaders.d.ts.map +1 -0
  174. package/dist/effects/temporal-upscale/temporal-upscale-shaders.js +321 -0
  175. package/dist/effects/temporal-upscale/temporal-upscale-shaders.js.map +1 -0
  176. package/dist/effects/temporal-upscale/temporal-upscaler.cjs +392 -0
  177. package/dist/effects/temporal-upscale/temporal-upscaler.d.ts +143 -0
  178. package/dist/effects/temporal-upscale/temporal-upscaler.d.ts.map +1 -0
  179. package/dist/effects/temporal-upscale/temporal-upscaler.js +385 -0
  180. package/dist/effects/temporal-upscale/temporal-upscaler.js.map +1 -0
  181. package/dist/experimental-controls.cjs +13 -3
  182. package/dist/experimental-controls.d.ts +2 -1
  183. package/dist/experimental-controls.d.ts.map +1 -1
  184. package/dist/experimental-controls.js +1 -1
  185. package/dist/experimental-controls.js.map +1 -1
  186. package/dist/experimental-materials.cjs +37 -3
  187. package/dist/experimental-materials.d.ts +2 -1
  188. package/dist/experimental-materials.d.ts.map +1 -1
  189. package/dist/experimental-materials.js +1 -1
  190. package/dist/experimental-materials.js.map +1 -1
  191. package/dist/experimental-textures.cjs +13 -3
  192. package/dist/experimental-textures.d.ts +2 -1
  193. package/dist/experimental-textures.d.ts.map +1 -1
  194. package/dist/experimental-textures.js +1 -1
  195. package/dist/experimental-textures.js.map +1 -1
  196. package/dist/experimental-webxr.cjs +17 -3
  197. package/dist/experimental-webxr.d.ts +2 -1
  198. package/dist/experimental-webxr.d.ts.map +1 -1
  199. package/dist/experimental-webxr.js +1 -1
  200. package/dist/experimental-webxr.js.map +1 -1
  201. package/dist/gltf/gltf/create-gltf-model.cjs +34 -71
  202. package/dist/gltf/gltf/create-gltf-model.d.ts +3 -0
  203. package/dist/gltf/gltf/create-gltf-model.d.ts.map +1 -1
  204. package/dist/gltf/gltf/create-gltf-model.js +40 -74
  205. package/dist/gltf/gltf/create-gltf-model.js.map +1 -1
  206. package/dist/gltf/gltf/create-scenegraph-from-gltf.cjs +46 -4
  207. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts +9 -1
  208. package/dist/gltf/gltf/create-scenegraph-from-gltf.d.ts.map +1 -1
  209. package/dist/gltf/gltf/create-scenegraph-from-gltf.js +54 -4
  210. package/dist/gltf/gltf/create-scenegraph-from-gltf.js.map +1 -1
  211. package/dist/gltf/gltf/gltf-animated-crowd.cjs +25 -136
  212. package/dist/gltf/gltf/gltf-animated-crowd.d.ts +4 -8
  213. package/dist/gltf/gltf/gltf-animated-crowd.d.ts.map +1 -1
  214. package/dist/gltf/gltf/gltf-animated-crowd.js +27 -139
  215. package/dist/gltf/gltf/gltf-animated-crowd.js.map +1 -1
  216. package/dist/gltf/gltf/gltf-animation-nodes.cjs +84 -0
  217. package/dist/gltf/gltf/gltf-animation-nodes.d.ts +11 -0
  218. package/dist/gltf/gltf/gltf-animation-nodes.d.ts.map +1 -0
  219. package/dist/gltf/gltf/gltf-animation-nodes.js +62 -0
  220. package/dist/gltf/gltf/gltf-animation-nodes.js.map +1 -0
  221. package/dist/gltf/gltf/gltf-animator.cjs +8 -2
  222. package/dist/gltf/gltf/gltf-animator.d.ts +6 -1
  223. package/dist/gltf/gltf/gltf-animator.d.ts.map +1 -1
  224. package/dist/gltf/gltf/gltf-animator.js +10 -2
  225. package/dist/gltf/gltf/gltf-animator.js.map +1 -1
  226. package/dist/gltf/gltf/gltf-gpu-animation-controller.cjs +81 -0
  227. package/dist/gltf/gltf/gltf-gpu-animation-controller.d.ts +9 -0
  228. package/dist/gltf/gltf/gltf-gpu-animation-controller.d.ts.map +1 -0
  229. package/dist/gltf/gltf/gltf-gpu-animation-controller.js +67 -0
  230. package/dist/gltf/gltf/gltf-gpu-animation-controller.js.map +1 -0
  231. package/dist/gltf/gltf/gltf-gpu-animation.cjs +33 -28
  232. package/dist/gltf/gltf/gltf-gpu-animation.d.ts +7 -26
  233. package/dist/gltf/gltf/gltf-gpu-animation.d.ts.map +1 -1
  234. package/dist/gltf/gltf/gltf-gpu-animation.js +29 -28
  235. package/dist/gltf/gltf/gltf-gpu-animation.js.map +1 -1
  236. package/dist/gltf/index.cjs.map +3 -3
  237. package/dist/gltf/index.d.ts +2 -2
  238. package/dist/gltf/index.d.ts.map +1 -1
  239. package/dist/gltf/index.js.map +1 -1
  240. package/dist/gltf/parsers/parse-gltf.cjs +4 -2
  241. package/dist/gltf/parsers/parse-gltf.d.ts +3 -0
  242. package/dist/gltf/parsers/parse-gltf.d.ts.map +1 -1
  243. package/dist/gltf/parsers/parse-gltf.js +7 -2
  244. package/dist/gltf/parsers/parse-gltf.js.map +1 -1
  245. package/dist/graph/models/index.cjs.map +2 -2
  246. package/dist/graph/physics/index.cjs +5 -0
  247. package/dist/graph/physics/index.cjs.map +3 -3
  248. package/dist/graph/physics/index.d.ts +1 -0
  249. package/dist/graph/physics/index.d.ts.map +1 -1
  250. package/dist/graph/physics/index.js +1 -0
  251. package/dist/graph/physics/index.js.map +1 -1
  252. package/dist/graph/physics/physics-controller-geometry.cjs +21 -0
  253. package/dist/graph/physics/physics-controller-geometry.d.ts +8 -1
  254. package/dist/graph/physics/physics-controller-geometry.d.ts.map +1 -1
  255. package/dist/graph/physics/physics-controller-geometry.js +22 -0
  256. package/dist/graph/physics/physics-controller-geometry.js.map +1 -1
  257. package/dist/graph/physics/scenegraph-session.d.ts +1 -1
  258. package/dist/graph/physics/scenegraph-session.d.ts.map +1 -1
  259. package/dist/graph/tables/index.cjs.map +2 -2
  260. package/dist/index.cjs +16 -0
  261. package/dist/index.cjs.map +3 -3
  262. package/dist/index.d.ts +6 -0
  263. package/dist/index.d.ts.map +1 -1
  264. package/dist/index.js +4 -0
  265. package/dist/index.js.map +1 -1
  266. package/dist/lighting/ambient-occlusion-pass.cjs +47 -28
  267. package/dist/lighting/ambient-occlusion-pass.d.ts +12 -0
  268. package/dist/lighting/ambient-occlusion-pass.d.ts.map +1 -1
  269. package/dist/lighting/ambient-occlusion-pass.js +45 -26
  270. package/dist/lighting/ambient-occlusion-pass.js.map +1 -1
  271. package/dist/lighting/clustered-light-grid.cjs +71 -20
  272. package/dist/lighting/clustered-light-grid.d.ts +37 -0
  273. package/dist/lighting/clustered-light-grid.d.ts.map +1 -1
  274. package/dist/lighting/clustered-light-grid.js +68 -18
  275. package/dist/lighting/clustered-light-grid.js.map +1 -1
  276. package/dist/lighting/contact-shadow-composite.cjs +72 -51
  277. package/dist/lighting/contact-shadow-composite.d.ts +274 -3
  278. package/dist/lighting/contact-shadow-composite.d.ts.map +1 -1
  279. package/dist/lighting/contact-shadow-composite.js +72 -50
  280. package/dist/lighting/contact-shadow-composite.js.map +1 -1
  281. package/dist/lighting/contact-shadow-pass.cjs +50 -39
  282. package/dist/lighting/contact-shadow-pass.d.ts +8 -0
  283. package/dist/lighting/contact-shadow-pass.d.ts.map +1 -1
  284. package/dist/lighting/contact-shadow-pass.js +47 -37
  285. package/dist/lighting/contact-shadow-pass.js.map +1 -1
  286. package/dist/lighting/cortao/cortao-occluder-lookup-table.cjs +96 -0
  287. package/dist/lighting/cortao/cortao-occluder-lookup-table.d.ts +41 -0
  288. package/dist/lighting/cortao/cortao-occluder-lookup-table.d.ts.map +1 -0
  289. package/dist/lighting/cortao/cortao-occluder-lookup-table.js +94 -0
  290. package/dist/lighting/cortao/cortao-occluder-lookup-table.js.map +1 -0
  291. package/dist/lighting/cortao/cortao-parameters.cjs +127 -0
  292. package/dist/lighting/cortao/cortao-parameters.d.ts +95 -0
  293. package/dist/lighting/cortao/cortao-parameters.d.ts.map +1 -0
  294. package/dist/lighting/cortao/cortao-parameters.js +122 -0
  295. package/dist/lighting/cortao/cortao-parameters.js.map +1 -0
  296. package/dist/lighting/cortao/cortao-pass.cjs +100 -0
  297. package/dist/lighting/cortao/cortao-pass.d.ts +33 -0
  298. package/dist/lighting/cortao/cortao-pass.d.ts.map +1 -0
  299. package/dist/lighting/cortao/cortao-pass.js +84 -0
  300. package/dist/lighting/cortao/cortao-pass.js.map +1 -0
  301. package/dist/lighting/cortao/cortao-passes.cjs +42 -0
  302. package/dist/lighting/cortao/cortao-passes.d.ts +38 -0
  303. package/dist/lighting/cortao/cortao-passes.d.ts.map +1 -0
  304. package/dist/lighting/cortao/cortao-passes.js +19 -0
  305. package/dist/lighting/cortao/cortao-passes.js.map +1 -0
  306. package/dist/lighting/cortao/cortao-shaders-wgsl.cjs +606 -0
  307. package/dist/lighting/cortao/cortao-shaders-wgsl.d.ts +49 -0
  308. package/dist/lighting/cortao/cortao-shaders-wgsl.d.ts.map +1 -0
  309. package/dist/lighting/cortao/cortao-shaders-wgsl.js +610 -0
  310. package/dist/lighting/cortao/cortao-shaders-wgsl.js.map +1 -0
  311. package/dist/lighting/cortao/cortao-shaders.cjs +667 -0
  312. package/dist/lighting/cortao/cortao-shaders.d.ts +118 -0
  313. package/dist/lighting/cortao/cortao-shaders.d.ts.map +1 -0
  314. package/dist/lighting/cortao/cortao-shaders.js +657 -0
  315. package/dist/lighting/cortao/cortao-shaders.js.map +1 -0
  316. package/dist/lighting/cortao/cortao-upsample.cjs +191 -0
  317. package/dist/lighting/cortao/cortao-upsample.d.ts +16 -0
  318. package/dist/lighting/cortao/cortao-upsample.d.ts.map +1 -0
  319. package/dist/lighting/cortao/cortao-upsample.js +159 -0
  320. package/dist/lighting/cortao/cortao-upsample.js.map +1 -0
  321. package/dist/lighting/cortao/cortao-webgl-passes.cjs +229 -0
  322. package/dist/lighting/cortao/cortao-webgl-passes.d.ts +28 -0
  323. package/dist/lighting/cortao/cortao-webgl-passes.d.ts.map +1 -0
  324. package/dist/lighting/cortao/cortao-webgl-passes.js +212 -0
  325. package/dist/lighting/cortao/cortao-webgl-passes.js.map +1 -0
  326. package/dist/lighting/cortao/cortao-webgpu-passes.cjs +348 -0
  327. package/dist/lighting/cortao/cortao-webgpu-passes.d.ts +31 -0
  328. package/dist/lighting/cortao/cortao-webgpu-passes.d.ts.map +1 -0
  329. package/dist/lighting/cortao/cortao-webgpu-passes.js +335 -0
  330. package/dist/lighting/cortao/cortao-webgpu-passes.js.map +1 -0
  331. package/dist/lighting/index.cjs +13 -2
  332. package/dist/lighting/index.cjs.map +3 -3
  333. package/dist/lighting/index.d.ts +11 -6
  334. package/dist/lighting/index.d.ts.map +1 -1
  335. package/dist/lighting/index.js +6 -5
  336. package/dist/lighting/index.js.map +1 -1
  337. package/dist/lighting/shadow-map-renderer.cjs +40 -37
  338. package/dist/lighting/shadow-map-renderer.d.ts +15 -0
  339. package/dist/lighting/shadow-map-renderer.d.ts.map +1 -1
  340. package/dist/lighting/shadow-map-renderer.js +37 -35
  341. package/dist/lighting/shadow-map-renderer.js.map +1 -1
  342. package/dist/model/gpu-vector-model.cjs +39 -16
  343. package/dist/model/gpu-vector-model.d.ts +8 -0
  344. package/dist/model/gpu-vector-model.d.ts.map +1 -1
  345. package/dist/model/gpu-vector-model.js +46 -18
  346. package/dist/model/gpu-vector-model.js.map +1 -1
  347. package/dist/passes/effect-renderer.cjs +155 -0
  348. package/dist/passes/effect-renderer.d.ts +158 -0
  349. package/dist/passes/effect-renderer.d.ts.map +1 -0
  350. package/dist/passes/effect-renderer.js +143 -0
  351. package/dist/passes/effect-renderer.js.map +1 -0
  352. package/dist/passes/scene-capture-pass.cjs +42 -0
  353. package/dist/passes/scene-capture-pass.d.ts +29 -0
  354. package/dist/passes/scene-capture-pass.d.ts.map +1 -0
  355. package/dist/passes/scene-capture-pass.js +21 -0
  356. package/dist/passes/scene-capture-pass.js.map +1 -0
  357. package/dist/passes/shader-pass-renderer.cjs +94 -68
  358. package/dist/passes/shader-pass-renderer.d.ts +32 -15
  359. package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
  360. package/dist/passes/shader-pass-renderer.js +104 -76
  361. package/dist/passes/shader-pass-renderer.js.map +1 -1
  362. package/dist/scenegraph/model-node.cjs +2 -0
  363. package/dist/scenegraph/model-node.d.ts +4 -0
  364. package/dist/scenegraph/model-node.d.ts.map +1 -1
  365. package/dist/scenegraph/model-node.js +2 -0
  366. package/dist/scenegraph/model-node.js.map +1 -1
  367. package/dist/splats/gpu-paged-splat-renderer.cjs +52 -8
  368. package/dist/splats/gpu-paged-splat-renderer.d.ts +16 -3
  369. package/dist/splats/gpu-paged-splat-renderer.d.ts.map +1 -1
  370. package/dist/splats/gpu-paged-splat-renderer.js +55 -9
  371. package/dist/splats/gpu-paged-splat-renderer.js.map +1 -1
  372. package/dist/splats/gpu-paged-splat-shaders.cjs +3 -1
  373. package/dist/splats/gpu-paged-splat-shaders.d.ts.map +1 -1
  374. package/dist/splats/gpu-paged-splat-shaders.js +3 -1
  375. package/dist/splats/gpu-paged-splat-shaders.js.map +1 -1
  376. package/dist/splats/index.cjs.map +2 -2
  377. package/dist/text/fonts/atlas/browser-font-atlas.cjs +10 -1
  378. package/dist/text/fonts/atlas/browser-font-atlas.d.ts +3 -1
  379. package/dist/text/fonts/atlas/browser-font-atlas.d.ts.map +1 -1
  380. package/dist/text/fonts/atlas/browser-font-atlas.js +10 -2
  381. package/dist/text/fonts/atlas/browser-font-atlas.js.map +1 -1
  382. package/dist/text/fonts/atlas/lru-cache.cjs +4 -0
  383. package/dist/text/fonts/atlas/lru-cache.d.ts +3 -1
  384. package/dist/text/fonts/atlas/lru-cache.d.ts.map +1 -1
  385. package/dist/text/fonts/atlas/lru-cache.js +4 -0
  386. package/dist/text/fonts/atlas/lru-cache.js.map +1 -1
  387. package/dist/text/fonts/index.cjs +2 -0
  388. package/dist/text/fonts/index.cjs.map +1 -1
  389. package/dist/text/fonts/index.d.ts +1 -1
  390. package/dist/text/fonts/index.d.ts.map +1 -1
  391. package/dist/text/fonts/index.js +1 -1
  392. package/dist/text/fonts/index.js.map +1 -1
  393. package/dist/text/index.cjs.map +1 -1
  394. package/package.json +8 -8
  395. package/src/animation/animation-track.ts +5 -0
  396. package/src/animation/node-animation-binding.ts +9 -8
  397. package/src/animation/scenegraph-gpu-animation-layout.ts +195 -0
  398. package/src/animation/scenegraph-gpu-animation.ts +340 -0
  399. package/src/arrow/arrow-picking.ts +23 -11
  400. package/src/audio/audio-controller.ts +4 -1
  401. package/src/audio/audio-graph.ts +46 -25
  402. package/src/effects/README.md +38 -14
  403. package/src/effects/glfx-effects.ts +227 -0
  404. package/src/effects/graph/gpu-effect-operation.ts +601 -0
  405. package/src/effects/graph/temporal-graph-history.ts +46 -0
  406. package/src/effects/index.ts +81 -19
  407. package/src/effects/passes/postprocessing/fxaa/fxaa.ts +8 -0
  408. package/src/effects/passes/postprocessing/image-adjust-filters/tone-mapping.ts +8 -0
  409. package/src/effects/passes/postprocessing/image-blur-filters/bloom-composite-shader-pass.ts +219 -19
  410. package/src/effects/passes/postprocessing/image-blur-filters/bloom-compute-pyramid.ts +6 -6
  411. package/src/effects/passes/screen-space/camera-reprojection-temporal-antialiasing.ts +45 -45
  412. package/src/effects/passes/screen-space/clustered-volumetric-lighting.ts +88 -68
  413. package/src/effects/passes/screen-space/copy-pass.ts +4 -0
  414. package/src/effects/passes/screen-space/depth-aware-blur.ts +13 -3
  415. package/src/effects/passes/screen-space/dof.ts +20 -3
  416. package/src/effects/passes/screen-space/gtao.ts +91 -65
  417. package/src/effects/passes/screen-space/hdr-auto-exposure.ts +109 -84
  418. package/src/effects/passes/screen-space/height-fog.ts +18 -3
  419. package/src/effects/passes/screen-space/motion-blur.ts +8 -7
  420. package/src/effects/passes/screen-space/outlines.ts +143 -17
  421. package/src/effects/passes/screen-space/screen-space-global-illumination.ts +75 -64
  422. package/src/effects/passes/screen-space/screen-space-reflections.ts +158 -95
  423. package/src/effects/passes/screen-space/selection-outline.ts +11 -0
  424. package/src/effects/passes/screen-space/ssao.ts +79 -46
  425. package/src/effects/passes/screen-space/temporal-antialiasing.ts +43 -33
  426. package/src/effects/passes/screen-space/temporal-frame.ts +33 -0
  427. package/src/effects/passes/screen-space/volumetric-fog.ts +30 -24
  428. package/src/effects/temporal-upscale/index.ts +20 -0
  429. package/src/effects/temporal-upscale/temporal-math.ts +308 -0
  430. package/src/effects/temporal-upscale/temporal-upscale-shaders.ts +326 -0
  431. package/src/effects/temporal-upscale/temporal-upscaler.ts +538 -0
  432. package/src/experimental-controls.ts +13 -1
  433. package/src/experimental-materials.ts +37 -1
  434. package/src/experimental-textures.ts +9 -1
  435. package/src/experimental-webxr.ts +18 -1
  436. package/src/gltf/gltf/create-gltf-model.ts +59 -90
  437. package/src/gltf/gltf/create-scenegraph-from-gltf.ts +71 -5
  438. package/src/gltf/gltf/gltf-animated-crowd.ts +30 -177
  439. package/src/gltf/gltf/gltf-animation-nodes.ts +82 -0
  440. package/src/gltf/gltf/gltf-animator.ts +15 -4
  441. package/src/gltf/gltf/gltf-gpu-animation-controller.ts +88 -0
  442. package/src/gltf/gltf/gltf-gpu-animation.ts +53 -60
  443. package/src/gltf/index.ts +5 -0
  444. package/src/gltf/parsers/parse-gltf.ts +12 -2
  445. package/src/graph/physics/index.ts +4 -0
  446. package/src/graph/physics/physics-controller-geometry.ts +33 -1
  447. package/src/index.ts +25 -0
  448. package/src/lighting/ambient-occlusion-pass.ts +62 -28
  449. package/src/lighting/clustered-light-grid.ts +87 -30
  450. package/src/lighting/contact-shadow-composite.ts +80 -52
  451. package/src/lighting/contact-shadow-pass.ts +59 -39
  452. package/src/lighting/cortao/cortao-occluder-lookup-table.ts +138 -0
  453. package/src/lighting/cortao/cortao-parameters.ts +218 -0
  454. package/src/lighting/cortao/cortao-pass.ts +136 -0
  455. package/src/lighting/cortao/cortao-passes.ts +50 -0
  456. package/src/lighting/cortao/cortao-shaders-wgsl.ts +633 -0
  457. package/src/lighting/cortao/cortao-shaders.ts +674 -0
  458. package/src/lighting/cortao/cortao-upsample.ts +177 -0
  459. package/src/lighting/cortao/cortao-webgl-passes.ts +284 -0
  460. package/src/lighting/cortao/cortao-webgpu-passes.ts +430 -0
  461. package/src/lighting/index.ts +12 -3
  462. package/src/lighting/shadow-map-renderer.ts +57 -43
  463. package/src/model/gpu-vector-model.ts +47 -18
  464. package/src/passes/effect-renderer.ts +332 -0
  465. package/src/passes/scene-capture-pass.ts +51 -0
  466. package/src/passes/shader-pass-renderer.ts +164 -115
  467. package/src/scenegraph/model-node.ts +5 -0
  468. package/src/splats/README.md +1 -1
  469. package/src/splats/gpu-paged-splat-renderer.ts +77 -9
  470. package/src/splats/gpu-paged-splat-shaders.ts +7 -1
  471. package/src/text/fonts/atlas/browser-font-atlas.ts +12 -2
  472. package/src/text/fonts/atlas/lru-cache.ts +6 -1
  473. package/src/text/fonts/index.ts +1 -0
@@ -29,6 +29,14 @@ import {gpuAnimation, pbrMaterial, skin} from '@luma.gl/shaders';
29
29
  import type {NumericArray} from '@math.gl/core/types';
30
30
  import {type ParsedPBRMaterial} from '../pbr/pbr-material';
31
31
  import type {GLTFCrowdGPUAnimationLayout} from './gltf-gpu-animation';
32
+ import {
33
+ getScenegraphGPUAnimationFrameStride,
34
+ type ScenegraphGPUAnimationModelOptions
35
+ } from '../../animation/scenegraph-gpu-animation-layout';
36
+ import {
37
+ createScenegraphGPUAnimationStorage,
38
+ ScenegraphGPUAnimationResources
39
+ } from '../../animation/scenegraph-gpu-animation';
32
40
 
33
41
  const SHADER = /* WGSL */ `
34
42
  struct VertexInputs {
@@ -499,6 +507,8 @@ export type CreateGLTFModelOptions = {
499
507
  material?: Material | null;
500
508
  /** Additional model props merged into the generated model. */
501
509
  modelOptions?: Partial<ModelProps>;
510
+ /** Resolved scenegraph playback requested for an ordinary primitive. */
511
+ scenegraphGPUAnimation?: ScenegraphGPUAnimationModelOptions;
502
512
  /** Source primitive bounds before node and optional instance transforms. */
503
513
  bounds?: ScenegraphBounds;
504
514
  /** Source-authored local transforms for `EXT_mesh_gpu_instancing`. */
@@ -612,15 +622,19 @@ export function createGLTFModel(device: Device, options: CreateGLTFModelOptions)
612
622
  const instanceBufferLayout: BufferLayout[] = [];
613
623
  const transformBuffers: Buffer[] = [];
614
624
  const transformColumns: Float32Array[] = [];
615
- const hasGPUAnimation = Boolean(crowd?.gpuAnimation);
616
- if (instanceMatrices || crowd) {
625
+ const sceneAnimation = options.scenegraphGPUAnimation;
626
+ const animationLayout = sceneAnimation?.layout || crowd?.gpuAnimation;
627
+ const hasGPUAnimation = Boolean(animationLayout);
628
+ const instanced = Boolean(instanceMatrices || crowd || sceneAnimation);
629
+ if (instanced) {
617
630
  for (let columnIndex = 0; columnIndex < 4; columnIndex++) {
618
- const values = new Float32Array((crowd?.capacity || instanceMatrices?.length || 0) * 4);
631
+ const values = new Float32Array((crowd?.capacity || instanceMatrices?.length || 1) * 4);
619
632
  instanceMatrices?.forEach((matrix, instanceIndex) => {
620
633
  for (let rowIndex = 0; rowIndex < 4; rowIndex++) {
621
634
  values[instanceIndex * 4 + rowIndex] = matrix[columnIndex * 4 + rowIndex];
622
635
  }
623
636
  });
637
+ if (sceneAnimation) values[columnIndex] = 1;
624
638
  const attributeName = `instanceModelMatrixCol${columnIndex}`;
625
639
  const buffer = device.createBuffer({
626
640
  id: `${id || 'gltf'}-${attributeName}`,
@@ -635,35 +649,10 @@ export function createGLTFModel(device: Device, options: CreateGLTFModelOptions)
635
649
  }
636
650
  }
637
651
 
638
- let animationParameters: Float32Array | undefined;
639
- let animationParameterBuffer: Buffer | undefined;
640
- let animationBlend: Float32Array | undefined;
641
- let animationBlendBuffer: Buffer | undefined;
642
- if (crowd && hasGPUAnimation) {
643
- animationParameters = new Float32Array(crowd.capacity * 4);
644
- animationBlend = new Float32Array(crowd.capacity * 4);
645
- for (const [attributeName, values] of [
646
- ['instanceAnimationFrames', animationParameters],
647
- ['instanceAnimationBlend', animationBlend]
648
- ] as const) {
649
- const buffer = device.createBuffer({
650
- id: `${id || 'gltf'}-${attributeName}`,
651
- data: values,
652
- usage: Buffer.VERTEX | Buffer.COPY_DST
653
- });
654
- instanceAttributes[attributeName] = buffer;
655
- instanceBufferLayout.push({name: attributeName, format: 'float32x4', stepMode: 'instance'});
656
- managedResources.push(buffer);
657
- if (attributeName === 'instanceAnimationFrames') {
658
- animationParameterBuffer = buffer;
659
- } else {
660
- animationBlendBuffer = buffer;
661
- }
662
- }
663
- }
664
-
665
652
  const hasSkin = Boolean(parsedPPBRMaterial.defines['HAS_SKIN']);
666
- const hasLargeSkinPalette = Boolean(usesLargeSkinPalette && hasSkin && !crowd);
653
+ const hasLargeSkinPalette = Boolean(
654
+ usesLargeSkinPalette && hasSkin && !crowd && !hasGPUAnimation
655
+ );
667
656
  const hasInstancedSkin = Boolean(crowd && hasSkin && !hasGPUAnimation);
668
657
  let skinJointMatrices: Buffer | Texture | undefined;
669
658
  let jointMatrices: Float32Array | undefined;
@@ -713,7 +702,7 @@ export function createGLTFModel(device: Device, options: CreateGLTFModelOptions)
713
702
  }
714
703
  }
715
704
 
716
- morphTargetData = createGPUAnimationResource(
705
+ morphTargetData = createScenegraphGPUAnimationStorage(
717
706
  device,
718
707
  `${id || 'gltf'}-crowd-morph-targets`,
719
708
  targetValues,
@@ -726,7 +715,7 @@ export function createGLTFModel(device: Device, options: CreateGLTFModelOptions)
726
715
  const packedTargetCount = Math.ceil(morphTargetCount / 4);
727
716
  const morphInstanceCount = crowd?.capacity || 1;
728
717
  morphWeights = new Float32Array(morphInstanceCount * packedTargetCount * 4);
729
- morphWeightData = createGPUAnimationResource(
718
+ morphWeightData = createScenegraphGPUAnimationStorage(
730
719
  device,
731
720
  `${id || 'gltf'}-crowd-morph-weights`,
732
721
  morphWeights,
@@ -737,22 +726,28 @@ export function createGLTFModel(device: Device, options: CreateGLTFModelOptions)
737
726
  }
738
727
  }
739
728
 
740
- const animationJointCount = hasSkin && crowd ? crowd.jointsPerInstance : 0;
741
- const animationFrameStride = 4 + animationJointCount * 4 + morphTargetCount;
742
- let animationFrames: Buffer | Texture | undefined;
743
- let animationFrameValues: Float32Array | undefined;
744
- if (crowd?.gpuAnimation) {
745
- animationFrameValues = new Float32Array(
746
- crowd.gpuAnimation.frameCount * animationFrameStride * 4
747
- );
748
- animationFrames = createGPUAnimationResource(
749
- device,
750
- `${id || 'gltf'}-crowd-animation-frames`,
751
- animationFrameValues,
752
- animationFrameStride,
753
- crowd.gpuAnimation.frameCount
754
- );
755
- managedResources.push(animationFrames);
729
+ const animationJointCount = hasSkin
730
+ ? sceneAnimation?.jointCount || crowd?.jointsPerInstance || 0
731
+ : 0;
732
+ const animationFrameStride = getScenegraphGPUAnimationFrameStride(
733
+ animationJointCount,
734
+ morphTargetCount
735
+ );
736
+ const animationResources = animationLayout
737
+ ? new ScenegraphGPUAnimationResources(
738
+ device,
739
+ animationLayout,
740
+ animationJointCount,
741
+ morphTargetCount,
742
+ crowd?.capacity || 1,
743
+ id
744
+ )
745
+ : undefined;
746
+ const animationFrames = animationResources?.animationFrames;
747
+ if (animationResources) {
748
+ Object.assign(instanceAttributes, animationResources.attributes);
749
+ instanceBufferLayout.push(...animationResources.bufferLayout);
750
+ managedResources.push(animationResources);
756
751
  }
757
752
 
758
753
  let source = SHADER;
@@ -777,16 +772,16 @@ export function createGLTFModel(device: Device, options: CreateGLTFModelOptions)
777
772
  modules: [
778
773
  pbrMaterial,
779
774
  skin,
780
- ...(crowd || morphTargetData ? [gpuAnimation] : []),
775
+ ...(animationResources || morphTargetData ? [gpuAnimation] : []),
781
776
  ...(options.publishedTransforms ? [publishedTransforms] : [])
782
777
  ],
783
778
  ...modelOptions,
784
779
 
785
- ...(instanceMatrices || crowd
780
+ ...(instanced
786
781
  ? {
787
782
  attributes: {...modelOptions.attributes, ...instanceAttributes},
788
783
  bufferLayout: [...(modelOptions.bufferLayout || []), ...instanceBufferLayout],
789
- instanceCount: instanceMatrices?.length || 0,
784
+ instanceCount: sceneAnimation ? 1 : instanceMatrices?.length || 0,
790
785
  isInstanced: true
791
786
  }
792
787
  : {}),
@@ -794,18 +789,18 @@ export function createGLTFModel(device: Device, options: CreateGLTFModelOptions)
794
789
  ...parsedPPBRMaterial.defines,
795
790
  ...(options.publishedTransforms ? {HAS_PUBLISHED_TRANSFORMS: true} : {}),
796
791
  ...modelOptions.defines,
797
- ...(instanceMatrices || crowd ? {HAS_GLTF_INSTANCING: true} : {}),
792
+ ...(instanced ? {HAS_GLTF_INSTANCING: true} : {}),
798
793
  ...(hasInstancedSkin
799
794
  ? {HAS_INSTANCED_SKIN: true, CROWD_JOINTS_PER_INSTANCE: crowd!.jointsPerInstance}
800
795
  : {}),
801
796
  ...(hasLargeSkinPalette ? {HAS_LARGE_SKIN: true} : {}),
802
- ...(hasGPUAnimation
803
- ? {HAS_GPU_CROWD_ANIMATION: true, CROWD_ANIMATION_FRAME_STRIDE: animationFrameStride}
804
- : {}),
797
+ ...animationResources?.defines,
805
798
  ...(morphTargetData
806
799
  ? {HAS_INSTANCED_MORPH: true, CROWD_MORPH_TARGET_COUNT: morphTargetCount}
807
800
  : {}),
808
- ...(crowd || morphTargetData ? {CROWD_ANIMATION_JOINT_COUNT: animationJointCount} : {})
801
+ ...(animationResources || morphTargetData
802
+ ? {CROWD_ANIMATION_JOINT_COUNT: animationJointCount}
803
+ : {})
809
804
  },
810
805
  parameters: {...parameters, ...parsedPPBRMaterial.parameters, ...modelOptions.parameters}
811
806
  };
@@ -842,13 +837,14 @@ export function createGLTFModel(device: Device, options: CreateGLTFModelOptions)
842
837
  if (animationFrames || morphTargetData || morphWeightData) {
843
838
  model.shaderInputs.setProps({
844
839
  gpuAnimation: {
845
- ...(animationFrames ? {gpuAnimationFrames: animationFrames} : {}),
840
+ ...animationResources?.bindings,
846
841
  ...(morphTargetData ? {gpuMorphTargets: morphTargetData} : {}),
847
842
  ...(morphWeightData ? {gpuMorphWeights: morphWeightData} : {})
848
843
  }
849
844
  });
850
845
  }
851
846
  const modelNode = new ModelNode({
847
+ gpuAnimation: animationResources,
852
848
  managedResources,
853
849
  model,
854
850
  bounds: options.bounds,
@@ -874,45 +870,18 @@ export function createGLTFModel(device: Device, options: CreateGLTFModelOptions)
874
870
  morphWeights,
875
871
  morphWeightData,
876
872
  animationFrames,
877
- animationFrameValues,
873
+ animationFrameValues: animationResources?.animationFrameValues,
878
874
  animationFrameStride,
879
875
  animationJointCount,
880
- animationParameters,
881
- animationParameterBuffer,
882
- animationBlend,
883
- animationBlendBuffer
876
+ animationParameters: animationResources?.animationParameters,
877
+ animationParameterBuffer: animationResources?.animationParameterBuffer,
878
+ animationBlend: animationResources?.animationBlend,
879
+ animationBlendBuffer: animationResources?.animationBlendBuffer
884
880
  } satisfies GLTFCrowdModelResources;
885
881
  }
886
882
  return modelNode;
887
883
  }
888
884
 
889
- function createGPUAnimationResource(
890
- device: Device,
891
- id: string,
892
- values: Float32Array,
893
- width: number,
894
- height: number
895
- ): Buffer | Texture {
896
- if (device.type === 'webgpu') {
897
- return device.createBuffer({
898
- id,
899
- data: values,
900
- usage: Buffer.STORAGE | Buffer.COPY_DST
901
- });
902
- }
903
-
904
- const texture = device.createTexture({
905
- id,
906
- format: 'rgba32float',
907
- width,
908
- height,
909
- usage: Texture.SAMPLE | Texture.COPY_DST,
910
- sampler: {minFilter: 'nearest', magFilter: 'nearest', mipmapFilter: 'nearest'}
911
- });
912
- texture.writeData(values, {width, height});
913
- return texture;
914
- }
915
-
916
885
  function isMaterialBindingResource(value: unknown): boolean {
917
886
  return (
918
887
  value instanceof Buffer ||
@@ -30,6 +30,15 @@ import {
30
30
  getGLTFExtensionSupport,
31
31
  type GLTFExtensionSupport
32
32
  } from './gltf-extension-support';
33
+ import {
34
+ planGLTFCrowdGPUAnimation,
35
+ type GLTFGPUAnimationOptions,
36
+ type GLTFGPUAnimationStats
37
+ } from './gltf-gpu-animation';
38
+ import {
39
+ canUseGLTFSceneGPUAnimation,
40
+ bindGLTFSceneGPUAnimation
41
+ } from './gltf-gpu-animation-controller';
33
42
  import {parseGLTFMaterialVariants} from './gltf-material-variants';
34
43
  import {parseGLTFBillboards} from './gltf-billboard';
35
44
 
@@ -46,6 +55,12 @@ export type GLTFScenegraphBounds = {
46
55
  recommendedOrbitDistance: number;
47
56
  };
48
57
 
58
+ /** Options for ordinary CPU or baked GPU glTF scene playback. */
59
+ export type CreateGLTFScenegraphsOptions = ParseGLTFOptions & {
60
+ /** Opt-in baked transform, skin, and morph sampling on WebGPU and WebGL 2. */
61
+ gpuAnimation?: GLTFGPUAnimationOptions;
62
+ };
63
+
49
64
  /** Scenegraph bundle returned from a parsed glTF asset. */
50
65
  export type GLTFScenegraphs = {
51
66
  /** Opt-in camera-facing scene traversal using resolved runtime node bindings. */
@@ -67,6 +82,8 @@ export type GLTFScenegraphs = {
67
82
  animator: GLTFAnimator;
68
83
  /** Parsed source animations, including supported material and texture-transform pointers. */
69
84
  animations: GLTFAnimation[];
85
+ /** Actual playback path, baked storage estimate, and optional CPU fallback reason. */
86
+ animationStats: GLTFGPUAnimationStats;
70
87
  /** Parsed punctual lights from the asset. */
71
88
  lights: Light[];
72
89
  /** Updates punctual lights after programmatic transform or visibility changes. */
@@ -99,7 +116,7 @@ export type GLTFScenegraphs = {
99
116
  export function createScenegraphsFromGLTF(
100
117
  device: Device,
101
118
  gltf: GLTFPostprocessed,
102
- options?: ParseGLTFOptions
119
+ options?: CreateGLTFScenegraphsOptions
103
120
  ): GLTFScenegraphs {
104
121
  const metadata = parseGLTFMetadata(gltf);
105
122
  if (options?.strictExtensions) {
@@ -127,6 +144,29 @@ export function createScenegraphsFromGLTF(
127
144
  );
128
145
  validation.destroy();
129
146
  }
147
+ const animations = parseGLTFAnimations(gltf);
148
+ const animationPlan = options?.gpuAnimation
149
+ ? planGLTFCrowdGPUAnimation(gltf, options.gpuAnimation, device)
150
+ : null;
151
+ if (
152
+ animationPlan?.layout &&
153
+ (!canUseGLTFSceneGPUAnimation(gltf, animations) ||
154
+ animationPlan.layout.clips.length !== animations.length ||
155
+ new Set(animations.map(animation => animation.name)).size !== animations.length)
156
+ ) {
157
+ animationPlan.layout = null;
158
+ animationPlan.fallbackReason = 'unsupported-scene';
159
+ }
160
+ const layout = animationPlan?.layout;
161
+ const parseOptions = layout
162
+ ? {
163
+ ...options,
164
+ scenegraphGPUAnimation: {
165
+ layout,
166
+ jointCount: Math.max(0, ...(gltf.skins || []).map(skin => skin.joints.length))
167
+ }
168
+ }
169
+ : options;
130
170
 
131
171
  const {
132
172
  scenes,
@@ -136,7 +176,7 @@ export function createScenegraphsFromGLTF(
136
176
  gltfNodeIndexToNodeMap,
137
177
  generatedTextures,
138
178
  materialInstances
139
- } = parseGLTF(device, gltf, options);
179
+ } = parseGLTF(device, gltf, parseOptions);
140
180
 
141
181
  const billboards = options?.billboards
142
182
  ? new BillboardController(
@@ -188,7 +228,6 @@ export function createScenegraphsFromGLTF(
188
228
 
189
229
  const jointDeclarations = parseGLTFJointDeclarations(gltf, gltfNodeIndexToNodeMap);
190
230
  const joints = new JointController(jointDeclarations.declarations.map(item => item.joint));
191
- const animations = parseGLTFAnimations(gltf);
192
231
  const sourceLights =
193
232
  (gltf as GLTFPostprocessed & {lights?: PunctualLightDefinition[]}).lights ||
194
233
  (gltf.extensions?.['KHR_lights_punctual']?.['lights'] as
@@ -223,7 +262,8 @@ export function createScenegraphsFromGLTF(
223
262
  animations,
224
263
  gltfNodeIdToNodeMap,
225
264
  materials,
226
- materialInstances
265
+ materialInstances,
266
+ ...(layout ? {autoplay: 'first', evaluateNodeTransforms: false} : {})
227
267
  });
228
268
  const variants = new MaterialVariants(parseGLTFMaterialVariants(gltf, scenes));
229
269
  const extensionSupport = getGLTFExtensionSupport(gltf, device);
@@ -284,7 +324,15 @@ export function createScenegraphsFromGLTF(
284
324
  generatedTextures.clear();
285
325
  };
286
326
 
287
- return {
327
+ const morphModels = new Set<ModelNode>();
328
+ for (const scene of scenes) {
329
+ scene.preorderTraversal(node => {
330
+ if (node instanceof ModelNode && node.userData['morphTargets']) {
331
+ morphModels.add(node);
332
+ }
333
+ });
334
+ }
335
+ const scenegraphs: GLTFScenegraphs = {
288
336
  metadata,
289
337
  scenes,
290
338
  materials,
@@ -295,6 +343,15 @@ export function createScenegraphsFromGLTF(
295
343
  cameras,
296
344
  animator,
297
345
  animations,
346
+ animationStats: {
347
+ mode: layout ? 'gpu' : 'cpu',
348
+ ...(layout ? {sampleRate: layout.sampleRate} : {}),
349
+ frameCount: layout?.frameCount || 0,
350
+ clipCount: layout?.clips.length || 0,
351
+ morphGroupCount: morphModels.size,
352
+ estimatedByteLength: animationPlan?.estimatedByteLength || 0,
353
+ ...(animationPlan?.fallbackReason ? {fallbackReason: animationPlan.fallbackReason} : {})
354
+ },
298
355
  lights,
299
356
  punctualLights,
300
357
  extensionSupport,
@@ -307,6 +364,15 @@ export function createScenegraphsFromGLTF(
307
364
  gltf,
308
365
  destroy
309
366
  };
367
+ if (layout) {
368
+ try {
369
+ bindGLTFSceneGPUAnimation(scenegraphs, layout);
370
+ } catch (error) {
371
+ destroy();
372
+ throw error;
373
+ }
374
+ }
375
+ return scenegraphs;
310
376
  }
311
377
 
312
378
  function getScenegraphBounds(bounds: [number[], number[]] | null): GLTFScenegraphBounds {
@@ -19,15 +19,19 @@ import type {GLTFCrowdModelConfiguration, GLTFCrowdModelResources} from './creat
19
19
  import {createScenegraphsFromGLTF, type GLTFScenegraphs} from './create-scenegraph-from-gltf';
20
20
  import {type GLTFAnimationSelectionOptions, GLTFAnimator} from './gltf-animator';
21
21
  import {
22
- createGLTFCrowdGPUAnimationLayout,
22
+ planGLTFCrowdGPUAnimation,
23
+ type GLTFCrowdGPUAnimationFallbackReason,
23
24
  type GLTFCrowdGPUAnimationClip,
24
25
  type GLTFCrowdGPUAnimationLayout,
25
26
  type GLTFCrowdGPUAnimationOptions,
27
+ type GLTFGPUAnimationStats,
26
28
  getGLTFCrowdGPUAnimationFrames
27
29
  } from './gltf-gpu-animation';
28
30
  import {generateGLTFLODLevels, getGLTFNodeLODs} from './gltf-lod';
29
31
  import {SkinController} from '@luma.gl/engine';
30
32
  import {parseGLTFSkins} from './gltf-skin';
33
+ import {createGLTFAnimationNodes} from './gltf-animation-nodes';
34
+ import {bakeScenegraphGPUAnimation} from '../../animation/scenegraph-gpu-animation';
31
35
 
32
36
  /** Authored or generated screen-space detail selection for independently animated crowd actors. */
33
37
  export type GLTFCrowdLODOptions = {
@@ -91,13 +95,7 @@ export type GLTFAnimatedCrowdOptions = ParseGLTFOptions & {
91
95
  };
92
96
 
93
97
  /** Runtime ownership and workload diagnostics for accelerated crowd animation. */
94
- export type GLTFCrowdAnimationStats = {
95
- mode: 'cpu' | 'gpu';
96
- sampleRate?: number;
97
- frameCount: number;
98
- clipCount: number;
99
- morphGroupCount: number;
100
- };
98
+ export type GLTFCrowdAnimationStats = GLTFGPUAnimationStats;
101
99
 
102
100
  /** Initial placement and independent playback controls for one lightweight crowd actor. */
103
101
  export type GLTFCrowdActorOptions = {
@@ -155,13 +153,6 @@ export type GLTFCrowdPrimitiveGroup = {
155
153
  animationParameters?: Float32Array;
156
154
  };
157
155
 
158
- type GLTFCrowdActorNodes = {
159
- root: GroupNode;
160
- scenes: GroupNode[];
161
- nodesByIndex: Map<number, GroupNode>;
162
- nodesById: Map<string, GroupNode>;
163
- };
164
-
165
156
  /** Lightweight independent animation state targeting shared, GPU-instanced glTF primitives. */
166
157
  export class GLTFCrowdActor {
167
158
  readonly id: string;
@@ -183,7 +174,7 @@ export class GLTFCrowdActor {
183
174
  constructor(crowd: GLTFAnimatedCrowd, id: string, options: GLTFCrowdActorOptions = {}) {
184
175
  this.crowd = crowd;
185
176
  this.id = id;
186
- const hierarchy = createActorNodes(crowd.scenegraphs, id);
177
+ const hierarchy = createGLTFAnimationNodes(crowd.scenegraphs, id);
187
178
  this.root = hierarchy.root;
188
179
  this.nodesByIndex = hierarchy.nodesByIndex;
189
180
  this.nodesById = hierarchy.nodesById;
@@ -411,6 +402,8 @@ export class GLTFAnimatedCrowd {
411
402
  private readonly lodScreenCoverage: readonly number[];
412
403
  private readonly maximumLODLevel: number;
413
404
  private readonly lodVertexCounts: readonly number[];
405
+ private readonly gpuAnimationEstimatedByteLength: number;
406
+ private readonly gpuAnimationFallbackReason?: GLTFCrowdGPUAnimationFallbackReason;
414
407
  private readonly gpuAnimationLayout: GLTFCrowdGPUAnimationLayout | null;
415
408
  private readonly gpuAnimationClips: ReadonlyMap<string, GLTFCrowdGPUAnimationClip>;
416
409
  private currentLODView: GLTFCrowdLODView | null = null;
@@ -453,27 +446,16 @@ export class GLTFAnimatedCrowd {
453
446
  })
454
447
  : gltf;
455
448
  this.lodSource = authoredLOD ? 'authored' : this.gltf !== gltf ? 'generated' : 'none';
456
- const requestedGPUAnimationLayout = gpuAnimation
457
- ? createGLTFCrowdGPUAnimationLayout(this.gltf, gpuAnimation)
449
+ const animationPlan = gpuAnimation
450
+ ? planGLTFCrowdGPUAnimation(this.gltf, gpuAnimation, device)
458
451
  : null;
459
452
  const jointsPerInstance = Math.max(
460
453
  0,
461
454
  ...(this.gltf.skins || []).map(skin => skin.joints.length)
462
455
  );
463
- const maximumMorphTargetCount = Math.max(
464
- 0,
465
- ...this.gltf.nodes.flatMap(node =>
466
- (node.mesh?.primitives || []).map(primitive => primitive.targets?.length || 0)
467
- )
468
- );
469
- const maximumAnimationFrameStride = 4 + jointsPerInstance * 4 + maximumMorphTargetCount;
470
- this.gpuAnimationLayout =
471
- requestedGPUAnimationLayout &&
472
- (device.type === 'webgpu' ||
473
- (maximumAnimationFrameStride <= device.limits.maxTextureDimension2D &&
474
- requestedGPUAnimationLayout.frameCount <= device.limits.maxTextureDimension2D))
475
- ? requestedGPUAnimationLayout
476
- : null;
456
+ this.gpuAnimationLayout = animationPlan?.layout || null;
457
+ this.gpuAnimationEstimatedByteLength = animationPlan?.estimatedByteLength || 0;
458
+ this.gpuAnimationFallbackReason = animationPlan?.fallbackReason;
477
459
  this.gpuAnimationEnabled = Boolean(this.gpuAnimationLayout);
478
460
  this.gpuAnimationClips = new Map(
479
461
  (this.gpuAnimationLayout?.clips || []).map(clip => [clip.name, clip])
@@ -555,6 +537,8 @@ export class GLTFAnimatedCrowd {
555
537
  get animationStats(): GLTFCrowdAnimationStats {
556
538
  return {
557
539
  mode: this.gpuAnimationEnabled ? 'gpu' : 'cpu',
540
+ estimatedByteLength: this.gpuAnimationEstimatedByteLength,
541
+ ...(this.gpuAnimationFallbackReason ? {fallbackReason: this.gpuAnimationFallbackReason} : {}),
558
542
  ...(this.gpuAnimationLayout ? {sampleRate: this.gpuAnimationLayout.sampleRate} : {}),
559
543
  frameCount: this.gpuAnimationLayout?.frameCount || 0,
560
544
  clipCount: this.gpuAnimationLayout?.clips.length || 0,
@@ -858,88 +842,22 @@ export class GLTFAnimatedCrowd {
858
842
  }
859
843
 
860
844
  private bakeGPUAnimationFrames(): void {
861
- const layout = this.gpuAnimationLayout;
862
- if (!layout) {
845
+ if (!this.gpuAnimationLayout) {
863
846
  return;
864
847
  }
865
-
866
- this.suspendedRefreshCount++;
867
- const bakingActor = new GLTFCrowdActor(this, '__gltf-gpu-animation-baker__', {playing: false});
868
- try {
869
- for (const clip of layout.clips) {
870
- const animation = bakingActor.animator.selectClip(clip.name);
871
- animation.action.setLoop('once', 1);
872
- for (let clipFrame = 0; clipFrame < clip.frameCount; clipFrame++) {
873
- const time = Math.min(clipFrame / layout.sampleRate, clip.duration);
874
- animation.action.setTime(time);
875
- bakingActor.animator.update(0);
876
- const worldMatrices = collectNodeWorldMatrices(bakingActor.root);
877
- bakingActor.updateSkinMatrices(worldMatrices);
878
-
879
- for (const group of this.primitiveGroups) {
880
- const modelNode = findCrowdModelNode(
881
- this.scenegraphs,
882
- group.sourceNodeIndex,
883
- group.model
884
- );
885
- if (!modelNode) {
886
- continue;
887
- }
888
- const resources = modelNode.userData['gltfAnimatedCrowd'] as GLTFCrowdModelResources;
889
- const values = resources.animationFrameValues;
890
- const frameStride = resources.animationFrameStride;
891
- if (!values || !frameStride) {
892
- continue;
893
- }
894
-
895
- const frameOffset = (clip.frameOffset + clipFrame) * frameStride * 4;
896
- const node = bakingActor.getNode(group.nodeIndex);
897
- const nodeMatrix = node && worldMatrices.get(node);
898
- if (nodeMatrix) {
899
- values.set(nodeMatrix, frameOffset);
900
- }
901
-
902
- const jointPalette = bakingActor.skins.getBinding(
903
- bakingActor.getNode(group.nodeIndex)
904
- )?.jointMatrices;
905
- if (jointPalette) {
906
- values.set(jointPalette, frameOffset + 16);
907
- }
908
-
909
- const weights = node?.userData['morphWeights'];
910
- if (Array.isArray(weights)) {
911
- for (let targetIndex = 0; targetIndex < resources.morphTargetCount; targetIndex++) {
912
- const offset =
913
- frameOffset + (4 + resources.animationJointCount * 4 + targetIndex) * 4;
914
- values[offset] = Number(weights[targetIndex] || 0);
915
- }
916
- }
917
- }
918
- }
919
- }
920
- } finally {
921
- bakingActor.destroy();
922
- this.suspendedRefreshCount--;
923
- }
924
-
925
- for (const group of this.primitiveGroups) {
926
- const modelNode = findCrowdModelNode(this.scenegraphs, group.sourceNodeIndex, group.model);
927
- if (!modelNode) {
928
- continue;
929
- }
930
- const resources = modelNode.userData['gltfAnimatedCrowd'] as GLTFCrowdModelResources;
931
- if (!resources.animationFrames || !resources.animationFrameValues) {
932
- continue;
933
- }
934
- if (resources.animationFrames instanceof Buffer) {
935
- resources.animationFrames.write(resources.animationFrameValues);
936
- } else {
937
- resources.animationFrames.writeData(resources.animationFrameValues, {
938
- width: resources.animationFrameStride,
939
- height: layout.frameCount
940
- });
941
- }
942
- }
848
+ const scenegraphs = this.scenegraphs;
849
+ const targets = this.primitiveGroups.flatMap(group => {
850
+ const node = scenegraphs.gltfNodeIndexToNodeMap.get(group.nodeIndex);
851
+ const modelNode = findCrowdModelNode(scenegraphs, group.sourceNodeIndex, group.model);
852
+ return node && modelNode?.gpuAnimation ? [{node, resources: modelNode.gpuAnimation}] : [];
853
+ });
854
+ bakeScenegraphGPUAnimation({
855
+ scenes: scenegraphs.scenes,
856
+ clips: scenegraphs.animator.getAnimations().map(animation => animation.sourceClip),
857
+ skins: scenegraphs.skins.bindings,
858
+ layout: this.gpuAnimationLayout,
859
+ targets
860
+ });
943
861
  }
944
862
 
945
863
  private writeGPUAnimationParameters(
@@ -1178,71 +1096,6 @@ export function createGLTFAnimatedCrowd(
1178
1096
  return new GLTFAnimatedCrowd(device, gltf, options);
1179
1097
  }
1180
1098
 
1181
- function createActorNodes(scenegraphs: GLTFScenegraphs, id: string): GLTFCrowdActorNodes {
1182
- const {gltf, gltfNodeIndexToNodeMap} = scenegraphs;
1183
- const nodesByIndex = new Map<number, GroupNode>();
1184
- const nodesById = new Map<string, GroupNode>();
1185
-
1186
- for (let nodeIndex = 0; nodeIndex < gltf.nodes.length; nodeIndex++) {
1187
- const sourceNode = gltf.nodes[nodeIndex];
1188
- const sourceRuntimeNode = gltfNodeIndexToNodeMap.get(nodeIndex);
1189
- if (!sourceRuntimeNode) {
1190
- continue;
1191
- }
1192
- const node = new GroupNode({
1193
- id: sourceRuntimeNode.id,
1194
- position: Array.from(sourceRuntimeNode.position),
1195
- rotation: Array.from(sourceRuntimeNode.rotation),
1196
- scale: Array.from(sourceRuntimeNode.scale),
1197
- matrix: Array.from(sourceRuntimeNode.matrix),
1198
- display: sourceRuntimeNode.display
1199
- });
1200
- const morphWeights = sourceRuntimeNode.userData['morphWeights'];
1201
- if (Array.isArray(morphWeights)) {
1202
- node.userData['morphWeights'] = [...morphWeights];
1203
- }
1204
- nodesByIndex.set(nodeIndex, node);
1205
- nodesById.set(sourceNode.id, node);
1206
- }
1207
-
1208
- for (let nodeIndex = 0; nodeIndex < gltf.nodes.length; nodeIndex++) {
1209
- const sourceNode = gltf.nodes[nodeIndex];
1210
- const node = nodesByIndex.get(nodeIndex);
1211
- if (!node) {
1212
- continue;
1213
- }
1214
- for (const child of sourceNode.children || []) {
1215
- const childNode = nodesById.get(child.id);
1216
- if (childNode) {
1217
- node.add(childNode);
1218
- }
1219
- }
1220
- if (sourceNode.mesh) {
1221
- const mesh = new GroupNode({id: sourceNode.mesh.name || sourceNode.mesh.id});
1222
- node.userData['gltfMesh'] = mesh;
1223
- node.add(mesh);
1224
- }
1225
- }
1226
-
1227
- const scenes = gltf.scenes.map(
1228
- (scene, sceneIndex) =>
1229
- new GroupNode({
1230
- id: `${id}-scene-${sceneIndex}`,
1231
- children: (scene.nodes || []).flatMap(sourceNode => {
1232
- const node = nodesById.get(sourceNode.id);
1233
- return node ? [node] : [];
1234
- })
1235
- })
1236
- );
1237
-
1238
- return {
1239
- root: new GroupNode({id: `${id}-root`, children: [...scenes]}),
1240
- scenes,
1241
- nodesByIndex,
1242
- nodesById
1243
- };
1244
- }
1245
-
1246
1099
  function createPrimitiveGroups(
1247
1100
  scenegraphs: GLTFScenegraphs,
1248
1101
  includeLODLevels: boolean