@pmndrs/vdb 0.0.0-stage → 0.2.0

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 (570) hide show
  1. package/CHANGELOG.md +727 -0
  2. package/LICENSE +21 -0
  3. package/README.md +496 -2
  4. package/THIRD_PARTY_NOTICES.md +315 -0
  5. package/dist/core/compute/atlas.d.ts +102 -0
  6. package/dist/core/compute/atlas.js +103 -0
  7. package/dist/core/compute/atlas.js.map +1 -0
  8. package/dist/core/compute/index.d.ts +13 -0
  9. package/dist/core/compute/index.js +9 -0
  10. package/dist/core/compute/index.js.map +1 -0
  11. package/dist/core/compute/majorant-build.d.ts +45 -0
  12. package/dist/core/compute/majorant-build.js +193 -0
  13. package/dist/core/compute/majorant-build.js.map +1 -0
  14. package/dist/core/compute/multi-scale.d.ts +155 -0
  15. package/dist/core/compute/multi-scale.js +684 -0
  16. package/dist/core/compute/multi-scale.js.map +1 -0
  17. package/dist/core/compute/pyramid.d.ts +120 -0
  18. package/dist/core/compute/pyramid.js +468 -0
  19. package/dist/core/compute/pyramid.js.map +1 -0
  20. package/dist/core/compute/shared.d.ts +116 -0
  21. package/dist/core/compute/shared.js +211 -0
  22. package/dist/core/compute/shared.js.map +1 -0
  23. package/dist/core/compute/stats.d.ts +78 -0
  24. package/dist/core/compute/stats.js +193 -0
  25. package/dist/core/compute/stats.js.map +1 -0
  26. package/dist/core/compute/value-transform.d.ts +30 -0
  27. package/dist/core/compute/value-transform.js +64 -0
  28. package/dist/core/compute/value-transform.js.map +1 -0
  29. package/dist/core/errors.d.ts +21 -0
  30. package/dist/core/errors.js +17 -0
  31. package/dist/core/errors.js.map +1 -0
  32. package/dist/core/frame/emission.d.ts +85 -0
  33. package/dist/core/frame/emission.js +422 -0
  34. package/dist/core/frame/emission.js.map +1 -0
  35. package/dist/core/frame/environment.d.ts +47 -0
  36. package/dist/core/frame/environment.js +178 -0
  37. package/dist/core/frame/environment.js.map +1 -0
  38. package/dist/core/frame/index.d.ts +39 -0
  39. package/dist/core/frame/index.js +27 -0
  40. package/dist/core/frame/index.js.map +1 -0
  41. package/dist/core/frame/kernels.d.ts +115 -0
  42. package/dist/core/frame/kernels.js +496 -0
  43. package/dist/core/frame/kernels.js.map +1 -0
  44. package/dist/core/frame/limits.d.ts +67 -0
  45. package/dist/core/frame/limits.js +109 -0
  46. package/dist/core/frame/limits.js.map +1 -0
  47. package/dist/core/frame/phase.d.ts +17 -0
  48. package/dist/core/frame/phase.js +53 -0
  49. package/dist/core/frame/phase.js.map +1 -0
  50. package/dist/core/frame/pipelines.d.ts +49 -0
  51. package/dist/core/frame/pipelines.js +147 -0
  52. package/dist/core/frame/pipelines.js.map +1 -0
  53. package/dist/core/frame/renderer.d.ts +122 -0
  54. package/dist/core/frame/renderer.js +1712 -0
  55. package/dist/core/frame/renderer.js.map +1 -0
  56. package/dist/core/frame/resources.d.ts +71 -0
  57. package/dist/core/frame/resources.js +100 -0
  58. package/dist/core/frame/resources.js.map +1 -0
  59. package/dist/core/frame/scattering.d.ts +97 -0
  60. package/dist/core/frame/scattering.js +332 -0
  61. package/dist/core/frame/scattering.js.map +1 -0
  62. package/dist/core/frame/settings.d.ts +243 -0
  63. package/dist/core/frame/settings.js +67 -0
  64. package/dist/core/frame/settings.js.map +1 -0
  65. package/dist/core/frame/shadows.d.ts +55 -0
  66. package/dist/core/frame/shadows.js +460 -0
  67. package/dist/core/frame/shadows.js.map +1 -0
  68. package/dist/core/frame/types.d.ts +415 -0
  69. package/dist/core/frame/types.js +49 -0
  70. package/dist/core/frame/types.js.map +1 -0
  71. package/dist/core/frame/uniforms.d.ts +105 -0
  72. package/dist/core/frame/uniforms.js +276 -0
  73. package/dist/core/frame/uniforms.js.map +1 -0
  74. package/dist/core/frame/wgsl/chunks.d.ts +4 -0
  75. package/dist/core/frame/wgsl/chunks.js +728 -0
  76. package/dist/core/frame/wgsl/chunks.js.map +1 -0
  77. package/dist/core/frame/wgsl/emission.d.ts +82 -0
  78. package/dist/core/frame/wgsl/emission.js +353 -0
  79. package/dist/core/frame/wgsl/emission.js.map +1 -0
  80. package/dist/core/frame/wgsl/environment.d.ts +42 -0
  81. package/dist/core/frame/wgsl/environment.js +711 -0
  82. package/dist/core/frame/wgsl/environment.js.map +1 -0
  83. package/dist/core/frame/wgsl/gather.d.ts +55 -0
  84. package/dist/core/frame/wgsl/gather.js +850 -0
  85. package/dist/core/frame/wgsl/gather.js.map +1 -0
  86. package/dist/core/frame/wgsl/integrate.d.ts +78 -0
  87. package/dist/core/frame/wgsl/integrate.js +213 -0
  88. package/dist/core/frame/wgsl/integrate.js.map +1 -0
  89. package/dist/core/frame/wgsl/lighting.d.ts +103 -0
  90. package/dist/core/frame/wgsl/lighting.js +1636 -0
  91. package/dist/core/frame/wgsl/lighting.js.map +1 -0
  92. package/dist/core/frame/wgsl/occluders.d.ts +20 -0
  93. package/dist/core/frame/wgsl/occluders.js +95 -0
  94. package/dist/core/frame/wgsl/occluders.js.map +1 -0
  95. package/dist/core/frame/wgsl/resolve.d.ts +19 -0
  96. package/dist/core/frame/wgsl/resolve.js +205 -0
  97. package/dist/core/frame/wgsl/resolve.js.map +1 -0
  98. package/dist/core/frame/wgsl/shadows.d.ts +35 -0
  99. package/dist/core/frame/wgsl/shadows.js +328 -0
  100. package/dist/core/frame/wgsl/shadows.js.map +1 -0
  101. package/dist/core/half.d.ts +11 -0
  102. package/dist/core/half.js +22 -0
  103. package/dist/core/half.js.map +1 -0
  104. package/dist/core/index.d.ts +52 -0
  105. package/dist/core/index.js +46 -0
  106. package/dist/core/index.js.map +1 -0
  107. package/dist/core/internal.d.ts +31 -0
  108. package/dist/core/internal.js +32 -0
  109. package/dist/core/internal.js.map +1 -0
  110. package/dist/core/pool/affine.d.ts +34 -0
  111. package/dist/core/pool/affine.js +100 -0
  112. package/dist/core/pool/affine.js.map +1 -0
  113. package/dist/core/pool/allocator.d.ts +32 -0
  114. package/dist/core/pool/allocator.js +81 -0
  115. package/dist/core/pool/allocator.js.map +1 -0
  116. package/dist/core/pool/image-header.d.ts +93 -0
  117. package/dist/core/pool/image-header.js +194 -0
  118. package/dist/core/pool/image-header.js.map +1 -0
  119. package/dist/core/pool/layout.d.ts +198 -0
  120. package/dist/core/pool/layout.js +316 -0
  121. package/dist/core/pool/layout.js.map +1 -0
  122. package/dist/core/pool/limits.d.ts +41 -0
  123. package/dist/core/pool/limits.js +80 -0
  124. package/dist/core/pool/limits.js.map +1 -0
  125. package/dist/core/pool/pool.d.ts +384 -0
  126. package/dist/core/pool/pool.js +1184 -0
  127. package/dist/core/pool/pool.js.map +1 -0
  128. package/dist/core/reference/index.d.ts +6 -0
  129. package/dist/core/reference/index.js +7 -0
  130. package/dist/core/reference/index.js.map +1 -0
  131. package/dist/core/reference/renderer.d.ts +105 -0
  132. package/dist/core/reference/renderer.js +474 -0
  133. package/dist/core/reference/renderer.js.map +1 -0
  134. package/dist/core/reference/wgsl.d.ts +65 -0
  135. package/dist/core/reference/wgsl.js +803 -0
  136. package/dist/core/reference/wgsl.js.map +1 -0
  137. package/dist/core/sequence.d.ts +347 -0
  138. package/dist/core/sequence.js +548 -0
  139. package/dist/core/sequence.js.map +1 -0
  140. package/dist/core/source/brick-cache.d.ts +165 -0
  141. package/dist/core/source/brick-cache.js +627 -0
  142. package/dist/core/source/brick-cache.js.map +1 -0
  143. package/dist/core/source/dense-fill.d.ts +53 -0
  144. package/dist/core/source/dense-fill.js +377 -0
  145. package/dist/core/source/dense-fill.js.map +1 -0
  146. package/dist/core/source/dense.d.ts +50 -0
  147. package/dist/core/source/dense.js +384 -0
  148. package/dist/core/source/dense.js.map +1 -0
  149. package/dist/core/source/sparse-wgsl.d.ts +92 -0
  150. package/dist/core/source/sparse-wgsl.js +481 -0
  151. package/dist/core/source/sparse-wgsl.js.map +1 -0
  152. package/dist/core/source/sparse.d.ts +192 -0
  153. package/dist/core/source/sparse.js +762 -0
  154. package/dist/core/source/sparse.js.map +1 -0
  155. package/dist/core/source/types.d.ts +120 -0
  156. package/dist/core/source/types.js +9 -0
  157. package/dist/core/source/types.js.map +1 -0
  158. package/dist/core/surface/index.d.ts +10 -0
  159. package/dist/core/surface/index.js +9 -0
  160. package/dist/core/surface/index.js.map +1 -0
  161. package/dist/core/surface/level-set-pass.d.ts +140 -0
  162. package/dist/core/surface/level-set-pass.js +291 -0
  163. package/dist/core/surface/level-set-pass.js.map +1 -0
  164. package/dist/core/surface/level-set-wgsl.d.ts +46 -0
  165. package/dist/core/surface/level-set-wgsl.js +99 -0
  166. package/dist/core/surface/level-set-wgsl.js.map +1 -0
  167. package/dist/core/surface/points.d.ts +109 -0
  168. package/dist/core/surface/points.js +226 -0
  169. package/dist/core/surface/points.js.map +1 -0
  170. package/dist/core/types.d.ts +37 -0
  171. package/dist/core/types.js +32 -0
  172. package/dist/core/types.js.map +1 -0
  173. package/dist/core/wgsl/api.d.ts +65 -0
  174. package/dist/core/wgsl/api.js +546 -0
  175. package/dist/core/wgsl/api.js.map +1 -0
  176. package/dist/core/wgsl/generate.d.ts +90 -0
  177. package/dist/core/wgsl/generate.js +678 -0
  178. package/dist/core/wgsl/generate.js.map +1 -0
  179. package/dist/core/wgsl/lean.d.ts +50 -0
  180. package/dist/core/wgsl/lean.js +327 -0
  181. package/dist/core/wgsl/lean.js.map +1 -0
  182. package/dist/core/wgsl/level-set.d.ts +58 -0
  183. package/dist/core/wgsl/level-set.js +200 -0
  184. package/dist/core/wgsl/level-set.js.map +1 -0
  185. package/dist/core/wgsl/majorant.d.ts +62 -0
  186. package/dist/core/wgsl/majorant.js +381 -0
  187. package/dist/core/wgsl/majorant.js.map +1 -0
  188. package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
  189. package/dist/core/wgsl/pnanovdb.chunks.generated.js +333 -0
  190. package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -0
  191. package/dist/core/wgsl/reserved.d.ts +9 -0
  192. package/dist/core/wgsl/reserved.js +26 -0
  193. package/dist/core/wgsl/reserved.js.map +1 -0
  194. package/dist/core/wgsl/types.d.ts +198 -0
  195. package/dist/core/wgsl/types.js +2 -0
  196. package/dist/core/wgsl/types.js.map +1 -0
  197. package/dist/three/coarse-first.d.ts +207 -0
  198. package/dist/three/coarse-first.js +205 -0
  199. package/dist/three/coarse-first.js.map +1 -0
  200. package/dist/three/compute.d.ts +73 -0
  201. package/dist/three/compute.js +66 -0
  202. package/dist/three/compute.js.map +1 -0
  203. package/dist/three/device.d.ts +66 -0
  204. package/dist/three/device.js +62 -0
  205. package/dist/three/device.js.map +1 -0
  206. package/dist/three/frame/core-environment.d.ts +38 -0
  207. package/dist/three/frame/core-environment.js +154 -0
  208. package/dist/three/frame/core-environment.js.map +1 -0
  209. package/dist/three/frame/core-integrate-material.d.ts +34 -0
  210. package/dist/three/frame/core-integrate-material.js +162 -0
  211. package/dist/three/frame/core-integrate-material.js.map +1 -0
  212. package/dist/three/frame/core-occluders.d.ts +53 -0
  213. package/dist/three/frame/core-occluders.js +193 -0
  214. package/dist/three/frame/core-occluders.js.map +1 -0
  215. package/dist/three/frame/core-structs.d.ts +34 -0
  216. package/dist/three/frame/core-structs.js +61 -0
  217. package/dist/three/frame/core-structs.js.map +1 -0
  218. package/dist/three/frame/core-textures.d.ts +41 -0
  219. package/dist/three/frame/core-textures.js +114 -0
  220. package/dist/three/frame/core-textures.js.map +1 -0
  221. package/dist/three/frame/emission-light.d.ts +117 -0
  222. package/dist/three/frame/emission-light.js +276 -0
  223. package/dist/three/frame/emission-light.js.map +1 -0
  224. package/dist/three/frame/index.d.ts +19 -0
  225. package/dist/three/frame/index.js +15 -0
  226. package/dist/three/frame/index.js.map +1 -0
  227. package/dist/three/frame/medium.d.ts +33 -0
  228. package/dist/three/frame/medium.js +29 -0
  229. package/dist/three/frame/medium.js.map +1 -0
  230. package/dist/three/frame/renderer.d.ts +97 -0
  231. package/dist/three/frame/renderer.js +480 -0
  232. package/dist/three/frame/renderer.js.map +1 -0
  233. package/dist/three/frame/spectrum.d.ts +4 -0
  234. package/dist/three/frame/spectrum.js +15 -0
  235. package/dist/three/frame/spectrum.js.map +1 -0
  236. package/dist/three/frame/three-internals.d.ts +60 -0
  237. package/dist/three/frame/three-internals.js +152 -0
  238. package/dist/three/frame/three-internals.js.map +1 -0
  239. package/dist/three/frame/volume-shadows.d.ts +139 -0
  240. package/dist/three/frame/volume-shadows.js +403 -0
  241. package/dist/three/frame/volume-shadows.js.map +1 -0
  242. package/dist/three/frame/volume.d.ts +230 -0
  243. package/dist/three/frame/volume.js +268 -0
  244. package/dist/three/frame/volume.js.map +1 -0
  245. package/dist/three/grid-node.d.ts +229 -0
  246. package/dist/three/grid-node.js +545 -0
  247. package/dist/three/grid-node.js.map +1 -0
  248. package/dist/three/index.d.ts +52 -0
  249. package/dist/three/index.js +58 -0
  250. package/dist/three/index.js.map +1 -0
  251. package/dist/three/internal.d.ts +20 -0
  252. package/dist/three/internal.js +18 -0
  253. package/dist/three/internal.js.map +1 -0
  254. package/dist/three/level-set-material.d.ts +185 -0
  255. package/dist/three/level-set-material.js +241 -0
  256. package/dist/three/level-set-material.js.map +1 -0
  257. package/dist/three/level-set-physical-material.d.ts +154 -0
  258. package/dist/three/level-set-physical-material.js +253 -0
  259. package/dist/three/level-set-physical-material.js.map +1 -0
  260. package/dist/three/level-set-velocity.d.ts +94 -0
  261. package/dist/three/level-set-velocity.js +208 -0
  262. package/dist/three/level-set-velocity.js.map +1 -0
  263. package/dist/three/material.d.ts +324 -0
  264. package/dist/three/material.js +502 -0
  265. package/dist/three/material.js.map +1 -0
  266. package/dist/three/points.d.ts +140 -0
  267. package/dist/three/points.js +261 -0
  268. package/dist/three/points.js.map +1 -0
  269. package/dist/three/sparse-source.d.ts +165 -0
  270. package/dist/three/sparse-source.js +405 -0
  271. package/dist/three/sparse-source.js.map +1 -0
  272. package/dist/three/volume-source.d.ts +22 -0
  273. package/dist/three/volume-source.js +110 -0
  274. package/dist/three/volume-source.js.map +1 -0
  275. package/dist/tools/cpu/brick-atlas.d.ts +36 -0
  276. package/dist/tools/cpu/brick-atlas.js +129 -0
  277. package/dist/tools/cpu/brick-atlas.js.map +1 -0
  278. package/dist/tools/cpu/compute.d.ts +116 -0
  279. package/dist/tools/cpu/compute.js +239 -0
  280. package/dist/tools/cpu/compute.js.map +1 -0
  281. package/dist/tools/cpu/lean-reads.d.ts +81 -0
  282. package/dist/tools/cpu/lean-reads.js +262 -0
  283. package/dist/tools/cpu/lean-reads.js.map +1 -0
  284. package/dist/tools/cpu/level-set.d.ts +111 -0
  285. package/dist/tools/cpu/level-set.js +313 -0
  286. package/dist/tools/cpu/level-set.js.map +1 -0
  287. package/dist/tools/cpu/majorant.d.ts +265 -0
  288. package/dist/tools/cpu/majorant.js +541 -0
  289. package/dist/tools/cpu/majorant.js.map +1 -0
  290. package/dist/tools/cpu/march.d.ts +297 -0
  291. package/dist/tools/cpu/march.js +726 -0
  292. package/dist/tools/cpu/march.js.map +1 -0
  293. package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
  294. package/dist/tools/cpu/mesh-decimate.js +1225 -0
  295. package/dist/tools/cpu/mesh-decimate.js.map +1 -0
  296. package/dist/tools/cpu/points.d.ts +29 -0
  297. package/dist/tools/cpu/points.js +38 -0
  298. package/dist/tools/cpu/points.js.map +1 -0
  299. package/dist/tools/cpu/probe-coords.d.ts +70 -0
  300. package/dist/tools/cpu/probe-coords.js +116 -0
  301. package/dist/tools/cpu/probe-coords.js.map +1 -0
  302. package/dist/tools/cpu/read-value.d.ts +44 -0
  303. package/dist/tools/cpu/read-value.js +351 -0
  304. package/dist/tools/cpu/read-value.js.map +1 -0
  305. package/dist/tools/cpu/sample-trilinear.d.ts +43 -0
  306. package/dist/tools/cpu/sample-trilinear.js +168 -0
  307. package/dist/tools/cpu/sample-trilinear.js.map +1 -0
  308. package/dist/tools/cpu/stride-tables.d.ts +56 -0
  309. package/dist/tools/cpu/stride-tables.generated.d.ts +1059 -0
  310. package/dist/tools/cpu/stride-tables.generated.js +1267 -0
  311. package/dist/tools/cpu/stride-tables.generated.js.map +1 -0
  312. package/dist/tools/cpu/stride-tables.js +78 -0
  313. package/dist/tools/cpu/stride-tables.js.map +1 -0
  314. package/dist/tools/cpu/surface-nets.d.ts +90 -0
  315. package/dist/tools/cpu/surface-nets.js +597 -0
  316. package/dist/tools/cpu/surface-nets.js.map +1 -0
  317. package/dist/tools/errors.d.ts +66 -0
  318. package/dist/tools/errors.js +67 -0
  319. package/dist/tools/errors.js.map +1 -0
  320. package/dist/tools/frame/ambient.d.ts +98 -0
  321. package/dist/tools/frame/ambient.js +274 -0
  322. package/dist/tools/frame/ambient.js.map +1 -0
  323. package/dist/tools/frame/blackbody.d.ts +57 -0
  324. package/dist/tools/frame/blackbody.js +151 -0
  325. package/dist/tools/frame/blackbody.js.map +1 -0
  326. package/dist/tools/frame/brick-cache.d.ts +165 -0
  327. package/dist/tools/frame/brick-cache.js +326 -0
  328. package/dist/tools/frame/brick-cache.js.map +1 -0
  329. package/dist/tools/frame/emission.d.ts +137 -0
  330. package/dist/tools/frame/emission.js +290 -0
  331. package/dist/tools/frame/emission.js.map +1 -0
  332. package/dist/tools/frame/environment-gpu.d.ts +111 -0
  333. package/dist/tools/frame/environment-gpu.js +280 -0
  334. package/dist/tools/frame/environment-gpu.js.map +1 -0
  335. package/dist/tools/frame/environment.d.ts +106 -0
  336. package/dist/tools/frame/environment.js +272 -0
  337. package/dist/tools/frame/environment.js.map +1 -0
  338. package/dist/tools/frame/froxel.d.ts +58 -0
  339. package/dist/tools/frame/froxel.js +115 -0
  340. package/dist/tools/frame/froxel.js.map +1 -0
  341. package/dist/tools/frame/grid.d.ts +392 -0
  342. package/dist/tools/frame/grid.js +802 -0
  343. package/dist/tools/frame/grid.js.map +1 -0
  344. package/dist/tools/frame/index.d.ts +150 -0
  345. package/dist/tools/frame/index.js +389 -0
  346. package/dist/tools/frame/index.js.map +1 -0
  347. package/dist/tools/frame/medium.d.ts +77 -0
  348. package/dist/tools/frame/medium.js +101 -0
  349. package/dist/tools/frame/medium.js.map +1 -0
  350. package/dist/tools/frame/mie-table.d.ts +6 -0
  351. package/dist/tools/frame/mie-table.js +16 -0
  352. package/dist/tools/frame/mie-table.js.map +1 -0
  353. package/dist/tools/frame/mie.d.ts +63 -0
  354. package/dist/tools/frame/mie.js +194 -0
  355. package/dist/tools/frame/mie.js.map +1 -0
  356. package/dist/tools/frame/mlp-nn.d.ts +36 -0
  357. package/dist/tools/frame/mlp-nn.js +159 -0
  358. package/dist/tools/frame/mlp-nn.js.map +1 -0
  359. package/dist/tools/frame/mlp-tza.d.ts +29 -0
  360. package/dist/tools/frame/mlp-tza.js +186 -0
  361. package/dist/tools/frame/mlp-tza.js.map +1 -0
  362. package/dist/tools/frame/mlp.d.ts +183 -0
  363. package/dist/tools/frame/mlp.js +434 -0
  364. package/dist/tools/frame/mlp.js.map +1 -0
  365. package/dist/tools/frame/ms-exit.d.ts +42 -0
  366. package/dist/tools/frame/ms-exit.js +90 -0
  367. package/dist/tools/frame/ms-exit.js.map +1 -0
  368. package/dist/tools/frame/multi-scale.d.ts +152 -0
  369. package/dist/tools/frame/multi-scale.js +302 -0
  370. package/dist/tools/frame/multi-scale.js.map +1 -0
  371. package/dist/tools/frame/neural-weights.d.ts +10 -0
  372. package/dist/tools/frame/neural-weights.js +244 -0
  373. package/dist/tools/frame/neural-weights.js.map +1 -0
  374. package/dist/tools/frame/neural.d.ts +80 -0
  375. package/dist/tools/frame/neural.js +150 -0
  376. package/dist/tools/frame/neural.js.map +1 -0
  377. package/dist/tools/frame/occluders.d.ts +51 -0
  378. package/dist/tools/frame/occluders.js +72 -0
  379. package/dist/tools/frame/occluders.js.map +1 -0
  380. package/dist/tools/frame/pyramid-layout.d.ts +55 -0
  381. package/dist/tools/frame/pyramid-layout.js +100 -0
  382. package/dist/tools/frame/pyramid-layout.js.map +1 -0
  383. package/dist/tools/frame/shadows.d.ts +190 -0
  384. package/dist/tools/frame/shadows.js +468 -0
  385. package/dist/tools/frame/shadows.js.map +1 -0
  386. package/dist/tools/frame/sparse.d.ts +147 -0
  387. package/dist/tools/frame/sparse.js +432 -0
  388. package/dist/tools/frame/sparse.js.map +1 -0
  389. package/dist/tools/frame/spectral-stack.d.ts +159 -0
  390. package/dist/tools/frame/spectral-stack.js +391 -0
  391. package/dist/tools/frame/spectral-stack.js.map +1 -0
  392. package/dist/tools/frame/spectral.d.ts +222 -0
  393. package/dist/tools/frame/spectral.js +572 -0
  394. package/dist/tools/frame/spectral.js.map +1 -0
  395. package/dist/tools/frame/stack.d.ts +115 -0
  396. package/dist/tools/frame/stack.js +290 -0
  397. package/dist/tools/frame/stack.js.map +1 -0
  398. package/dist/tools/frame/view.d.ts +131 -0
  399. package/dist/tools/frame/view.js +337 -0
  400. package/dist/tools/frame/view.js.map +1 -0
  401. package/dist/tools/index.d.ts +157 -0
  402. package/dist/tools/index.js +132 -0
  403. package/dist/tools/index.js.map +1 -0
  404. package/dist/tools/internal.d.ts +87 -0
  405. package/dist/tools/internal.js +85 -0
  406. package/dist/tools/internal.js.map +1 -0
  407. package/dist/tools/nanovdb/build-from-vdb.d.ts +59 -0
  408. package/dist/tools/nanovdb/build-from-vdb.js +100 -0
  409. package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
  410. package/dist/tools/nanovdb/bytes.d.ts +233 -0
  411. package/dist/tools/nanovdb/bytes.js +388 -0
  412. package/dist/tools/nanovdb/bytes.js.map +1 -0
  413. package/dist/tools/nanovdb/coarse-first.d.ts +78 -0
  414. package/dist/tools/nanovdb/coarse-first.js +92 -0
  415. package/dist/tools/nanovdb/coarse-first.js.map +1 -0
  416. package/dist/tools/nanovdb/half.d.ts +22 -0
  417. package/dist/tools/nanovdb/half.js +73 -0
  418. package/dist/tools/nanovdb/half.js.map +1 -0
  419. package/dist/tools/nanovdb/index.d.ts +34 -0
  420. package/dist/tools/nanovdb/index.js +25 -0
  421. package/dist/tools/nanovdb/index.js.map +1 -0
  422. package/dist/tools/nanovdb/inspect.d.ts +33 -0
  423. package/dist/tools/nanovdb/inspect.js +70 -0
  424. package/dist/tools/nanovdb/inspect.js.map +1 -0
  425. package/dist/tools/nanovdb/leaf-codec.d.ts +119 -0
  426. package/dist/tools/nanovdb/leaf-codec.js +356 -0
  427. package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
  428. package/dist/tools/nanovdb/quantize.d.ts +72 -0
  429. package/dist/tools/nanovdb/quantize.js +329 -0
  430. package/dist/tools/nanovdb/quantize.js.map +1 -0
  431. package/dist/tools/nanovdb/resample.d.ts +177 -0
  432. package/dist/tools/nanovdb/resample.js +692 -0
  433. package/dist/tools/nanovdb/resample.js.map +1 -0
  434. package/dist/tools/nanovdb/serialize.d.ts +176 -0
  435. package/dist/tools/nanovdb/serialize.js +439 -0
  436. package/dist/tools/nanovdb/serialize.js.map +1 -0
  437. package/dist/tools/nanovdb/stats.d.ts +87 -0
  438. package/dist/tools/nanovdb/stats.js +225 -0
  439. package/dist/tools/nanovdb/stats.js.map +1 -0
  440. package/dist/tools/nanovdb/transform.d.ts +30 -0
  441. package/dist/tools/nanovdb/transform.js +94 -0
  442. package/dist/tools/nanovdb/transform.js.map +1 -0
  443. package/dist/tools/nanovdb/tree.d.ts +186 -0
  444. package/dist/tools/nanovdb/tree.js +530 -0
  445. package/dist/tools/nanovdb/tree.js.map +1 -0
  446. package/dist/tools/nanovdb/write-nvdb.d.ts +74 -0
  447. package/dist/tools/nanovdb/write-nvdb.js +290 -0
  448. package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
  449. package/dist/tools/nvdb-file.d.ts +265 -0
  450. package/dist/tools/nvdb-file.js +763 -0
  451. package/dist/tools/nvdb-file.js.map +1 -0
  452. package/dist/tools/nvdb-stream.d.ts +154 -0
  453. package/dist/tools/nvdb-stream.js +409 -0
  454. package/dist/tools/nvdb-stream.js.map +1 -0
  455. package/dist/tools/reference/analytic.d.ts +41 -0
  456. package/dist/tools/reference/analytic.js +95 -0
  457. package/dist/tools/reference/analytic.js.map +1 -0
  458. package/dist/tools/reference/environment.d.ts +62 -0
  459. package/dist/tools/reference/environment.js +154 -0
  460. package/dist/tools/reference/environment.js.map +1 -0
  461. package/dist/tools/reference/index.d.ts +12 -0
  462. package/dist/tools/reference/index.js +13 -0
  463. package/dist/tools/reference/index.js.map +1 -0
  464. package/dist/tools/reference/media.d.ts +14 -0
  465. package/dist/tools/reference/media.js +30 -0
  466. package/dist/tools/reference/media.js.map +1 -0
  467. package/dist/tools/reference/rng.d.ts +20 -0
  468. package/dist/tools/reference/rng.js +30 -0
  469. package/dist/tools/reference/rng.js.map +1 -0
  470. package/dist/tools/reference/scene.d.ts +312 -0
  471. package/dist/tools/reference/scene.js +169 -0
  472. package/dist/tools/reference/scene.js.map +1 -0
  473. package/dist/tools/reference/tables.d.ts +98 -0
  474. package/dist/tools/reference/tables.js +264 -0
  475. package/dist/tools/reference/tables.js.map +1 -0
  476. package/dist/tools/reference/trace.d.ts +160 -0
  477. package/dist/tools/reference/trace.js +497 -0
  478. package/dist/tools/reference/trace.js.map +1 -0
  479. package/dist/tools/vdb/bit-utils.d.ts +20 -0
  480. package/dist/tools/vdb/bit-utils.js +42 -0
  481. package/dist/tools/vdb/bit-utils.js.map +1 -0
  482. package/dist/tools/vdb/blosc-write.d.ts +43 -0
  483. package/dist/tools/vdb/blosc-write.js +197 -0
  484. package/dist/tools/vdb/blosc-write.js.map +1 -0
  485. package/dist/tools/vdb/blosc.d.ts +86 -0
  486. package/dist/tools/vdb/blosc.js +287 -0
  487. package/dist/tools/vdb/blosc.js.map +1 -0
  488. package/dist/tools/vdb/blosclz.d.ts +33 -0
  489. package/dist/tools/vdb/blosclz.js +112 -0
  490. package/dist/tools/vdb/blosclz.js.map +1 -0
  491. package/dist/tools/vdb/byte-reader.d.ts +50 -0
  492. package/dist/tools/vdb/byte-reader.js +161 -0
  493. package/dist/tools/vdb/byte-reader.js.map +1 -0
  494. package/dist/tools/vdb/compression.d.ts +81 -0
  495. package/dist/tools/vdb/compression.js +260 -0
  496. package/dist/tools/vdb/compression.js.map +1 -0
  497. package/dist/tools/vdb/errors.d.ts +10 -0
  498. package/dist/tools/vdb/errors.js +11 -0
  499. package/dist/tools/vdb/errors.js.map +1 -0
  500. package/dist/tools/vdb/grid.d.ts +37 -0
  501. package/dist/tools/vdb/grid.js +153 -0
  502. package/dist/tools/vdb/grid.js.map +1 -0
  503. package/dist/tools/vdb/half-float.d.ts +9 -0
  504. package/dist/tools/vdb/half-float.js +24 -0
  505. package/dist/tools/vdb/half-float.js.map +1 -0
  506. package/dist/tools/vdb/index.d.ts +4 -0
  507. package/dist/tools/vdb/index.js +3 -0
  508. package/dist/tools/vdb/index.js.map +1 -0
  509. package/dist/tools/vdb/inflate.d.ts +24 -0
  510. package/dist/tools/vdb/inflate.js +334 -0
  511. package/dist/tools/vdb/inflate.js.map +1 -0
  512. package/dist/tools/vdb/lz4.d.ts +30 -0
  513. package/dist/tools/vdb/lz4.js +228 -0
  514. package/dist/tools/vdb/lz4.js.map +1 -0
  515. package/dist/tools/vdb/metadata.d.ts +17 -0
  516. package/dist/tools/vdb/metadata.js +72 -0
  517. package/dist/tools/vdb/metadata.js.map +1 -0
  518. package/dist/tools/vdb/parse.d.ts +47 -0
  519. package/dist/tools/vdb/parse.js +241 -0
  520. package/dist/tools/vdb/parse.js.map +1 -0
  521. package/dist/tools/vdb/point-render-data.d.ts +79 -0
  522. package/dist/tools/vdb/point-render-data.js +137 -0
  523. package/dist/tools/vdb/point-render-data.js.map +1 -0
  524. package/dist/tools/vdb/points.d.ts +186 -0
  525. package/dist/tools/vdb/points.js +835 -0
  526. package/dist/tools/vdb/points.js.map +1 -0
  527. package/dist/tools/vdb/transform.d.ts +23 -0
  528. package/dist/tools/vdb/transform.js +54 -0
  529. package/dist/tools/vdb/transform.js.map +1 -0
  530. package/dist/tools/vdb/tree.d.ts +111 -0
  531. package/dist/tools/vdb/tree.js +228 -0
  532. package/dist/tools/vdb/tree.js.map +1 -0
  533. package/dist/tools/vdb/types.d.ts +195 -0
  534. package/dist/tools/vdb/types.js +3 -0
  535. package/dist/tools/vdb/types.js.map +1 -0
  536. package/dist/tools/wvdb/bake.d.ts +145 -0
  537. package/dist/tools/wvdb/bake.js +361 -0
  538. package/dist/tools/wvdb/bake.js.map +1 -0
  539. package/dist/tools/wvdb/dense.d.ts +191 -0
  540. package/dist/tools/wvdb/dense.js +368 -0
  541. package/dist/tools/wvdb/dense.js.map +1 -0
  542. package/dist/tools/wvdb/format.d.ts +220 -0
  543. package/dist/tools/wvdb/format.js +306 -0
  544. package/dist/tools/wvdb/format.js.map +1 -0
  545. package/dist/tools/wvdb/index.d.ts +14 -0
  546. package/dist/tools/wvdb/index.js +15 -0
  547. package/dist/tools/wvdb/index.js.map +1 -0
  548. package/dist/tools/wvdb/level-set.d.ts +56 -0
  549. package/dist/tools/wvdb/level-set.js +153 -0
  550. package/dist/tools/wvdb/level-set.js.map +1 -0
  551. package/dist/tools/wvdb/nanovdb.d.ts +59 -0
  552. package/dist/tools/wvdb/nanovdb.js +64 -0
  553. package/dist/tools/wvdb/nanovdb.js.map +1 -0
  554. package/dist/tools/wvdb/partial.d.ts +74 -0
  555. package/dist/tools/wvdb/partial.js +233 -0
  556. package/dist/tools/wvdb/partial.js.map +1 -0
  557. package/dist/tools/wvdb/read.d.ts +336 -0
  558. package/dist/tools/wvdb/read.js +766 -0
  559. package/dist/tools/wvdb/read.js.map +1 -0
  560. package/dist/tools/wvdb/sha256.d.ts +7 -0
  561. package/dist/tools/wvdb/sha256.js +76 -0
  562. package/dist/tools/wvdb/sha256.js.map +1 -0
  563. package/dist/tools/wvdb/write.d.ts +149 -0
  564. package/dist/tools/wvdb/write.js +403 -0
  565. package/dist/tools/wvdb/write.js.map +1 -0
  566. package/package.json +83 -4
  567. package/vendor/LICENSE +201 -0
  568. package/vendor/NOTICE +19 -0
  569. package/vendor/VENDOR.md +100 -0
  570. package/vendor/pnanovdb.wgsl +1577 -0
