@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":"majorant.js","sourceRoot":"","sources":["../../../src/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AAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;oBACpB,OAAO,CAAC,CAAC;gBACX,CAAC;gBACD,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;oBAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,CAAC;YAC1F,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/**\n * Majorants for delta and ratio tracking (P1.2, P1.3, P1.4; docs/dev/design/K1-core.md §5).\n *\n * {@link vdbBrickMajorant} builds the brick grid the core's `majorant` WGSL profile walks: one upper\n * (and optionally lower) bound per cell of `2^brickLog2` index voxels, over the SAMPLED field. A\n * trilinear sample at `p` reads voxels `floor(p)` and `floor(p) + 1`, so a cell that holds the\n * positions `[o + B c, o + B (c + 1))` (origin `o`, edge `B`) bounds the voxels `[o + B c, o + B c + B]`\n * (its \"taps\", `B + 1` per axis): leaf voxels active or not, tile values, and the background.\n *\n * {@link vdbMajorantWalk} is the CPU twin of `vdbMajorantInit` / `vdbMajorantNext` (all three modes, and the\n * `vdbMajorantInitWorld` / `vdbMajorantInitGlobal` helpers), in f32 in the WGSL's evaluation order. Like the other\n * twins, GPU parity compares `t` with a tolerance (a GPU may fuse a multiply-add or divide less exactly) and the\n * bounds exactly. {@link vdbDeltaTrack} and {@link vdbRatioTrack} (EX1f-b) are the twins of the tracking helpers.\n */\nimport { VDBToolsError } from \"../errors.js\";\nimport type { VDBVec3 } from \"../vdb/types.js\";\nimport { vdbSampleNearestCpu, vdbSampleTrilinearCpu } from \"./sample-trilinear.js\";\nimport {\n cellBoundTrilinear,\n defaultValueMax,\n forEachTreeRegion,\n getDim,\n hddaInit,\n hddaStep,\n hddaUpdate,\n indexBBox,\n leafVoxels,\n type Vec3,\n} from \"./march.js\";\n\nconst f = Math.fround;\n\n/**\n * Brick-majorant bounds for one grid: a dense grid of cells, x fastest, cell `c` covering the index\n * positions `[origin + B c, origin + B (c + 1))` with `B = 2^brickLog2`. Built by\n * {@link vdbBrickMajorant}; the core's `VDBGridPool.setMajorant` stores it next to the grid\n * (the core exports this same type).\n */\nexport interface VDBBrickMajorant {\n /** log2 of the brick edge in index voxels (3 for 8³ bricks). */\n brickLog2: number;\n /** Cells along x, y, z. */\n dims: VDBVec3;\n /** `dims[0] * dims[1] * dims[2]` upper bounds, x fastest. */\n data: Float32Array;\n /**\n * Index position of cell 0's min corner. Default (when a host builds the grid itself and leaves it out):\n * the grid's `indexBBoxMin - 1`, where the trilinear support starts.\n */\n origin?: VDBVec3;\n /** Lower bounds, as `data` (optional; the `minima` module option reads them). */\n minima?: Float32Array;\n}\n\n/** Options of {@link vdbBrickMajorant}. */\nexport interface VDBBrickMajorantOptions {\n /** log2 of the brick edge (0..10). Default 3 (8³ voxels, the pathtracer's brick). */\n brickLog2?: number;\n /** Also build lower bounds (`minima`). Default false. */\n minima?: boolean;\n /**\n * Where the cells sit.\n * - `'support'` (default): origin `indexBBoxMin - 1`, `ceil((max - min + 2) / B)` cells per axis: the\n * smallest grid that covers the trilinear support `[min - 1, max + 1)`.\n * - `'pathtracer'`: pmndrs/pathtracer's `brickMajorants` layout for a dense grid of `resolution` voxels\n * at index `[0, n)`: origin -1, `floor((n + B) / B)` cells, cell c over `[B c - 1, B c + B - 1)`. Bounds\n * are at least 0 and a cell whose taps reach `[0, n - 1]`'s faces has minimum 0 (its rule, kept\n * bit for bit, so the arrays equal its `brickMajorants` on the same dense array). Implies\n * `outside: 'zero'`; the grid's bbox must lie in `[0, resolution - 1]`.\n */\n align?: \"support\" | \"pathtracer\";\n /**\n * The field the bounds are for, as the module's `outside` option: `'background'` (default) reads the\n * tree everywhere; `'zero'` is 0 outside the index bbox (a tap outside it reads 0).\n */\n outside?: \"background\" | \"zero\";\n /** `align: 'pathtracer'`: the dense grid's voxel counts. Default `indexBBoxMax + 1`. */\n resolution?: VDBVec3;\n}\n\nfunction bad(message: string): never {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbBrickMajorant: ${message}`);\n}\n\n/** Where the cells of a brick majorant sit, and the field it bounds ({@link brickMajorantLayout}). */\nexport interface BrickMajorantLayout {\n brickLog2: number;\n align: \"support\" | \"pathtracer\";\n /** The bounds are for the field that is 0 outside the index bbox. */\n zero: boolean;\n /** The index bbox is empty (`max < min` on an axis). */\n empty: boolean;\n /** Index position of cell 0's min corner. */\n origin: Vec3;\n /** Cells per axis. */\n dims: Vec3;\n /** `align: 'pathtracer'`: the dense grid's voxel counts; `[0, 0, 0]` for `'support'`. */\n resolution: Vec3;\n}\n\n/**\n * Checks the options of {@link vdbBrickMajorant} and lays out its cells for a grid with index bbox `[min, max]`\n * (tools internal). The core's GPU builder (`VDBGridPool.buildMajorant`, P1.15) takes the same layout, so the two\n * builders agree on origin and dims by construction.\n *\n * @throws VDBToolsError `VDB_BAD_OPTION` for invalid options or a bbox outside `resolution`.\n */\nexport function brickMajorantLayout(min: Vec3, max: Vec3, options: VDBBrickMajorantOptions = {}): BrickMajorantLayout {\n if (typeof options !== \"object\" || options === null) bad(`options must be an object, got ${JSON.stringify(options)}.`);\n const log2 = options.brickLog2 ?? 3;\n if (!Number.isInteger(log2) || log2 < 0 || log2 > 10) bad(`brickLog2 must be an integer in 0..10, got ${String(log2)}.`);\n const align = options.align ?? \"support\";\n if (align !== \"support\" && align !== \"pathtracer\") bad(`align must be 'support' or 'pathtracer', got ${JSON.stringify(align)}.`);\n if (options.outside !== undefined && options.outside !== \"background\" && options.outside !== \"zero\") {\n bad(`outside must be 'background' or 'zero', got ${JSON.stringify(options.outside)}.`);\n }\n if (align === \"pathtracer\" && options.outside === \"background\") bad(\"align 'pathtracer' samples zero outside the grid; drop outside: 'background'.\");\n const zero = align === \"pathtracer\" || options.outside === \"zero\";\n const B = 1 << log2;\n const empty = max[0] < min[0] || max[1] < min[1] || max[2] < min[2];\n\n let origin: Vec3;\n let dims: Vec3;\n let n: Vec3 = [0, 0, 0];\n if (align === \"support\") {\n origin = empty ? [0, 0, 0] : [min[0] - 1, min[1] - 1, min[2] - 1];\n dims = empty ? [1, 1, 1] : ([0, 1, 2].map((a) => Math.ceil((max[a]! - min[a]! + 2) / B)) as Vec3);\n } else {\n const res = options.resolution ?? (empty ? [1, 1, 1] : [max[0] + 1, max[1] + 1, max[2] + 1]);\n if (!Array.isArray(res) || res.length !== 3 || res.some((v) => !Number.isInteger(v) || v < 1)) {\n bad(`resolution must be [nx, ny, nz] positive integers, got ${JSON.stringify(res)}.`);\n }\n n = [res[0], res[1], res[2]];\n if (!empty && (min.some((v) => v < 0) || max.some((v, a) => v >= n[a]!))) {\n bad(`align 'pathtracer' needs the grid's bbox [${min.join(\",\")}]..[${max.join(\",\")}] inside [0, resolution - 1] = [0,0,0]..[${n.map((v) => v - 1).join(\",\")}].`);\n }\n origin = [-1, -1, -1];\n dims = [0, 1, 2].map((a) => Math.floor((n[a]! + B) / B)) as Vec3;\n }\n return { brickLog2: log2, align, zero, empty, origin, dims, resolution: n };\n}\n\n/**\n * Builds brick-majorant bounds of a NanoVDB grid image (P1.2) for the core's `majorant` profile\n * (`pool.setMajorant(id, vdbBrickMajorant(image))`, module option `majorant: 'brick'`).\n *\n * A cell's bound is the max (and with `minima`, the min) of every value a trilinear sample inside it\n * can read: its `B + 1` taps per axis, leaf voxels active or not, tiles and the background, or 0 for a\n * tap outside the index bbox with `outside: 'zero'`. So every trilinear (or nearest) sample in the cell\n * lies in `[minima, data]`. Works on every scalar grid type (Fp values as the GPU decodes them).\n *\n * @param image The grid image (little-endian u32 words, `GridData` at word 0).\n * @param options Brick size, minima, alignment and the `outside` field.\n * @throws VDBToolsError `VDB_BAD_OPTION` for invalid options or a bbox outside `resolution`.\n */\nexport function vdbBrickMajorant(image: Uint32Array, options: VDBBrickMajorantOptions = {}): VDBBrickMajorant {\n const { min, max } = indexBBox(image);\n const { brickLog2: log2, align, zero, empty, origin, dims, resolution: n } = brickMajorantLayout(min, max, options);\n const B = 1 << log2;\n\n const cells = dims[0] * dims[1] * dims[2];\n const hi = new Float64Array(cells).fill(-Infinity);\n const lo = options.minima ? new Float64Array(cells).fill(Infinity) : null;\n // Tap extent of the whole grid of cells: [origin, origin + B * dims].\n const extLo: Vec3 = [origin[0], origin[1], origin[2]];\n const extHi: Vec3 = [origin[0] + B * dims[0], origin[1] + B * dims[1], origin[2] + B * dims[2]];\n // Where values come from the tree: the bbox (zero) or the extent (background).\n const domLo: Vec3 = zero ? [Math.max(min[0], extLo[0]), Math.max(min[1], extLo[1]), Math.max(min[2], extLo[2])] : extLo;\n const domHi: Vec3 = zero ? [Math.min(max[0], extHi[0]), Math.min(max[1], extHi[1]), Math.min(max[2], extHi[2])] : extHi;\n const cellLo = (a: number, axis: number) => Math.max(0, Math.ceil((a - origin[axis]! - B) / B));\n const cellHi = (b: number, axis: number) => Math.min(dims[axis]! - 1, Math.floor((b - origin[axis]!) / B));\n\n /** Max/min `v` into every cell whose taps meet the voxel box [a, b] (inclusive), after clipping to the domain. */\n const add = (a0: number, a1: number, a2: number, b0: number, b1: number, b2: number, v: number) => {\n if (empty && zero) return;\n const x0 = Math.max(a0, domLo[0]), y0 = Math.max(a1, domLo[1]), z0 = Math.max(a2, domLo[2]);\n const x1 = Math.min(b0, domHi[0]), y1 = Math.min(b1, domHi[1]), z1 = Math.min(b2, domHi[2]);\n if (x0 > x1 || y0 > y1 || z0 > z1) return;\n const cx0 = cellLo(x0, 0), cx1 = cellHi(x1, 0);\n const cy0 = cellLo(y0, 1), cy1 = cellHi(y1, 1);\n const cz0 = cellLo(z0, 2), cz1 = cellHi(z1, 2);\n for (let cz = cz0; cz <= cz1; cz++) {\n for (let cy = cy0; cy <= cy1; cy++) {\n let i = cx0 + dims[0] * (cy + dims[1] * cz);\n for (let cx = cx0; cx <= cx1; cx++, i++) {\n if (v > hi[i]!) hi[i] = v;\n if (lo && v < lo[i]!) lo[i] = v;\n }\n }\n }\n };\n\n const { background, rootTiles } = forEachTreeRegion(image, (r) => {\n const [ox, oy, oz] = r.origin;\n if (ox > domHi[0] || oy > domHi[1] || oz > domHi[2] || ox + r.dim - 1 < domLo[0] || oy + r.dim - 1 < domLo[1] || oz + r.dim - 1 < domLo[2]) return;\n if (r.level > 0) {\n add(ox, oy, oz, ox + r.dim - 1, oy + r.dim - 1, oz + r.dim - 1, r.value);\n return;\n }\n const { values } = leafVoxels(image, r.leaf);\n for (let n0 = 0; n0 < 512; n0++) {\n const x = ox + (n0 >> 6), y = oy + ((n0 >> 3) & 7), z = oz + (n0 & 7);\n add(x, y, z, x, y, z, values[n0]!);\n }\n });\n\n // The background (space under no root tile) and the zeros a tap outside the bbox reads.\n const roots = new Set(rootTiles.map((o) => `${o[0]},${o[1]},${o[2]}`));\n const covered = (a: Vec3, b: Vec3): boolean => {\n for (let x = Math.floor(a[0] / 4096); x <= Math.floor(b[0] / 4096); x++)\n for (let y = Math.floor(a[1] / 4096); y <= Math.floor(b[1] / 4096); y++)\n for (let z = Math.floor(a[2] / 4096); z <= Math.floor(b[2] / 4096); z++) if (!roots.has(`${x * 4096},${y * 4096},${z * 4096}`)) return false;\n return true;\n };\n for (let cz = 0; cz < dims[2]; cz++) {\n for (let cy = 0; cy < dims[1]; cy++) {\n for (let cx = 0; cx < dims[0]; cx++) {\n const i = cx + dims[0] * (cy + dims[1] * cz);\n const c = [cx, cy, cz];\n const tLo = [0, 1, 2].map((a) => origin[a]! + B * c[a]!) as Vec3;\n const tHi = [0, 1, 2].map((a) => tLo[a]! + B) as Vec3;\n const inLo = [0, 1, 2].map((a) => Math.max(tLo[a]!, domLo[a]!)) as Vec3;\n const inHi = [0, 1, 2].map((a) => Math.min(tHi[a]!, domHi[a]!)) as Vec3;\n const meets = !(empty && zero) && inLo.every((v, a) => v <= inHi[a]!);\n if (meets && !covered(inLo, inHi)) {\n hi[i] = Math.max(hi[i]!, background);\n if (lo) lo[i] = Math.min(lo[i]!, background);\n }\n if (zero) {\n const leaves = empty || tLo.some((v, a) => v < min[a]!) || tHi.some((v, a) => v > max[a]!);\n if (align === \"pathtracer\") {\n // Its rule: the bound starts at 0, and the minimum is 0 when the taps start below 0 or end at n - 1 or later.\n hi[i] = Math.max(hi[i]!, 0);\n if (lo && (leaves || tLo.some((v) => v < 0) || tHi.some((v, a) => v + 1 > n[a]! - 1))) lo[i] = Math.min(lo[i]!, 0);\n } else if (leaves) {\n hi[i] = Math.max(hi[i]!, 0);\n if (lo) lo[i] = Math.min(lo[i]!, 0);\n }\n }\n }\n }\n }\n\n // A bound of -0 is stored as +0 (V214): a cell whose extreme is a signed zero has no defined sign on the GPU\n // (WGSL min / max of +0 and -0 may return either), so both builders write +0.\n const data = Float32Array.from(hi, (v) => (v === 0 ? 0 : v));\n const out: VDBBrickMajorant = { brickLog2: log2, dims, data, origin };\n if (lo) {\n const m = new Float32Array(cells);\n for (let i = 0; i < cells; i++) {\n const v = Math.min(lo[i]!, data[i]!);\n m[i] = v === 0 ? 0 : v;\n }\n out.minima = m;\n }\n return out;\n}\n\n/** Options of {@link vdbValueRange}. */\nexport interface VDBValueRangeOptions {\n /**\n * The field the range is for, as the module's `outside` option: `'background'` (default) reads the tree\n * everywhere; `'zero'` is 0 outside the index bbox.\n */\n outside?: \"background\" | \"zero\";\n}\n\n/** The range of a grid's sampled field ({@link vdbValueRange}). */\nexport interface VDBValueRange {\n /** The smallest value a sample can take. */\n min: number;\n /** The largest value a sample can take: the grid's global majorant. */\n max: number;\n}\n\n/**\n * The exact range of the field a shader samples from a grid image inside its support box (EX1f-a): every\n * trilinear or nearest sample at a point of `[min - 1, max + 1]` (the index bbox grown by one voxel, the box\n * the majorant walks cover) lies in `[min, max]`. It reads every value a tap there can read: leaf voxels\n * active or not, tiles, and the background where no root tile covers the box; with `outside: 'zero'` only\n * the values inside the index bbox, and 0. Beyond the support box the field is 0 (`'zero'`) or whatever the\n * tree holds there (`'background'`), which no walk visits.\n *\n * `max` is the tightest global majorant: `pool.setValueMax(id, vdbValueRange(image, { outside }).max)`.\n * The pool's own default, `max(root max, background)`, costs nothing and holds when the inactive values are\n * the background, but it counts a root background that no voxel near the grid may hold (3 against 1 on a fog\n * volume converted from a level set). The root max alone is not a bound: node statistics cover active\n * values only.\n *\n * It walks the whole tree (as {@link vdbBrickMajorant} does), so call it once per image, not per frame.\n *\n * @param image The grid image (little-endian u32 words, `GridData` at word 0).\n * @param options The `outside` field.\n * @throws VDBToolsError `VDB_BAD_OPTION` for an invalid `outside`.\n */\nexport function vdbValueRange(image: Uint32Array, options: VDBValueRangeOptions = {}): VDBValueRange {\n if (typeof options !== \"object\" || options === null) {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbValueRange: options must be an object, got ${JSON.stringify(options)}.`);\n }\n if (options.outside !== undefined && options.outside !== \"background\" && options.outside !== \"zero\") {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbValueRange: outside must be 'background' or 'zero', got ${JSON.stringify(options.outside)}.`);\n }\n const zero = options.outside === \"zero\";\n const { min, max } = indexBBox(image);\n const empty = max[0] < min[0] || max[1] < min[1] || max[2] < min[2];\n let lo = Infinity;\n let hi = -Infinity;\n const take = (v: number): void => {\n if (v < lo) lo = v;\n if (v > hi) hi = v;\n };\n // The voxels whose tree values a tap in the support box reads: the bbox, grown by one voxel unless the\n // field is 0 out there.\n const pad = zero ? 0 : 1;\n const a: Vec3 = [min[0] - pad, min[1] - pad, min[2] - pad];\n const b: Vec3 = [max[0] + pad, max[1] + pad, max[2] + pad];\n const { background, rootTiles } = forEachTreeRegion(image, (r) => {\n const [ox, oy, oz] = r.origin;\n const e = r.dim - 1;\n if (empty || ox > b[0] || oy > b[1] || oz > b[2] || ox + e < a[0] || oy + e < a[1] || oz + e < a[2]) return;\n if (r.level > 0) {\n take(r.value);\n return;\n }\n const { values } = leafVoxels(image, r.leaf);\n const inside = ox >= a[0] && oy >= a[1] && oz >= a[2] && ox + e <= b[0] && oy + e <= b[1] && oz + e <= b[2];\n for (let n = 0; n < 512; n++) {\n if (!inside) {\n const x = ox + (n >> 6), y = oy + ((n >> 3) & 7), z = oz + (n & 7);\n if (x < a[0] || y < a[1] || z < a[2] || x > b[0] || y > b[1] || z > b[2]) continue;\n }\n take(values[n]!);\n }\n });\n if (zero) take(0); // the support box always reaches a voxel outside the bbox\n if (empty) {\n if (!zero) take(background);\n } else {\n // A part of the box under no root tile reads the background.\n const roots = new Set(rootTiles.map((o) => `${o[0]},${o[1]},${o[2]}`));\n let covered = true;\n for (let x = Math.floor(a[0] / 4096); covered && x <= Math.floor(b[0] / 4096); x++)\n for (let y = Math.floor(a[1] / 4096); covered && y <= Math.floor(b[1] / 4096); y++)\n for (let z = Math.floor(a[2] / 4096); covered && z <= Math.floor(b[2] / 4096); z++) covered = roots.has(`${x * 4096},${y * 4096},${z * 4096}`);\n if (!covered) take(background);\n }\n // -0 as +0, as the brick bounds (V214).\n return { min: lo === 0 ? 0 : lo, max: hi === 0 ? 0 : hi };\n}\n\n// ---------------------------------------------------------------------------\n// The walk (twin of the `majorant` WGSL profile)\n\n/** One segment of the majorant walk ({@link vdbMajorantWalk}): every sample on `[t0, t1)` lies in `[min, max]`. */\nexport interface VDBMajorantSegment {\n t0: number;\n t1: number;\n /** Upper bound of the sampled field on the segment. */\n max: number;\n /** Lower bound: the brick minimum with minima, else 0 (a valid minorant of a non-negative field). */\n min: number;\n /** Accessor queries the segment cost (`vdbGetDim` / `vdbNodeMax`; 1 brick load, 2 with minima). */\n lookups: number;\n}\n\n/** The internal name of {@link VDBMajorantSegment} (tests and harnesses). */\nexport type MajorantSegment = VDBMajorantSegment;\n\n/** Options of {@link vdbMajorantWalk}. */\nexport interface VDBMajorantWalkOptions {\n /** The module's `majorant` option. `'brick'` with no brick majorant walks as `'global'`. Default `'brick'`. */\n mode?: \"brick\" | \"global\" | \"nodeMax\";\n /** Ray interval before clipping. Default `[0, 3.4e38]`. */\n tMin?: number;\n tMax?: number;\n /** The record's `valueMax` (default {@link defaultValueMax}: the pool's default). */\n valueMax?: number;\n /** The module's sampler (the support box of `global` and `nodeMax`). Default `'trilinear'`. */\n sampler?: \"trilinear\" | \"nearest\";\n /** The module's `outside`; `'zero'` raises a bound below 0 to 0 (`global`, `nodeMax`). Default `'background'`. */\n outside?: \"background\" | \"zero\";\n /** The module's `minima` option (read the brick minima when it has them). Default false. */\n minima?: boolean;\n /** Safety cap on segments. Default 1 << 16. */\n maxSegments?: number;\n /**\n * Twin of `vdbMajorantInitWorld` (helper `'majorantWorld'`): the grid's world-to-index affine, 3x4 row-major\n * (`pool.info(id).worldToIndex`). `origin` and `direction` are then a world-space ray; it is taken to index\n * space as the shader does (f32 rows; the direction is not renormalized, so `t` stays a world parameter).\n */\n worldToIndex?: ArrayLike<number>;\n}\n\n/** The internal name of {@link VDBMajorantWalkOptions} (tests and harnesses). */\nexport type MajorantWalkOptions = VDBMajorantWalkOptions;\n\n/** The ray of a walk in index space, f32: `origin` / `direction` themselves, or through `worldToIndex` as the WGSL does. */\nfunction indexRay(origin: Vec3, direction: Vec3, worldToIndex: ArrayLike<number> | undefined): { o: Vec3; d: Vec3 } {\n const p = f3(origin);\n const v = f3(direction);\n if (worldToIndex === undefined) return { o: p, d: v };\n if (worldToIndex.length !== 12) throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbMajorantWalk: worldToIndex must have 12 numbers (3x4 row-major), got ${worldToIndex.length}.`);\n const m = Array.from(worldToIndex, f);\n // dot(row, vec4(p, w)), summed left to right as WGSL's dot is specified.\n const row = (r: number, a: Vec3, w: number): number => f(f(f(f(m[4 * r]! * a[0]) + f(m[4 * r + 1]! * a[1])) + f(m[4 * r + 2]! * a[2])) + f(m[4 * r + 3]! * w));\n return { o: [row(0, p, 1), row(1, p, 1), row(2, p, 1)], d: [row(0, v, 0), row(1, v, 0), row(2, v, 0)] };\n}\n\n/** f32 1e-20: below it a direction component counts as 0 (the pathtracer's DDA guard). */\nconst PARALLEL = f(1e-20);\nconst FAR = f(1e30);\n\n/**\n * Twin of the WGSL `vdb_maj_clip`: the slab test of `[lo, hi]` with a guard for axis-parallel rays (a\n * component below 1e-20 in magnitude: the ray misses unless `lo <= o < hi` on that axis; WGSL may\n * assume no infinities, CLAUDE.md Traps). Returns `[a, b]`; empty when `!(a < b)`.\n */\nfunction clip(lo: Vec3, hi: Vec3, o: Vec3, d: Vec3, t0: number, t1: number): [number, number] {\n let a = t0;\n let b = t1;\n for (let k = 0; k < 3; k++) {\n if (Math.abs(d[k]!) < PARALLEL) {\n if (o[k]! < lo[k]! || o[k]! >= hi[k]!) return [t0, t0];\n } else {\n const p = f(f(lo[k]! - o[k]!) / d[k]!);\n const q = f(f(hi[k]! - o[k]!) / d[k]!);\n a = Math.max(a, Math.min(p, q));\n b = Math.min(b, Math.max(p, q));\n }\n }\n return [a, b];\n}\n\nconst f3 = (v: readonly number[]): Vec3 => [f(v[0]!), f(v[1]!), f(v[2]!)];\n\n/**\n * Twin of `vdbMajorantInit(g, o, d, tMin, tMax)` + `vdbMajorantNext` until it ends: the segments the\n * GPU walk returns for an index-space ray (`d` unnormalized; `t` in the caller's units), in order,\n * contiguous (each `t0` is the previous `t1`), none of zero length.\n *\n * - `'brick'` with bounds: the DDA over the brick cells (the pathtracer's `ptDdaInit` / `ptDdaNext`\n * in the module's cell space `(p - origin) / B`), clipped to the cell grid's box.\n * - `'global'` (or `'brick'` without bounds): one segment over the sampler's support box\n * (`[min - 1, max + 1]` trilinear, `[min - 0.5, max + 0.5]` nearest) with bound `valueMax`.\n * - `'nodeMax'` (P1.4): the vendored HDDA at leaf size 8, widening over tiles and empty space, over the\n * support box; a cell's bound is {@link cellBoundTrilinear} (the 2x2x2 block of `dim`-cells from the\n * cell's corner: the \"8-leaf support\" of a leaf cell). Stats bound ACTIVE values, so this assumes every\n * inactive leaf voxel is <= its leaf's max (fog). Without stats the bound is `valueMax`.\n *\n * `mode: 'global'` with a brick majorant is the twin of `vdbMajorantInitGlobal`; `worldToIndex` makes it the twin\n * of `vdbMajorantInitWorld`.\n *\n * @param gridWords The grid image (little-endian u32 words, `GridData` at word 0).\n * @param majorant The grid's brick bounds (`vdbBrickMajorant`), or `null`.\n * @param origin The ray's origin, in index space (or world space with `worldToIndex`).\n * @param direction The ray's direction, same space; not normalized by the walk.\n * @param options The module's options and the ray interval.\n * @throws VDBToolsError `VDB_BAD_OPTION` for a `worldToIndex` that is not 12 numbers.\n */\nexport function vdbMajorantWalk(\n gridWords: Uint32Array,\n majorant: VDBBrickMajorant | null,\n origin: VDBVec3,\n direction: VDBVec3,\n options: VDBMajorantWalkOptions = {},\n): VDBMajorantSegment[] {\n const mode = options.mode ?? \"brick\";\n const zero = options.outside === \"zero\";\n const { o, d } = indexRay(origin, direction, options.worldToIndex);\n const tMin = f(options.tMin ?? 0);\n const tMax = f(options.tMax ?? 3.4e38);\n const maxSegments = options.maxSegments ?? 1 << 16;\n const vmaxRecord = f(options.valueMax ?? defaultValueMax(gridWords));\n const vmax = zero ? Math.max(vmaxRecord, 0) : vmaxRecord;\n const out: MajorantSegment[] = [];\n\n if (mode === \"brick\" && majorant) {\n const B = 1 << majorant.brickLog2;\n const s = f(1 / B);\n const { min } = indexBBox(gridWords);\n const org = f3(majorant.origin ?? [min[0] - 1, min[1] - 1, min[2] - 1]);\n const n = majorant.dims;\n const u: Vec3 = [f(f(o[0] - org[0]) * s), f(f(o[1] - org[1]) * s), f(f(o[2] - org[2]) * s)];\n const du: Vec3 = [f(d[0] * s), f(d[1] * s), f(d[2] * s)];\n const [tEnter, tExit] = clip([0, 0, 0], f3(n), u, du, tMin, tMax);\n if (!(tEnter < tExit)) return out;\n const cell = [0, 1, 2].map((k) => Math.min(n[k]! - 1, Math.max(0, Math.floor(f(u[k]! + f(du[k]! * tEnter)))))) as Vec3;\n const step = du.map((v) => (v > 0 ? 1 : -1));\n const tn = [0, 1, 2].map((k) => (Math.abs(du[k]!) < PARALLEL ? FAR : f(f(f(cell[k]! + (du[k]! > 0 ? 1 : 0)) - u[k]!) / du[k]!)));\n const dt = du.map((v) => (Math.abs(v) < PARALLEL ? FAR : Math.abs(f(1 / v))));\n const minima = options.minima === true && majorant.minima !== undefined;\n let t = tEnter;\n let te = tExit;\n while (t < te && out.length < maxSegments) {\n let k = 0;\n if (tn[1]! < tn[k]!) k = 1;\n if (tn[2]! < tn[k]!) k = 2;\n const t1 = Math.min(tn[k]!, te);\n const i = cell[0] + n[0] * (cell[1] + n[1] * cell[2]);\n cell[k] = cell[k]! + step[k]!;\n tn[k] = f(tn[k]! + dt[k]!);\n if (cell[k]! < 0 || cell[k]! >= n[k]!) te = t1;\n if (t1 > t) {\n out.push({ t0: t, t1, max: majorant.data[i]!, min: minima ? majorant.minima![i]! : 0, lookups: minima ? 2 : 1 });\n t = t1;\n }\n }\n return out;\n }\n\n const { min, max } = indexBBox(gridWords);\n const pad = options.sampler === \"nearest\" ? 0.5 : 1;\n const [t0, t1] = clip(f3([min[0] - pad, min[1] - pad, min[2] - pad]), f3([max[0] + pad, max[1] + pad, max[2] + pad]), o, d, tMin, tMax);\n if (!(t0 < t1)) return out;\n if (mode !== \"nodeMax\") {\n out.push({ t0, t1, max: vmax, min: 0, lookups: 0 });\n return out;\n }\n\n const bound = (ijk: Vec3, dim: number): number => {\n const b = cellBoundTrilinear(gridWords, ijk, dim, { valueMax: vmaxRecord });\n return zero ? Math.max(b, 0) : b;\n };\n const start: Vec3 = [f(o[0] + f(d[0] * t0)), f(o[1] + f(d[1] * t0)), f(o[2] + f(d[2] * t0))];\n const h = hddaInit(o, t0, d, t1, Math.max(getDim(gridWords, [Math.floor(start[0]), Math.floor(start[1]), Math.floor(start[2])]), 8));\n let t = t0;\n let te = t1;\n let lookups = 1;\n while (t < te && out.length < maxSegments) {\n let updates = 0;\n for (;;) {\n const want = Math.max(getDim(gridWords, h.voxel), 8);\n lookups++;\n if (want === h.dim || updates >= 2) break;\n hddaUpdate(h, o, d, want);\n updates++;\n }\n const end = Math.min(Math.min(Math.min(h.next[0], h.next[1]), Math.min(h.next[2], h.tmax)), te);\n const voxel: Vec3 = [h.voxel[0], h.voxel[1], h.voxel[2]];\n const dim = h.dim;\n const more = hddaStep(h);\n const e = more ? end : te;\n if (!more) te = Math.max(t, e);\n if (e > t) {\n out.push({ t0: t, t1: e, max: bound(voxel, dim), min: 0, lookups: lookups + 8 });\n lookups = 0;\n t = e;\n }\n }\n return out;\n}\n\n/** The internal name of {@link vdbMajorantWalk} (tests, harnesses and scripts written before EX1f-b published it). */\nexport const majorantWalk = vdbMajorantWalk;\n\n// ---------------------------------------------------------------------------\n// The trackers (twins of the `deltaTrack` / `ratioTrack` WGSL helpers, EX1f-b)\n\n/** What {@link vdbDeltaTrack} returns (the WGSL `VdbCollision`). */\nexport interface VDBCollision {\n /** The collision's ray parameter; without a hit, where the walk ended (or the tentative collision a truncated track stopped at). */\n t: number;\n /** The grid's sampled value at the collision (0 without a hit). */\n density: number;\n /** A real collision was found. */\n hit: boolean;\n /** `maxLookups` was reached first. */\n truncated: boolean;\n /** Majorant segments walked. */\n steps: number;\n /** Samples of the grid: tentative collisions. */\n lookups: number;\n}\n\n/** What {@link vdbRatioTrack} returns (the WGSL `VdbTransmittance`). */\nexport interface VDBTransmittance {\n /** The transmittance estimate per channel. */\n value: VDBVec3;\n /** `maxLookups` was reached first. */\n truncated: boolean;\n /** Majorant segments walked. */\n steps: number;\n /** Samples of the grid: tentative collisions. */\n lookups: number;\n}\n\n/** Options of {@link vdbDeltaTrack}: the walk's ({@link VDBMajorantWalkOptions}) and the tracker's. */\nexport interface VDBDeltaTrackOptions extends VDBMajorantWalkOptions {\n /** Extinction per unit of `t` at grid value 1. */\n sigma: number;\n /** The random stream: uniform numbers in [0, 1), drawn in the WGSL helper's order. */\n random: () => number;\n /** Stop after this many samples of the grid (`truncated`). Default 2^32 - 1. */\n maxLookups?: number;\n}\n\n/** Options of {@link vdbRatioTrack}: the walk's ({@link VDBMajorantWalkOptions}) and the tracker's. */\nexport interface VDBRatioTrackOptions extends VDBMajorantWalkOptions {\n /** Extinction per unit of `t` at grid value 1: one number, or one per channel (the majorant is the largest channel's). */\n sigma: number | VDBVec3;\n /** The random stream: uniform numbers in [0, 1), drawn in the WGSL helper's order. */\n random: () => number;\n /** Below this transmittance (the largest channel) the estimate plays Russian roulette; 0 (default) never does. */\n cutoff?: number;\n /** Stop after this many samples of the grid (`truncated`). Default 2^32 - 1. */\n maxLookups?: number;\n}\n\n/** What both trackers share: the index-space ray, the walk's segments and the sampler. */\nfunction trackSetup(gridWords: Uint32Array, majorant: VDBBrickMajorant | null, origin: VDBVec3, direction: VDBVec3, options: VDBMajorantWalkOptions) {\n const { o, d } = indexRay(origin, direction, options.worldToIndex);\n const walk: VDBMajorantWalkOptions = { ...options };\n delete walk.worldToIndex;\n const segments = vdbMajorantWalk(gridWords, majorant, o, d, walk);\n const outside = options.outside ?? \"background\";\n const read = options.sampler === \"nearest\" ? vdbSampleNearestCpu : vdbSampleTrilinearCpu;\n const sample = (t: number): number => f(read(gridWords, [f(o[0] + f(d[0] * t)), f(o[1] + f(d[1] * t)), f(o[2] + f(d[2] * t))], { outside }));\n return { segments, sample, tStart: segments.length > 0 ? segments[0]!.t0 : f(options.tMin ?? 0) };\n}\n\n/** The tentative-collision step both trackers take: `t - log(1 - u) / m` in f32. */\nconst stepT = (t: number, u: number, m: number): number => f(t - f(f(Math.log(f(1 - f(u)))) / m));\n\n/**\n * Twin of `vdbMajorantInit` (or its `World` / `Global` helper) followed by the WGSL helper\n * `vdbDeltaTrack(&it, &acc, sigma, maxLookups)` (EX1f-b): delta (Woodcock) tracking along the ray. It returns the\n * next real collision of the medium whose extinction is `sigma` times the grid's sampled value, or `hit: false`\n * when the ray leaves the walk without one. P(no collision) is the transmittance exp(-sigma ∫ value dt).\n *\n * The random numbers are drawn from `options.random` in the helper's order: per tentative collision one for\n * the distance, then one for the accept test.\n *\n * @param gridWords The grid image (little-endian u32 words, `GridData` at word 0).\n * @param majorant The grid's brick bounds, or `null` (see {@link vdbMajorantWalk}).\n * @param origin The ray's origin, in index space (or world space with `worldToIndex`).\n * @param direction The ray's direction, same space; `t` and `sigma` are in its units.\n * @param options The walk's options, `sigma`, `random` and `maxLookups`.\n */\nexport function vdbDeltaTrack(\n gridWords: Uint32Array,\n majorant: VDBBrickMajorant | null,\n origin: VDBVec3,\n direction: VDBVec3,\n options: VDBDeltaTrackOptions,\n): VDBCollision {\n const { segments, sample, tStart } = trackSetup(gridWords, majorant, origin, direction, options);\n const sigma = f(options.sigma);\n const cap = options.maxLookups ?? 0xffffffff;\n const r: VDBCollision = { t: tStart, density: 0, hit: false, truncated: false, steps: 0, lookups: 0 };\n for (const s of segments) {\n r.steps++;\n r.t = s.t1;\n const m = f(s.max * sigma);\n if (!(m > 0)) continue;\n let t = s.t0;\n for (;;) {\n t = stepT(t, options.random(), m);\n if (t >= s.t1) break;\n if (r.lookups >= cap) {\n r.t = t;\n r.truncated = true;\n return r;\n }\n r.lookups++;\n const v = sample(t);\n if (f(f(options.random()) * m) < f(v * sigma)) {\n r.t = t;\n r.density = v;\n r.hit = true;\n return r;\n }\n }\n }\n return r;\n}\n\n/**\n * Twin of `vdbMajorantInit` (or its `World` / `Global` helper) followed by the WGSL helper\n * `vdbRatioTrack(&it, &acc, sigma, cutoff, maxLookups)` (EX1f-b): ratio tracking along the ray, an unbiased\n * estimate of the transmittance exp(-sigma ∫ value dt) per channel. All channels share the tentative collisions\n * of the largest channel's majorant, so a spectral medium costs one walk.\n *\n * The random numbers are drawn from `options.random` in the helper's order: one per tentative collision, and one\n * more whenever the roulette plays (the largest channel under `cutoff`).\n *\n * @param gridWords The grid image (little-endian u32 words, `GridData` at word 0).\n * @param majorant The grid's brick bounds, or `null` (see {@link vdbMajorantWalk}).\n * @param origin The ray's origin, in index space (or world space with `worldToIndex`).\n * @param direction The ray's direction, same space; `t` and `sigma` are in its units.\n * @param options The walk's options, `sigma`, `random`, `cutoff` and `maxLookups`.\n */\nexport function vdbRatioTrack(\n gridWords: Uint32Array,\n majorant: VDBBrickMajorant | null,\n origin: VDBVec3,\n direction: VDBVec3,\n options: VDBRatioTrackOptions,\n): VDBTransmittance {\n const { segments, sample } = trackSetup(gridWords, majorant, origin, direction, options);\n const sg: Vec3 = typeof options.sigma === \"number\" ? [f(options.sigma), f(options.sigma), f(options.sigma)] : f3(options.sigma);\n const top = Math.max(sg[0], Math.max(sg[1], sg[2]));\n const cutoff = f(options.cutoff ?? 0);\n const cap = options.maxLookups ?? 0xffffffff;\n const r: VDBTransmittance = { value: [1, 1, 1], truncated: false, steps: 0, lookups: 0 };\n for (const s of segments) {\n r.steps++;\n const m = f(s.max * top);\n if (!(m > 0)) continue;\n let t = s.t0;\n for (;;) {\n t = stepT(t, options.random(), m);\n if (t >= s.t1) break;\n if (r.lookups >= cap) {\n r.truncated = true;\n return r;\n }\n r.lookups++;\n const q = f(sample(t) / m);\n for (let k = 0; k < 3; k++) r.value[k] = f(r.value[k]! * f(1 - f(sg[k]! * q)));\n const w = Math.max(r.value[0], Math.max(r.value[1], r.value[2]));\n if (w < cutoff || w <= 0) {\n if (f(f(options.random()) * cutoff) >= w) {\n r.value = [0, 0, 0];\n return r;\n }\n const g = f(cutoff / w);\n for (let k = 0; k < 3; k++) r.value[k] = r.value[k]! >= w ? cutoff : f(r.value[k]! * g);\n }\n }\n }\n return r;\n}\n"]}
@@ -0,0 +1,297 @@
1
+ export type Vec3 = [number, number, number];
2
+ /**
3
+ * Twin of `vdbGetDim` (vendored `readaccessor_get_dim`): 1 inside a leaf, 8 in
4
+ * a lower-node tile, 128 in an upper-node tile, 4096 in a root tile or the
5
+ * background.
6
+ */
7
+ export declare function getDim(gridWords: Uint32Array, ijk: Vec3): number;
8
+ /** Node levels: 0 leaf, 1 lower, 2 upper, 3 root. */
9
+ export type NodeLevel = 0 | 1 | 2 | 3;
10
+ export interface NodeStats {
11
+ min: number;
12
+ max: number;
13
+ ave: number;
14
+ stddev: number;
15
+ }
16
+ /**
17
+ * Twin of the fork's `{root,upper,lower,leaf}_get_{min,max,ave,stddev}_float`
18
+ * for the node at byte `address` of the image. Root, upper and lower stats are
19
+ * f32; Fp leaf stats are uint16 codes decoded against the leaf's quantization.
20
+ * Meaningful only when the grid has stats (`HAS_MIN_MAX`) and the node has
21
+ * active values.
22
+ */
23
+ export declare function nodeStats(gridWords: Uint32Array, level: NodeLevel, address: number): NodeStats;
24
+ /** Whether the grid carries node stats (`HAS_MIN_MAX`; pool record flag b1). */
25
+ export declare function gridHasStats(gridWords: Uint32Array): boolean;
26
+ /** The pool's `valueMax` for this image with no caller bound (`VDBGridPool`): max(root max, background), or +Infinity without stats. */
27
+ export declare function defaultValueMax(gridWords: Uint32Array): number;
28
+ export interface NodeMaxOptions {
29
+ /** The record's `valueMax` (returned without stats). Default {@link defaultValueMax}. */
30
+ valueMax?: number;
31
+ }
32
+ /**
33
+ * Twin of `vdbNodeMax(acc, ijk, dim)`: a bound for the aligned cell of size
34
+ * `dim` holding `ijk`. With `a = getDim(ijk)`: if `a > 1` and `dim <= a` the
35
+ * cell is one tile and the result is its value (exact). Otherwise it is the
36
+ * max statistic of the smallest node spanning the cell (leaf for `dim <= 8`,
37
+ * lower `<= 128`, upper `<= 4096`, else root), which bounds that node's ACTIVE
38
+ * values only; without stats it is `valueMax` (+Infinity unless the caller
39
+ * gave a bound).
40
+ */
41
+ export declare function nodeMax(gridWords: Uint32Array, ijk: Vec3, dim: number, options?: NodeMaxOptions): number;
42
+ /** Twin of `vdbIsActive`. */
43
+ export declare function isActive(gridWords: Uint32Array, ijk: Vec3): boolean;
44
+ /**
45
+ * Twin of `vdbReadValue` (f32 decode in WGSL order; any of Float/Half/Fp4/Fp8/Fp16/FpN).
46
+ *
47
+ * This matches the GPU's evaluation order (f32 arithmetic), so it is the right
48
+ * oracle for GPU parity checks. `readValue` instead returns the exact f64
49
+ * decode; on Fp grids the two can differ by 1 ulp (f32).
50
+ *
51
+ * @param gridWords The grid image (little-endian u32 words, `GridData` at word 0).
52
+ * @param ijk Integer index coordinates of the voxel.
53
+ */
54
+ export declare function vdbReadValueF32Cpu(gridWords: Uint32Array, ijk: Vec3): number;
55
+ export interface TreeNode {
56
+ level: NodeLevel;
57
+ /** Byte address of the node in the image. */
58
+ address: number;
59
+ /** Index-space origin (min corner) of the node; the root's is unused (0, 0, 0). */
60
+ origin: Vec3;
61
+ /** Index of the parent in the returned array; -1 for the root. */
62
+ parent: number;
63
+ /** Values of the node's ACTIVE tiles (root, upper, lower), with each tile's origin and size. */
64
+ activeTiles: {
65
+ value: number;
66
+ origin: Vec3;
67
+ dim: number;
68
+ }[];
69
+ }
70
+ /**
71
+ * Every node of the tree, root first, then depth first. Leaves carry no tiles;
72
+ * use {@link leafVoxels} for their values.
73
+ */
74
+ export declare function treeNodes(gridWords: Uint32Array): TreeNode[];
75
+ /** One region of the tree for {@link forEachTreeRegion}: a leaf, or a tile (active or not). */
76
+ export interface TreeRegion {
77
+ /** 0 leaf, 1 lower-node tile (8³), 2 upper-node tile (128³), 3 root tile (4096³). */
78
+ level: NodeLevel;
79
+ /** Index-space min corner. */
80
+ origin: Vec3;
81
+ /** Edge in voxels: 8, 8, 128 or 4096. */
82
+ dim: number;
83
+ /** Byte address of the leaf (level 0; read it with {@link leafVoxels}); 0 for a tile. */
84
+ leaf: number;
85
+ /** The tile's value (levels 1-3, active or inactive); 0 for a leaf. */
86
+ value: number;
87
+ }
88
+ /**
89
+ * Every leaf and every tile of the tree, active or not (P1.2, the brick-majorant builder needs the
90
+ * values a trilinear tap can read, inactive ones included). Space under no root tile reads the
91
+ * background: the result lists the min corners of the root tiles (with or without a child), so a
92
+ * caller can tell which 4096-blocks are covered.
93
+ */
94
+ export declare function forEachTreeRegion(gridWords: Uint32Array, visit: (r: TreeRegion) => void): {
95
+ background: number;
96
+ rootTiles: Vec3[];
97
+ };
98
+ /** Options of {@link vdbTreeNodes}. */
99
+ export interface VDBTreeNodesOptions {
100
+ /** Yield the leaves. Default `true`. */
101
+ leaves?: boolean;
102
+ /**
103
+ * Which tiles to yield: `'active'` (default), `'all'` or `'none'`. `'all'` is every table slot without a child,
104
+ * so beside the inactive tiles that mean something (a level set's interior) it yields the empty slots: inactive
105
+ * tiles that hold the background, 32,768 less the children per upper node and 4,096 less the leaves per lower
106
+ * node. Filter on `value` when you want only the former.
107
+ */
108
+ tiles?: "active" | "all" | "none";
109
+ /** Also yield the upper and lower nodes themselves, each before what it holds. Default `false`. */
110
+ internalNodes?: boolean;
111
+ }
112
+ /**
113
+ * One entry of {@link vdbTreeNodes}: a node of the tree, or a tile (a constant block stored in a node's table in
114
+ * place of a child). `origin` is the index-space min corner and `size` the edge in voxels, so the entry covers the
115
+ * voxels `origin` to `origin + size - 1` on each axis.
116
+ *
117
+ * - `'leaf'`: level 0, size 8. `activeVoxelCount` counts its value-mask bits (0 to 512).
118
+ * - `'lower'`: a lower node, level 1, size 128. `'upper'`: an upper node, level 2, size 4096.
119
+ * - `'tile'`: `level` is the level of the node that holds it: 1 (in a lower node, size 8), 2 (in an upper node,
120
+ * size 128) or 3 (in the root, size 4096). `value` is the stored value as a number (a Half grid's binary16
121
+ * widened; Float and Fp grids store tiles as f32) and `active` its state.
122
+ */
123
+ export type VDBTreeNode = {
124
+ kind: "leaf";
125
+ level: 0;
126
+ origin: Vec3;
127
+ size: 8;
128
+ activeVoxelCount: number;
129
+ } | {
130
+ kind: "lower";
131
+ level: 1;
132
+ origin: Vec3;
133
+ size: 128;
134
+ } | {
135
+ kind: "upper";
136
+ level: 2;
137
+ origin: Vec3;
138
+ size: 4096;
139
+ } | {
140
+ kind: "tile";
141
+ level: 1 | 2 | 3;
142
+ origin: Vec3;
143
+ size: 8 | 128 | 4096;
144
+ value: number;
145
+ active: boolean;
146
+ };
147
+ /**
148
+ * Walks the tree of a scalar grid image (Float, Half, Fp4, Fp8, Fp16, FpN): its leaves and tiles, and on request
149
+ * its upper and lower nodes. For drawing node boxes, counting what a grid stores, or telling where a voxel's value
150
+ * comes from (a leaf holds one value per voxel; a tile is one value for its whole block).
151
+ *
152
+ * The order is the image's own: root entries in table order (signed origin order: x, then y, then z), then each
153
+ * node's table by slot, depth first. Every entry is a new object. Space that no entry covers reads the grid's
154
+ * background. Voxel values are not decoded here: read them with `vdbReadValueCpu`.
155
+ *
156
+ * The image and the options are checked when the first entry is asked for, not when the function is called.
157
+ *
158
+ * @param image A NanoVDB grid image (`NvdbFile.gridImage`, `buildFromVdb`, `vdbBuildFromDense`, `vdbQuantize`…).
159
+ * @throws {VDBToolsError} `VDB_BAD_IMAGE` for words that are not a grid image, `VDB_UNSUPPORTED_GRID_TYPE` for a
160
+ * grid type that is not scalar (vector, point and index grids), `VDB_BAD_OPTION` for an unknown `tiles` value.
161
+ */
162
+ export declare function vdbTreeNodes(image: Uint32Array, options?: VDBTreeNodesOptions): Generator<VDBTreeNode, void, undefined>;
163
+ /** A leaf's 512 decoded values (f32, WGSL decode order) and active flags, x-major (`n = x*64 + y*8 + z`). */
164
+ export declare function leafVoxels(gridWords: Uint32Array, leafAddress: number): {
165
+ values: Float32Array;
166
+ active: Uint8Array;
167
+ };
168
+ /** Twin of `VdbHdda` (vendored `pnanovdb_hdda_t`). */
169
+ export interface Hdda {
170
+ dim: number;
171
+ tmin: number;
172
+ tmax: number;
173
+ voxel: Vec3;
174
+ step: Vec3;
175
+ delta: Vec3;
176
+ next: Vec3;
177
+ }
178
+ /** Twin of `vdbHddaInit` (vendored `pnanovdb_hdda_init`). */
179
+ export declare function hddaInit(origin: Vec3, tmin: number, direction: Vec3, tmax: number, dim: number): Hdda;
180
+ /** Twin of `vdbHddaUpdate` (vendored `pnanovdb_hdda_update`): switch to `dim`; false if already there. */
181
+ export declare function hddaUpdate(h: Hdda, origin: Vec3, direction: Vec3, dim: number): boolean;
182
+ /** Twin of `vdbHddaStep` (vendored `pnanovdb_hdda_step`, with PNANOVDB_ENFORCE_FORWARD_STEPPING). */
183
+ export declare function hddaStep(h: Hdda): boolean;
184
+ /** The grid's index bbox (root bbox, inclusive): the pool record's `indexBBoxMin/Max`. */
185
+ export declare function indexBBox(gridWords: Uint32Array): {
186
+ min: Vec3;
187
+ max: Vec3;
188
+ };
189
+ /**
190
+ * Twin of `vdbRayClip(g, o, d, &t)`: clip `[t0, t1]` to the voxel-cell box
191
+ * `[min, max + 1]` (vendored `hdda_ray_clip`); hit if the clipped interval is
192
+ * non-empty. NaN handling (an axis-parallel ray starting exactly on a slab
193
+ * plane) follows JS `Math.min/max`, which a GPU need not match.
194
+ */
195
+ export declare function rayClip(gridWords: Uint32Array, origin: Vec3, direction: Vec3, t: [number, number]): {
196
+ hit: boolean;
197
+ t0: number;
198
+ t1: number;
199
+ };
200
+ /** Options of {@link rayClipSupport}. */
201
+ export interface RayClipSupportOptions {
202
+ /** The module's sampler (default `'trilinear'`). */
203
+ sampler?: "trilinear" | "nearest";
204
+ }
205
+ /**
206
+ * Twin of the opt-in `vdbRayClipSupport(g, o, d, &t)` (helper
207
+ * `'rayClipSupport'`): clip `[t0, t1]` to the box where `vdbSample` can read
208
+ * the grid's voxels, `[min - 1, max + 1]` for trilinear and
209
+ * `[min - 0.5, max + 0.5]` for nearest. Unlike {@link rayClip}'s
210
+ * `[min, max + 1]` it keeps the min-side half of the trilinear support.
211
+ */
212
+ export declare function rayClipSupport(gridWords: Uint32Array, origin: Vec3, direction: Vec3, t: [number, number], options?: RayClipSupportOptions): {
213
+ hit: boolean;
214
+ t0: number;
215
+ t1: number;
216
+ };
217
+ /**
218
+ * Twin of the opt-in `vdbHddaCellEnd(&h)` (helper `'hddaCellEnd'`): the ray
219
+ * `t` where the HDDA's current cell ends, `min(next, tmax)`.
220
+ */
221
+ export declare function hddaCellEnd(h: Hdda): number;
222
+ /**
223
+ * Twin of the opt-in `vdbCellBoundTrilinear(acc, ijk, dim)` (helper
224
+ * `'cellBoundTrilinear'`): the max of {@link nodeMax} over the 2x2x2 block of
225
+ * aligned `dim`-cells whose min corner is the cell holding `ijk`. It bounds
226
+ * every trilinear sample whose base voxel `floor(p)` lies in that cell,
227
+ * provided every inactive leaf voxel is <= its leaf's max (stats bound active
228
+ * values only; true of fog volumes).
229
+ */
230
+ export declare function cellBoundTrilinear(gridWords: Uint32Array, ijk: Vec3, dim: number, options?: NodeMaxOptions): number;
231
+ /**
232
+ * Twin of the opt-in `vdbNodeAverage(acc, ijk, dim)` (helper `'nodeAverage'`,
233
+ * K3.2): the box mean of the aligned `dim`-cell holding `ijk` from node
234
+ * statistics. A cell inside one tile (or the background) is the tile's value;
235
+ * without stats (or `dim <= 1`) the value at `ijk`; `dim <= 8`: the leaf's
236
+ * `ave * activeVoxels / 512` (exact for fog leaves, whose inactive voxels are
237
+ * 0); larger: the lower node's `ave` (mean of its ACTIVE voxels; `dim` is meant
238
+ * to be 8 or 128). f32 arithmetic in WGSL order.
239
+ */
240
+ export declare function nodeAverage(gridWords: Uint32Array, ijk: Vec3, dim: number): number;
241
+ /** One HDDA cell the walk visited. */
242
+ export interface HddaSegment {
243
+ /** Where the cell's corner resolves: 0 inside a leaf, 1 lower tile, 2 upper tile, 3 root tile or background. */
244
+ level: 0 | 1 | 2 | 3;
245
+ /** HDDA cell size (1, 8, 128 or 4096). */
246
+ dim: number;
247
+ /** Cell min corner (aligned to `dim`). */
248
+ voxel: Vec3;
249
+ /** Ray interval in the cell: entry `h.tmin` to `min(h.next, h.tmax)`. */
250
+ t0: number;
251
+ t1: number;
252
+ /** False only when the cell is uniform (one tile or one voxel) and inactive. */
253
+ active: boolean;
254
+ /** `vdbNodeMax(voxel, dim)`. */
255
+ max: number;
256
+ /** `!active || max < threshold`: a march may skip the cell. */
257
+ skip: boolean;
258
+ }
259
+ export interface HddaWalkOptions {
260
+ /** Ray interval before clipping. Default `[0, 3.4e38]`. */
261
+ tmin?: number;
262
+ tmax?: number;
263
+ /** Smallest cell: 8 (default) steps leaf by leaf, 1 voxel by voxel inside leaves. */
264
+ leafDim?: 1 | 8;
265
+ /** Cells whose bound is below this are skipped. Default -Infinity (skip only inactive cells). */
266
+ threshold?: number;
267
+ /** The record's `valueMax` (see {@link nodeMax}). */
268
+ valueMax?: number;
269
+ /** Safety cap on loop iterations. Default 1 << 16. */
270
+ maxSteps?: number;
271
+ }
272
+ /**
273
+ * The canonical `march` walk, built only from the profile's calls (the GPU
274
+ * probe kernel in scripts/lib/march-probe.mjs is the same loop in WGSL):
275
+ *
276
+ * ```
277
+ * t = [tmin, tmax]; if !vdbRayClip(g, o, d, &t) { return; }
278
+ * vdbHddaInit(&h, o, t.x, d, t.y, max(vdbGetDim(&a, floor(o + d * t.x)), leafDim));
279
+ * loop {
280
+ * want = max(vdbGetDim(&a, h.voxel), leafDim); // probe the cell's corner
281
+ * if want != h.dim && updates < 2 { vdbHddaUpdate(&h, o, d, want); updates++; continue; }
282
+ * updates = 0;
283
+ * emit (h.voxel, h.dim, h.tmin, min(h.next, h.tmax), active, vdbNodeMax(&a, h.voxel, h.dim));
284
+ * if !vdbHddaStep(&h) { break; }
285
+ * }
286
+ * ```
287
+ *
288
+ * The corner decides the cell: a tile of size >= dim holding the corner holds
289
+ * the whole aligned cell. `vdbHddaUpdate` re-derives the cell from
290
+ * `floor(o + d * h.tmin)`, which on the entry face can name the previous cell;
291
+ * that yields a zero-length cell and the vendored forward-stepping moves on.
292
+ * Every emitted cell is classified from its own corner, so classification is
293
+ * valid even for those. At most two updates per cell keep the loop finite.
294
+ * `vdbHddaStep` continues while `tmin <= tmax`, so the last cell can be a
295
+ * zero-length one at the exit face.
296
+ */
297
+ export declare function hddaWalk(gridWords: Uint32Array, origin: Vec3, direction: Vec3, options?: HddaWalkOptions): HddaSegment[];