@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 @@
1
+ {"version":3,"file":"sparse.js","sourceRoot":"","sources":["../../../src/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,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAiB,EAAE,UAAkC,EAAE;IACrF,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,uBAAuB,CAAC,MAAuB;IAC7D,OAAQ,MAAiE,CAAC,UAAU,EAAE,QAAQ,IAAI,IAAI,CAAC;AACzG,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,mBAAmB,CAAC,MAAuB;IACzD,OAAQ,MAAiE,CAAC,UAAU,IAAI,IAAI,CAAC;AAC/F,CAAC","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0), through the TSL sparse source\n// (`three/sparse-source.ts`, K3.2): frameShaderChunks.js L729–763 (createVolumeUniforms, the source half) and\n// L834–1028 (createVolumeNodes).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: engine-free; one source per pool serving every volume through a uniform table indexed by `v`; the\n// coarse pyramids of all volumes packed in one r16float texture. Divergences: DIVERGES.md (K3.2 rows, K6.7 row).\n\n/**\n * `vdbSparseSource(pool, options)` (K6.7, design K6-core-renderer.md §2.1): the sparse volume source of the core\n * renderer, on raw WebGPU. One source serves every volume of one `VDBGridPool`:\n *\n * const source = vdbSparseSource(pool, { followImage: true });\n * const slot = source.volume({ density: id }); // a VDBVolumeSlot; slot.v indexes the source's table\n * // per frame, in the host's encoder:\n * pool.update(encoder);\n * source.update(encoder); // pyramids, layouts, the table (after the pool's update)\n * // bind group 2: source.layoutEntries(slot2) / source.bindEntries(slot2) (rebuild when source.version moves)\n * // WGSL: source.moduleWgsl(slot2) (or the renderer's one module with source.module's helpers) + source.wgsl(...)\n *\n * Group 2 at `slot` = { group, firstBinding: b }: b the pool (the VDB module's storage buffer, D10), b + 1 the volume\n * table (`array<VdbSrcVolume, maxVolumes>`, uniform), and with `lod: 'coarse-pyramid'` b + 2 the packed pyramid\n * atlas (r16float `texture_3d<f32>`) and b + 3 its sampler (linear, clamp to edge).\n *\n * The WGSL depends only on the options (LOD strategy, channels, `maxVolumes`, sampling options): boxes, pool ids,\n * LOD ranges and pyramid placements are values in the table, so adding volumes, a sequence frame (`pool.replace`)\n * or a coarse-first swap (`followImage`) never changes it, and with `types` fixed (the default\n * `VDB_ALL_SCALAR_TYPES`; the pyramid kernels of every type are compiled at creation when following images) a\n * swap creates no pipeline and no shader module (G16a).\n *\n * Per volume (see {@link VDBSparseVolume}): `texels`, `lodLevels`, `stats`, `boxToSource`, `bbox` and `version`\n * describe that volume; the source's own copies of the {@link VDBVolumeSourceInfo} fields are aggregates.\n */\n\nimport { VDBError } from \"../errors.js\";\nimport { VDBRetireQueue } from \"../frame/resources.js\";\nimport type { VDBGridInfo, VDBGridPool } from \"../pool/pool.js\";\nimport { VDB_ALL_SCALAR_TYPES, type VDBGridTypeName, type VDBSlot } from \"../types.js\";\nimport { vdbModuleEntries, vdbModuleWgsl } from \"../wgsl/generate.js\";\nimport type { VDBModuleHelper } from \"../wgsl/types.js\";\nimport { vdbCreateBoxPyramid, warmBoxPyramidPipelines, type VDBBoxPyramid } from \"../compute/pyramid.js\";\nimport { vdbBoxPyramidLayout, vdbPackPyramidBlocks, type VDBBoxPyramidLayout } from \"../../tools/frame/pyramid-layout.js\";\nimport { vdbSparseDensityStats } from \"../../tools/frame/sparse.js\";\nimport type { VDBVolumeChannels, VDBVolumeSlot, VDBVolumeSource, VDBVolumeSourceWgslInternalOptions, VDBVolumeSourceWgslOptions } from \"./types.js\";\nimport { packSparseRecord, sparseBindings, sparseSourceWgsl, SPARSE_FLAG, VDB_SPARSE_RECORD_BYTES, type SparseRecord, type SparseWgslConfig } from \"./sparse-wgsl.js\";\nimport { VDBSparseBrickCache, type VDBSparseBrickCounters, type VDBSparseBrickMode } from \"./brick-cache.js\";\nimport { VDB_BRICK_KERNELS, vdbBrickKernelUse, type VDBBrickKernel, type VDBBrickKernels } from \"../../tools/frame/brick-cache.js\";\n\ntype Vec3 = [number, number, number];\n\n/** WebGPU flag values (the globals do not exist in Node). */\nconst BUFFER = { MAP_READ: 0x1, COPY_DST: 0x8, UNIFORM: 0x40 } as const;\nconst TEXTURE = { COPY_SRC: 0x1, COPY_DST: 0x2, TEXTURE_BINDING: 0x4 } as const;\nconst STAGE_FRAGMENT_COMPUTE = 0x2 | 0x4;\n/** Updates a replaced GPU object outlives (the core's retire rule: destroyed two updates later). */\nconst RETIRE_UPDATES = 2;\n\n/** The LOD strategies (R1 §4.3; `three/sparse-source.ts`). */\nexport type VDBSparseLod = \"none\" | \"coarse-pyramid\" | \"node-average\";\n\n/** Inclusive voxel index box. */\nexport interface VDBSparseIndexBox {\n /** Smallest voxel index (inclusive). */\n min: Vec3;\n /** Largest voxel index (inclusive). */\n max: Vec3;\n}\n\n/** Options of {@link vdbSparseSource}. */\nexport interface VDBSparseSourceOptions {\n /** LOD strategy (default `'coarse-pyramid'`, the K3.2 pick). */\n lod?: VDBSparseLod;\n /** `'coarse-pyramid'`: base level texels on the longest side at most (default 128). */\n pyramidMax?: number;\n /** `'clamp01'` clamps each density sample to [0, 1] (his 8-bit range); default `'none'`. */\n normalize?: \"none\" | \"clamp01\";\n /** Grid types the source's volumes may hold (default `VDB_ALL_SCALAR_TYPES`); the VDB module must decode them. */\n types?: readonly VDBGridTypeName[];\n /**\n * G16a: follow the grids' images. When a channel grid's `imageRevision` moves and every channel grid of the volume\n * is resident, `update()` re-reads its boxes, world box and pyramid size from `pool.info` (values in the table, so\n * nothing recompiles) and bumps the volume's `version`. Not with per-volume `indexBox`, `auxIndexBoxes` or `bbox`.\n */\n followImage?: boolean;\n /** `march` profile: the HDDA empty-space query (`vdbSrcSkipSpan`); default true. False: it never skips (smaller module). */\n skipEmpty?: boolean;\n /** K3.2d: level 0 through `vdbSampleFast` (module helper `'fastTrilinear'`); default true. */\n fastTrilinear?: boolean;\n /** K3.2d: one accessor per invocation across samples (`var<private>`); default true. */\n cacheAccessor?: boolean;\n /** Channels the WGSL compiles (default: grows with the volumes' channels; fixed when given). */\n channels?: Partial<VDBVolumeChannels>;\n /** Volume slots (the WGSL table size, default 64; 224 bytes each, ≤ the device's uniform binding size). */\n maxVolumes?: number;\n /** Label prefix of the GPU objects. */\n label?: string;\n}\n\n/**\n * Internal options of {@link vdbSparseSource} (`core/internal.ts`; not part of the public options until the K6.T A/B).\n * K3.2f: the brick cache (`brick-cache.ts`).\n */\nexport interface VDBSparseSourceInternalOptions extends VDBSparseSourceOptions {\n /** Level-0 density through a brick cache: `'off'` (default), `'f32'` (bit-identical) or `'f16'` (one filtered fetch). */\n brickCache?: \"off\" | VDBSparseBrickMode;\n /** Most atlas bricks (default: 64 MiB of atlas). */\n brickCapacity?: number;\n /** Most bricks filled per update (default 1024 f32, 256 f16). */\n brickBudget?: number;\n /** Most pages over the volumes (default 2²²); volumes past it read the tree. */\n brickPagesMax?: number;\n /**\n * K3.2f-e: which frame kernels read and mark the cache: `'all'` (default), `'gather-marks'` (all read, the gather\n * marks) or `'gather-only'` (the gather reads and marks, the others read the tree). `tools` `VDBBrickKernels`.\n */\n brickKernels?: VDBBrickKernels;\n /**\n * K3.2f-e: count the marks per kernel (`vdbSparseBrickCacheInfo(source).kernelMarks`): every kernel marks its own\n * section of the marks buffer; the residency still follows `brickKernels`, so the images do not change. Default false.\n */\n brickMarkStats?: boolean;\n}\n\n/**\n * K3.2f-e (internal): `source.wgsl()` options of the frame kernels: which kernel the WGSL is for (`'gather'` when\n * absent), so the brick cache can mark per kernel. A dense source ignores it.\n */\nexport interface VDBSparseSourceWgslInternalOptions extends VDBVolumeSourceWgslInternalOptions {\n readonly brickKernel?: VDBBrickKernel;\n}\n\n/** The pool ids of one volume's channels. `albedo`: one grey grid or three (RGB). */\nexport interface VDBSparseVolumeGrids {\n /** Pool id of the density grid. */\n density: number;\n /** Pool id of an optional mask grid (multiplies the density). */\n mask?: number;\n /** Pool id of one grey albedo grid, or three ids for RGB. */\n albedo?: number | readonly [number, number, number];\n /** Pool id of an optional emission (temperature) grid. */\n emission?: number;\n}\n\n/** Per-volume options of {@link VDBSparseSource.volume}. */\nexport interface VDBSparseVolumeOptions {\n /** Density index box the unit box covers (default: the grid's index bbox). Not with `followImage`. */\n indexBox?: VDBSparseIndexBox;\n /** Index boxes of the aux grids (default: each grid's own bbox). Not with `followImage`. */\n auxIndexBoxes?: Partial<Record<\"mask\" | \"albedo\" | \"emission\", VDBSparseIndexBox>>;\n /** World box (default: the density cell box through the grid's transform, as an AABB). Not with `followImage`. */\n bbox?: [Vec3, Vec3];\n /** Density stats; default from `image`, else read back from the pool by `update()` once the grid is resident. */\n stats?: { meanNonZero: number; max: number; activeVoxels: number };\n /** The density grid's CPU image (for the stats). */\n image?: Uint32Array;\n}\n\n/** One volume of a sparse source: its slot and its own layout (the {@link VDBVolumeSlot} fields describe it). */\nexport interface VDBSparseVolume extends VDBVolumeSlot {\n readonly kind: \"sparse\";\n readonly source: VDBSparseSource;\n /** The pool ids of the channels. */\n readonly ids: Readonly<VDBSparseVolumeGrids>;\n /** The density index box the unit box covers. */\n readonly indexBox: VDBSparseIndexBox;\n /** World box (AABB of the density cell box). */\n readonly bbox: [Vec3, Vec3];\n /** `'coarse-pyramid'`: the pyramid layout and where its blocks sit in the packed atlas (null before the first update). */\n readonly pyramid: { readonly layout: VDBBoxPyramidLayout; readonly base: Vec3 | null; readonly atlas: Vec3 | null } | null;\n /** Times the stats were recomputed from a read-back image. */\n readonly statsUpdates: number;\n /** Times the layout was re-read after an image change (`followImage`). */\n readonly layoutUpdates: number;\n /** True once `remove()` ran. */\n readonly removed: boolean;\n /** Frees the slot (its `v` may be reused by a later volume) and its pyramid. */\n remove(): void;\n}\n\n/** What `update()` did. */\nexport interface VDBSparseSourceUpdate {\n /** Pyramid builds recorded into the encoder. */\n readonly pyramidBuilds: number;\n /** Volumes whose layout was re-read (`followImage`). */\n readonly relayouts: number;\n /** True when `version` moved since the previous `update()` (a new atlas texture or pool buffer): rebuild bind group 2. */\n readonly rebind: boolean;\n}\n\n/** The sparse source of the core renderer. */\nexport interface VDBSparseSource extends VDBVolumeSource {\n readonly kind: \"sparse\";\n readonly pool: VDBGridPool;\n readonly lod: VDBSparseLod;\n readonly followImage: boolean;\n readonly maxVolumes: number;\n /** What the shader's one VDB module must include (profile, helpers, types). */\n readonly module: { readonly profile: \"sample\" | \"march\"; readonly helpers: readonly VDBModuleHelper[]; readonly types: readonly VDBGridTypeName[] };\n /** Live volumes, by slot. */\n readonly volumes: readonly VDBSparseVolume[];\n /** GPU bytes the source allocated: the table, the packed atlas, the pyramids' scratch buffers. */\n readonly gpuBytes: { readonly table: number; readonly atlas: number; readonly pyramidScratch: number };\n /** Pyramid builds recorded so far. */\n readonly pyramidBuilds: number;\n /** Adds a volume; returns its slot (lowest free `v`). */\n volume(grids: VDBSparseVolumeGrids, options?: VDBSparseVolumeOptions): VDBSparseVolume;\n /**\n * Records this frame's source work into the host's encoder: re-reads followed layouts, packs and (re)builds the\n * pyramids whose grid image changed or whose block moved, writes the volume table (`queue.writeBuffer`) and\n * starts stats readbacks. Call once per submitted encoder, after `pool.update(encoder)` in the same encoder, and\n * build bind group 2 after it (Traps).\n */\n update(encoder: GPUCommandEncoder): VDBSparseSourceUpdate;\n /** The VDB module for `slot` with this source's needs (plus `helpers`), for shaders that sample only this source. */\n moduleWgsl(slot: VDBSlot, helpers?: Iterable<VDBModuleHelper>): string;\n /** Resolves when the stats readbacks in flight have landed. */\n settled(): Promise<void>;\n /** The packed pyramid atlas (r16float; a 1³ placeholder before the first pyramid), for tests and readbacks. */\n readonly atlas: GPUTexture | null;\n}\n\nconst bad = (message: string) => new VDBError(\"VDB_BAD_OPTION\", `vdbSparseSource: ${message}`);\n\nfunction checkSlot(slot: VDBSlot, where: string): VDBSlot {\n if (!slot || !Number.isInteger(slot.group) || slot.group < 0 || !Number.isInteger(slot.firstBinding) || slot.firstBinding < 0) {\n throw bad(`${where}: slot must be { group, firstBinding } with non-negative integers, got ${JSON.stringify(slot)}.`);\n }\n return slot;\n}\n\nconst copyBox = (b: { min: readonly number[]; max: readonly number[] }): VDBSparseIndexBox => ({ min: [b.min[0]!, b.min[1]!, b.min[2]!], max: [b.max[0]!, b.max[1]!, b.max[2]!] });\nconst sizeOf = (b: VDBSparseIndexBox): Vec3 => [b.max[0] - b.min[0] + 1, b.max[1] - b.min[1] + 1, b.max[2] - b.min[2] + 1];\nconst sameBox = (a: VDBSparseIndexBox, b: VDBSparseIndexBox) => a.min.every((v, i) => v === b.min[i]) && a.max.every((v, i) => v === b.max[i]);\n\n/** World AABB of an index cell box through a 3x4 row-major affine (the TSL source's `worldBox`). */\nfunction worldBox(box: VDBSparseIndexBox, m: Float64Array): [Vec3, Vec3] {\n const lo: Vec3 = [Infinity, Infinity, Infinity];\n const hi: Vec3 = [-Infinity, -Infinity, -Infinity];\n for (let c = 0; c < 8; c++) {\n const p = [c & 1 ? box.max[0] + 0.5 : box.min[0] - 0.5, c & 2 ? box.max[1] + 0.5 : box.min[1] - 0.5, c & 4 ? box.max[2] + 0.5 : box.min[2] - 0.5];\n for (let r = 0; r < 3; r++) {\n const v = m[r * 4]! * p[0]! + m[r * 4 + 1]! * p[1]! + m[r * 4 + 2]! * p[2]! + m[r * 4 + 3]!;\n lo[r] = Math.min(lo[r]!, v);\n hi[r] = Math.max(hi[r]!, v);\n }\n }\n return [lo, hi];\n}\n\n/** Local unit box → sample index space: p = min − ½ + (local + ½)·size (column-major; the TSL source's). */\nfunction boxToIndex(b: VDBSparseIndexBox): Float32Array {\n const [sx, sy, sz] = sizeOf(b);\n return new Float32Array([sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, b.min[0] - 0.5 + 0.5 * sx, b.min[1] - 0.5 + 0.5 * sy, b.min[2] - 0.5 + 0.5 * sz, 1]);\n}\n\n/** A coarse pyramid shared by the volumes with the same density grid and box. */\ninterface PyramidEntry {\n readonly key: string;\n readonly gridId: number;\n readonly box: VDBSparseIndexBox;\n readonly layout: VDBBoxPyramidLayout;\n refs: number;\n gpu: VDBBoxPyramid | null;\n base: Vec3 | null;\n atlas: Vec3 | null;\n /** A (re)build is needed whatever the grid's revision (new or moved block). */\n dirty: boolean;\n}\n\ninterface Readback {\n readonly buffer: GPUBuffer;\n readonly revision: number;\n readonly recordedAt: number;\n mapping: Promise<void> | null;\n}\n\nclass SparseVolume implements VDBSparseVolume {\n readonly kind = \"sparse\" as const;\n readonly source: SparseSource;\n readonly v: number;\n readonly ids: Readonly<VDBSparseVolumeGrids>;\n readonly channels: VDBVolumeChannels;\n indexBox: VDBSparseIndexBox;\n auxBoxes: Record<\"mask\" | \"albedo\" | \"emission\", VDBSparseIndexBox | null>;\n texels: [number, number, number];\n lodLevels = 0;\n stats: { meanNonZero: number; max: number; activeVoxels: number };\n boxToSource: Float32Array;\n bbox: [Vec3, Vec3];\n statsUpdates = 0;\n layoutUpdates = 0;\n removed = false;\n entry: PyramidEntry | null = null;\n /** The channel grids' newest imageRevision the layout describes (followImage) and the pool revision last checked. */\n layoutRevision = 0;\n layoutPoolRevision = -1;\n /** The density imageRevision the stats describe; -1 = none yet (read back once resident). */\n statsRevision: number;\n readback: Readback | null = null;\n readonly poolIds: number[];\n #versionSeen = { poolRevision: -1, value: 0 };\n\n constructor(source: SparseSource, v: number, ids: VDBSparseVolumeGrids, o: VDBSparseVolumeOptions) {\n this.source = source;\n this.v = v;\n const albedo = Array.isArray(ids.albedo) ? ([...ids.albedo] as unknown as [number, number, number]) : ids.albedo;\n this.ids = Object.freeze({ ...ids, ...(albedo !== undefined ? { albedo } : {}) });\n this.channels = { mask: ids.mask !== undefined, albedo: ids.albedo !== undefined, emission: ids.emission !== undefined };\n this.poolIds = [...new Set([ids.density, ids.mask, ids.emission, ...(Array.isArray(albedo) ? albedo : [albedo])].filter((x): x is number => x !== undefined))];\n const pool = source.pool;\n const density = pool.info(ids.density);\n this.indexBox = copyBox(o.indexBox ?? density.indexBBox);\n this.texels = sizeOf(this.indexBox);\n if (this.texels.some((t) => !(t > 0))) throw bad(\"the density index box is empty.\");\n const aux = o.auxIndexBoxes ?? {};\n const box = (id: number | undefined, given?: VDBSparseIndexBox) => (id === undefined ? null : copyBox(given ?? pool.info(id).indexBBox));\n this.auxBoxes = { mask: box(ids.mask, aux.mask), albedo: box(this.albedoId, aux.albedo), emission: box(ids.emission, aux.emission) };\n this.boxToSource = boxToIndex(this.indexBox);\n this.bbox = o.bbox ? [[...o.bbox[0]], [...o.bbox[1]]] : worldBox(this.indexBox, density.indexToWorld);\n const clamp01 = source.normalize === \"clamp01\";\n this.stats = o.stats ? { ...o.stats } : o.image ? vdbSparseDensityStats(o.image, clamp01) : { meanNonZero: 0, max: 0, activeVoxels: 0 };\n this.statsRevision = o.stats || o.image ? density.imageRevision : -1;\n this.layoutRevision = this.poolIds.reduce((r, id) => Math.max(r, pool.info(id).imageRevision), 0);\n }\n\n get albedoId(): number | undefined {\n const a = this.ids.albedo;\n return Array.isArray(a) ? a[0] : (a as number | undefined);\n }\n\n /** Content version: the image revision the layout describes (following), else the newest channel imageRevision. */\n get version(): number {\n if (this.source.followImage) return this.layoutRevision;\n const pool = this.source.pool;\n if (pool.revision !== this.#versionSeen.poolRevision) {\n let value = 0;\n for (const id of this.poolIds) {\n try {\n value = Math.max(value, pool.info(id).imageRevision);\n } catch {\n // A removed grid: keep the others' revision.\n }\n }\n this.#versionSeen = { poolRevision: pool.revision, value };\n }\n return this.#versionSeen.value;\n }\n\n get pyramid(): VDBSparseVolume[\"pyramid\"] {\n const e = this.entry;\n return e ? { layout: e.layout, base: e.base, atlas: e.atlas } : null;\n }\n\n /** Re-reads every box from the pool (followImage). */\n relayout(): void {\n const pool = this.source.pool;\n const density = pool.info(this.ids.density);\n this.indexBox = copyBox(density.indexBBox);\n this.texels = sizeOf(this.indexBox);\n this.boxToSource = boxToIndex(this.indexBox);\n this.bbox = worldBox(this.indexBox, density.indexToWorld);\n const aux = (id: number | undefined) => (id === undefined ? null : copyBox(pool.info(id).indexBBox));\n this.auxBoxes = { mask: aux(this.ids.mask), albedo: aux(this.albedoId), emission: aux(this.ids.emission) };\n this.layoutUpdates++;\n }\n\n /** The table record. */\n record(): SparseRecord {\n const ids = this.ids;\n const albedo = ids.albedo === undefined ? [0, 0, 0] : Array.isArray(ids.albedo) ? ids.albedo : [ids.albedo as number, ids.albedo as number, ids.albedo as number];\n const flags =\n (this.channels.mask ? SPARSE_FLAG.mask : 0) |\n (this.channels.albedo ? SPARSE_FLAG.albedo : 0) |\n (Array.isArray(ids.albedo) ? SPARSE_FLAG.albedoRgb : 0) |\n (this.channels.emission ? SPARSE_FLAG.emission : 0);\n const minOf = (b: VDBSparseIndexBox | null) => (b ? b.min : [0, 0, 0]);\n const sizeOfBox = (b: VDBSparseIndexBox | null) => (b ? sizeOf(b) : [1, 1, 1]);\n const e = this.entry;\n const layout = e?.layout;\n return {\n ids: [ids.density, ids.mask ?? 0, ids.emission ?? 0, flags],\n albedo: [albedo[0]!, albedo[1]!, albedo[2]!, 0],\n lod: [this.lodLevels, layout?.level ?? 0, layout?.atlas?.levels.length ?? 0, this.stats.max],\n densityMin: this.indexBox.min,\n densitySize: this.texels,\n maskMin: minOf(this.auxBoxes.mask),\n maskSize: sizeOfBox(this.auxBoxes.mask),\n albedoMin: minOf(this.auxBoxes.albedo),\n albedoSize: sizeOfBox(this.auxBoxes.albedo),\n emissionMin: minOf(this.auxBoxes.emission),\n emissionSize: sizeOfBox(this.auxBoxes.emission),\n pyrBase: e?.base ?? [0, 0, 0],\n pyrSize: layout?.dimensions ?? [1, 1, 1],\n pyrMip: [...(e?.atlas ?? [0, 0, 0]), layout?.atlas?.dimensions[0] ?? 1],\n };\n }\n\n remove(): void {\n this.source.removeVolume(this);\n }\n}\n\nclass SparseSource implements VDBSparseSource {\n readonly kind = \"sparse\" as const;\n readonly pool: VDBGridPool;\n readonly lod: VDBSparseLod;\n readonly normalize: \"none\" | \"clamp01\";\n readonly followImage: boolean;\n readonly maxVolumes: number;\n readonly module: VDBSparseSource[\"module\"];\n readonly boxToSource = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);\n pyramidBuilds = 0;\n readonly #device: GPUDevice;\n readonly #label: string;\n readonly #types: readonly VDBGridTypeName[];\n readonly #pyramidMax: number;\n readonly #fixedChannels: Partial<VDBVolumeChannels> | null;\n readonly #channels: { -readonly [K in keyof VDBVolumeChannels]: boolean } = { mask: false, albedo: false, emission: false };\n readonly #wgslBase: Omit<SparseWgslConfig, \"slot\" | \"profile\" | \"channels\">;\n readonly #slots: (SparseVolume | null)[] = [];\n readonly #pyramids = new Map<string, PyramidEntry>();\n readonly #table: GPUBuffer;\n readonly #sampler: GPUSampler | null;\n #atlas: GPUTexture | null = null;\n #ownVersion = 0;\n #lastVersion = -1;\n #packDirty = false;\n #tableDirty = true;\n #updates = 0;\n #retired: { at: number; destroy: () => void }[] = [];\n /** K6.10a: due objects are destroyed in a later task (several updates may share one encoder and one submit). */\n readonly #later = new VDBRetireQueue();\n readonly #mappings = new Set<Promise<void>>();\n #disposed = false;\n /** K3.2f: the brick cache (null when off) and whether its page layout must be redone. */\n readonly #bricks: VDBSparseBrickCache | null;\n /** K3.2f-e: which kernels read and mark the cache, and whether each marks its own section (counts per kernel). */\n readonly #brickKernels: VDBBrickKernels;\n readonly #brickMarkStats: boolean;\n #bricksLayout = true;\n\n constructor(pool: VDBGridPool, o: VDBSparseSourceInternalOptions) {\n if (!pool || typeof (pool as { info?: unknown }).info !== \"function\" || !(pool as { device?: unknown }).device) throw bad(\"pass a VDBGridPool.\");\n this.pool = pool;\n this.#device = pool.device;\n this.#label = o.label ?? \"vdb sparse source\";\n const lod = o.lod ?? \"coarse-pyramid\";\n if (lod !== \"none\" && lod !== \"coarse-pyramid\" && lod !== \"node-average\") throw bad(`unknown lod ${JSON.stringify(lod)}; use 'none', 'coarse-pyramid' or 'node-average'.`);\n this.lod = lod;\n const normalize = o.normalize ?? \"none\";\n if (normalize !== \"none\" && normalize !== \"clamp01\") throw bad(`unknown normalize ${JSON.stringify(normalize)}; use 'none' or 'clamp01'.`);\n this.normalize = normalize;\n if (o.followImage !== undefined && typeof o.followImage !== \"boolean\") throw bad(\"followImage must be a boolean.\");\n this.followImage = o.followImage ?? false;\n const types = o.types ?? VDB_ALL_SCALAR_TYPES;\n if (!Array.isArray(types) || types.length === 0 || types.some((t) => !VDB_ALL_SCALAR_TYPES.includes(t))) throw bad(`types must list grid types (${VDB_ALL_SCALAR_TYPES.join(\", \")}), got ${JSON.stringify(types)}.`);\n this.#types = Object.freeze([...types]);\n this.#pyramidMax = o.pyramidMax ?? 128;\n if (!Number.isInteger(this.#pyramidMax) || this.#pyramidMax < 1) throw bad(`pyramidMax must be a positive integer, got ${o.pyramidMax}.`);\n const skipEmpty = o.skipEmpty ?? true;\n const fastTrilinear = o.fastTrilinear ?? true;\n const cacheAccessor = o.cacheAccessor ?? true;\n const uniformLimit = (this.#device.limits as { maxUniformBufferBindingSize?: number } | undefined)?.maxUniformBufferBindingSize ?? 65536;\n const maxVolumes = o.maxVolumes ?? 64;\n const cap = Math.floor(uniformLimit / VDB_SPARSE_RECORD_BYTES);\n if (!Number.isInteger(maxVolumes) || maxVolumes < 1 || maxVolumes > cap) throw bad(`maxVolumes must be an integer in [1, ${cap}] (${VDB_SPARSE_RECORD_BYTES} B each in one uniform binding), got ${o.maxVolumes}.`);\n this.maxVolumes = maxVolumes;\n this.#fixedChannels = o.channels ? { ...o.channels } : null;\n if (this.#fixedChannels) Object.assign(this.#channels, { mask: !!o.channels!.mask, albedo: !!o.channels!.albedo, emission: !!o.channels!.emission });\n const brick = o.brickCache ?? \"off\";\n if (brick !== \"off\" && brick !== \"f32\" && brick !== \"f16\") throw bad(`brickCache must be 'off', 'f32' or 'f16', got ${JSON.stringify(o.brickCache)}.`);\n this.#wgslBase = { lod, fastTrilinear, cacheAccessor, clamp01: normalize === \"clamp01\", skipEmpty, maxVolumes, ...(brick !== \"off\" ? { brick } : {}) };\n const brickKernels = o.brickKernels ?? \"all\";\n if (brickKernels !== \"all\" && brickKernels !== \"gather-marks\" && brickKernels !== \"gather-only\") throw bad(`brickKernels must be 'all', 'gather-marks' or 'gather-only', got ${JSON.stringify(o.brickKernels)}.`);\n if (o.brickMarkStats !== undefined && typeof o.brickMarkStats !== \"boolean\") throw bad(\"brickMarkStats must be a boolean.\");\n this.#brickKernels = brickKernels;\n this.#brickMarkStats = o.brickMarkStats ?? false;\n const helpers: VDBModuleHelper[] = [];\n if (skipEmpty) helpers.push(\"cellBoundTrilinear\", \"hddaCellEnd\");\n if (lod === \"node-average\") helpers.push(\"nodeAverage\");\n if (fastTrilinear) helpers.push(\"fastTrilinear\");\n this.module = Object.freeze({ profile: skipEmpty || lod === \"node-average\" ? \"march\" : \"sample\", helpers: Object.freeze(helpers), types: this.#types });\n\n this.#table = this.#device.createBuffer({ label: `${this.#label} volumes`, size: maxVolumes * VDB_SPARSE_RECORD_BYTES, usage: BUFFER.UNIFORM | BUFFER.COPY_DST });\n if (lod === \"coarse-pyramid\") {\n this.#sampler = this.#device.createSampler({\n label: `${this.#label} pyramid sampler`,\n magFilter: \"linear\",\n minFilter: \"linear\",\n mipmapFilter: \"nearest\",\n addressModeU: \"clamp-to-edge\",\n addressModeV: \"clamp-to-edge\",\n addressModeW: \"clamp-to-edge\",\n });\n this.#atlas = this.#newAtlas([1, 1, 1]);\n // G16a: a following source compiles the pyramid kernels of every type now, so a swap creates no pipeline.\n if (this.followImage) warmBoxPyramidPipelines(this.#device, this.#types);\n } else {\n this.#sampler = null;\n }\n this.#bricks =\n brick === \"off\"\n ? null\n : new VDBSparseBrickCache(\n this.#device,\n pool,\n {\n mode: brick,\n types: this.#types,\n maxVolumes,\n label: this.#label,\n ...(o.brickCapacity !== undefined ? { capacity: o.brickCapacity } : {}),\n ...(o.brickBudget !== undefined ? { budget: o.brickBudget } : {}),\n ...(o.brickPagesMax !== undefined ? { pagesMax: o.brickPagesMax } : {}),\n kernels: brickKernels,\n markStats: this.#brickMarkStats,\n },\n { retire: (destroy) => this.#retire(destroy), rebind: () => this.#ownVersion++ },\n );\n }\n\n /** K3.2f: the brick cache (null when off), for counters, tests and probes. */\n get brickCache(): VDBSparseBrickCache | null {\n return this.#bricks;\n }\n\n // ---- VDBVolumeSourceInfo (aggregates over the live volumes; per volume, read the slot) ----\n\n get channels(): VDBVolumeChannels {\n return { ...this.#channels };\n }\n\n get texels(): [number, number, number] {\n const t: Vec3 = [1, 1, 1];\n for (const s of this.volumes) for (let a = 0; a < 3; a++) t[a] = Math.max(t[a]!, s.texels[a]!);\n return t;\n }\n\n get lodLevels(): number {\n return this.volumes.reduce((m, s) => Math.max(m, s.lodLevels), 0);\n }\n\n get stats(): { meanNonZero: number; max: number; activeVoxels: number } {\n let sum = 0;\n let count = 0;\n let max = 0;\n for (const s of this.volumes) {\n sum += s.stats.meanNonZero * s.stats.activeVoxels;\n count += s.stats.activeVoxels;\n max = Math.max(max, s.stats.max);\n }\n return { meanNonZero: count > 0 ? sum / count : 0, max, activeVoxels: count };\n }\n\n /** Bumps when bind group 2 must be rebuilt: a new atlas texture, or the pool's buffer replaced (`pool.version`). */\n get version(): number {\n return this.#ownVersion + this.pool.version;\n }\n\n get volumes(): readonly SparseVolume[] {\n return this.#slots.filter((s): s is SparseVolume => s !== null);\n }\n\n get atlas(): GPUTexture | null {\n return this.#atlas;\n }\n\n get gpuBytes(): VDBSparseSource[\"gpuBytes\"] {\n const a = this.#atlas;\n let scratch = 0;\n for (const e of this.#pyramids.values()) scratch += e.gpu?.gpuBytes.scratch ?? 0;\n return { table: this.#table.size, atlas: a ? 2 * a.width * a.height * a.depthOrArrayLayers : 0, pyramidScratch: scratch };\n }\n\n // ---- volumes ----\n\n #check(): void {\n if (this.#disposed) throw new VDBError(\"VDB_DISPOSED\", \"vdbSparseSource: the source was disposed; create a new one.\");\n }\n\n #checkTypes(infos: readonly { id: number; type: VDBGridTypeName }[], what: string): void {\n const missing = infos.filter((i) => !this.#types.includes(i.type));\n if (missing.length === 0) return;\n throw new VDBError(\n \"VDB_TYPE_NOT_COMPILED\",\n `vdbSparseSource: ${what} is ${missing.map((m) => `grid ${m.id}: ${m.type}`).join(\", \")}, but the source compiles only ${this.#types.join(\", \")}; ` +\n `it would read 0. Make the source with types that include every type the images will have (a coarse-first stream lists them in VDBCoarseFirstEvent.types).`,\n );\n }\n\n volume(grids: VDBSparseVolumeGrids, o: VDBSparseVolumeOptions = {}): VDBSparseVolume {\n this.#check();\n if (!grids || !Number.isInteger(grids.density)) throw bad(\"volume(): grids.density must be a pool grid id.\");\n if (Array.isArray(grids.albedo) && grids.albedo.length !== 3) throw bad(\"volume(): albedo must be one id or three (RGB).\");\n if (this.followImage) {\n const fixed = ([\"indexBox\", \"auxIndexBoxes\", \"bbox\"] as const).filter((k) => o[k] !== undefined);\n if (fixed.length) throw bad(`followImage re-reads every box from the pool; drop ${fixed.join(\", \")} (fixed boxes).`);\n }\n const ids = [grids.density, grids.mask, grids.emission, ...(Array.isArray(grids.albedo) ? grids.albedo : [grids.albedo])].filter((x): x is number => x !== undefined);\n const infos: VDBGridInfo[] = ids.map((id) => this.pool.info(id));\n this.#checkTypes(infos, \"a channel grid\");\n if (this.lod === \"node-average\" && !infos[0]!.hasStats) throw bad(\"lod 'node-average' reads node statistics; this grid has none (rebuild it with stats).\");\n const channels = { mask: grids.mask !== undefined, albedo: grids.albedo !== undefined, emission: grids.emission !== undefined };\n if (this.#fixedChannels) {\n const off = (Object.keys(channels) as (keyof VDBVolumeChannels)[]).filter((k) => channels[k] && !this.#channels[k]);\n if (off.length) throw bad(`volume(): the source compiles channels ${JSON.stringify(this.#channels)}; this volume has ${off.join(\", \")} (make the source with channels that include it).`);\n }\n let v = this.#slots.indexOf(null);\n if (v < 0) v = this.#slots.length;\n if (v >= this.maxVolumes) throw new VDBError(\"VDB_POOL_FULL\", `vdbSparseSource: all ${this.maxVolumes} volume slots are used (maxVolumes).`);\n const volume = new SparseVolume(this, v, grids, o);\n this.#slots[v] = volume;\n for (const k of Object.keys(channels) as (keyof VDBVolumeChannels)[]) if (channels[k]) this.#channels[k] = true;\n this.#attachPyramid(volume);\n this.#tableDirty = true;\n this.#bricksLayout = true;\n return volume;\n }\n\n removeVolume(volume: SparseVolume): void {\n if (volume.removed || this.#slots[volume.v] !== volume) return;\n volume.removed = true;\n this.#slots[volume.v] = null;\n while (this.#slots.length && this.#slots[this.#slots.length - 1] === null) this.#slots.pop();\n this.#detachPyramid(volume);\n const r = volume.readback;\n // Not mapping yet: its copy may sit in an encoder that is not submitted (mapping ones free themselves).\n if (r && !r.mapping) this.#retire(() => r.buffer.destroy());\n this.#tableDirty = true;\n this.#bricksLayout = true;\n }\n\n #attachPyramid(volume: SparseVolume): void {\n if (this.lod !== \"coarse-pyramid\") {\n volume.lodLevels = this.lod === \"node-average\" ? 7 : 0;\n return;\n }\n const box = volume.indexBox;\n const key = `${volume.ids.density}:${box.min.join(\",\")}:${box.max.join(\",\")}`;\n let entry = this.#pyramids.get(key);\n if (!entry) {\n entry = { key, gridId: volume.ids.density, box: copyBox(box), layout: vdbBoxPyramidLayout(sizeOf(box), { pyramidMax: this.#pyramidMax }), refs: 0, gpu: null, base: null, atlas: null, dirty: true };\n this.#pyramids.set(key, entry);\n this.#packDirty = true;\n }\n entry.refs++;\n volume.entry = entry;\n volume.lodLevels = entry.layout.lodLevels;\n }\n\n #detachPyramid(volume: SparseVolume): void {\n const entry = volume.entry;\n volume.entry = null;\n if (!entry || --entry.refs > 0) return;\n this.#pyramids.delete(entry.key);\n const gpu = entry.gpu;\n if (gpu) this.#retire(() => gpu.destroy());\n this.#packDirty = true;\n }\n\n #retire(destroy: () => void): void {\n this.#retired.push({ at: this.#updates, destroy });\n }\n\n #newAtlas(size: Vec3): GPUTexture {\n return this.#device.createTexture({\n label: `${this.#label} pyramid atlas`,\n size,\n dimension: \"3d\",\n format: \"r16float\",\n usage: TEXTURE.TEXTURE_BINDING | TEXTURE.COPY_DST | TEXTURE.COPY_SRC,\n });\n }\n\n /** Packs every pyramid's blocks; grows the atlas when they no longer fit; moved or new blocks rebuild. */\n #pack(): void {\n this.#packDirty = false;\n const entries = [...this.#pyramids.values()];\n const blocks: (readonly number[])[] = [];\n for (const e of entries) {\n blocks.push(e.layout.dimensions);\n if (e.layout.atlas) blocks.push(e.layout.atlas.dimensions);\n }\n const max = (this.#device.limits as { maxTextureDimension3D?: number } | undefined)?.maxTextureDimension3D ?? 2048;\n const packing = vdbPackPyramidBlocks(blocks, [max, max, max]);\n const old = this.#atlas!;\n const grow = packing.size.some((s, a) => s > [old.width, old.height, old.depthOrArrayLayers][a]!);\n if (grow) {\n const size: Vec3 = [Math.max(old.width, packing.size[0]), Math.max(old.height, packing.size[1]), Math.max(old.depthOrArrayLayers, packing.size[2])];\n this.#atlas = this.#newAtlas(size);\n this.#retire(() => old.destroy());\n this.#ownVersion++;\n }\n let i = 0;\n for (const e of entries) {\n const base = packing.origins[i++]!;\n const atlas = e.layout.atlas ? packing.origins[i++]! : null;\n const moved = !e.base || e.base.some((v, a) => v !== base[a]) || (atlas !== null && (!e.atlas || e.atlas.some((v, a) => v !== atlas[a])));\n if (!moved && !grow && e.gpu) continue;\n e.base = [...base];\n e.atlas = atlas ? [...atlas] : null;\n const previous = e.gpu;\n if (previous) this.#retire(() => previous.destroy());\n const target = this.#atlas!;\n e.gpu = vdbCreateBoxPyramid(this.#device, this.pool, e.gridId, {\n indexBox: e.box,\n level: e.layout.level,\n targets: { base: target, atlas: e.layout.atlas ? target : null, baseOrigin: e.base, ...(e.atlas ? { atlasOrigin: e.atlas } : {}) },\n label: `${this.#label} pyramid grid ${e.gridId}`,\n });\n e.dirty = true;\n }\n this.#tableDirty = true;\n }\n\n /** G16a: re-reads a following volume's layout once every channel grid's new image is resident. */\n #syncLayout(volume: SparseVolume): boolean {\n const pool = this.pool;\n if (pool.revision === volume.layoutPoolRevision) return false;\n let revision = 0;\n let resident = true;\n const infos: { id: number; type: VDBGridTypeName }[] = [];\n for (const id of volume.poolIds) {\n let i: VDBGridInfo;\n try {\n i = pool.info(id);\n } catch {\n return false; // a removed grid: keep the last layout\n }\n revision = Math.max(revision, i.imageRevision);\n if (!i.resident) resident = false;\n infos.push({ id, type: i.type });\n }\n if (revision === volume.layoutRevision) {\n volume.layoutPoolRevision = pool.revision;\n return false;\n }\n if (!resident) return false; // look again once the update has written it\n this.#checkTypes(infos, \"a channel grid's new image\");\n const before = copyBox(volume.indexBox);\n volume.relayout();\n if (this.lod === \"coarse-pyramid\" && !sameBox(before, volume.indexBox)) {\n this.#detachPyramid(volume);\n this.#attachPyramid(volume);\n }\n volume.layoutRevision = revision;\n volume.layoutPoolRevision = pool.revision;\n this.#tableDirty = true;\n this.#bricksLayout = true;\n return true;\n }\n\n update(encoder: GPUCommandEncoder): VDBSparseSourceUpdate {\n this.#check();\n this.#updates++;\n // Retire: destroyed two updates after they were replaced (an encoder recorded before may still name them), in a\n // later task (K6.10a: updates recorded into one encoder before its submit in this task)\n const keep: { at: number; destroy: () => void }[] = [];\n for (const r of this.#retired) {\n if (this.#updates - r.at > RETIRE_UPDATES) this.#later.retireAfterTask(r);\n else keep.push(r);\n }\n this.#retired = keep;\n\n let relayouts = 0;\n if (this.followImage) for (const s of this.volumes) if (this.#syncLayout(s)) relayouts++;\n if (this.#packDirty) this.#pack();\n\n let builds = 0;\n for (const e of this.#pyramids.values()) {\n const gpu = e.gpu;\n if (!gpu) continue;\n let info: VDBGridInfo;\n try {\n info = this.pool.info(e.gridId);\n } catch {\n continue; // removed from the pool: keep the last pyramid\n }\n if (!info.resident) continue; // the update that writes it is still to come\n if (e.dirty) {\n gpu.record(encoder);\n e.dirty = false;\n builds++;\n } else if (gpu.update(encoder)) {\n builds++;\n }\n }\n this.pyramidBuilds += builds;\n\n this.#stats(encoder);\n\n // K3.2f: the brick cache after the pool's update (its fills read the resident images) and before the frame's passes.\n if (this.#bricks) {\n if (this.#bricksLayout) {\n this.#bricksLayout = false;\n this.#bricks.layout(this.volumes);\n }\n this.#bricks.update(encoder);\n }\n\n if (this.#tableDirty) {\n this.#tableDirty = false;\n const bytes = new ArrayBuffer(Math.max(1, this.#slots.length) * VDB_SPARSE_RECORD_BYTES);\n for (const s of this.volumes) packSparseRecord(bytes, s.v * VDB_SPARSE_RECORD_BYTES, s.record());\n this.#device.queue.writeBuffer(this.#table, 0, new Uint8Array(bytes));\n }\n const version = this.version;\n const rebind = version !== this.#lastVersion;\n this.#lastVersion = version;\n return { pyramidBuilds: builds, relayouts, rebind };\n }\n\n /** K3.2e: a changed density image's stats, read back from the pool: copied in this encoder, mapped next update. */\n #stats(encoder: GPUCommandEncoder): void {\n const clamp01 = this.normalize === \"clamp01\";\n for (const s of this.volumes) {\n const r = s.readback;\n if (r && !r.mapping && r.recordedAt < this.#updates) {\n // The encoder that holds the copy was submitted (one update per submitted encoder).\n const mapping = r.buffer\n .mapAsync(0x1)\n .then(() => {\n if (s.removed) return;\n s.stats = vdbSparseDensityStats(new Uint32Array(r.buffer.getMappedRange().slice(0)), clamp01);\n s.statsRevision = r.revision;\n s.statsUpdates++;\n this.#tableDirty = true;\n })\n .catch(() => {})\n .finally(() => {\n r.buffer.destroy();\n if (s.readback === r) s.readback = null;\n this.#mappings.delete(mapping);\n });\n r.mapping = mapping;\n this.#mappings.add(mapping);\n continue;\n }\n if (r) continue;\n let info: VDBGridInfo;\n try {\n info = this.pool.info(s.ids.density);\n } catch {\n continue;\n }\n if (info.imageRevision === s.statsRevision || !info.resident || info.imageOffset === null) continue;\n const bytes = Math.ceil(info.imageBytes / 4) * 4;\n const buffer = this.#device.createBuffer({ label: `${this.#label} stats readback`, size: bytes, usage: BUFFER.MAP_READ | BUFFER.COPY_DST });\n encoder.copyBufferToBuffer(this.pool.buffer, info.imageOffset, buffer, 0, bytes);\n s.readback = { buffer, revision: info.imageRevision, recordedAt: this.#updates, mapping: null };\n }\n }\n\n async settled(): Promise<void> {\n while (this.#mappings.size) await Promise.all([...this.#mappings]);\n await this.#bricks?.settled();\n }\n\n // ---- group-2 contract ----\n\n #config(o: VDBSparseSourceWgslInternalOptions): SparseWgslConfig {\n const slot = checkSlot(o.slot, \"wgsl\");\n if (o.profile !== \"sample\" && o.profile !== \"march\") throw bad(`wgsl: profile must be 'sample' or 'march', got ${JSON.stringify(o.profile)}.`);\n const on = (k: keyof VDBVolumeChannels) => this.#channels[k] && o.channels?.[k] !== false;\n // K3.2f-e: the kernel's use of the brick cache (absent for the K3.2f defaults: the WGSL is the K3.2f text)\n const kernel = o.brickKernel ?? \"gather\";\n if (!VDB_BRICK_KERNELS.includes(kernel)) throw bad(`wgsl: brickKernel must be one of ${VDB_BRICK_KERNELS.join(\", \")}, got ${JSON.stringify(kernel)}.`);\n const brickUse = this.#wgslBase.brick && (this.#brickKernels !== \"all\" || this.#brickMarkStats) ? { brickUse: vdbBrickKernelUse(this.#brickKernels, kernel, this.#brickMarkStats) } : {};\n return { ...this.#wgslBase, ...brickUse, slot, profile: o.profile, channels: { mask: on(\"mask\"), albedo: on(\"albedo\"), emission: on(\"emission\") }, stochastic: o.stochastic === true };\n }\n\n wgsl(o: VDBVolumeSourceWgslOptions): string {\n this.#check();\n return sparseSourceWgsl(this.#config(o));\n }\n\n moduleWgsl(slot: VDBSlot, helpers: Iterable<VDBModuleHelper> = []): string {\n this.#check();\n return vdbModuleWgsl({ slot: checkSlot(slot, \"moduleWgsl\"), types: this.#types, profile: this.module.profile, helpers: new Set([...this.module.helpers, ...helpers]) });\n }\n\n layoutEntries(slot: VDBSlot, visibility: GPUShaderStageFlags = STAGE_FRAGMENT_COMPUTE): GPUBindGroupLayoutEntry[] {\n this.#check();\n const b = sparseBindings(checkSlot(slot, \"layoutEntries\"), this.lod, this.#wgslBase.brick);\n const entries: GPUBindGroupLayoutEntry[] = [\n ...vdbModuleEntries({ slot, visibility }),\n { binding: b.table, visibility, buffer: { type: \"uniform\", minBindingSize: this.maxVolumes * VDB_SPARSE_RECORD_BYTES } },\n ];\n if (b.pyramid !== null) {\n entries.push({ binding: b.pyramid, visibility, texture: { sampleType: \"float\", viewDimension: \"3d\" } });\n entries.push({ binding: b.sampler!, visibility, sampler: { type: \"filtering\" } });\n }\n if (b.brick) entries.push(...this.#bricks!.layoutEntries(b.brick, visibility));\n return entries;\n }\n\n bindEntries(slot: VDBSlot): GPUBindGroupEntry[] {\n this.#check();\n const b = sparseBindings(checkSlot(slot, \"bindEntries\"), this.lod, this.#wgslBase.brick);\n const entries: GPUBindGroupEntry[] = [this.pool.bindGroupEntry(slot), { binding: b.table, resource: { buffer: this.#table } }];\n if (b.pyramid !== null) {\n entries.push({ binding: b.pyramid, resource: this.#atlas!.createView({ dimension: \"3d\" }) });\n entries.push({ binding: b.sampler!, resource: this.#sampler! });\n }\n if (b.brick) entries.push(...this.#bricks!.bindEntries(b.brick));\n return entries;\n }\n\n dispose(): void {\n if (this.#disposed) return;\n this.#disposed = true;\n for (const r of this.#retired) r.destroy();\n this.#retired = [];\n this.#later.drain();\n for (const e of this.#pyramids.values()) e.gpu?.destroy();\n this.#pyramids.clear();\n for (const s of this.volumes) {\n s.removed = true;\n if (s.readback && !s.readback.mapping) s.readback.buffer.destroy();\n }\n this.#slots.length = 0;\n this.#atlas?.destroy();\n this.#atlas = null;\n this.#bricks?.dispose();\n this.#table.destroy();\n }\n}\n\n/**\n * A sparse volume source over the volumes of one `VDBGridPool` (see the file comment). The source owns its volume\n * table, the packed pyramid atlas and the pyramids' scratch buffers; it never touches the pool's buffer or the\n * device. `dispose()` frees what it allocated.\n *\n * @param pool The pool whose grids the volumes read (the source creates its objects on `pool.device`).\n * @param options LOD, normalization, types, `followImage`, `skipEmpty`, sampling and size options.\n */\nexport function vdbSparseSource(pool: VDBGridPool, options: VDBSparseSourceOptions = {}): VDBSparseSource {\n return new SparseSource(pool, options);\n}\n\n/** K3.2f (internal): the brick cache's counters of a source made with `brickCache` (null when off). */\nexport function vdbSparseBrickCacheInfo(source: VDBSparseSource): VDBSparseBrickCounters | null {\n return (source as unknown as { brickCache?: VDBSparseBrickCache | null }).brickCache?.counters ?? null;\n}\n\n/** K3.2f (internal): the brick cache of a source (null when off), for tests and probes. */\nexport function vdbSparseBrickCache(source: VDBSparseSource): VDBSparseBrickCache | null {\n return (source as unknown as { brickCache?: VDBSparseBrickCache | null }).brickCache ?? null;\n}\n"]}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * The volume-source seam of the K3 renderer (R1 §4.2): the renderer's shading
3
+ * reads density, mask, albedo and emission through one interface, with two
4
+ * sources behind it, the sparse `VDBGridPool` (K3.2) and dense `.wvdb` levels
5
+ * (`vdbDenseSource`, K3.0). It mirrors mjurczyk's `createVolumeNodes()`
6
+ * (frameShaderChunks.js L834–1028), so his materials port with call-site edits.
7
+ */
8
+ import type { VDBSlot } from "../types.js";
9
+ /** Optional channels of a source; absent channels compile to constants (mask 1, albedo 1, emission 0). */
10
+ export interface VDBVolumeChannels {
11
+ /** True when the source has a mask channel. */
12
+ readonly mask: boolean;
13
+ /** True when the source has an albedo (colour) channel. */
14
+ readonly albedo: boolean;
15
+ /** True when the source has an emission channel. */
16
+ readonly emission: boolean;
17
+ }
18
+ /** The descriptive half of a source: what every adapter needs, whatever it binds. */
19
+ export interface VDBVolumeSourceInfo {
20
+ /** Which backing the source has: the sparse pool or dense textures. */
21
+ readonly kind: "sparse" | "dense";
22
+ /** Voxels across the box at lod 0 (dense: the texture size; sparse: the index bbox extent). */
23
+ readonly texels: readonly [number, number, number];
24
+ /** Prefiltered levels available above level 0 (0 = level 0 only). */
25
+ readonly lodLevels: number;
26
+ /** Which optional channels the source has. */
27
+ readonly channels: VDBVolumeChannels;
28
+ /** `meanNonZero` feeds `normalizeDensity`; `max` bounds the density; `activeVoxels` counts non-zero voxels. */
29
+ readonly stats: {
30
+ readonly meanNonZero: number;
31
+ readonly max: number;
32
+ readonly activeVoxels: number;
33
+ };
34
+ /** Column-major 4x4: local unit box [-0.5, 0.5]³ → source space (dense: uvw in [0, 1]³; sparse: index space). */
35
+ readonly boxToSource: Float32Array;
36
+ /** Bumps when bindings must be rebuilt (new textures after a LOD swap, pool growth). */
37
+ readonly version: number;
38
+ /**
39
+ * K4.22: bumps whenever the volume's content changes, bindings or not (a dense `replace` of the same size writes
40
+ * into the same textures: a sequence frame, a streamed page). Lighting caches key on it (the frame renderer's
41
+ * shadow grid and emission probes). Absent: `version` covers content changes (sparse slots: the image revision).
42
+ */
43
+ readonly revision?: number;
44
+ }
45
+ /** Options of {@link VDBVolumeSource.wgsl}. */
46
+ export interface VDBVolumeSourceWgslOptions {
47
+ /** The bind-group slot the source's bindings start at. */
48
+ readonly slot: VDBSlot;
49
+ /** `march` adds `vdbSrcSkipEmpty` and `vdbSrcMaxIn`. */
50
+ readonly profile: "sample" | "march";
51
+ /** Turn channels the source has off (compiled to constants). Channels it lacks are always constants. */
52
+ readonly channels?: Partial<VDBVolumeChannels>;
53
+ }
54
+ /**
55
+ * Internal options of {@link VDBVolumeSource.wgsl} (`src/core/internal.ts`, not in the published API): what the
56
+ * frame and reference kernels ask of a source beyond the public options. Both core sources read them. A host's own
57
+ * `VDBVolumeSource` never receives one with the public settings: the kernels pass them only for internal settings
58
+ * (`densityFilter: 'stochastic'`, which then needs `vdbSrcDensityStochastic` from the source).
59
+ */
60
+ export interface VDBVolumeSourceWgslInternalOptions extends VDBVolumeSourceWgslOptions {
61
+ /**
62
+ * Issue #2 (stochastic texture filtering, Pharr et al. 2024): also emit
63
+ * `fn vdbSrcDensityStochastic(v: u32, uvw: vec3f, lod: f32, xi: vec3f) -> f32`, the density at lod 0 from ONE
64
+ * voxel picked with probability equal to its trilinear weight (per axis: the upper voxel when `xi.axis < frac`);
65
+ * its expectation over uniform `xi` is `vdbSrcDensity(v, uvw, 0)`. A sparse source reads one tree value instead of
66
+ * eight; a dense source returns `vdbSrcDensity` (its trilinear is already one hardware fetch). The pick replaces the
67
+ * level-0 trilinear wherever `vdbSrcDensity` reads level 0 (lod `'none'`: at every lod; `'coarse-pyramid'`: below the
68
+ * pyramid's base level, blended with the base as `vdbSrcDensity` does; `'node-average'`: at lod 0); elsewhere it is
69
+ * `vdbSrcDensity`. Default false (not emitted). Internal while the frame setting that uses it (`densityFilter`) is.
70
+ */
71
+ readonly stochastic?: boolean;
72
+ }
73
+ /**
74
+ * A volume source for raw WebGPU kernels. Generated WGSL (all names `vdbSrc*`):
75
+ *
76
+ * fn vdbSrcDensity (v: u32, uvw: vec3f, lod: f32) -> f32; // dense: [0, 1]
77
+ * fn vdbSrcMask (v: u32, uvw: vec3f, lod: f32) -> f32; // 1.0 when absent
78
+ * fn vdbSrcAlbedo (v: u32, uvw: vec3f, lod: f32) -> vec3f; // vec3(1) when absent
79
+ * fn vdbSrcEmission(v: u32, uvw: vec3f, lod: f32) -> f32; // 0.0 when absent
80
+ * fn vdbSrcTexels (v: u32) -> vec3f;
81
+ * fn vdbSrcLodLevels(v: u32) -> f32;
82
+ * // profile 'march':
83
+ * fn vdbSrcSkipEmpty(v: u32, o: vec3f, d: vec3f, t0: f32, t1: f32) -> f32;
84
+ * fn vdbSrcSkipSpan (v: u32, o: vec3f, d: vec3f, t0: f32, t1: f32, lod: f32, cutoff: f32) -> vec2f; // K6.7/K6.1d; dense: (t0, 1e30)
85
+ * fn vdbSrcMaxIn (v: u32, uvwMin: vec3f, uvwMax: vec3f) -> f32;
86
+ *
87
+ * `v` is the volume's source-local slot ({@link VDBVolumeSlot}; a dense source
88
+ * ignores it, its only volume is `v` = 0). `uvw` is in [0, 1]³ of the source box,
89
+ * already offset and wrapped by the caller; `lod` is in levels (log2 of the
90
+ * footprint in lod-0 voxels).
91
+ */
92
+ export interface VDBVolumeSource extends VDBVolumeSourceInfo {
93
+ /** Returns the WGSL of the `vdbSrc*` functions for the given slot, profile and channels. */
94
+ wgsl(o: VDBVolumeSourceWgslOptions): string;
95
+ /**
96
+ * Bind group layout entries for the source at `slot` (default visibility compute and fragment).
97
+ *
98
+ * @param slot Where the source's bindings start.
99
+ * @param visibility Shader stages that read them (default compute and fragment).
100
+ */
101
+ layoutEntries(slot: VDBSlot, visibility?: GPUShaderStageFlags): GPUBindGroupLayoutEntry[];
102
+ /** Bind group entries for the source at `slot`; rebuild the bind group when `version` changes. */
103
+ bindEntries(slot: VDBSlot): GPUBindGroupEntry[];
104
+ /** Frees what the source allocated. */
105
+ dispose(): void;
106
+ }
107
+ /**
108
+ * One volume of a source (K6 group-2 contract, design K6-core-renderer.md §2.1): what `renderer.addVolume` takes.
109
+ * `source` is the object whose `wgsl` / `layoutEntries` / `bindEntries` serve it (volumes that share one source
110
+ * object form one source group: one bind group, one dispatch); `v` is the volume's source-local slot, which the
111
+ * renderer copies into the volume's uniform record and passes as the `v` argument of every `vdbSrc*` call. The
112
+ * {@link VDBVolumeSourceInfo} fields describe this volume (a sparse source serves many volumes, each with its own
113
+ * texels, LOD range, stats and box). A dense source is its own slot (`v` = 0).
114
+ */
115
+ export interface VDBVolumeSlot extends VDBVolumeSourceInfo {
116
+ /** The source whose bindings and WGSL serve this volume. */
117
+ readonly source: VDBVolumeSource;
118
+ /** The source-local slot: the `v` of every `vdbSrc*` call for this volume. */
119
+ readonly v: number;
120
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The volume-source seam of the K3 renderer (R1 §4.2): the renderer's shading
3
+ * reads density, mask, albedo and emission through one interface, with two
4
+ * sources behind it, the sparse `VDBGridPool` (K3.2) and dense `.wvdb` levels
5
+ * (`vdbDenseSource`, K3.0). It mirrors mjurczyk's `createVolumeNodes()`
6
+ * (frameShaderChunks.js L834–1028), so his materials port with call-site edits.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/source/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * The volume-source seam of the K3 renderer (R1 §4.2): the renderer's shading\n * reads density, mask, albedo and emission through one interface, with two\n * sources behind it, the sparse `VDBGridPool` (K3.2) and dense `.wvdb` levels\n * (`vdbDenseSource`, K3.0). It mirrors mjurczyk's `createVolumeNodes()`\n * (frameShaderChunks.js L834–1028), so his materials port with call-site edits.\n */\n\nimport type { VDBSlot } from \"../types.js\";\n\n/** Optional channels of a source; absent channels compile to constants (mask 1, albedo 1, emission 0). */\nexport interface VDBVolumeChannels {\n /** True when the source has a mask channel. */\n readonly mask: boolean;\n /** True when the source has an albedo (colour) channel. */\n readonly albedo: boolean;\n /** True when the source has an emission channel. */\n readonly emission: boolean;\n}\n\n/** The descriptive half of a source: what every adapter needs, whatever it binds. */\nexport interface VDBVolumeSourceInfo {\n /** Which backing the source has: the sparse pool or dense textures. */\n readonly kind: \"sparse\" | \"dense\";\n /** Voxels across the box at lod 0 (dense: the texture size; sparse: the index bbox extent). */\n readonly texels: readonly [number, number, number];\n /** Prefiltered levels available above level 0 (0 = level 0 only). */\n readonly lodLevels: number;\n /** Which optional channels the source has. */\n readonly channels: VDBVolumeChannels;\n /** `meanNonZero` feeds `normalizeDensity`; `max` bounds the density; `activeVoxels` counts non-zero voxels. */\n readonly stats: { readonly meanNonZero: number; readonly max: number; readonly activeVoxels: number };\n /** Column-major 4x4: local unit box [-0.5, 0.5]³ → source space (dense: uvw in [0, 1]³; sparse: index space). */\n readonly boxToSource: Float32Array;\n /** Bumps when bindings must be rebuilt (new textures after a LOD swap, pool growth). */\n readonly version: number;\n /**\n * K4.22: bumps whenever the volume's content changes, bindings or not (a dense `replace` of the same size writes\n * into the same textures: a sequence frame, a streamed page). Lighting caches key on it (the frame renderer's\n * shadow grid and emission probes). Absent: `version` covers content changes (sparse slots: the image revision).\n */\n readonly revision?: number;\n}\n\n/** Options of {@link VDBVolumeSource.wgsl}. */\nexport interface VDBVolumeSourceWgslOptions {\n /** The bind-group slot the source's bindings start at. */\n readonly slot: VDBSlot;\n /** `march` adds `vdbSrcSkipEmpty` and `vdbSrcMaxIn`. */\n readonly profile: \"sample\" | \"march\";\n /** Turn channels the source has off (compiled to constants). Channels it lacks are always constants. */\n readonly channels?: Partial<VDBVolumeChannels>;\n}\n\n/**\n * Internal options of {@link VDBVolumeSource.wgsl} (`src/core/internal.ts`, not in the published API): what the\n * frame and reference kernels ask of a source beyond the public options. Both core sources read them. A host's own\n * `VDBVolumeSource` never receives one with the public settings: the kernels pass them only for internal settings\n * (`densityFilter: 'stochastic'`, which then needs `vdbSrcDensityStochastic` from the source).\n */\nexport interface VDBVolumeSourceWgslInternalOptions extends VDBVolumeSourceWgslOptions {\n /**\n * Issue #2 (stochastic texture filtering, Pharr et al. 2024): also emit\n * `fn vdbSrcDensityStochastic(v: u32, uvw: vec3f, lod: f32, xi: vec3f) -> f32`, the density at lod 0 from ONE\n * voxel picked with probability equal to its trilinear weight (per axis: the upper voxel when `xi.axis < frac`);\n * its expectation over uniform `xi` is `vdbSrcDensity(v, uvw, 0)`. A sparse source reads one tree value instead of\n * eight; a dense source returns `vdbSrcDensity` (its trilinear is already one hardware fetch). The pick replaces the\n * level-0 trilinear wherever `vdbSrcDensity` reads level 0 (lod `'none'`: at every lod; `'coarse-pyramid'`: below the\n * pyramid's base level, blended with the base as `vdbSrcDensity` does; `'node-average'`: at lod 0); elsewhere it is\n * `vdbSrcDensity`. Default false (not emitted). Internal while the frame setting that uses it (`densityFilter`) is.\n */\n readonly stochastic?: boolean;\n}\n\n/**\n * A volume source for raw WebGPU kernels. Generated WGSL (all names `vdbSrc*`):\n *\n * fn vdbSrcDensity (v: u32, uvw: vec3f, lod: f32) -> f32; // dense: [0, 1]\n * fn vdbSrcMask (v: u32, uvw: vec3f, lod: f32) -> f32; // 1.0 when absent\n * fn vdbSrcAlbedo (v: u32, uvw: vec3f, lod: f32) -> vec3f; // vec3(1) when absent\n * fn vdbSrcEmission(v: u32, uvw: vec3f, lod: f32) -> f32; // 0.0 when absent\n * fn vdbSrcTexels (v: u32) -> vec3f;\n * fn vdbSrcLodLevels(v: u32) -> f32;\n * // profile 'march':\n * fn vdbSrcSkipEmpty(v: u32, o: vec3f, d: vec3f, t0: f32, t1: f32) -> f32;\n * fn vdbSrcSkipSpan (v: u32, o: vec3f, d: vec3f, t0: f32, t1: f32, lod: f32, cutoff: f32) -> vec2f; // K6.7/K6.1d; dense: (t0, 1e30)\n * fn vdbSrcMaxIn (v: u32, uvwMin: vec3f, uvwMax: vec3f) -> f32;\n *\n * `v` is the volume's source-local slot ({@link VDBVolumeSlot}; a dense source\n * ignores it, its only volume is `v` = 0). `uvw` is in [0, 1]³ of the source box,\n * already offset and wrapped by the caller; `lod` is in levels (log2 of the\n * footprint in lod-0 voxels).\n */\nexport interface VDBVolumeSource extends VDBVolumeSourceInfo {\n /** Returns the WGSL of the `vdbSrc*` functions for the given slot, profile and channels. */\n wgsl(o: VDBVolumeSourceWgslOptions): string;\n /**\n * Bind group layout entries for the source at `slot` (default visibility compute and fragment).\n *\n * @param slot Where the source's bindings start.\n * @param visibility Shader stages that read them (default compute and fragment).\n */\n layoutEntries(slot: VDBSlot, visibility?: GPUShaderStageFlags): GPUBindGroupLayoutEntry[];\n /** Bind group entries for the source at `slot`; rebuild the bind group when `version` changes. */\n bindEntries(slot: VDBSlot): GPUBindGroupEntry[];\n /** Frees what the source allocated. */\n dispose(): void;\n}\n\n/**\n * One volume of a source (K6 group-2 contract, design K6-core-renderer.md §2.1): what `renderer.addVolume` takes.\n * `source` is the object whose `wgsl` / `layoutEntries` / `bindEntries` serve it (volumes that share one source\n * object form one source group: one bind group, one dispatch); `v` is the volume's source-local slot, which the\n * renderer copies into the volume's uniform record and passes as the `v` argument of every `vdbSrc*` call. The\n * {@link VDBVolumeSourceInfo} fields describe this volume (a sparse source serves many volumes, each with its own\n * texels, LOD range, stats and box). A dense source is its own slot (`v` = 0).\n */\nexport interface VDBVolumeSlot extends VDBVolumeSourceInfo {\n /** The source whose bindings and WGSL serve this volume. */\n readonly source: VDBVolumeSource;\n /** The source-local slot: the `v` of every `vdbSrc*` call for this volume. */\n readonly v: number;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Level-set surfaces and point sprites in the core (K6.6, design §3.9): WGSL functions for hosts that shade
3
+ * with their own materials, and raw reference passes for engine-free hosts. K6.6 exports through
4
+ * `core/internal.ts` only; the public surface lands in K6.8 (design §2.1).
5
+ */
6
+ export { vdbLevelSetSurfaceWgsl } from "./level-set-wgsl.js";
7
+ export { VDB_LEVEL_SET_BOX_TRIANGLES, VDB_LEVEL_SET_PASS_DRAW, VDB_LEVEL_SET_PASS_FRAME, vdbCreateLevelSetPass, vdbLevelSetPassWgsl, vdbLevelSetProxyCorners, } from "./level-set-pass.js";
8
+ export type { VDBLevelSetPassDraw, VDBLevelSetPassFrame, VDBLevelSetPass, VDBLevelSetPassOptions, VDBLevelSetPassPool } from "./level-set-pass.js";
9
+ export { VDB_POINT_PASS_FRAME, VDB_POINT_SPRITE_CORNERS, vdbCreatePointPass, vdbPointPassWgsl, vdbPointPixelScale, vdbPointSpriteWgsl, } from "./points.js";
10
+ export type { VDBPointPassData, VDBPointPassFrame, VDBPointPass, VDBPointPassOptions } from "./points.js";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Level-set surfaces and point sprites in the core (K6.6, design §3.9): WGSL functions for hosts that shade
3
+ * with their own materials, and raw reference passes for engine-free hosts. K6.6 exports through
4
+ * `core/internal.ts` only; the public surface lands in K6.8 (design §2.1).
5
+ */
6
+ export { vdbLevelSetSurfaceWgsl } from "./level-set-wgsl.js";
7
+ export { VDB_LEVEL_SET_BOX_TRIANGLES, VDB_LEVEL_SET_PASS_DRAW, VDB_LEVEL_SET_PASS_FRAME, vdbCreateLevelSetPass, vdbLevelSetPassWgsl, vdbLevelSetProxyCorners, } from "./level-set-pass.js";
8
+ export { VDB_POINT_PASS_FRAME, VDB_POINT_SPRITE_CORNERS, vdbCreatePointPass, vdbPointPassWgsl, vdbPointPixelScale, vdbPointSpriteWgsl, } from "./points.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/surface/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,aAAa,CAAC","sourcesContent":["/**\n * Level-set surfaces and point sprites in the core (K6.6, design §3.9): WGSL functions for hosts that shade\n * with their own materials, and raw reference passes for engine-free hosts. K6.6 exports through\n * `core/internal.ts` only; the public surface lands in K6.8 (design §2.1).\n */\n\nexport { vdbLevelSetSurfaceWgsl } from \"./level-set-wgsl.js\";\nexport {\n VDB_LEVEL_SET_BOX_TRIANGLES,\n VDB_LEVEL_SET_PASS_DRAW,\n VDB_LEVEL_SET_PASS_FRAME,\n vdbCreateLevelSetPass,\n vdbLevelSetPassWgsl,\n vdbLevelSetProxyCorners,\n} from \"./level-set-pass.js\";\nexport type { VDBLevelSetPassDraw, VDBLevelSetPassFrame, VDBLevelSetPass, VDBLevelSetPassOptions, VDBLevelSetPassPool } from \"./level-set-pass.js\";\nexport {\n VDB_POINT_PASS_FRAME,\n VDB_POINT_SPRITE_CORNERS,\n vdbCreatePointPass,\n vdbPointPassWgsl,\n vdbPointPixelScale,\n vdbPointSpriteWgsl,\n} from \"./points.js\";\nexport type { VDBPointPassData, VDBPointPassFrame, VDBPointPass, VDBPointPassOptions } from \"./points.js\";\n"]}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * The raw level-set reference pass (K6.6, design §3.9): level-set surfaces drawn by an engine-free host
3
+ * into its own render pass, through the same `vdbLevelSetSurface` WGSL that `VDBLevelSetMaterial` calls.
4
+ * Writes `frag_depth` (so surfaces depth-test against the host's meshes) and either a Lambert + ambient
5
+ * shade or a G-buffer texel (world normal, ray distance).
6
+ *
7
+ * const surfaces = vdbCreateLevelSetPass(device, pool, { colorFormat: 'rgba8unorm', depthFormat: 'depth24plus' });
8
+ * // per frame, after pool.update(encoder):
9
+ * const pass = encoder.beginRenderPass({ colorAttachments: [...], depthStencilAttachment: { ... } });
10
+ * surfaces.record(pass, { view, projection, viewport: [0, 0, width, height] }, [{ grid: id, color: [1, 0.8, 0.6] }]);
11
+ * pass.end();
12
+ *
13
+ * Each draw rasterizes the back faces of the grid's index box `[min − 1.5, max + 1.5]` (the trilinear
14
+ * support the trace clips to, half a voxel wider) mapped to world space, so the camera may be inside it;
15
+ * the fragment ignores the box and traces the pixel-centre ray (V57). Uniforms go through
16
+ * `queue.writeBuffer`: one `record()` per submitted encoder (the pool's contract).
17
+ */
18
+ import { type VDBGridTypeName } from "../types.js";
19
+ import type { VDBVec3 } from "../pool/layout.js";
20
+ import { type VDBRenderSpec } from "../frame/pipelines.js";
21
+ import { type VDBMat4 } from "../../tools/frame/view.js";
22
+ /** What the pass reads from the pool (a `VDBGridPool` has all of it). */
23
+ export interface VDBLevelSetPassPool {
24
+ readonly buffer: GPUBuffer;
25
+ readonly version: number;
26
+ readonly layoutVersion: number;
27
+ readonly types: ReadonlySet<VDBGridTypeName>;
28
+ info(id: number): {
29
+ readonly indexBBox: {
30
+ readonly min: readonly number[];
31
+ readonly max: readonly number[];
32
+ };
33
+ readonly indexToWorld: ArrayLike<number>;
34
+ readonly voxelSize: readonly number[];
35
+ };
36
+ }
37
+ /** Options of {@link vdbCreateLevelSetPass}. */
38
+ export interface VDBLevelSetPassOptions {
39
+ /** Format of the one colour attachment. */
40
+ readonly colorFormat: GPUTextureFormat;
41
+ /** Format of the depth attachment (`frag_depth` needs one). */
42
+ readonly depthFormat: GPUTextureFormat;
43
+ /**
44
+ * `'shade'` (default): `color · (ambient + lightColor · max(n · −lightDirection, 0))`, alpha 1, linear.
45
+ * `'gbuffer'`: `(world normal xyz, ray distance t)`; use a float format (`rgba16float`, `rgba32float`).
46
+ */
47
+ readonly output?: "shade" | "gbuffer";
48
+ /** Grid types the module decodes (fixed at creation; others read 0). Default: the pool's types now. */
49
+ readonly types?: readonly VDBGridTypeName[];
50
+ /** Compiled cap on a draw's `maxSamples`. Default 1024 (`VDB_LEVEL_SET_SAMPLES_CAP`). */
51
+ readonly maxSamplesCap?: number;
52
+ /** Depth test. Default `'less'` (`'greater'` for a reversed-depth host). */
53
+ readonly depthCompare?: GPUCompareFunction;
54
+ readonly label?: string;
55
+ }
56
+ /** The camera and lights of one {@link VDBLevelSetPass.record}. Matrices are column-major. */
57
+ export interface VDBLevelSetPassFrame {
58
+ /** World → view. */
59
+ readonly view: VDBMat4;
60
+ /** View → clip, WebGPU depth range (`[0, 1]`, or reversed). */
61
+ readonly projection: VDBMat4;
62
+ /** Default: `projection[11] === 0` (no perspective divide). */
63
+ readonly orthographic?: boolean;
64
+ /** The render pass's viewport in attachment pixels: `[x, y, width, height]`. */
65
+ readonly viewport: readonly [number, number, number, number];
66
+ /** `'shade'`: one directional light; `direction` is the way the light travels. Default `[-0.4, -0.8, -0.45]`, white. */
67
+ readonly light?: {
68
+ readonly direction: VDBVec3;
69
+ readonly color: VDBVec3;
70
+ } | null;
71
+ /** `'shade'`: ambient radiance. Default `[0.15, 0.15, 0.15]`. */
72
+ readonly ambient?: VDBVec3;
73
+ }
74
+ /** One level set to draw. */
75
+ export interface VDBLevelSetPassDraw {
76
+ /** The grid's pool id. */
77
+ readonly grid: number;
78
+ /** `'shade'` albedo. Default white. */
79
+ readonly color?: VDBVec3;
80
+ /** Index voxels per SDF unit. Default `1 / pool.info(grid).voxelSize[0]`. */
81
+ readonly sdfToIndex?: number;
82
+ /** Trilinear samples per trace, clamped to `[1, maxSamplesCap]`. Default 512. */
83
+ readonly maxSamples?: number;
84
+ /** Central-difference step of the normal in index voxels. Default 1; 0: the trilinear cell's exact gradient (G13c-a). */
85
+ readonly normalStep?: number;
86
+ }
87
+ /** A level-set pass (see the file comment). */
88
+ export interface VDBLevelSetPass {
89
+ readonly device: GPUDevice;
90
+ readonly output: "shade" | "gbuffer";
91
+ /** Grid types the module decodes. */
92
+ readonly types: readonly VDBGridTypeName[];
93
+ /** The pass's whole WGSL (module + surface + entries), for inspection and size budgets. */
94
+ readonly wgsl: string;
95
+ /** The render pipeline's spec (cache key, layouts, state). */
96
+ readonly spec: VDBRenderSpec;
97
+ /** Builds the pipeline with `createRenderPipelineAsync` (optional warm-up). */
98
+ prepare(): Promise<void>;
99
+ /**
100
+ * Records the draws into the host's render pass (its viewport must equal `frame.viewport`). Call after
101
+ * `pool.update(encoder)` of this frame: the pool's bind group is rebuilt when `pool.version` moved.
102
+ *
103
+ * @throws VDBError `VDB_TYPE_NOT_COMPILED` when the pool holds a type the module doesn't decode;
104
+ * `VDB_BAD_OPTION` for a bad draw; `VDB_DISPOSED` after `dispose()`.
105
+ */
106
+ record(renderPass: GPURenderPassEncoder, frame: VDBLevelSetPassFrame, draws: readonly VDBLevelSetPassDraw[]): void;
107
+ /** Destroys the buffers the pass made (never the pool, device or targets). Idempotent. */
108
+ dispose(): void;
109
+ }
110
+ /** Group 0 binding 0: the camera and lights. */
111
+ export declare const VDB_LEVEL_SET_PASS_FRAME: import("../internal.js").VDBUniformStruct;
112
+ /** Group 0 binding 1 (dynamic offset): one draw. */
113
+ export declare const VDB_LEVEL_SET_PASS_DRAW: import("../internal.js").VDBUniformStruct;
114
+ /**
115
+ * The 36 corner indices of the box's 12 triangles, counter-clockwise seen from outside in a right-handed
116
+ * world (a unit test checks every triangle's normal points out). Culling front faces draws the back faces.
117
+ */
118
+ export declare const VDB_LEVEL_SET_BOX_TRIANGLES: readonly number[];
119
+ /** The full WGSL of a level-set pass (module + `vdbLevelSetSurfaceWgsl()` + entries). */
120
+ export declare function vdbLevelSetPassWgsl(options: {
121
+ types: readonly VDBGridTypeName[];
122
+ output?: "shade" | "gbuffer";
123
+ maxSamplesCap?: number;
124
+ }): string;
125
+ /**
126
+ * The 8 world corners of a grid's proxy box (`[min − 1.5, max + 1.5]` through the 3x4 row-major
127
+ * index-to-world affine), `x, y, z, 1` each. A mirroring affine swaps the x corners so the triangles stay
128
+ * counter-clockwise from outside.
129
+ */
130
+ export declare function vdbLevelSetProxyCorners(info: ReturnType<VDBLevelSetPassPool["info"]>, out?: Float32Array): Float32Array;
131
+ /**
132
+ * Creates a level-set pass on `device` for the grids of `pool` (see the file comment). The pipeline is
133
+ * built at the first `record()` (or `prepare()`), cached per device by its WGSL and state.
134
+ *
135
+ * @param device The host's device (the pool's).
136
+ * @param pool The `VDBGridPool` holding the level sets.
137
+ * @param options Formats, output and module types ({@link VDBLevelSetPassOptions}).
138
+ * @throws VDBError `VDB_BAD_OPTION` for bad options.
139
+ */
140
+ export declare function vdbCreateLevelSetPass(device: GPUDevice, pool: VDBLevelSetPassPool, options: VDBLevelSetPassOptions): VDBLevelSetPass;