@@ -0,0 +1,276 @@
1
+ /**
2
+ * Uniform structs of the core frame renderer (K6.1, design §3.1, §5.1): one field list per struct
3
+ * generates both the WGSL struct text and the TypeScript packer, so the two cannot disagree (a unit
4
+ * test checks the offsets against WGSL's uniform layout rules).
5
+ *
6
+ * Spectral (K6.4) uses `VdbFrameUniforms.spectral` (the former reserved vector), the volume's `extinctionSpectrum` and
7
+ * the transmittance origins of 3 targets per slot group (the array grew from 16 to 48 entries, at the end of its block).
8
+ */
9
+ import { VDB_FRAME_AMBIENT_MAX_PAIRS } from "../../tools/frame/ambient.js";
10
+ const ALIGN = { f32: 4, u32: 4, i32: 4, vec2f: 8, vec2u: 8, vec3f: 16, vec3u: 16, vec4f: 16, vec4u: 16, mat4x4f: 16 };
11
+ const SIZE = { f32: 4, u32: 4, i32: 4, vec2f: 8, vec2u: 8, vec3f: 12, vec3u: 12, vec4f: 16, vec4u: 16, mat4x4f: 64 };
12
+ const INTEGER = new Set(["u32", "i32", "vec2u", "vec3u", "vec4u"]);
13
+ const roundUp = (n, a) => Math.ceil(n / a) * a;
14
+ /**
15
+ * Lays out `fields` by WGSL's uniform address-space rules and returns the struct.
16
+ *
17
+ * @param name The WGSL struct name.
18
+ * @param fields The fields in order.
19
+ * @param size A fixed byte size (padding added at the end; throws if the fields do not fit).
20
+ */
21
+ export function vdbUniformStruct(name, fields, size) {
22
+ const out = new Map();
23
+ const lines = [];
24
+ let offset = 0;
25
+ for (const f of fields) {
26
+ const count = f.count ?? 1;
27
+ if (f.count !== undefined && ALIGN[f.type] < 16)
28
+ throw new Error(`${name}.${f.name}: uniform arrays need 16-byte elements`);
29
+ const align = ALIGN[f.type];
30
+ const stride = f.count !== undefined ? roundUp(SIZE[f.type], 16) : SIZE[f.type];
31
+ offset = roundUp(offset, align);
32
+ out.set(f.name, { name: f.name, type: f.type, count, offset, stride });
33
+ lines.push(` ${f.name}: ${f.count !== undefined ? `array<${f.type}, ${f.count}>` : f.type},`);
34
+ offset += f.count !== undefined ? stride * count : SIZE[f.type];
35
+ }
36
+ let total = roundUp(offset, 16);
37
+ if (size !== undefined) {
38
+ if (total > size)
39
+ throw new Error(`${name}: ${total} bytes of fields exceed the fixed ${size}`);
40
+ let pad = 0;
41
+ for (let at = total; at < size; at += 16)
42
+ lines.push(` pad${pad++}: vec4f,`);
43
+ total = size;
44
+ }
45
+ return { name, size: total, fields: out, wgsl: `struct ${name} {\n${lines.join("\n")}\n};\n` };
46
+ }
47
+ /** A packer over one ArrayBuffer: writes fields of structs at a base offset. */
48
+ export class VDBUniformWriter {
49
+ buffer;
50
+ f32;
51
+ u32;
52
+ i32;
53
+ constructor(bytes) {
54
+ this.buffer = new ArrayBuffer(bytes);
55
+ this.f32 = new Float32Array(this.buffer);
56
+ this.u32 = new Uint32Array(this.buffer);
57
+ this.i32 = new Int32Array(this.buffer);
58
+ }
59
+ /**
60
+ * Writes `value` into field `name` of struct `s` at byte `base` (array fields: `value` holds all elements
61
+ * back to back, each the type's component count; mat4x4f takes 16 numbers column-major).
62
+ */
63
+ set(s, base, name, value) {
64
+ const slot = s.fields.get(name);
65
+ if (!slot)
66
+ throw new Error(`${s.name} has no field ${name}`);
67
+ const comps = SIZE[slot.type] / 4;
68
+ const values = typeof value === "number" ? [value] : value;
69
+ const view = slot.type === "i32" ? this.i32 : INTEGER.has(slot.type) ? this.u32 : this.f32;
70
+ const elements = Math.min(slot.count, Math.ceil(values.length / comps));
71
+ for (let e = 0; e < elements; e++) {
72
+ const at = (base + slot.offset + e * slot.stride) / 4;
73
+ for (let c = 0; c < comps; c++) {
74
+ const v = values[e * comps + c];
75
+ if (v !== undefined)
76
+ view[at + c] = v;
77
+ }
78
+ }
79
+ }
80
+ /** Zeroes `bytes` from `base`. */
81
+ clear(base, bytes) {
82
+ new Uint8Array(this.buffer, base, bytes).fill(0);
83
+ }
84
+ }
85
+ /** Most visible volumes per update (64 KiB of 512-byte records; compat devices bind 16 KiB: 32). */
86
+ export const VDB_FRAME_MAX_VOLUMES = 128;
87
+ /** Bytes of one volume record. */
88
+ export const VDB_FRAME_VOLUME_BYTES = 512;
89
+ /** Dynamic-offset stride of the group records (`minUniformBufferOffsetAlignment` ≤ 256). */
90
+ export const VDB_FRAME_GROUP_STRIDE = 256;
91
+ /** Most scene lights (his `frameMaxLights`). */
92
+ export const VDB_FRAME_MAX_LIGHTS = 16;
93
+ /** Most hemisphere lights (his `frameMaxHemisphereLights`). */
94
+ export const VDB_FRAME_MAX_HEMISPHERE_LIGHTS = 4;
95
+ /** Most shadow grid cascades (his `frameMaxShadowCascades`). */
96
+ export const VDB_FRAME_MAX_CASCADES = 4;
97
+ /** Light slots of the 'frame' transmittance (his `frameShadowLightSlots`). */
98
+ export const VDB_FRAME_SHADOW_SLOTS = 6;
99
+ /** K6.4: spectral slot groups (his `frameSpectralGroupCount`): group 0 sky + slot 0, group g slots 2g − 1, 2g. */
100
+ export const VDB_FRAME_SPECTRAL_GROUPS = 4;
101
+ /**
102
+ * K6.Q1d: where the pairs' dipole targets sit in `transmittanceOrigin` (after every slot-group entry): grey cascade c at
103
+ * [48 + c], spectral channel k of cascade c at [48 + 3c + k]. Allocated only while a gather reads them
104
+ * (K6.Q1d-a, `vdbFrameDipoleTargetsWanted`).
105
+ */
106
+ export const VDB_FRAME_DIPOLE_ORIGIN = 3 * VDB_FRAME_SPECTRAL_GROUPS * VDB_FRAME_MAX_CASCADES;
107
+ /** K6.5b: host occluder maps bound per kernel (fixed slots; placeholders fill the empty ones). */
108
+ export const VDB_FRAME_MAX_OCCLUDERS = 4;
109
+ /** K6.5b: layers per occluder map (cascades or a cube's 6 faces). */
110
+ export const VDB_FRAME_OCCLUDER_LAYERS = 6;
111
+ /** Group 0 binding 0: camera, froxel layout, areas, jitter, fade, temporal and composite values. */
112
+ export const VDB_FRAME_UNIFORMS = vdbUniformStruct("VdbFrameUniforms", [
113
+ // view → world; the inverse projection reconstructs the froxel rays and the composite's view depth
114
+ { name: "cameraWorld", type: "mat4x4f" },
115
+ { name: "projectionInverse", type: "mat4x4f" },
116
+ // temporal: the previous frame's world → view, projection and froxel range
117
+ { name: "previousView", type: "mat4x4f" },
118
+ { name: "previousProjection", type: "mat4x4f" },
119
+ // W, H, D and his atlas columns (the noise's virtual atlas coordinate)
120
+ { name: "grid", type: "vec4f" },
121
+ // near, far of the slices; previous near, far
122
+ { name: "range", type: "vec4f" },
123
+ // this frame's froxel area: rect cells (x0, y0, x1, y1), slices (first, end)
124
+ { name: "areaRect", type: "vec4f" },
125
+ { name: "areaSlices", type: "vec4f" },
126
+ // the dispatch box: origin x, y and size w, h in cells (the union of this area and what was written before)
127
+ { name: "dispatchBox", type: "vec4u" },
128
+ // jitter (< 0: off), fade radius (0: off), temporal blend, use history (0/1)
129
+ { name: "jitterFade", type: "vec4f" },
130
+ // sub-steps, temporal on, composite flags (bit 0 reversed depth, bit 1 orthographic), spare
131
+ { name: "flags", type: "vec4u" },
132
+ // composite: screen size in pixels, clamp colours (0/1), spare
133
+ { name: "screen", type: "vec4f" },
134
+ // composite: the camera's near and far (three's depth → view Z), spare
135
+ { name: "camera", type: "vec4f" },
136
+ // K6.3: octaves (count, a, b, c)
137
+ { name: "octaves", type: "vec4f" },
138
+ // K6.4: spectral (0/1), spectral slot groups in use (1–4; the transmittance stack holds 3 per group and cascade); K7.4c: the
139
+ // scattered light's exit (internal msExit: 0 isotropic, 1 dipole, 2 hg, 3 hg-chroma); spare
140
+ { name: "spectral", type: "vec4f" },
141
+ // K6.2 'frame' lighting: the world shadow grid cascades (his createGridUniforms; xyz, w unused)
142
+ { name: "gridMin", type: "vec4f", count: VDB_FRAME_MAX_CASCADES },
143
+ { name: "gridSize", type: "vec4f", count: VDB_FRAME_MAX_CASCADES },
144
+ { name: "gridVoxel", type: "vec4f", count: VDB_FRAME_MAX_CASCADES },
145
+ // cascade count, resolution R (voxels per side), his grid atlas columns (the noise coordinate), scene shadow slots
146
+ { name: "gridLayout", type: "vec4f" },
147
+ // texel origin of cascade c in the shadow grid stack (a stacked 3D texture, design §3.2)
148
+ { name: "shadowOrigin", type: "vec4f", count: VDB_FRAME_MAX_CASCADES },
149
+ // texel origin of transmittance target k of cascade c, at [4c + k], in the transmittance stack; K6.4 spectral: target k
150
+ // of slot group g of cascade c at [3 (g C + c) + k] (C the cascade count); K6.Q1d: the dipole targets from
151
+ // VDB_FRAME_DIPOLE_ORIGIN (grey [48 + c], spectral [48 + 3c + k])
152
+ { name: "transmittanceOrigin", type: "vec4f", count: VDB_FRAME_DIPOLE_ORIGIN + 3 * VDB_FRAME_MAX_CASCADES },
153
+ // multiple scattering (1 − g or 0), two-sided (0/1; K6.3), use shadows (0/1), diffusion (0/1)
154
+ { name: "lighting", type: "vec4f" },
155
+ // the renderer's 'frame' phase (forward g, back g, back weight, Lorenz-Mie mode) and its spectrum (red, blue g scale, flag)
156
+ { name: "framePhase", type: "vec4f" },
157
+ { name: "framePhaseSpectrum", type: "vec4f" },
158
+ // K6.2b: environment slot in use (0/1), first environment-grid light (= the slot flag), the environment grid holds
159
+ // this frame's lights (0/1), an environment is given (0/1)
160
+ { name: "environment", type: "vec4f" },
161
+ ]);
162
+ /** Group 0 binding 1: the scene lights (his light uniforms), in slot order directional, point, spot. */
163
+ export const VDB_FRAME_LIGHTS = vdbUniformStruct("VdbFrameLights", [
164
+ // ambient rgb, hemisphere count
165
+ { name: "ambient", type: "vec4f" },
166
+ // scene light count, K6.5b occluder maps bound (0: occlusion off), K6.Q1 shadowed-ambient direction pairs (0: off),
167
+ // K6.Q1 'volume' march steps of each ambient direction (0: the volume's shadow steps)
168
+ { name: "counts", type: "vec4u" },
169
+ // light probe SH9 (rgb in xyz)
170
+ { name: "probe", type: "vec4f", count: 9 },
171
+ { name: "hemiSky", type: "vec4f", count: VDB_FRAME_MAX_HEMISPHERE_LIGHTS },
172
+ { name: "hemiGround", type: "vec4f", count: VDB_FRAME_MAX_HEMISPHERE_LIGHTS },
173
+ { name: "hemiUp", type: "vec4f", count: VDB_FRAME_MAX_HEMISPHERE_LIGHTS },
174
+ // his records: position (w 1 directional: xyz toward the light, 2 point, 3 spot), colour (w penumbra cos),
175
+ // spot (xyz target → light, w cone cos), falloff (distance, decay, K6.5b occluder slot + 1 (0: none))
176
+ { name: "position", type: "vec4f", count: VDB_FRAME_MAX_LIGHTS },
177
+ { name: "color", type: "vec4f", count: VDB_FRAME_MAX_LIGHTS },
178
+ { name: "spot", type: "vec4f", count: VDB_FRAME_MAX_LIGHTS },
179
+ { name: "falloff", type: "vec4f", count: VDB_FRAME_MAX_LIGHTS },
180
+ // K6.2 'frame' lighting: the sky direction (his frameSkyDirection: the first hemisphere light's up, else +y) and the
181
+ // sums of every hemisphere light's sky and ground colours (his frameHemiSkyColor / frameHemiGroundColor). K7.15: sky.w
182
+ // 1 when something reads the sky up / down transmittance (ambient-class light, the 'outward' environment), else 0 (the
183
+ // transmittance pass skips those marches; the AO pairs march them anyway)
184
+ { name: "sky", type: "vec4f" },
185
+ { name: "hemiSkySum", type: "vec4f" },
186
+ { name: "hemiGroundSum", type: "vec4f" },
187
+ // K6.5b occluder maps (slot k): layers, bias, reversed depth (0/1), nearest filter (0/1)
188
+ { name: "occluderInfo", type: "vec4f", count: VDB_FRAME_MAX_OCCLUDERS },
189
+ // the view-projection of layer l of slot k at [6k + l] (column-major, WebGPU depth)
190
+ { name: "occluderMatrix", type: "mat4x4f", count: VDB_FRAME_MAX_OCCLUDERS * VDB_FRAME_OCCLUDER_LAYERS },
191
+ // K6.Q1: the upper direction of each shadowed-ambient pair (world, unit; [0] the sky direction; tools/frame
192
+ // vdbFrameAmbientDirections)
193
+ { name: "ambientDirections", type: "vec4f", count: VDB_FRAME_AMBIENT_MAX_PAIRS },
194
+ // K6.Q1c: the rows of M+ / 2 of the pairs' dipole fit (xyz; tools/frame vdbFrameAmbientDipoleMatrix); [0].w the phase
195
+ // weight's mode (internal `ambientPhase`: 0 'isotropic', 1 'dipole' (not on diffusion totals)); K6.Q1d / K6.Q1d-a:
196
+ // [1].w 1 while 'frame' lighting's stack holds the dipole targets and a gather reads them (the transmittance pass
197
+ // stores b, the gather weights the non-diffusion visibilities), else 0
198
+ { name: "ambientDipole", type: "vec4f", count: 3 },
199
+ ]);
200
+ /** One volume record (512 B) in the `VdbFrameVolumes` array (group 1). */
201
+ export const VDB_FRAME_VOLUME = vdbUniformStruct("VdbFrameVolume", [
202
+ { name: "viewToLocal", type: "mat4x4f" },
203
+ { name: "localToView", type: "mat4x4f" },
204
+ { name: "worldToLocal", type: "mat4x4f" },
205
+ // the volume's froxel rect (cells) and slices
206
+ { name: "rect", type: "vec4f" },
207
+ // first slice, slice count, source slot v, lights bitmask
208
+ { name: "slices", type: "vec4u" },
209
+ // scatter colour, opacity
210
+ { name: "scatterOpacity", type: "vec4f" },
211
+ // base colour (albedo), extinction
212
+ { name: "baseExtinction", type: "vec4f" },
213
+ // offset3D, wrap (0 clamp, 1 repeat, 2 mirror) as f32
214
+ { name: "offsetWrap", type: "vec4f" },
215
+ // (forward g, back g, back weight, Lorenz-Mie mode)
216
+ { name: "phase", type: "vec4f" },
217
+ // (red g scale, blue g scale, flag), multiple scattering (1 − g, or 0)
218
+ { name: "phaseSpectrumMs", type: "vec4f" },
219
+ // densityScale (normalized), densityCutoff, worldScale, absorbance
220
+ { name: "density", type: "vec4f" },
221
+ // emissiveIntensity, temperature min, max, lod levels the read may use (mipmaps ? levels : 0)
222
+ { name: "emission", type: "vec4f" },
223
+ // shadow steps, mipmaps (0/1), hdda (0/1), K6.5 emission colour code (bits 0-1: 0 white, 1 LUT row, 2 user hook; bits 2+: row)
224
+ { name: "march", type: "vec4u" },
225
+ // K6.4: extinction spectrum (rgb), spare
226
+ { name: "extinctionSpectrum", type: "vec4f" },
227
+ ], VDB_FRAME_VOLUME_BYTES);
228
+ /** One source group's record (group 1, dynamic offset, {@link VDB_FRAME_GROUP_STRIDE}). */
229
+ export const VDB_FRAME_GROUP = vdbUniformStruct("VdbFrameGroup", [
230
+ // first volume record, count, role (bit 0 first group, bit 1 last group), group index
231
+ { name: "range", type: "vec4u" },
232
+ // K6.2: the group's shadow casters (first record, count, role among the caster groups, caster group index)
233
+ { name: "casters", type: "vec4u" },
234
+ ]);
235
+ /** Most environment lights in the environment buffer (his `frameMaxEnvironmentLights`). */
236
+ export const VDB_FRAME_MAX_ENVIRONMENT_LIGHTS = 12;
237
+ /**
238
+ * Group 0 binding 3 (K6.2b): the environment buffer. `envReduce` writes it as storage; every later kernel binds it as
239
+ * a uniform (design §3.1, §3.5). No CPU readback.
240
+ */
241
+ export const VDB_FRAME_ENVIRONMENT = vdbUniformStruct("VdbFrameEnvironment", [
242
+ // light count, mode (0 'outward', 1 'directional', 2 'spherical-harmonics'), valid (an environment with finite,
243
+ // positive energy: 0/1), spare
244
+ { name: "info", type: "vec4u" },
245
+ // SH9 radiance coefficients of the environment × intensity (three's basis; irradiance by vdbFrameEnvIrradiance)
246
+ { name: "sh", type: "vec4f", count: 9 },
247
+ // the lights: world direction toward the light, colour (his energy / 4 × intensity)
248
+ { name: "direction", type: "vec4f", count: VDB_FRAME_MAX_ENVIRONMENT_LIGHTS },
249
+ { name: "color", type: "vec4f", count: VDB_FRAME_MAX_ENVIRONMENT_LIGHTS },
250
+ ]);
251
+ /** Group 0 binding 0 of the environment kernels (`envPrefilter`, `envBlur`, `envReduce`; K6.2b). */
252
+ export const VDB_FRAME_ENV_PARAMS = vdbUniformStruct("VdbFrameEnvParams", [
253
+ // the rows of R (world → map; a rotation, or a rotation with a reflection)
254
+ { name: "rotation", type: "vec4f", count: 3 },
255
+ // source width, height, projection (0 equirect, 1 cube), cube sub-samples per axis
256
+ { name: "source", type: "vec4u" },
257
+ // mode code, environmentSamples, environmentShOrder, pairs (0/1)
258
+ { name: "settings", type: "vec4f" },
259
+ // intensity, spare
260
+ { name: "scale", type: "vec4f" },
261
+ ]);
262
+ /**
263
+ * The WGSL of the frame structs and the group-0 bindings every frame kernel declares; `environment` adds the
264
+ * environment buffer (binding 3; the layout always has it).
265
+ */
266
+ export function vdbFrameUniformsWgsl(maxVolumes = VDB_FRAME_MAX_VOLUMES, o = {}) {
267
+ const env = o.environment ? `${VDB_FRAME_ENVIRONMENT.wgsl}@group(0) @binding(3) var<uniform> vdbFrameEnv: VdbFrameEnvironment;\n` : "";
268
+ return `${VDB_FRAME_UNIFORMS.wgsl}${VDB_FRAME_LIGHTS.wgsl}${VDB_FRAME_VOLUME.wgsl}struct VdbFrameVolumes {
269
+ v: array<VdbFrameVolume, ${maxVolumes}>,
270
+ };
271
+ ${VDB_FRAME_GROUP.wgsl}@group(0) @binding(0) var<uniform> vdbFrame: VdbFrameUniforms;
272
+ @group(0) @binding(1) var<uniform> vdbFrameLights: VdbFrameLights;
273
+ @group(0) @binding(2) var vdbFrameLinear: sampler;
274
+ ${env}`;
275
+ }
276
+ //# sourceMappingURL=uniforms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uniforms.js","sourceRoot":"","sources":["../../../src/core/frame/uniforms.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AA8B3E,MAAM,KAAK,GAAmC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACtJ,MAAM,IAAI,GAAmC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACrJ,MAAM,OAAO,GAAG,IAAI,GAAG,CAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EA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,OAAO,EAAE;CACjC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAU,GAAG,qBAAqB,EAAE,IAA+B,EAAE;IACxG,MAAM,GAAG,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,IAAI,wEAAwE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvI,OAAO,GAAG,kBAAkB,CAAC,IAAI,GAAG,gBAAgB,CAAC,IAAI,GAAG,gBAAgB,CAAC,IAAI;6BACtD,UAAU;;EAErC,eAAe,CAAC,IAAI;;;EAGpB,GAAG,EAAE,CAAC;AACR,CAAC","sourcesContent":["/**\n * Uniform structs of the core frame renderer (K6.1, design §3.1, §5.1): one field list per struct\n * generates both the WGSL struct text and the TypeScript packer, so the two cannot disagree (a unit\n * test checks the offsets against WGSL's uniform layout rules).\n *\n * Spectral (K6.4) uses `VdbFrameUniforms.spectral` (the former reserved vector), the volume's `extinctionSpectrum` and\n * the transmittance origins of 3 targets per slot group (the array grew from 16 to 48 entries, at the end of its block).\n */\n\nimport { VDB_FRAME_AMBIENT_MAX_PAIRS } from \"../../tools/frame/ambient.js\";\n\n/** Field types the generator supports. Arrays take only 16-byte-aligned element types (uniform rule). */\nexport type VDBUniformType = \"f32\" | \"u32\" | \"i32\" | \"vec2f\" | \"vec2u\" | \"vec3f\" | \"vec3u\" | \"vec4f\" | \"vec4u\" | \"mat4x4f\";\n\n/** One field: name, type, optional array length. */\nexport interface VDBUniformField {\n readonly name: string;\n readonly type: VDBUniformType;\n readonly count?: number;\n}\n\n/** A field with its byte offset. */\nexport interface VDBUniformSlot {\n readonly name: string;\n readonly type: VDBUniformType;\n readonly count: number;\n readonly offset: number;\n /** Bytes between array elements (the element size for one value). */\n readonly stride: number;\n}\n\n/** A generated struct: its WGSL, byte size and field offsets. */\nexport interface VDBUniformStruct {\n readonly name: string;\n readonly size: number;\n readonly fields: ReadonlyMap<string, VDBUniformSlot>;\n readonly wgsl: string;\n}\n\nconst ALIGN: Record<VDBUniformType, number> = { f32: 4, u32: 4, i32: 4, vec2f: 8, vec2u: 8, vec3f: 16, vec3u: 16, vec4f: 16, vec4u: 16, mat4x4f: 16 };\nconst SIZE: Record<VDBUniformType, number> = { f32: 4, u32: 4, i32: 4, vec2f: 8, vec2u: 8, vec3f: 12, vec3u: 12, vec4f: 16, vec4u: 16, mat4x4f: 64 };\nconst INTEGER = new Set<VDBUniformType>([\"u32\", \"i32\", \"vec2u\", \"vec3u\", \"vec4u\"]);\n\nconst roundUp = (n: number, a: number) => Math.ceil(n / a) * a;\n\n/**\n * Lays out `fields` by WGSL's uniform address-space rules and returns the struct.\n *\n * @param name The WGSL struct name.\n * @param fields The fields in order.\n * @param size A fixed byte size (padding added at the end; throws if the fields do not fit).\n */\nexport function vdbUniformStruct(name: string, fields: readonly VDBUniformField[], size?: number): VDBUniformStruct {\n const out = new Map<string, VDBUniformSlot>();\n const lines: string[] = [];\n let offset = 0;\n for (const f of fields) {\n const count = f.count ?? 1;\n if (f.count !== undefined && ALIGN[f.type] < 16) throw new Error(`${name}.${f.name}: uniform arrays need 16-byte elements`);\n const align = ALIGN[f.type];\n const stride = f.count !== undefined ? roundUp(SIZE[f.type], 16) : SIZE[f.type];\n offset = roundUp(offset, align);\n out.set(f.name, { name: f.name, type: f.type, count, offset, stride });\n lines.push(` ${f.name}: ${f.count !== undefined ? `array<${f.type}, ${f.count}>` : f.type},`);\n offset += f.count !== undefined ? stride * count : SIZE[f.type];\n }\n let total = roundUp(offset, 16);\n if (size !== undefined) {\n if (total > size) throw new Error(`${name}: ${total} bytes of fields exceed the fixed ${size}`);\n let pad = 0;\n for (let at = total; at < size; at += 16) lines.push(` pad${pad++}: vec4f,`);\n total = size;\n }\n return { name, size: total, fields: out, wgsl: `struct ${name} {\\n${lines.join(\"\\n\")}\\n};\\n` };\n}\n\n/** A packer over one ArrayBuffer: writes fields of structs at a base offset. */\nexport class VDBUniformWriter {\n readonly buffer: ArrayBuffer;\n readonly f32: Float32Array;\n readonly u32: Uint32Array;\n readonly i32: Int32Array;\n\n constructor(bytes: number) {\n this.buffer = new ArrayBuffer(bytes);\n this.f32 = new Float32Array(this.buffer);\n this.u32 = new Uint32Array(this.buffer);\n this.i32 = new Int32Array(this.buffer);\n }\n\n /**\n * Writes `value` into field `name` of struct `s` at byte `base` (array fields: `value` holds all elements\n * back to back, each the type's component count; mat4x4f takes 16 numbers column-major).\n */\n set(s: VDBUniformStruct, base: number, name: string, value: number | ArrayLike<number>): void {\n const slot = s.fields.get(name);\n if (!slot) throw new Error(`${s.name} has no field ${name}`);\n const comps = SIZE[slot.type] / 4;\n const values = typeof value === \"number\" ? [value] : value;\n const view = slot.type === \"i32\" ? this.i32 : INTEGER.has(slot.type) ? this.u32 : this.f32;\n const elements = Math.min(slot.count, Math.ceil(values.length / comps));\n for (let e = 0; e < elements; e++) {\n const at = (base + slot.offset + e * slot.stride) / 4;\n for (let c = 0; c < comps; c++) {\n const v = values[e * comps + c];\n if (v !== undefined) view[at + c] = v;\n }\n }\n }\n\n /** Zeroes `bytes` from `base`. */\n clear(base: number, bytes: number): void {\n new Uint8Array(this.buffer, base, bytes).fill(0);\n }\n}\n\n/** Most visible volumes per update (64 KiB of 512-byte records; compat devices bind 16 KiB: 32). */\nexport const VDB_FRAME_MAX_VOLUMES = 128;\n/** Bytes of one volume record. */\nexport const VDB_FRAME_VOLUME_BYTES = 512;\n/** Dynamic-offset stride of the group records (`minUniformBufferOffsetAlignment` ≤ 256). */\nexport const VDB_FRAME_GROUP_STRIDE = 256;\n/** Most scene lights (his `frameMaxLights`). */\nexport const VDB_FRAME_MAX_LIGHTS = 16;\n/** Most hemisphere lights (his `frameMaxHemisphereLights`). */\nexport const VDB_FRAME_MAX_HEMISPHERE_LIGHTS = 4;\n/** Most shadow grid cascades (his `frameMaxShadowCascades`). */\nexport const VDB_FRAME_MAX_CASCADES = 4;\n/** Light slots of the 'frame' transmittance (his `frameShadowLightSlots`). */\nexport const VDB_FRAME_SHADOW_SLOTS = 6;\n/** K6.4: spectral slot groups (his `frameSpectralGroupCount`): group 0 sky + slot 0, group g slots 2g − 1, 2g. */\nexport const VDB_FRAME_SPECTRAL_GROUPS = 4;\n/**\n * K6.Q1d: where the pairs' dipole targets sit in `transmittanceOrigin` (after every slot-group entry): grey cascade c at\n * [48 + c], spectral channel k of cascade c at [48 + 3c + k]. Allocated only while a gather reads them\n * (K6.Q1d-a, `vdbFrameDipoleTargetsWanted`).\n */\nexport const VDB_FRAME_DIPOLE_ORIGIN = 3 * VDB_FRAME_SPECTRAL_GROUPS * VDB_FRAME_MAX_CASCADES;\n/** K6.5b: host occluder maps bound per kernel (fixed slots; placeholders fill the empty ones). */\nexport const VDB_FRAME_MAX_OCCLUDERS = 4;\n/** K6.5b: layers per occluder map (cascades or a cube's 6 faces). */\nexport const VDB_FRAME_OCCLUDER_LAYERS = 6;\n\n/** Group 0 binding 0: camera, froxel layout, areas, jitter, fade, temporal and composite values. */\nexport const VDB_FRAME_UNIFORMS = vdbUniformStruct(\"VdbFrameUniforms\", [\n // view → world; the inverse projection reconstructs the froxel rays and the composite's view depth\n { name: \"cameraWorld\", type: \"mat4x4f\" },\n { name: \"projectionInverse\", type: \"mat4x4f\" },\n // temporal: the previous frame's world → view, projection and froxel range\n { name: \"previousView\", type: \"mat4x4f\" },\n { name: \"previousProjection\", type: \"mat4x4f\" },\n // W, H, D and his atlas columns (the noise's virtual atlas coordinate)\n { name: \"grid\", type: \"vec4f\" },\n // near, far of the slices; previous near, far\n { name: \"range\", type: \"vec4f\" },\n // this frame's froxel area: rect cells (x0, y0, x1, y1), slices (first, end)\n { name: \"areaRect\", type: \"vec4f\" },\n { name: \"areaSlices\", type: \"vec4f\" },\n // the dispatch box: origin x, y and size w, h in cells (the union of this area and what was written before)\n { name: \"dispatchBox\", type: \"vec4u\" },\n // jitter (< 0: off), fade radius (0: off), temporal blend, use history (0/1)\n { name: \"jitterFade\", type: \"vec4f\" },\n // sub-steps, temporal on, composite flags (bit 0 reversed depth, bit 1 orthographic), spare\n { name: \"flags\", type: \"vec4u\" },\n // composite: screen size in pixels, clamp colours (0/1), spare\n { name: \"screen\", type: \"vec4f\" },\n // composite: the camera's near and far (three's depth → view Z), spare\n { name: \"camera\", type: \"vec4f\" },\n // K6.3: octaves (count, a, b, c)\n { name: \"octaves\", type: \"vec4f\" },\n // K6.4: spectral (0/1), spectral slot groups in use (1–4; the transmittance stack holds 3 per group and cascade); K7.4c: the\n // scattered light's exit (internal msExit: 0 isotropic, 1 dipole, 2 hg, 3 hg-chroma); spare\n { name: \"spectral\", type: \"vec4f\" },\n // K6.2 'frame' lighting: the world shadow grid cascades (his createGridUniforms; xyz, w unused)\n { name: \"gridMin\", type: \"vec4f\", count: VDB_FRAME_MAX_CASCADES },\n { name: \"gridSize\", type: \"vec4f\", count: VDB_FRAME_MAX_CASCADES },\n { name: \"gridVoxel\", type: \"vec4f\", count: VDB_FRAME_MAX_CASCADES },\n // cascade count, resolution R (voxels per side), his grid atlas columns (the noise coordinate), scene shadow slots\n { name: \"gridLayout\", type: \"vec4f\" },\n // texel origin of cascade c in the shadow grid stack (a stacked 3D texture, design §3.2)\n { name: \"shadowOrigin\", type: \"vec4f\", count: VDB_FRAME_MAX_CASCADES },\n // texel origin of transmittance target k of cascade c, at [4c + k], in the transmittance stack; K6.4 spectral: target k\n // of slot group g of cascade c at [3 (g C + c) + k] (C the cascade count); K6.Q1d: the dipole targets from\n // VDB_FRAME_DIPOLE_ORIGIN (grey [48 + c], spectral [48 + 3c + k])\n { name: \"transmittanceOrigin\", type: \"vec4f\", count: VDB_FRAME_DIPOLE_ORIGIN + 3 * VDB_FRAME_MAX_CASCADES },\n // multiple scattering (1 − g or 0), two-sided (0/1; K6.3), use shadows (0/1), diffusion (0/1)\n { name: \"lighting\", type: \"vec4f\" },\n // the renderer's 'frame' phase (forward g, back g, back weight, Lorenz-Mie mode) and its spectrum (red, blue g scale, flag)\n { name: \"framePhase\", type: \"vec4f\" },\n { name: \"framePhaseSpectrum\", type: \"vec4f\" },\n // K6.2b: environment slot in use (0/1), first environment-grid light (= the slot flag), the environment grid holds\n // this frame's lights (0/1), an environment is given (0/1)\n { name: \"environment\", type: \"vec4f\" },\n]);\n\n/** Group 0 binding 1: the scene lights (his light uniforms), in slot order directional, point, spot. */\nexport const VDB_FRAME_LIGHTS = vdbUniformStruct(\"VdbFrameLights\", [\n // ambient rgb, hemisphere count\n { name: \"ambient\", type: \"vec4f\" },\n // scene light count, K6.5b occluder maps bound (0: occlusion off), K6.Q1 shadowed-ambient direction pairs (0: off),\n // K6.Q1 'volume' march steps of each ambient direction (0: the volume's shadow steps)\n { name: \"counts\", type: \"vec4u\" },\n // light probe SH9 (rgb in xyz)\n { name: \"probe\", type: \"vec4f\", count: 9 },\n { name: \"hemiSky\", type: \"vec4f\", count: VDB_FRAME_MAX_HEMISPHERE_LIGHTS },\n { name: \"hemiGround\", type: \"vec4f\", count: VDB_FRAME_MAX_HEMISPHERE_LIGHTS },\n { name: \"hemiUp\", type: \"vec4f\", count: VDB_FRAME_MAX_HEMISPHERE_LIGHTS },\n // his records: position (w 1 directional: xyz toward the light, 2 point, 3 spot), colour (w penumbra cos),\n // spot (xyz target → light, w cone cos), falloff (distance, decay, K6.5b occluder slot + 1 (0: none))\n { name: \"position\", type: \"vec4f\", count: VDB_FRAME_MAX_LIGHTS },\n { name: \"color\", type: \"vec4f\", count: VDB_FRAME_MAX_LIGHTS },\n { name: \"spot\", type: \"vec4f\", count: VDB_FRAME_MAX_LIGHTS },\n { name: \"falloff\", type: \"vec4f\", count: VDB_FRAME_MAX_LIGHTS },\n // K6.2 'frame' lighting: the sky direction (his frameSkyDirection: the first hemisphere light's up, else +y) and the\n // sums of every hemisphere light's sky and ground colours (his frameHemiSkyColor / frameHemiGroundColor). K7.15: sky.w\n // 1 when something reads the sky up / down transmittance (ambient-class light, the 'outward' environment), else 0 (the\n // transmittance pass skips those marches; the AO pairs march them anyway)\n { name: \"sky\", type: \"vec4f\" },\n { name: \"hemiSkySum\", type: \"vec4f\" },\n { name: \"hemiGroundSum\", type: \"vec4f\" },\n // K6.5b occluder maps (slot k): layers, bias, reversed depth (0/1), nearest filter (0/1)\n { name: \"occluderInfo\", type: \"vec4f\", count: VDB_FRAME_MAX_OCCLUDERS },\n // the view-projection of layer l of slot k at [6k + l] (column-major, WebGPU depth)\n { name: \"occluderMatrix\", type: \"mat4x4f\", count: VDB_FRAME_MAX_OCCLUDERS * VDB_FRAME_OCCLUDER_LAYERS },\n // K6.Q1: the upper direction of each shadowed-ambient pair (world, unit; [0] the sky direction; tools/frame\n // vdbFrameAmbientDirections)\n { name: \"ambientDirections\", type: \"vec4f\", count: VDB_FRAME_AMBIENT_MAX_PAIRS },\n // K6.Q1c: the rows of M+ / 2 of the pairs' dipole fit (xyz; tools/frame vdbFrameAmbientDipoleMatrix); [0].w the phase\n // weight's mode (internal `ambientPhase`: 0 'isotropic', 1 'dipole' (not on diffusion totals)); K6.Q1d / K6.Q1d-a:\n // [1].w 1 while 'frame' lighting's stack holds the dipole targets and a gather reads them (the transmittance pass\n // stores b, the gather weights the non-diffusion visibilities), else 0\n { name: \"ambientDipole\", type: \"vec4f\", count: 3 },\n]);\n\n/** One volume record (512 B) in the `VdbFrameVolumes` array (group 1). */\nexport const VDB_FRAME_VOLUME = vdbUniformStruct(\n \"VdbFrameVolume\",\n [\n { name: \"viewToLocal\", type: \"mat4x4f\" },\n { name: \"localToView\", type: \"mat4x4f\" },\n { name: \"worldToLocal\", type: \"mat4x4f\" },\n // the volume's froxel rect (cells) and slices\n { name: \"rect\", type: \"vec4f\" },\n // first slice, slice count, source slot v, lights bitmask\n { name: \"slices\", type: \"vec4u\" },\n // scatter colour, opacity\n { name: \"scatterOpacity\", type: \"vec4f\" },\n // base colour (albedo), extinction\n { name: \"baseExtinction\", type: \"vec4f\" },\n // offset3D, wrap (0 clamp, 1 repeat, 2 mirror) as f32\n { name: \"offsetWrap\", type: \"vec4f\" },\n // (forward g, back g, back weight, Lorenz-Mie mode)\n { name: \"phase\", type: \"vec4f\" },\n // (red g scale, blue g scale, flag), multiple scattering (1 − g, or 0)\n { name: \"phaseSpectrumMs\", type: \"vec4f\" },\n // densityScale (normalized), densityCutoff, worldScale, absorbance\n { name: \"density\", type: \"vec4f\" },\n // emissiveIntensity, temperature min, max, lod levels the read may use (mipmaps ? levels : 0)\n { name: \"emission\", type: \"vec4f\" },\n // shadow steps, mipmaps (0/1), hdda (0/1), K6.5 emission colour code (bits 0-1: 0 white, 1 LUT row, 2 user hook; bits 2+: row)\n { name: \"march\", type: \"vec4u\" },\n // K6.4: extinction spectrum (rgb), spare\n { name: \"extinctionSpectrum\", type: \"vec4f\" },\n ],\n VDB_FRAME_VOLUME_BYTES,\n);\n\n/** One source group's record (group 1, dynamic offset, {@link VDB_FRAME_GROUP_STRIDE}). */\nexport const VDB_FRAME_GROUP = vdbUniformStruct(\"VdbFrameGroup\", [\n // first volume record, count, role (bit 0 first group, bit 1 last group), group index\n { name: \"range\", type: \"vec4u\" },\n // K6.2: the group's shadow casters (first record, count, role among the caster groups, caster group index)\n { name: \"casters\", type: \"vec4u\" },\n]);\n\n/** Most environment lights in the environment buffer (his `frameMaxEnvironmentLights`). */\nexport const VDB_FRAME_MAX_ENVIRONMENT_LIGHTS = 12;\n\n/**\n * Group 0 binding 3 (K6.2b): the environment buffer. `envReduce` writes it as storage; every later kernel binds it as\n * a uniform (design §3.1, §3.5). No CPU readback.\n */\nexport const VDB_FRAME_ENVIRONMENT = vdbUniformStruct(\"VdbFrameEnvironment\", [\n // light count, mode (0 'outward', 1 'directional', 2 'spherical-harmonics'), valid (an environment with finite,\n // positive energy: 0/1), spare\n { name: \"info\", type: \"vec4u\" },\n // SH9 radiance coefficients of the environment × intensity (three's basis; irradiance by vdbFrameEnvIrradiance)\n { name: \"sh\", type: \"vec4f\", count: 9 },\n // the lights: world direction toward the light, colour (his energy / 4 × intensity)\n { name: \"direction\", type: \"vec4f\", count: VDB_FRAME_MAX_ENVIRONMENT_LIGHTS },\n { name: \"color\", type: \"vec4f\", count: VDB_FRAME_MAX_ENVIRONMENT_LIGHTS },\n]);\n\n/** Group 0 binding 0 of the environment kernels (`envPrefilter`, `envBlur`, `envReduce`; K6.2b). */\nexport const VDB_FRAME_ENV_PARAMS = vdbUniformStruct(\"VdbFrameEnvParams\", [\n // the rows of R (world → map; a rotation, or a rotation with a reflection)\n { name: \"rotation\", type: \"vec4f\", count: 3 },\n // source width, height, projection (0 equirect, 1 cube), cube sub-samples per axis\n { name: \"source\", type: \"vec4u\" },\n // mode code, environmentSamples, environmentShOrder, pairs (0/1)\n { name: \"settings\", type: \"vec4f\" },\n // intensity, spare\n { name: \"scale\", type: \"vec4f\" },\n]);\n\n/**\n * The WGSL of the frame structs and the group-0 bindings every frame kernel declares; `environment` adds the\n * environment buffer (binding 3; the layout always has it).\n */\nexport function vdbFrameUniformsWgsl(maxVolumes = VDB_FRAME_MAX_VOLUMES, o: { environment?: boolean } = {}): string {\n const env = o.environment ? `${VDB_FRAME_ENVIRONMENT.wgsl}@group(0) @binding(3) var<uniform> vdbFrameEnv: VdbFrameEnvironment;\\n` : \"\";\n return `${VDB_FRAME_UNIFORMS.wgsl}${VDB_FRAME_LIGHTS.wgsl}${VDB_FRAME_VOLUME.wgsl}struct VdbFrameVolumes {\n v: array<VdbFrameVolume, ${maxVolumes}>,\n};\n${VDB_FRAME_GROUP.wgsl}@group(0) @binding(0) var<uniform> vdbFrame: VdbFrameUniforms;\n@group(0) @binding(1) var<uniform> vdbFrameLights: VdbFrameLights;\n@group(0) @binding(2) var vdbFrameLinear: sampler;\n${env}`;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ /** Names of the chunks {@link frameChunksWgsl} knows. */
2
+ export type VDBFrameChunk = "constants" | "mat3" | "sliceDepth" | "viewPosition" | "froxel" | "noise" | "rand" | "fade" | "box" | "lod" | "phase" | "ambientPhase" | "msExit" | "shadow" | "octaveTotal" | "octaves" | "spectral" | "sh" | "envSh" | "grid" | "srgb";
3
+ /** The closure of `roots` (with dependencies), in the fixed chunk order. */
4
+ export declare function frameChunksWgsl(roots: Iterable<VDBFrameChunk>): string;