@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,415 @@
1
+ /**
2
+ * Plain-data types of the core frame renderer (K6.1, design §2.1–§2.5). Matrices are column-major
3
+ * `ArrayLike<number>` (three's `Matrix4.elements` order); colours are linear RGB. K6.1 implements
4
+ * 'volume' lighting on dense sources (K6.2: 'frame' lighting, K6.2b: the environment, K6.5: volume shadow maps and
5
+ * emission, K6.5b: host occluder maps).
6
+ */
7
+ import type { VDBVolumeSlot } from "../source/types.js";
8
+ import type { VDBFramePhaseName } from "./settings.js";
9
+ export type { VDBVolumeSlot } from "../source/types.js";
10
+ /** A 3-vector. */
11
+ export type VDBFrameVec3 = readonly [number, number, number];
12
+ /** Column-major 4x4. */
13
+ export type VDBFrameMat4 = ArrayLike<number>;
14
+ /** His `frameLights` bitmask of a volume's `lights` (the same bits as `./three` `vdbFrameLights`). */
15
+ export declare const VDB_FRAME_LIGHT_BITS: {
16
+ readonly ambient: 32;
17
+ readonly point: 16;
18
+ readonly directional: 8;
19
+ readonly spot: 4;
20
+ readonly hemisphere: 2;
21
+ readonly environment: 1;
22
+ };
23
+ /** Every light type (his FrameVolume default). */
24
+ export declare const VDB_FRAME_ALL_LIGHTS = 63;
25
+ /** The camera of a frame. */
26
+ export interface VDBFrameCamera {
27
+ /** World → view (three's `camera.matrixWorldInverse`). */
28
+ readonly view: VDBFrameMat4;
29
+ /** View → clip with NDC z in [0, 1] (WebGPU; three's `camera.projectionMatrix` on WebGPURenderer). */
30
+ readonly projection: VDBFrameMat4;
31
+ readonly near: number;
32
+ readonly far: number;
33
+ readonly orthographic?: boolean;
34
+ /** The projection maps near to depth 1 and far to 0. */
35
+ readonly reversedDepth?: boolean;
36
+ /** Identity of the camera: the temporal history is dropped when it changes. */
37
+ readonly id?: number | string;
38
+ }
39
+ /**
40
+ * A volume shadow map request on a directional, spot or point light (K6.5, design §2.6): the core draws a Beer map of
41
+ * every shadow caster for it (`settings.castShadows`), and returns it in `outputs.volumeShadows` with the view it was
42
+ * drawn with. `size`: texels per side (`settings.castShadowCoarse`: 64). `view`:
43
+ * - spot: the camera the host's own depth map uses (`viewProjection` column-major, WebGPU depth), so both maps share
44
+ * one texel grid; default a perspective camera over the cone (near 0.5, far = distance or 500).
45
+ * - point: `near` / `far` of the cube (far divides the stored depths; default distance or 500).
46
+ * - directional: `'fit'` (default; his cascades of the view around the casters, `castShadowCascades`,
47
+ * `castShadowDistance`) or explicit orthographic cascades with their view-depth `breaks`.
48
+ */
49
+ export interface VDBVolumeShadowRequest {
50
+ size: number;
51
+ view?: {
52
+ viewProjection?: ArrayLike<number>;
53
+ near: number;
54
+ far: number;
55
+ orthographic?: boolean;
56
+ } | {
57
+ cascades: {
58
+ viewProjection: ArrayLike<number>;
59
+ near: number;
60
+ far: number;
61
+ }[];
62
+ breaks: number[];
63
+ } | "fit";
64
+ }
65
+ /** The state a volume shadow map was drawn with (what receivers project with; his 62a6e3e by construction). */
66
+ export interface VDBVolumeShadowDrawn {
67
+ /** Per layer (cascades; spot: one), column-major, WebGPU depth. Point maps: empty. */
68
+ readonly viewProjection: readonly Float32Array[];
69
+ /** Ray origin per layer (cascades) or the light's position / camera position. */
70
+ readonly origin: readonly VDBFrameVec3[];
71
+ /** Far plane per layer: the map stores depths ÷ far. */
72
+ readonly far: readonly number[];
73
+ readonly forward: VDBFrameVec3;
74
+ readonly perspective: boolean;
75
+ /** Directional: the cascade far distances (view depth) and count the layers were drawn for. */
76
+ readonly breaks: readonly number[];
77
+ readonly cascadeCount: number;
78
+ }
79
+ /**
80
+ * One light's volume shadow map (`outputs.volumeShadows`, by light id). Bind `texture` (a `'2d-array'` view; point
81
+ * maps a `'cube'` view of its 6 layers), a linear clamp sampler and `view` (`var<uniform> VdbVolumeShadowView`), and
82
+ * call `vdbVolumeShadow` / `vdbVolumeShadowCube` (`vdbVolumeShadowWgsl()`).
83
+ */
84
+ export interface VDBVolumeShadowMap {
85
+ readonly light: number | string;
86
+ readonly kind: "directional" | "spot" | "point";
87
+ /** rgba16float 2d with `layers` layers: (τ·first, τ·last, 0, τ), depths ÷ far (K6.4 spectral: τ the channel mean). */
88
+ readonly texture: GPUTexture;
89
+ /**
90
+ * K6.4 `settings.spectral`: the map's twin with the optical depth of each channel (τ rgb, 0), same layers, else null;
91
+ * receivers `vdbVolumeShadowRgb` / `vdbVolumeShadowCubeRgb`.
92
+ */
93
+ readonly rgbTexture: GPUTexture | null;
94
+ readonly layers: number;
95
+ readonly size: number;
96
+ /**
97
+ * The drawn view as a uniform buffer (`VdbVolumeShadowView`, rewritten each update). Its usage also has `STORAGE`
98
+ * (K6.8a: `./three` binds it read-only as `array<vec4u>`).
99
+ */
100
+ readonly view: GPUBuffer;
101
+ readonly drawn: VDBVolumeShadowDrawn;
102
+ /** False when the light is not in this frame or no caster exists: receivers read 1. */
103
+ readonly enabled: boolean;
104
+ /** +1 per drawn piece; a new `texture` bumps `outputs.version`. */
105
+ readonly revision: number;
106
+ /** The update count of the last draw of each piece (the map, or each cascade), for budget checks. */
107
+ readonly lastDraw: readonly number[];
108
+ }
109
+ /**
110
+ * Emission colour of a volume (K6.5, design §3.8): `'white'` (default); his `'planck'` / `'soot'` spectra (the
111
+ * blackbody table of the analytic CMF fit, D33, at the soot exponent); a 256-texel LUT (`lut`: 256 × rgb over log
112
+ * temperature 500–40,000 K, linear between texels); or a user WGSL hook defining
113
+ * `fn vdbUserEmissionColor(t: f32, temperature: f32) -> vec3f` (t = the normalized temperature, `temperature` in
114
+ * kelvin; every top-level name starts with `vdbUser`), validated once (`VDB_BAD_WGSL`).
115
+ */
116
+ export type VDBEmissionColor = "white" | {
117
+ readonly spectrum: "planck" | "soot";
118
+ readonly exponent?: number;
119
+ } | {
120
+ readonly lut: ArrayLike<number>;
121
+ } | {
122
+ readonly wgsl: string;
123
+ };
124
+ /** The emission light's probe settings (his `FrameEmissionLight` props; `VDBFrameInput.emissionLight`). */
125
+ export interface VDBFrameEmissionLightSettings {
126
+ /** Probes per axis of each cascade, 2–32 (default 16). */
127
+ readonly resolution?: number;
128
+ /** The last cascade's size as a multiple of the box of all emitters (default 3). */
129
+ readonly range?: number;
130
+ /** Probe cascades 1–4 (default 1). */
131
+ readonly cascades?: number;
132
+ /** The finer cascades cover this distance from the camera (default 512). */
133
+ readonly distance?: number;
134
+ /** Steps of each ray in a volume (default 24). */
135
+ readonly steps?: number;
136
+ }
137
+ /** The emission light's outputs (`outputs.emissionProbes`). */
138
+ export interface VDBFrameEmissionProbes {
139
+ /** rgba16float 3D stack: per cascade c and channel k (red, green, blue) the L1 probes at `layout.origins[3c + k]`. */
140
+ readonly texture: GPUTexture;
141
+ /** `VdbEmissionGrid` uniform (the receivers' `grid`). */
142
+ readonly grid: GPUBuffer;
143
+ /** The stack's sub-volume layout (side = the probe resolution). */
144
+ readonly layout: {
145
+ readonly size: readonly [number, number, number];
146
+ readonly origins: readonly (readonly [number, number, number])[];
147
+ };
148
+ /** The probe cascades, their centre and the emitters (the CPU copy of `grid`). */
149
+ readonly state: {
150
+ readonly count: number;
151
+ readonly resolution: number;
152
+ readonly min: readonly VDBFrameVec3[];
153
+ readonly size: readonly VDBFrameVec3[];
154
+ readonly center: VDBFrameVec3;
155
+ readonly emitters: number;
156
+ };
157
+ /** +1 when the probes were drawn again. */
158
+ readonly revision: number;
159
+ /** The last update: direction passes run and whether the probes were drawn. */
160
+ readonly lastUpdate: {
161
+ readonly directions: number;
162
+ readonly probes: boolean;
163
+ };
164
+ }
165
+ /**
166
+ * A scene light. `direction` is the way the light travels (from the light toward its target); `up` of a
167
+ * hemisphere light points at its sky colour; `color` is colour × intensity.
168
+ */
169
+ export type VDBFrameLight = {
170
+ readonly id: number | string;
171
+ readonly mask?: number;
172
+ } & ({
173
+ readonly kind: "ambient";
174
+ readonly color: VDBFrameVec3;
175
+ } | {
176
+ readonly kind: "hemisphere";
177
+ readonly sky: VDBFrameVec3;
178
+ readonly ground: VDBFrameVec3;
179
+ readonly up: VDBFrameVec3;
180
+ } | {
181
+ readonly kind: "probe";
182
+ readonly sh: ArrayLike<number>;
183
+ } | {
184
+ readonly kind: "directional";
185
+ readonly direction: VDBFrameVec3;
186
+ readonly color: VDBFrameVec3;
187
+ readonly shadow?: VDBVolumeShadowRequest;
188
+ } | {
189
+ readonly kind: "point";
190
+ readonly position: VDBFrameVec3;
191
+ readonly color: VDBFrameVec3;
192
+ readonly distance: number;
193
+ readonly decay: number;
194
+ readonly shadow?: VDBVolumeShadowRequest;
195
+ } | {
196
+ readonly kind: "spot";
197
+ readonly position: VDBFrameVec3;
198
+ readonly direction: VDBFrameVec3;
199
+ readonly color: VDBFrameVec3;
200
+ readonly distance: number;
201
+ readonly decay: number;
202
+ /** cos of the cone angle. */
203
+ readonly cosAngle: number;
204
+ /** cos of angle × (1 − penumbra): full intensity inside it. */
205
+ readonly cosPenumbra: number;
206
+ readonly shadow?: VDBVolumeShadowRequest;
207
+ });
208
+ /**
209
+ * A host environment texture (K6.2b, design §2.3, Q3): linear radiance, reduced on the GPU (no readback). Any float
210
+ * format the device can bind as a sampled texture (read with `textureLoad` at level 0, so unfilterable formats such as
211
+ * rgba32float work): a compute-PMREM or sky generator's output plugs in directly.
212
+ */
213
+ export interface VDBFrameEnvironment {
214
+ /** Identity of the source: a new id or revision re-runs the prefilter. */
215
+ id: unknown;
216
+ revision: number;
217
+ /** Equirect: u = atan2(m.z, m.x) / 2π + ½ along x, row 0 the zenith (+Y). Cube: 6 layers, WebGPU's faces. */
218
+ texture: GPUTexture;
219
+ /** Default: 6 square layers → cube, else equirect (a `GPUTextureView` has no readable dimension). */
220
+ projection?: "equirect" | "cube";
221
+ /**
222
+ * World → map, 3 × 3 column-major (m = R · d): a rotation, or a rotation with a reflection (three's flipY equirect is
223
+ * diag(1, −1, 1) · Rᵀ, its WebGPU cube diag(−1, 1, 1) · Rᵀ). Default identity.
224
+ */
225
+ rotation?: Float32Array;
226
+ /** Scales the environment lights and irradiance (three's `scene.environmentIntensity`). */
227
+ intensity: number;
228
+ }
229
+ /**
230
+ * A host depth shadow map (K6.5b, design §3.7): the meshes the host drew from one light, so they shadow the volumes
231
+ * (mesh → volume shadows; `settings.occlusion`). The core tests a world position against the first layer whose clip
232
+ * volume holds it (2 × 2 PCF, or one texel), as the host's own receivers do; outside every layer it is lit. At most 4
233
+ * maps are bound per kernel (fixed slots; more are warned about and ignored); the core reads, never writes or frees, it.
234
+ */
235
+ export interface VDBFrameOccluder {
236
+ /** The {@link VDBFrameLight} `id` the map belongs to (a directional, point or spot light of this frame). */
237
+ readonly light: number | string;
238
+ /**
239
+ * A `'2d-array'` view of the map: a depth texture (`'depth-only'` aspect for a depth-stencil format) or an `r32float`
240
+ * texture, `TEXTURE_BINDING`; one layer per cascade or cube face (≤ 6). Read with `textureLoad` (no sampler).
241
+ */
242
+ readonly depth: GPUTextureView;
243
+ /** Per layer: the view-projection the layer was drawn with (column-major, WebGPU depth [0, 1]); ≤ 6. */
244
+ readonly viewProjection: readonly ArrayLike<number>[];
245
+ /** Added to the position's depth before the test (three's `shadow.bias` sign; reversed depth: subtracted). Default 0. */
246
+ readonly bias?: number;
247
+ /** The map stores 1 at the near plane. Default false. */
248
+ readonly reversedDepth?: boolean;
249
+ /** `'bilinear'` (default): 2 × 2 percentage-closer filtering with bilinear weights; `'nearest'`: one texel. */
250
+ readonly filter?: "bilinear" | "nearest";
251
+ /**
252
+ * Bump when the map's texels or matrices changed (the 'frame' transmittance redraws then); omitted: the map is taken
253
+ * to change every update.
254
+ */
255
+ readonly revision?: number;
256
+ }
257
+ /** What one `update()` gets from the host. */
258
+ export interface VDBFrameInput {
259
+ /** Monotonic: jitter index; a skipped id drops the temporal history. */
260
+ readonly frameId: number;
261
+ readonly camera: VDBFrameCamera;
262
+ /** Drawing-buffer and canvas (CSS) pixels: the froxel size (`pixelsPerFroxel`). */
263
+ readonly viewport: {
264
+ readonly drawingBuffer: readonly [number, number];
265
+ readonly canvas: readonly [number, number];
266
+ };
267
+ /** Only the lights of the rendered scene. */
268
+ readonly lights: readonly VDBFrameLight[];
269
+ readonly environment?: VDBFrameEnvironment | null;
270
+ /** K6.5b: the host's depth shadow maps (mesh → volume shadows), at most 4 used. */
271
+ readonly occluders?: readonly VDBFrameOccluder[];
272
+ /** K6.5: the scene has an emission light: draw the emission probes with these settings (null: none). */
273
+ readonly emissionLight?: VDBFrameEmissionLightSettings | null;
274
+ }
275
+ /** Texture wrapping of a volume's lookup (his `wrap3D`). */
276
+ export type VDBFrameWrap = "clamp" | "repeat" | "mirror";
277
+ /** One volume's parameters: his `FrameVolume` props (names and defaults) for the K6.1 subset. */
278
+ export interface VDBFrameVolumeParams {
279
+ /** The volume box: the local unit box [-0.5, 0.5]³ → world (his `volume.matrixWorld × boxMatrix`). */
280
+ matrixWorld: VDBFrameMat4;
281
+ baseColor: VDBFrameVec3;
282
+ scatterColor: VDBFrameVec3;
283
+ extinction: number;
284
+ /** K6.4 (`settings.spectral`): the extinction scale of each channel (red, green, blue). */
285
+ extinctionScale: VDBFrameVec3;
286
+ /** K6.4 (`settings.spectral`): Ångström exponent α; each channel's extinction × extinctionScale × (λ / 550 nm)^−α. */
287
+ angstromExponent: number;
288
+ densityScale: number;
289
+ normalizeDensity: boolean;
290
+ /** The mean density `normalizeDensity` divides by; null: the source's `stats.meanNonZero`. */
291
+ densityMean: number | null;
292
+ densityCutoff: number;
293
+ absorbance: number;
294
+ opacity: number;
295
+ emissiveIntensity: number;
296
+ temperatureRange: readonly [number, number];
297
+ offset3D: VDBFrameVec3;
298
+ wrap3D: VDBFrameWrap;
299
+ /** {@link VDB_FRAME_LIGHT_BITS}. */
300
+ lights: number;
301
+ shadowSteps: number;
302
+ mipmaps: boolean;
303
+ /** Sparse sources (K6.7); dense ignores it. */
304
+ hdda: boolean;
305
+ /** 'volume' lighting phase overrides (V65); null: the renderer settings'. */
306
+ phase: VDBFramePhaseName | null;
307
+ phaseG: number | null;
308
+ phaseBackG: number | null;
309
+ phaseBackWeight: number | null;
310
+ phaseGExponent: number | null;
311
+ /** K6.5: the emission colour (default `'white'`). */
312
+ emissionColor: VDBEmissionColor;
313
+ }
314
+ /** His FrameVolume defaults. */
315
+ export declare function vdbFrameDefaultVolumeParams(): VDBFrameVolumeParams;
316
+ /** The host's composite targets (`render()`). */
317
+ export interface VDBFrameTargets {
318
+ /** The colour attachment the volumes composite onto (single-sample; the format of `options.composite`). */
319
+ readonly color: GPUTextureView;
320
+ /** Pixels of `color` (the composite's screen size). */
321
+ readonly size: readonly [number, number];
322
+ /** The scene depth: a depth texture or r32float, single-sample. */
323
+ readonly depth: GPUTextureView;
324
+ /** The scene colour before the volumes (sRGB blending reads it); required with `srgbBlending`. */
325
+ readonly sceneColor?: GPUTextureView;
326
+ /** Clamp colours to [0, 1] in the sRGB blend (true without tone mapping, his rule). Default true. */
327
+ readonly clampColors?: boolean;
328
+ /** `colorSpace` of `color`: sRGB blending applies only for 'srgb' output (three: `outputColorSpace`). Default 'srgb'. */
329
+ readonly outputColorSpace?: "srgb" | "linear";
330
+ }
331
+ /** The froxel layout of the outputs. */
332
+ export interface VDBFroxelLayout {
333
+ /** Froxels across, up, and slices. */
334
+ readonly width: number;
335
+ readonly height: number;
336
+ readonly depth: number;
337
+ /** View depths of the first and last slice boundaries. */
338
+ readonly range: readonly [number, number];
339
+ /** Clip-space rectangle of the froxel area with one cell of padding (x0, y0, x1, y1); empty: all 0. */
340
+ readonly screenRect: readonly [number, number, number, number];
341
+ }
342
+ /** What the renderer gives the host (design §2.5). */
343
+ export interface VDBFrameOutputs {
344
+ /** +1 when a texture below is a new object or goes (K7.16a: `froxels` null): rebuild host bind groups. */
345
+ readonly version: number;
346
+ /**
347
+ * The integrated froxels: `integrated` is W × H × (D + 1) rgba16float, boundary k = (radiance of slices
348
+ * < k, opacity 1 − T); read with `vdbFrameIntegrateWgsl`. Null before the first update with volumes, and (K7.16a) after
349
+ * 120 updates in a row with no visible volume in view, when the renderer frees them (made again, empty, at the next
350
+ * update that draws a volume).
351
+ */
352
+ readonly froxels: {
353
+ readonly integrated: GPUTexture;
354
+ readonly integratedAlpha: GPUTexture | null;
355
+ readonly layout: VDBFroxelLayout;
356
+ } | null;
357
+ /** Frame uniforms (`VdbFrameUniforms`) for host shaders. */
358
+ readonly uniforms: GPUBuffer;
359
+ /** K6.5: the volume shadow maps by light id (lights with a `shadow` request; `settings.castShadows`). */
360
+ readonly volumeShadows: ReadonlyMap<number | string, VDBVolumeShadowMap>;
361
+ /** K6.5: the emission probes (with `VDBFrameInput.emissionLight` and an emitting volume), else null. */
362
+ readonly emissionProbes: VDBFrameEmissionProbes | null;
363
+ }
364
+ /** The result of `update()`. */
365
+ /** Timestamp writes bracketing one update's kernels (WebGPU's `GPUComputePassTimestampWrites` fields; a `'timestamp'` query set). */
366
+ export interface VDBFrameTimestamps {
367
+ readonly querySet: GPUQuerySet;
368
+ readonly beginningOfPassWriteIndex?: number;
369
+ readonly endOfPassWriteIndex?: number;
370
+ }
371
+ /** Options of `VDBFrameRenderer.update`. */
372
+ export interface VDBFrameUpdateOptions {
373
+ /** False: keep the last froxels (no froxel work this update; the composite reads them again). Default true. */
374
+ readonly froxels?: boolean;
375
+ /** Timestamp writes before the first and after the last kernel of the update. */
376
+ readonly timestampWrites?: VDBFrameTimestamps | null;
377
+ }
378
+ export interface VDBFrameUpdate {
379
+ readonly outputs: VDBFrameOutputs;
380
+ /** True when kernels were recorded (some volume is in view); false: draw nothing this frame. */
381
+ readonly recorded: boolean;
382
+ /** Volumes drawn this frame. */
383
+ readonly volumes: number;
384
+ }
385
+ /** Redraw counters of the 'frame' lighting caches (K6.2; zeros in K6.1). */
386
+ export interface VDBFrameRedrawStats {
387
+ shadowDensity: {
388
+ drawn: number;
389
+ skipped: number;
390
+ };
391
+ transmittance: {
392
+ drawn: number;
393
+ skipped: number;
394
+ };
395
+ environmentGrid: {
396
+ drawn: number;
397
+ skipped: number;
398
+ };
399
+ /** K6.5: volume shadow map pieces drawn and waiting for the budget in the last update (his `lastUpdate`). */
400
+ volumeShadows: {
401
+ drawn: number;
402
+ waiting: number;
403
+ };
404
+ }
405
+ /** Handle of one volume in the renderer. */
406
+ export interface VDBFrameVolume {
407
+ /** One writer (the host); packed at each `update()`. */
408
+ params: VDBFrameVolumeParams;
409
+ /** Drawn this frame (host culling, layers). */
410
+ visible: boolean;
411
+ /** 'frame' lighting (K6.2). */
412
+ castsShadow: boolean;
413
+ readonly slot: VDBVolumeSlot;
414
+ remove(): void;
415
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Plain-data types of the core frame renderer (K6.1, design §2.1–§2.5). Matrices are column-major
3
+ * `ArrayLike<number>` (three's `Matrix4.elements` order); colours are linear RGB. K6.1 implements
4
+ * 'volume' lighting on dense sources (K6.2: 'frame' lighting, K6.2b: the environment, K6.5: volume shadow maps and
5
+ * emission, K6.5b: host occluder maps).
6
+ */
7
+ /** His `frameLights` bitmask of a volume's `lights` (the same bits as `./three` `vdbFrameLights`). */
8
+ export const VDB_FRAME_LIGHT_BITS = {
9
+ ambient: 0b100000,
10
+ point: 0b010000,
11
+ directional: 0b001000,
12
+ spot: 0b000100,
13
+ hemisphere: 0b000010,
14
+ environment: 0b000001,
15
+ };
16
+ /** Every light type (his FrameVolume default). */
17
+ export const VDB_FRAME_ALL_LIGHTS = 0b111111;
18
+ /** His FrameVolume defaults. */
19
+ export function vdbFrameDefaultVolumeParams() {
20
+ return {
21
+ matrixWorld: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
22
+ baseColor: [1, 1, 1],
23
+ scatterColor: [0, 0, 0],
24
+ extinction: 100,
25
+ extinctionScale: [1, 1, 1],
26
+ angstromExponent: 0,
27
+ densityScale: 1,
28
+ normalizeDensity: true,
29
+ densityMean: null,
30
+ densityCutoff: 0,
31
+ absorbance: 1,
32
+ opacity: 1,
33
+ emissiveIntensity: 1,
34
+ temperatureRange: [0, 6500],
35
+ offset3D: [0, 0, 0],
36
+ wrap3D: "clamp",
37
+ lights: VDB_FRAME_ALL_LIGHTS,
38
+ shadowSteps: 32,
39
+ mipmaps: true,
40
+ hdda: false,
41
+ phase: null,
42
+ phaseG: null,
43
+ phaseBackG: null,
44
+ phaseBackWeight: null,
45
+ phaseGExponent: null,
46
+ emissionColor: "white",
47
+ };
48
+ }
49
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/frame/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,sGAAsG;AACtG,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,WAAW,EAAE,QAAQ;CACb,CAAC;AAEX,kDAAkD;AAClD,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AA2Q7C,gCAAgC;AAChC,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC7D,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACpB,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACvB,UAAU,EAAE,GAAG;QACf,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC1B,gBAAgB,EAAE,CAAC;QACnB,YAAY,EAAE,CAAC;QACf,gBAAgB,EAAE,IAAI;QACtB,WAAW,EAAE,IAAI;QACjB,aAAa,EAAE,CAAC;QAChB,UAAU,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;QACV,iBAAiB,EAAE,CAAC;QACpB,gBAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC;QAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACnB,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,oBAAoB;QAC5B,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,IAAI;QAChB,eAAe,EAAE,IAAI;QACrB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,OAAO;KACvB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Plain-data types of the core frame renderer (K6.1, design §2.1–§2.5). Matrices are column-major\n * `ArrayLike<number>` (three's `Matrix4.elements` order); colours are linear RGB. K6.1 implements\n * 'volume' lighting on dense sources (K6.2: 'frame' lighting, K6.2b: the environment, K6.5: volume shadow maps and\n * emission, K6.5b: host occluder maps).\n */\n\nimport type { VDBVolumeSlot } from \"../source/types.js\";\nimport type { VDBFramePhaseName } from \"./settings.js\";\n\nexport type { VDBVolumeSlot } from \"../source/types.js\";\n\n/** A 3-vector. */\nexport type VDBFrameVec3 = readonly [number, number, number];\n\n/** Column-major 4x4. */\nexport type VDBFrameMat4 = ArrayLike<number>;\n\n/** His `frameLights` bitmask of a volume's `lights` (the same bits as `./three` `vdbFrameLights`). */\nexport const VDB_FRAME_LIGHT_BITS = {\n ambient: 0b100000,\n point: 0b010000,\n directional: 0b001000,\n spot: 0b000100,\n hemisphere: 0b000010,\n environment: 0b000001,\n} as const;\n\n/** Every light type (his FrameVolume default). */\nexport const VDB_FRAME_ALL_LIGHTS = 0b111111;\n\n/** The camera of a frame. */\nexport interface VDBFrameCamera {\n /** World → view (three's `camera.matrixWorldInverse`). */\n readonly view: VDBFrameMat4;\n /** View → clip with NDC z in [0, 1] (WebGPU; three's `camera.projectionMatrix` on WebGPURenderer). */\n readonly projection: VDBFrameMat4;\n readonly near: number;\n readonly far: number;\n readonly orthographic?: boolean;\n /** The projection maps near to depth 1 and far to 0. */\n readonly reversedDepth?: boolean;\n /** Identity of the camera: the temporal history is dropped when it changes. */\n readonly id?: number | string;\n}\n\n/**\n * A volume shadow map request on a directional, spot or point light (K6.5, design §2.6): the core draws a Beer map of\n * every shadow caster for it (`settings.castShadows`), and returns it in `outputs.volumeShadows` with the view it was\n * drawn with. `size`: texels per side (`settings.castShadowCoarse`: 64). `view`:\n * - spot: the camera the host's own depth map uses (`viewProjection` column-major, WebGPU depth), so both maps share\n * one texel grid; default a perspective camera over the cone (near 0.5, far = distance or 500).\n * - point: `near` / `far` of the cube (far divides the stored depths; default distance or 500).\n * - directional: `'fit'` (default; his cascades of the view around the casters, `castShadowCascades`,\n * `castShadowDistance`) or explicit orthographic cascades with their view-depth `breaks`.\n */\nexport interface VDBVolumeShadowRequest {\n size: number;\n view?:\n | { viewProjection?: ArrayLike<number>; near: number; far: number; orthographic?: boolean }\n | { cascades: { viewProjection: ArrayLike<number>; near: number; far: number }[]; breaks: number[] }\n | \"fit\";\n}\n\n/** The state a volume shadow map was drawn with (what receivers project with; his 62a6e3e by construction). */\nexport interface VDBVolumeShadowDrawn {\n /** Per layer (cascades; spot: one), column-major, WebGPU depth. Point maps: empty. */\n readonly viewProjection: readonly Float32Array[];\n /** Ray origin per layer (cascades) or the light's position / camera position. */\n readonly origin: readonly VDBFrameVec3[];\n /** Far plane per layer: the map stores depths ÷ far. */\n readonly far: readonly number[];\n readonly forward: VDBFrameVec3;\n readonly perspective: boolean;\n /** Directional: the cascade far distances (view depth) and count the layers were drawn for. */\n readonly breaks: readonly number[];\n readonly cascadeCount: number;\n}\n\n/**\n * One light's volume shadow map (`outputs.volumeShadows`, by light id). Bind `texture` (a `'2d-array'` view; point\n * maps a `'cube'` view of its 6 layers), a linear clamp sampler and `view` (`var<uniform> VdbVolumeShadowView`), and\n * call `vdbVolumeShadow` / `vdbVolumeShadowCube` (`vdbVolumeShadowWgsl()`).\n */\nexport interface VDBVolumeShadowMap {\n readonly light: number | string;\n readonly kind: \"directional\" | \"spot\" | \"point\";\n /** rgba16float 2d with `layers` layers: (τ·first, τ·last, 0, τ), depths ÷ far (K6.4 spectral: τ the channel mean). */\n readonly texture: GPUTexture;\n /**\n * K6.4 `settings.spectral`: the map's twin with the optical depth of each channel (τ rgb, 0), same layers, else null;\n * receivers `vdbVolumeShadowRgb` / `vdbVolumeShadowCubeRgb`.\n */\n readonly rgbTexture: GPUTexture | null;\n readonly layers: number;\n readonly size: number;\n /**\n * The drawn view as a uniform buffer (`VdbVolumeShadowView`, rewritten each update). Its usage also has `STORAGE`\n * (K6.8a: `./three` binds it read-only as `array<vec4u>`).\n */\n readonly view: GPUBuffer;\n readonly drawn: VDBVolumeShadowDrawn;\n /** False when the light is not in this frame or no caster exists: receivers read 1. */\n readonly enabled: boolean;\n /** +1 per drawn piece; a new `texture` bumps `outputs.version`. */\n readonly revision: number;\n /** The update count of the last draw of each piece (the map, or each cascade), for budget checks. */\n readonly lastDraw: readonly number[];\n}\n\n/**\n * Emission colour of a volume (K6.5, design §3.8): `'white'` (default); his `'planck'` / `'soot'` spectra (the\n * blackbody table of the analytic CMF fit, D33, at the soot exponent); a 256-texel LUT (`lut`: 256 × rgb over log\n * temperature 500–40,000 K, linear between texels); or a user WGSL hook defining\n * `fn vdbUserEmissionColor(t: f32, temperature: f32) -> vec3f` (t = the normalized temperature, `temperature` in\n * kelvin; every top-level name starts with `vdbUser`), validated once (`VDB_BAD_WGSL`).\n */\nexport type VDBEmissionColor = \"white\" | { readonly spectrum: \"planck\" | \"soot\"; readonly exponent?: number } | { readonly lut: ArrayLike<number> } | { readonly wgsl: string };\n\n/** The emission light's probe settings (his `FrameEmissionLight` props; `VDBFrameInput.emissionLight`). */\nexport interface VDBFrameEmissionLightSettings {\n /** Probes per axis of each cascade, 2–32 (default 16). */\n readonly resolution?: number;\n /** The last cascade's size as a multiple of the box of all emitters (default 3). */\n readonly range?: number;\n /** Probe cascades 1–4 (default 1). */\n readonly cascades?: number;\n /** The finer cascades cover this distance from the camera (default 512). */\n readonly distance?: number;\n /** Steps of each ray in a volume (default 24). */\n readonly steps?: number;\n}\n\n/** The emission light's outputs (`outputs.emissionProbes`). */\nexport interface VDBFrameEmissionProbes {\n /** rgba16float 3D stack: per cascade c and channel k (red, green, blue) the L1 probes at `layout.origins[3c + k]`. */\n readonly texture: GPUTexture;\n /** `VdbEmissionGrid` uniform (the receivers' `grid`). */\n readonly grid: GPUBuffer;\n /** The stack's sub-volume layout (side = the probe resolution). */\n readonly layout: { readonly size: readonly [number, number, number]; readonly origins: readonly (readonly [number, number, number])[] };\n /** The probe cascades, their centre and the emitters (the CPU copy of `grid`). */\n readonly state: {\n readonly count: number;\n readonly resolution: number;\n readonly min: readonly VDBFrameVec3[];\n readonly size: readonly VDBFrameVec3[];\n readonly center: VDBFrameVec3;\n readonly emitters: number;\n };\n /** +1 when the probes were drawn again. */\n readonly revision: number;\n /** The last update: direction passes run and whether the probes were drawn. */\n readonly lastUpdate: { readonly directions: number; readonly probes: boolean };\n}\n\n/**\n * A scene light. `direction` is the way the light travels (from the light toward its target); `up` of a\n * hemisphere light points at its sky colour; `color` is colour × intensity.\n */\nexport type VDBFrameLight = { readonly id: number | string; readonly mask?: number } & (\n | { readonly kind: \"ambient\"; readonly color: VDBFrameVec3 }\n | { readonly kind: \"hemisphere\"; readonly sky: VDBFrameVec3; readonly ground: VDBFrameVec3; readonly up: VDBFrameVec3 }\n | { readonly kind: \"probe\"; readonly sh: ArrayLike<number> }\n | { readonly kind: \"directional\"; readonly direction: VDBFrameVec3; readonly color: VDBFrameVec3; readonly shadow?: VDBVolumeShadowRequest }\n | {\n readonly kind: \"point\";\n readonly position: VDBFrameVec3;\n readonly color: VDBFrameVec3;\n readonly distance: number;\n readonly decay: number;\n readonly shadow?: VDBVolumeShadowRequest;\n }\n | {\n readonly kind: \"spot\";\n readonly position: VDBFrameVec3;\n readonly direction: VDBFrameVec3;\n readonly color: VDBFrameVec3;\n readonly distance: number;\n readonly decay: number;\n /** cos of the cone angle. */\n readonly cosAngle: number;\n /** cos of angle × (1 − penumbra): full intensity inside it. */\n readonly cosPenumbra: number;\n readonly shadow?: VDBVolumeShadowRequest;\n }\n);\n\n/**\n * A host environment texture (K6.2b, design §2.3, Q3): linear radiance, reduced on the GPU (no readback). Any float\n * format the device can bind as a sampled texture (read with `textureLoad` at level 0, so unfilterable formats such as\n * rgba32float work): a compute-PMREM or sky generator's output plugs in directly.\n */\nexport interface VDBFrameEnvironment {\n /** Identity of the source: a new id or revision re-runs the prefilter. */\n id: unknown;\n revision: number;\n /** Equirect: u = atan2(m.z, m.x) / 2π + ½ along x, row 0 the zenith (+Y). Cube: 6 layers, WebGPU's faces. */\n texture: GPUTexture;\n /** Default: 6 square layers → cube, else equirect (a `GPUTextureView` has no readable dimension). */\n projection?: \"equirect\" | \"cube\";\n /**\n * World → map, 3 × 3 column-major (m = R · d): a rotation, or a rotation with a reflection (three's flipY equirect is\n * diag(1, −1, 1) · Rᵀ, its WebGPU cube diag(−1, 1, 1) · Rᵀ). Default identity.\n */\n rotation?: Float32Array;\n /** Scales the environment lights and irradiance (three's `scene.environmentIntensity`). */\n intensity: number;\n}\n\n/**\n * A host depth shadow map (K6.5b, design §3.7): the meshes the host drew from one light, so they shadow the volumes\n * (mesh → volume shadows; `settings.occlusion`). The core tests a world position against the first layer whose clip\n * volume holds it (2 × 2 PCF, or one texel), as the host's own receivers do; outside every layer it is lit. At most 4\n * maps are bound per kernel (fixed slots; more are warned about and ignored); the core reads, never writes or frees, it.\n */\nexport interface VDBFrameOccluder {\n /** The {@link VDBFrameLight} `id` the map belongs to (a directional, point or spot light of this frame). */\n readonly light: number | string;\n /**\n * A `'2d-array'` view of the map: a depth texture (`'depth-only'` aspect for a depth-stencil format) or an `r32float`\n * texture, `TEXTURE_BINDING`; one layer per cascade or cube face (≤ 6). Read with `textureLoad` (no sampler).\n */\n readonly depth: GPUTextureView;\n /** Per layer: the view-projection the layer was drawn with (column-major, WebGPU depth [0, 1]); ≤ 6. */\n readonly viewProjection: readonly ArrayLike<number>[];\n /** Added to the position's depth before the test (three's `shadow.bias` sign; reversed depth: subtracted). Default 0. */\n readonly bias?: number;\n /** The map stores 1 at the near plane. Default false. */\n readonly reversedDepth?: boolean;\n /** `'bilinear'` (default): 2 × 2 percentage-closer filtering with bilinear weights; `'nearest'`: one texel. */\n readonly filter?: \"bilinear\" | \"nearest\";\n /**\n * Bump when the map's texels or matrices changed (the 'frame' transmittance redraws then); omitted: the map is taken\n * to change every update.\n */\n readonly revision?: number;\n}\n\n/** What one `update()` gets from the host. */\nexport interface VDBFrameInput {\n /** Monotonic: jitter index; a skipped id drops the temporal history. */\n readonly frameId: number;\n readonly camera: VDBFrameCamera;\n /** Drawing-buffer and canvas (CSS) pixels: the froxel size (`pixelsPerFroxel`). */\n readonly viewport: { readonly drawingBuffer: readonly [number, number]; readonly canvas: readonly [number, number] };\n /** Only the lights of the rendered scene. */\n readonly lights: readonly VDBFrameLight[];\n readonly environment?: VDBFrameEnvironment | null;\n /** K6.5b: the host's depth shadow maps (mesh → volume shadows), at most 4 used. */\n readonly occluders?: readonly VDBFrameOccluder[];\n /** K6.5: the scene has an emission light: draw the emission probes with these settings (null: none). */\n readonly emissionLight?: VDBFrameEmissionLightSettings | null;\n}\n\n/** Texture wrapping of a volume's lookup (his `wrap3D`). */\nexport type VDBFrameWrap = \"clamp\" | \"repeat\" | \"mirror\";\n\n/** One volume's parameters: his `FrameVolume` props (names and defaults) for the K6.1 subset. */\nexport interface VDBFrameVolumeParams {\n /** The volume box: the local unit box [-0.5, 0.5]³ → world (his `volume.matrixWorld × boxMatrix`). */\n matrixWorld: VDBFrameMat4;\n baseColor: VDBFrameVec3;\n scatterColor: VDBFrameVec3;\n extinction: number;\n /** K6.4 (`settings.spectral`): the extinction scale of each channel (red, green, blue). */\n extinctionScale: VDBFrameVec3;\n /** K6.4 (`settings.spectral`): Ångström exponent α; each channel's extinction × extinctionScale × (λ / 550 nm)^−α. */\n angstromExponent: number;\n densityScale: number;\n normalizeDensity: boolean;\n /** The mean density `normalizeDensity` divides by; null: the source's `stats.meanNonZero`. */\n densityMean: number | null;\n densityCutoff: number;\n absorbance: number;\n opacity: number;\n emissiveIntensity: number;\n temperatureRange: readonly [number, number];\n offset3D: VDBFrameVec3;\n wrap3D: VDBFrameWrap;\n /** {@link VDB_FRAME_LIGHT_BITS}. */\n lights: number;\n shadowSteps: number;\n mipmaps: boolean;\n /** Sparse sources (K6.7); dense ignores it. */\n hdda: boolean;\n /** 'volume' lighting phase overrides (V65); null: the renderer settings'. */\n phase: VDBFramePhaseName | null;\n phaseG: number | null;\n phaseBackG: number | null;\n phaseBackWeight: number | null;\n phaseGExponent: number | null;\n /** K6.5: the emission colour (default `'white'`). */\n emissionColor: VDBEmissionColor;\n}\n\n/** His FrameVolume defaults. */\nexport function vdbFrameDefaultVolumeParams(): VDBFrameVolumeParams {\n return {\n matrixWorld: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],\n baseColor: [1, 1, 1],\n scatterColor: [0, 0, 0],\n extinction: 100,\n extinctionScale: [1, 1, 1],\n angstromExponent: 0,\n densityScale: 1,\n normalizeDensity: true,\n densityMean: null,\n densityCutoff: 0,\n absorbance: 1,\n opacity: 1,\n emissiveIntensity: 1,\n temperatureRange: [0, 6500],\n offset3D: [0, 0, 0],\n wrap3D: \"clamp\",\n lights: VDB_FRAME_ALL_LIGHTS,\n shadowSteps: 32,\n mipmaps: true,\n hdda: false,\n phase: null,\n phaseG: null,\n phaseBackG: null,\n phaseBackWeight: null,\n phaseGExponent: null,\n emissionColor: \"white\",\n };\n}\n\n/** The host's composite targets (`render()`). */\nexport interface VDBFrameTargets {\n /** The colour attachment the volumes composite onto (single-sample; the format of `options.composite`). */\n readonly color: GPUTextureView;\n /** Pixels of `color` (the composite's screen size). */\n readonly size: readonly [number, number];\n /** The scene depth: a depth texture or r32float, single-sample. */\n readonly depth: GPUTextureView;\n /** The scene colour before the volumes (sRGB blending reads it); required with `srgbBlending`. */\n readonly sceneColor?: GPUTextureView;\n /** Clamp colours to [0, 1] in the sRGB blend (true without tone mapping, his rule). Default true. */\n readonly clampColors?: boolean;\n /** `colorSpace` of `color`: sRGB blending applies only for 'srgb' output (three: `outputColorSpace`). Default 'srgb'. */\n readonly outputColorSpace?: \"srgb\" | \"linear\";\n}\n\n/** The froxel layout of the outputs. */\nexport interface VDBFroxelLayout {\n /** Froxels across, up, and slices. */\n readonly width: number;\n readonly height: number;\n readonly depth: number;\n /** View depths of the first and last slice boundaries. */\n readonly range: readonly [number, number];\n /** Clip-space rectangle of the froxel area with one cell of padding (x0, y0, x1, y1); empty: all 0. */\n readonly screenRect: readonly [number, number, number, number];\n}\n\n/** What the renderer gives the host (design §2.5). */\nexport interface VDBFrameOutputs {\n /** +1 when a texture below is a new object or goes (K7.16a: `froxels` null): rebuild host bind groups. */\n readonly version: number;\n /**\n * The integrated froxels: `integrated` is W × H × (D + 1) rgba16float, boundary k = (radiance of slices\n * < k, opacity 1 − T); read with `vdbFrameIntegrateWgsl`. Null before the first update with volumes, and (K7.16a) after\n * 120 updates in a row with no visible volume in view, when the renderer frees them (made again, empty, at the next\n * update that draws a volume).\n */\n readonly froxels: { readonly integrated: GPUTexture; readonly integratedAlpha: GPUTexture | null; readonly layout: VDBFroxelLayout } | null;\n /** Frame uniforms (`VdbFrameUniforms`) for host shaders. */\n readonly uniforms: GPUBuffer;\n /** K6.5: the volume shadow maps by light id (lights with a `shadow` request; `settings.castShadows`). */\n readonly volumeShadows: ReadonlyMap<number | string, VDBVolumeShadowMap>;\n /** K6.5: the emission probes (with `VDBFrameInput.emissionLight` and an emitting volume), else null. */\n readonly emissionProbes: VDBFrameEmissionProbes | null;\n}\n\n/** The result of `update()`. */\n/** Timestamp writes bracketing one update's kernels (WebGPU's `GPUComputePassTimestampWrites` fields; a `'timestamp'` query set). */\nexport interface VDBFrameTimestamps {\n readonly querySet: GPUQuerySet;\n readonly beginningOfPassWriteIndex?: number;\n readonly endOfPassWriteIndex?: number;\n}\n\n/** Options of `VDBFrameRenderer.update`. */\nexport interface VDBFrameUpdateOptions {\n /** False: keep the last froxels (no froxel work this update; the composite reads them again). Default true. */\n readonly froxels?: boolean;\n /** Timestamp writes before the first and after the last kernel of the update. */\n readonly timestampWrites?: VDBFrameTimestamps | null;\n}\n\nexport interface VDBFrameUpdate {\n readonly outputs: VDBFrameOutputs;\n /** True when kernels were recorded (some volume is in view); false: draw nothing this frame. */\n readonly recorded: boolean;\n /** Volumes drawn this frame. */\n readonly volumes: number;\n}\n\n/** Redraw counters of the 'frame' lighting caches (K6.2; zeros in K6.1). */\nexport interface VDBFrameRedrawStats {\n shadowDensity: { drawn: number; skipped: number };\n transmittance: { drawn: number; skipped: number };\n environmentGrid: { drawn: number; skipped: number };\n /** K6.5: volume shadow map pieces drawn and waiting for the budget in the last update (his `lastUpdate`). */\n volumeShadows: { drawn: number; waiting: number };\n}\n\n/** Handle of one volume in the renderer. */\nexport interface VDBFrameVolume {\n /** One writer (the host); packed at each `update()`. */\n params: VDBFrameVolumeParams;\n /** Drawn this frame (host culling, layers). */\n visible: boolean;\n /** 'frame' lighting (K6.2). */\n castsShadow: boolean;\n readonly slot: VDBVolumeSlot;\n remove(): void;\n}\n"]}
@@ -0,0 +1,105 @@
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
+ /** Field types the generator supports. Arrays take only 16-byte-aligned element types (uniform rule). */
10
+ export type VDBUniformType = "f32" | "u32" | "i32" | "vec2f" | "vec2u" | "vec3f" | "vec3u" | "vec4f" | "vec4u" | "mat4x4f";
11
+ /** One field: name, type, optional array length. */
12
+ export interface VDBUniformField {
13
+ readonly name: string;
14
+ readonly type: VDBUniformType;
15
+ readonly count?: number;
16
+ }
17
+ /** A field with its byte offset. */
18
+ export interface VDBUniformSlot {
19
+ readonly name: string;
20
+ readonly type: VDBUniformType;
21
+ readonly count: number;
22
+ readonly offset: number;
23
+ /** Bytes between array elements (the element size for one value). */
24
+ readonly stride: number;
25
+ }
26
+ /** A generated struct: its WGSL, byte size and field offsets. */
27
+ export interface VDBUniformStruct {
28
+ readonly name: string;
29
+ readonly size: number;
30
+ readonly fields: ReadonlyMap<string, VDBUniformSlot>;
31
+ readonly wgsl: string;
32
+ }
33
+ /**
34
+ * Lays out `fields` by WGSL's uniform address-space rules and returns the struct.
35
+ *
36
+ * @param name The WGSL struct name.
37
+ * @param fields The fields in order.
38
+ * @param size A fixed byte size (padding added at the end; throws if the fields do not fit).
39
+ */
40
+ export declare function vdbUniformStruct(name: string, fields: readonly VDBUniformField[], size?: number): VDBUniformStruct;
41
+ /** A packer over one ArrayBuffer: writes fields of structs at a base offset. */
42
+ export declare class VDBUniformWriter {
43
+ readonly buffer: ArrayBuffer;
44
+ readonly f32: Float32Array;
45
+ readonly u32: Uint32Array;
46
+ readonly i32: Int32Array;
47
+ constructor(bytes: number);
48
+ /**
49
+ * Writes `value` into field `name` of struct `s` at byte `base` (array fields: `value` holds all elements
50
+ * back to back, each the type's component count; mat4x4f takes 16 numbers column-major).
51
+ */
52
+ set(s: VDBUniformStruct, base: number, name: string, value: number | ArrayLike<number>): void;
53
+ /** Zeroes `bytes` from `base`. */
54
+ clear(base: number, bytes: number): void;
55
+ }
56
+ /** Most visible volumes per update (64 KiB of 512-byte records; compat devices bind 16 KiB: 32). */
57
+ export declare const VDB_FRAME_MAX_VOLUMES = 128;
58
+ /** Bytes of one volume record. */
59
+ export declare const VDB_FRAME_VOLUME_BYTES = 512;
60
+ /** Dynamic-offset stride of the group records (`minUniformBufferOffsetAlignment` ≤ 256). */
61
+ export declare const VDB_FRAME_GROUP_STRIDE = 256;
62
+ /** Most scene lights (his `frameMaxLights`). */
63
+ export declare const VDB_FRAME_MAX_LIGHTS = 16;
64
+ /** Most hemisphere lights (his `frameMaxHemisphereLights`). */
65
+ export declare const VDB_FRAME_MAX_HEMISPHERE_LIGHTS = 4;
66
+ /** Most shadow grid cascades (his `frameMaxShadowCascades`). */
67
+ export declare const VDB_FRAME_MAX_CASCADES = 4;
68
+ /** Light slots of the 'frame' transmittance (his `frameShadowLightSlots`). */
69
+ export declare const VDB_FRAME_SHADOW_SLOTS = 6;
70
+ /** K6.4: spectral slot groups (his `frameSpectralGroupCount`): group 0 sky + slot 0, group g slots 2g − 1, 2g. */
71
+ export declare const VDB_FRAME_SPECTRAL_GROUPS = 4;
72
+ /**
73
+ * K6.Q1d: where the pairs' dipole targets sit in `transmittanceOrigin` (after every slot-group entry): grey cascade c at
74
+ * [48 + c], spectral channel k of cascade c at [48 + 3c + k]. Allocated only while a gather reads them
75
+ * (K6.Q1d-a, `vdbFrameDipoleTargetsWanted`).
76
+ */
77
+ export declare const VDB_FRAME_DIPOLE_ORIGIN: number;
78
+ /** K6.5b: host occluder maps bound per kernel (fixed slots; placeholders fill the empty ones). */
79
+ export declare const VDB_FRAME_MAX_OCCLUDERS = 4;
80
+ /** K6.5b: layers per occluder map (cascades or a cube's 6 faces). */
81
+ export declare const VDB_FRAME_OCCLUDER_LAYERS = 6;
82
+ /** Group 0 binding 0: camera, froxel layout, areas, jitter, fade, temporal and composite values. */
83
+ export declare const VDB_FRAME_UNIFORMS: VDBUniformStruct;
84
+ /** Group 0 binding 1: the scene lights (his light uniforms), in slot order directional, point, spot. */
85
+ export declare const VDB_FRAME_LIGHTS: VDBUniformStruct;
86
+ /** One volume record (512 B) in the `VdbFrameVolumes` array (group 1). */
87
+ export declare const VDB_FRAME_VOLUME: VDBUniformStruct;
88
+ /** One source group's record (group 1, dynamic offset, {@link VDB_FRAME_GROUP_STRIDE}). */
89
+ export declare const VDB_FRAME_GROUP: VDBUniformStruct;
90
+ /** Most environment lights in the environment buffer (his `frameMaxEnvironmentLights`). */
91
+ export declare const VDB_FRAME_MAX_ENVIRONMENT_LIGHTS = 12;
92
+ /**
93
+ * Group 0 binding 3 (K6.2b): the environment buffer. `envReduce` writes it as storage; every later kernel binds it as
94
+ * a uniform (design §3.1, §3.5). No CPU readback.
95
+ */
96
+ export declare const VDB_FRAME_ENVIRONMENT: VDBUniformStruct;
97
+ /** Group 0 binding 0 of the environment kernels (`envPrefilter`, `envBlur`, `envReduce`; K6.2b). */
98
+ export declare const VDB_FRAME_ENV_PARAMS: VDBUniformStruct;
99
+ /**
100
+ * The WGSL of the frame structs and the group-0 bindings every frame kernel declares; `environment` adds the
101
+ * environment buffer (binding 3; the layout always has it).
102
+ */
103
+ export declare function vdbFrameUniformsWgsl(maxVolumes?: number, o?: {
104
+ environment?: boolean;
105
+ }): string;