@pmndrs/vdb 0.1.0 → 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 (576) hide show
  1. package/CHANGELOG.md +592 -2
  2. package/README.md +85 -37
  3. package/THIRD_PARTY_NOTICES.md +197 -29
  4. package/dist/core/compute/atlas.d.ts +10 -2
  5. package/dist/core/compute/atlas.js +6 -1
  6. package/dist/core/compute/atlas.js.map +1 -1
  7. package/dist/core/compute/index.d.ts +3 -3
  8. package/dist/core/compute/index.js +2 -2
  9. package/dist/core/compute/index.js.map +1 -1
  10. package/dist/core/compute/majorant-build.d.ts +45 -0
  11. package/dist/core/compute/majorant-build.js +193 -0
  12. package/dist/core/compute/majorant-build.js.map +1 -0
  13. package/dist/core/compute/multi-scale.d.ts +155 -0
  14. package/dist/core/compute/multi-scale.js +684 -0
  15. package/dist/core/compute/multi-scale.js.map +1 -0
  16. package/dist/core/compute/pyramid.d.ts +22 -7
  17. package/dist/core/compute/pyramid.js +22 -9
  18. package/dist/core/compute/pyramid.js.map +1 -1
  19. package/dist/core/compute/shared.d.ts +1 -0
  20. package/dist/core/compute/shared.js.map +1 -1
  21. package/dist/core/compute/stats.d.ts +10 -3
  22. package/dist/core/compute/stats.js +6 -1
  23. package/dist/core/compute/stats.js.map +1 -1
  24. package/dist/core/compute/value-transform.d.ts +8 -1
  25. package/dist/core/compute/value-transform.js +9 -3
  26. package/dist/core/compute/value-transform.js.map +1 -1
  27. package/dist/core/errors.d.ts +10 -0
  28. package/dist/core/errors.js +8 -0
  29. package/dist/core/errors.js.map +1 -1
  30. package/dist/core/frame/emission.d.ts +85 -0
  31. package/dist/core/frame/emission.js +422 -0
  32. package/dist/core/frame/emission.js.map +1 -0
  33. package/dist/core/frame/environment.d.ts +47 -0
  34. package/dist/core/frame/environment.js +178 -0
  35. package/dist/core/frame/environment.js.map +1 -0
  36. package/dist/core/frame/index.d.ts +39 -0
  37. package/dist/core/frame/index.js +27 -0
  38. package/dist/core/frame/index.js.map +1 -0
  39. package/dist/core/frame/kernels.d.ts +115 -0
  40. package/dist/core/frame/kernels.js +496 -0
  41. package/dist/core/frame/kernels.js.map +1 -0
  42. package/dist/core/frame/limits.d.ts +67 -0
  43. package/dist/core/frame/limits.js +109 -0
  44. package/dist/core/frame/limits.js.map +1 -0
  45. package/dist/core/frame/phase.d.ts +17 -0
  46. package/dist/core/frame/phase.js +53 -0
  47. package/dist/core/frame/phase.js.map +1 -0
  48. package/dist/core/frame/pipelines.d.ts +49 -0
  49. package/dist/core/frame/pipelines.js +147 -0
  50. package/dist/core/frame/pipelines.js.map +1 -0
  51. package/dist/core/frame/renderer.d.ts +122 -0
  52. package/dist/core/frame/renderer.js +1712 -0
  53. package/dist/core/frame/renderer.js.map +1 -0
  54. package/dist/core/frame/resources.d.ts +71 -0
  55. package/dist/core/frame/resources.js +100 -0
  56. package/dist/core/frame/resources.js.map +1 -0
  57. package/dist/core/frame/scattering.d.ts +97 -0
  58. package/dist/core/frame/scattering.js +332 -0
  59. package/dist/core/frame/scattering.js.map +1 -0
  60. package/dist/core/frame/settings.d.ts +243 -0
  61. package/dist/core/frame/settings.js +67 -0
  62. package/dist/core/frame/settings.js.map +1 -0
  63. package/dist/core/frame/shadows.d.ts +55 -0
  64. package/dist/core/frame/shadows.js +460 -0
  65. package/dist/core/frame/shadows.js.map +1 -0
  66. package/dist/core/frame/types.d.ts +415 -0
  67. package/dist/core/frame/types.js +49 -0
  68. package/dist/core/frame/types.js.map +1 -0
  69. package/dist/core/frame/uniforms.d.ts +105 -0
  70. package/dist/core/frame/uniforms.js +276 -0
  71. package/dist/core/frame/uniforms.js.map +1 -0
  72. package/dist/core/frame/wgsl/chunks.d.ts +4 -0
  73. package/dist/core/frame/wgsl/chunks.js +728 -0
  74. package/dist/core/frame/wgsl/chunks.js.map +1 -0
  75. package/dist/core/frame/wgsl/emission.d.ts +82 -0
  76. package/dist/core/frame/wgsl/emission.js +353 -0
  77. package/dist/core/frame/wgsl/emission.js.map +1 -0
  78. package/dist/core/frame/wgsl/environment.d.ts +42 -0
  79. package/dist/core/frame/wgsl/environment.js +711 -0
  80. package/dist/core/frame/wgsl/environment.js.map +1 -0
  81. package/dist/core/frame/wgsl/gather.d.ts +55 -0
  82. package/dist/core/frame/wgsl/gather.js +850 -0
  83. package/dist/core/frame/wgsl/gather.js.map +1 -0
  84. package/dist/core/frame/wgsl/integrate.d.ts +78 -0
  85. package/dist/core/frame/wgsl/integrate.js +213 -0
  86. package/dist/core/frame/wgsl/integrate.js.map +1 -0
  87. package/dist/core/frame/wgsl/lighting.d.ts +103 -0
  88. package/dist/core/frame/wgsl/lighting.js +1636 -0
  89. package/dist/core/frame/wgsl/lighting.js.map +1 -0
  90. package/dist/core/frame/wgsl/occluders.d.ts +20 -0
  91. package/dist/core/frame/wgsl/occluders.js +95 -0
  92. package/dist/core/frame/wgsl/occluders.js.map +1 -0
  93. package/dist/core/frame/wgsl/resolve.d.ts +19 -0
  94. package/dist/core/frame/wgsl/resolve.js +205 -0
  95. package/dist/core/frame/wgsl/resolve.js.map +1 -0
  96. package/dist/core/frame/wgsl/shadows.d.ts +35 -0
  97. package/dist/core/frame/wgsl/shadows.js +328 -0
  98. package/dist/core/frame/wgsl/shadows.js.map +1 -0
  99. package/dist/core/half.d.ts +11 -0
  100. package/dist/core/half.js +22 -0
  101. package/dist/core/half.js.map +1 -0
  102. package/dist/core/index.d.ts +25 -3
  103. package/dist/core/index.js +23 -4
  104. package/dist/core/index.js.map +1 -1
  105. package/dist/core/internal.d.ts +17 -1
  106. package/dist/core/internal.js +18 -1
  107. package/dist/core/internal.js.map +1 -1
  108. package/dist/core/pool/image-header.d.ts +13 -2
  109. package/dist/core/pool/image-header.js +24 -5
  110. package/dist/core/pool/image-header.js.map +1 -1
  111. package/dist/core/pool/layout.d.ts +35 -1
  112. package/dist/core/pool/layout.js +51 -2
  113. package/dist/core/pool/layout.js.map +1 -1
  114. package/dist/core/pool/limits.d.ts +1 -0
  115. package/dist/core/pool/limits.js +1 -0
  116. package/dist/core/pool/limits.js.map +1 -1
  117. package/dist/core/pool/pool.d.ts +120 -15
  118. package/dist/core/pool/pool.js +255 -24
  119. package/dist/core/pool/pool.js.map +1 -1
  120. package/dist/core/reference/index.d.ts +6 -0
  121. package/dist/core/reference/index.js +7 -0
  122. package/dist/core/reference/index.js.map +1 -0
  123. package/dist/core/reference/renderer.d.ts +105 -0
  124. package/dist/core/reference/renderer.js +474 -0
  125. package/dist/core/reference/renderer.js.map +1 -0
  126. package/dist/core/reference/wgsl.d.ts +65 -0
  127. package/dist/core/reference/wgsl.js +803 -0
  128. package/dist/core/reference/wgsl.js.map +1 -0
  129. package/dist/{three → core}/sequence.d.ts +32 -2
  130. package/dist/{three → core}/sequence.js +24 -2
  131. package/dist/core/sequence.js.map +1 -0
  132. package/dist/core/source/brick-cache.d.ts +165 -0
  133. package/dist/core/source/brick-cache.js +627 -0
  134. package/dist/core/source/brick-cache.js.map +1 -0
  135. package/dist/core/source/dense-fill.d.ts +53 -0
  136. package/dist/core/source/dense-fill.js +377 -0
  137. package/dist/core/source/dense-fill.js.map +1 -0
  138. package/dist/core/source/dense.d.ts +33 -2
  139. package/dist/core/source/dense.js +121 -24
  140. package/dist/core/source/dense.js.map +1 -1
  141. package/dist/core/source/sparse-wgsl.d.ts +92 -0
  142. package/dist/core/source/sparse-wgsl.js +481 -0
  143. package/dist/core/source/sparse-wgsl.js.map +1 -0
  144. package/dist/core/source/sparse.d.ts +192 -0
  145. package/dist/core/source/sparse.js +762 -0
  146. package/dist/core/source/sparse.js.map +1 -0
  147. package/dist/core/source/types.d.ts +59 -2
  148. package/dist/core/source/types.js.map +1 -1
  149. package/dist/core/surface/index.d.ts +10 -0
  150. package/dist/core/surface/index.js +9 -0
  151. package/dist/core/surface/index.js.map +1 -0
  152. package/dist/core/surface/level-set-pass.d.ts +140 -0
  153. package/dist/core/surface/level-set-pass.js +291 -0
  154. package/dist/core/surface/level-set-pass.js.map +1 -0
  155. package/dist/core/surface/level-set-wgsl.d.ts +46 -0
  156. package/dist/core/surface/level-set-wgsl.js +99 -0
  157. package/dist/core/surface/level-set-wgsl.js.map +1 -0
  158. package/dist/core/surface/points.d.ts +109 -0
  159. package/dist/core/surface/points.js +226 -0
  160. package/dist/core/surface/points.js.map +1 -0
  161. package/dist/core/types.d.ts +12 -3
  162. package/dist/core/types.js +6 -2
  163. package/dist/core/types.js.map +1 -1
  164. package/dist/core/wgsl/api.d.ts +29 -5
  165. package/dist/core/wgsl/api.js +110 -27
  166. package/dist/core/wgsl/api.js.map +1 -1
  167. package/dist/core/wgsl/generate.d.ts +8 -0
  168. package/dist/core/wgsl/generate.js +195 -22
  169. package/dist/core/wgsl/generate.js.map +1 -1
  170. package/dist/core/wgsl/lean.d.ts +50 -0
  171. package/dist/core/wgsl/lean.js +327 -0
  172. package/dist/core/wgsl/lean.js.map +1 -0
  173. package/dist/core/wgsl/level-set.d.ts +5 -1
  174. package/dist/core/wgsl/level-set.js +11 -5
  175. package/dist/core/wgsl/level-set.js.map +1 -1
  176. package/dist/core/wgsl/majorant.d.ts +62 -0
  177. package/dist/core/wgsl/majorant.js +381 -0
  178. package/dist/core/wgsl/majorant.js.map +1 -0
  179. package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +2 -2
  180. package/dist/core/wgsl/pnanovdb.chunks.generated.js +15 -12
  181. package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -1
  182. package/dist/core/wgsl/types.d.ts +97 -3
  183. package/dist/core/wgsl/types.js.map +1 -1
  184. package/dist/three/coarse-first.d.ts +53 -8
  185. package/dist/three/coarse-first.js +24 -6
  186. package/dist/three/coarse-first.js.map +1 -1
  187. package/dist/three/compute.d.ts +12 -2
  188. package/dist/three/compute.js +16 -6
  189. package/dist/three/compute.js.map +1 -1
  190. package/dist/three/device.d.ts +7 -0
  191. package/dist/three/device.js +3 -0
  192. package/dist/three/device.js.map +1 -1
  193. package/dist/three/frame/core-environment.d.ts +38 -0
  194. package/dist/three/frame/core-environment.js +154 -0
  195. package/dist/three/frame/core-environment.js.map +1 -0
  196. package/dist/three/frame/core-integrate-material.d.ts +34 -0
  197. package/dist/three/frame/core-integrate-material.js +162 -0
  198. package/dist/three/frame/core-integrate-material.js.map +1 -0
  199. package/dist/three/frame/core-occluders.d.ts +53 -0
  200. package/dist/three/frame/core-occluders.js +193 -0
  201. package/dist/three/frame/core-occluders.js.map +1 -0
  202. package/dist/three/frame/core-structs.d.ts +34 -0
  203. package/dist/three/frame/core-structs.js +61 -0
  204. package/dist/three/frame/core-structs.js.map +1 -0
  205. package/dist/three/frame/core-textures.d.ts +41 -0
  206. package/dist/three/frame/core-textures.js +114 -0
  207. package/dist/three/frame/core-textures.js.map +1 -0
  208. package/dist/three/frame/emission-light.d.ts +64 -114
  209. package/dist/three/frame/emission-light.js +188 -567
  210. package/dist/three/frame/emission-light.js.map +1 -1
  211. package/dist/three/frame/index.d.ts +11 -31
  212. package/dist/three/frame/index.js +9 -29
  213. package/dist/three/frame/index.js.map +1 -1
  214. package/dist/three/frame/medium.d.ts +12 -0
  215. package/dist/three/frame/medium.js.map +1 -1
  216. package/dist/three/frame/renderer.d.ts +58 -454
  217. package/dist/three/frame/renderer.js +409 -1427
  218. package/dist/three/frame/renderer.js.map +1 -1
  219. package/dist/three/frame/spectrum.d.ts +0 -14
  220. package/dist/three/frame/spectrum.js +2 -23
  221. package/dist/three/frame/spectrum.js.map +1 -1
  222. package/dist/three/frame/three-internals.d.ts +3 -8
  223. package/dist/three/frame/three-internals.js +13 -11
  224. package/dist/three/frame/three-internals.js.map +1 -1
  225. package/dist/three/frame/volume-shadows.d.ts +93 -107
  226. package/dist/three/frame/volume-shadows.js +278 -631
  227. package/dist/three/frame/volume-shadows.js.map +1 -1
  228. package/dist/three/frame/volume.d.ts +91 -33
  229. package/dist/three/frame/volume.js +63 -51
  230. package/dist/three/frame/volume.js.map +1 -1
  231. package/dist/three/grid-node.d.ts +34 -1
  232. package/dist/three/grid-node.js +36 -1
  233. package/dist/three/grid-node.js.map +1 -1
  234. package/dist/three/index.d.ts +20 -11
  235. package/dist/three/index.js +21 -12
  236. package/dist/three/index.js.map +1 -1
  237. package/dist/three/internal.d.ts +14 -8
  238. package/dist/three/internal.js +11 -7
  239. package/dist/three/internal.js.map +1 -1
  240. package/dist/three/level-set-material.d.ts +81 -8
  241. package/dist/three/level-set-material.js +162 -125
  242. package/dist/three/level-set-material.js.map +1 -1
  243. package/dist/three/level-set-physical-material.d.ts +154 -0
  244. package/dist/three/level-set-physical-material.js +253 -0
  245. package/dist/three/level-set-physical-material.js.map +1 -0
  246. package/dist/three/level-set-velocity.d.ts +94 -0
  247. package/dist/three/level-set-velocity.js +208 -0
  248. package/dist/three/level-set-velocity.js.map +1 -0
  249. package/dist/three/material.d.ts +141 -11
  250. package/dist/three/material.js +161 -18
  251. package/dist/three/material.js.map +1 -1
  252. package/dist/three/points.d.ts +60 -4
  253. package/dist/three/points.js +140 -9
  254. package/dist/three/points.js.map +1 -1
  255. package/dist/three/sparse-source.d.ts +49 -117
  256. package/dist/three/sparse-source.js +109 -580
  257. package/dist/three/sparse-source.js.map +1 -1
  258. package/dist/three/volume-source.d.ts +11 -156
  259. package/dist/three/volume-source.js +29 -272
  260. package/dist/three/volume-source.js.map +1 -1
  261. package/dist/tools/cpu/brick-atlas.d.ts +36 -0
  262. package/dist/tools/cpu/brick-atlas.js +129 -0
  263. package/dist/tools/cpu/brick-atlas.js.map +1 -0
  264. package/dist/tools/cpu/compute.d.ts +23 -4
  265. package/dist/tools/cpu/compute.js +35 -14
  266. package/dist/tools/cpu/compute.js.map +1 -1
  267. package/dist/tools/cpu/lean-reads.d.ts +81 -0
  268. package/dist/tools/cpu/lean-reads.js +262 -0
  269. package/dist/tools/cpu/lean-reads.js.map +1 -0
  270. package/dist/tools/cpu/level-set.d.ts +42 -3
  271. package/dist/tools/cpu/level-set.js +59 -7
  272. package/dist/tools/cpu/level-set.js.map +1 -1
  273. package/dist/tools/cpu/majorant.d.ts +265 -0
  274. package/dist/tools/cpu/majorant.js +541 -0
  275. package/dist/tools/cpu/majorant.js.map +1 -0
  276. package/dist/tools/cpu/march.d.ts +93 -2
  277. package/dist/tools/cpu/march.js +165 -14
  278. package/dist/tools/cpu/march.js.map +1 -1
  279. package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
  280. package/dist/tools/cpu/mesh-decimate.js +1225 -0
  281. package/dist/tools/cpu/mesh-decimate.js.map +1 -0
  282. package/dist/tools/cpu/points.d.ts +29 -0
  283. package/dist/tools/cpu/points.js +38 -0
  284. package/dist/tools/cpu/points.js.map +1 -0
  285. package/dist/tools/cpu/read-value.d.ts +19 -6
  286. package/dist/tools/cpu/read-value.js +32 -17
  287. package/dist/tools/cpu/read-value.js.map +1 -1
  288. package/dist/tools/cpu/sample-trilinear.d.ts +17 -4
  289. package/dist/tools/cpu/sample-trilinear.js +19 -7
  290. package/dist/tools/cpu/sample-trilinear.js.map +1 -1
  291. package/dist/tools/cpu/stride-tables.d.ts +2 -2
  292. package/dist/tools/cpu/stride-tables.generated.d.ts +6 -5
  293. package/dist/tools/cpu/stride-tables.generated.js +7 -6
  294. package/dist/tools/cpu/stride-tables.generated.js.map +1 -1
  295. package/dist/tools/cpu/stride-tables.js +1 -1
  296. package/dist/tools/cpu/stride-tables.js.map +1 -1
  297. package/dist/tools/cpu/surface-nets.d.ts +90 -0
  298. package/dist/tools/cpu/surface-nets.js +597 -0
  299. package/dist/tools/cpu/surface-nets.js.map +1 -0
  300. package/dist/tools/errors.d.ts +9 -0
  301. package/dist/tools/errors.js +9 -0
  302. package/dist/tools/errors.js.map +1 -1
  303. package/dist/tools/frame/ambient.d.ts +98 -0
  304. package/dist/tools/frame/ambient.js +274 -0
  305. package/dist/tools/frame/ambient.js.map +1 -0
  306. package/dist/tools/frame/blackbody.d.ts +15 -0
  307. package/dist/tools/frame/blackbody.js +35 -0
  308. package/dist/tools/frame/blackbody.js.map +1 -1
  309. package/dist/tools/frame/brick-cache.d.ts +165 -0
  310. package/dist/tools/frame/brick-cache.js +326 -0
  311. package/dist/tools/frame/brick-cache.js.map +1 -0
  312. package/dist/tools/frame/emission.d.ts +9 -0
  313. package/dist/tools/frame/emission.js +9 -1
  314. package/dist/tools/frame/emission.js.map +1 -1
  315. package/dist/tools/frame/environment-gpu.d.ts +111 -0
  316. package/dist/tools/frame/environment-gpu.js +280 -0
  317. package/dist/tools/frame/environment-gpu.js.map +1 -0
  318. package/dist/tools/frame/environment.d.ts +3 -2
  319. package/dist/tools/frame/environment.js +8 -4
  320. package/dist/tools/frame/environment.js.map +1 -1
  321. package/dist/tools/frame/froxel.d.ts +58 -0
  322. package/dist/tools/frame/froxel.js +115 -0
  323. package/dist/tools/frame/froxel.js.map +1 -0
  324. package/dist/tools/frame/grid.d.ts +90 -0
  325. package/dist/tools/frame/grid.js +112 -13
  326. package/dist/tools/frame/grid.js.map +1 -1
  327. package/dist/tools/frame/index.d.ts +14 -0
  328. package/dist/tools/frame/index.js +45 -4
  329. package/dist/tools/frame/index.js.map +1 -1
  330. package/dist/tools/frame/medium.d.ts +16 -0
  331. package/dist/tools/frame/medium.js +3 -1
  332. package/dist/tools/frame/medium.js.map +1 -1
  333. package/dist/tools/frame/mie.d.ts +9 -0
  334. package/dist/tools/frame/mie.js +18 -0
  335. package/dist/tools/frame/mie.js.map +1 -1
  336. package/dist/tools/frame/mlp-nn.d.ts +36 -0
  337. package/dist/tools/frame/mlp-nn.js +159 -0
  338. package/dist/tools/frame/mlp-nn.js.map +1 -0
  339. package/dist/tools/frame/mlp-tza.d.ts +29 -0
  340. package/dist/tools/frame/mlp-tza.js +186 -0
  341. package/dist/tools/frame/mlp-tza.js.map +1 -0
  342. package/dist/tools/frame/mlp.d.ts +183 -0
  343. package/dist/tools/frame/mlp.js +434 -0
  344. package/dist/tools/frame/mlp.js.map +1 -0
  345. package/dist/tools/frame/ms-exit.d.ts +42 -0
  346. package/dist/tools/frame/ms-exit.js +90 -0
  347. package/dist/tools/frame/ms-exit.js.map +1 -0
  348. package/dist/tools/frame/multi-scale.d.ts +152 -0
  349. package/dist/tools/frame/multi-scale.js +302 -0
  350. package/dist/tools/frame/multi-scale.js.map +1 -0
  351. package/dist/tools/frame/neural-weights.d.ts +6 -5
  352. package/dist/tools/frame/neural-weights.js +234 -235
  353. package/dist/tools/frame/neural-weights.js.map +1 -1
  354. package/dist/tools/frame/neural.js +1 -1
  355. package/dist/tools/frame/neural.js.map +1 -1
  356. package/dist/tools/frame/occluders.d.ts +51 -0
  357. package/dist/tools/frame/occluders.js +72 -0
  358. package/dist/tools/frame/occluders.js.map +1 -0
  359. package/dist/tools/frame/pyramid-layout.d.ts +17 -0
  360. package/dist/tools/frame/pyramid-layout.js +47 -0
  361. package/dist/tools/frame/pyramid-layout.js.map +1 -1
  362. package/dist/tools/frame/shadows.d.ts +110 -0
  363. package/dist/tools/frame/shadows.js +286 -0
  364. package/dist/tools/frame/shadows.js.map +1 -1
  365. package/dist/tools/frame/sparse.d.ts +82 -0
  366. package/dist/tools/frame/sparse.js +242 -1
  367. package/dist/tools/frame/sparse.js.map +1 -1
  368. package/dist/tools/frame/spectral-stack.d.ts +159 -0
  369. package/dist/tools/frame/spectral-stack.js +391 -0
  370. package/dist/tools/frame/spectral-stack.js.map +1 -0
  371. package/dist/tools/frame/spectral.d.ts +21 -2
  372. package/dist/tools/frame/spectral.js +30 -8
  373. package/dist/tools/frame/spectral.js.map +1 -1
  374. package/dist/tools/frame/stack.d.ts +115 -0
  375. package/dist/tools/frame/stack.js +290 -0
  376. package/dist/tools/frame/stack.js.map +1 -0
  377. package/dist/tools/frame/view.d.ts +131 -0
  378. package/dist/tools/frame/view.js +337 -0
  379. package/dist/tools/frame/view.js.map +1 -0
  380. package/dist/tools/index.d.ts +66 -15
  381. package/dist/tools/index.js +55 -11
  382. package/dist/tools/index.js.map +1 -1
  383. package/dist/tools/internal.d.ts +58 -17
  384. package/dist/tools/internal.js +65 -11
  385. package/dist/tools/internal.js.map +1 -1
  386. package/dist/tools/nanovdb/build-from-vdb.d.ts +11 -2
  387. package/dist/tools/nanovdb/build-from-vdb.js +10 -2
  388. package/dist/tools/nanovdb/build-from-vdb.js.map +1 -1
  389. package/dist/tools/nanovdb/bytes.d.ts +17 -4
  390. package/dist/tools/nanovdb/bytes.js +46 -3
  391. package/dist/tools/nanovdb/bytes.js.map +1 -1
  392. package/dist/tools/nanovdb/coarse-first.d.ts +19 -3
  393. package/dist/tools/nanovdb/coarse-first.js +7 -1
  394. package/dist/tools/nanovdb/coarse-first.js.map +1 -1
  395. package/dist/tools/nanovdb/half.d.ts +22 -0
  396. package/dist/tools/nanovdb/half.js +73 -0
  397. package/dist/tools/nanovdb/half.js.map +1 -0
  398. package/dist/tools/nanovdb/index.d.ts +3 -1
  399. package/dist/tools/nanovdb/index.js +2 -1
  400. package/dist/tools/nanovdb/index.js.map +1 -1
  401. package/dist/tools/nanovdb/inspect.d.ts +10 -1
  402. package/dist/tools/nanovdb/inspect.js +8 -1
  403. package/dist/tools/nanovdb/inspect.js.map +1 -1
  404. package/dist/tools/nanovdb/leaf-codec.d.ts +35 -1
  405. package/dist/tools/nanovdb/leaf-codec.js +40 -4
  406. package/dist/tools/nanovdb/leaf-codec.js.map +1 -1
  407. package/dist/tools/nanovdb/quantize.d.ts +39 -10
  408. package/dist/tools/nanovdb/quantize.js +96 -44
  409. package/dist/tools/nanovdb/quantize.js.map +1 -1
  410. package/dist/tools/nanovdb/resample.d.ts +20 -3
  411. package/dist/tools/nanovdb/resample.js +20 -7
  412. package/dist/tools/nanovdb/resample.js.map +1 -1
  413. package/dist/tools/nanovdb/serialize.d.ts +34 -3
  414. package/dist/tools/nanovdb/serialize.js +51 -7
  415. package/dist/tools/nanovdb/serialize.js.map +1 -1
  416. package/dist/tools/nanovdb/stats.d.ts +34 -5
  417. package/dist/tools/nanovdb/stats.js +87 -11
  418. package/dist/tools/nanovdb/stats.js.map +1 -1
  419. package/dist/tools/nanovdb/transform.d.ts +4 -0
  420. package/dist/tools/nanovdb/transform.js +3 -0
  421. package/dist/tools/nanovdb/transform.js.map +1 -1
  422. package/dist/tools/nanovdb/tree.d.ts +14 -3
  423. package/dist/tools/nanovdb/tree.js +25 -13
  424. package/dist/tools/nanovdb/tree.js.map +1 -1
  425. package/dist/tools/nanovdb/write-nvdb.d.ts +47 -12
  426. package/dist/tools/nanovdb/write-nvdb.js +108 -28
  427. package/dist/tools/nanovdb/write-nvdb.js.map +1 -1
  428. package/dist/tools/nvdb-file.d.ts +77 -7
  429. package/dist/tools/nvdb-file.js +177 -20
  430. package/dist/tools/nvdb-file.js.map +1 -1
  431. package/dist/tools/nvdb-stream.d.ts +23 -7
  432. package/dist/tools/nvdb-stream.js +78 -34
  433. package/dist/tools/nvdb-stream.js.map +1 -1
  434. package/dist/tools/reference/analytic.d.ts +41 -0
  435. package/dist/tools/reference/analytic.js +95 -0
  436. package/dist/tools/reference/analytic.js.map +1 -0
  437. package/dist/tools/reference/environment.d.ts +62 -0
  438. package/dist/tools/reference/environment.js +154 -0
  439. package/dist/tools/reference/environment.js.map +1 -0
  440. package/dist/tools/reference/index.d.ts +12 -0
  441. package/dist/tools/reference/index.js +13 -0
  442. package/dist/tools/reference/index.js.map +1 -0
  443. package/dist/tools/reference/media.d.ts +14 -0
  444. package/dist/tools/reference/media.js +30 -0
  445. package/dist/tools/reference/media.js.map +1 -0
  446. package/dist/tools/reference/rng.d.ts +20 -0
  447. package/dist/tools/reference/rng.js +30 -0
  448. package/dist/tools/reference/rng.js.map +1 -0
  449. package/dist/tools/reference/scene.d.ts +312 -0
  450. package/dist/tools/reference/scene.js +169 -0
  451. package/dist/tools/reference/scene.js.map +1 -0
  452. package/dist/tools/reference/tables.d.ts +98 -0
  453. package/dist/tools/reference/tables.js +264 -0
  454. package/dist/tools/reference/tables.js.map +1 -0
  455. package/dist/tools/reference/trace.d.ts +160 -0
  456. package/dist/tools/reference/trace.js +497 -0
  457. package/dist/tools/reference/trace.js.map +1 -0
  458. package/dist/tools/vdb/blosc-write.d.ts +43 -0
  459. package/dist/tools/vdb/blosc-write.js +197 -0
  460. package/dist/tools/vdb/blosc-write.js.map +1 -0
  461. package/dist/tools/vdb/blosc.d.ts +35 -5
  462. package/dist/tools/vdb/blosc.js +82 -26
  463. package/dist/tools/vdb/blosc.js.map +1 -1
  464. package/dist/tools/vdb/blosclz.d.ts +33 -0
  465. package/dist/tools/vdb/blosclz.js +112 -0
  466. package/dist/tools/vdb/blosclz.js.map +1 -0
  467. package/dist/tools/vdb/byte-reader.d.ts +13 -3
  468. package/dist/tools/vdb/byte-reader.js +26 -4
  469. package/dist/tools/vdb/byte-reader.js.map +1 -1
  470. package/dist/tools/vdb/compression.d.ts +13 -5
  471. package/dist/tools/vdb/compression.js +13 -2
  472. package/dist/tools/vdb/compression.js.map +1 -1
  473. package/dist/tools/vdb/grid.js +8 -2
  474. package/dist/tools/vdb/grid.js.map +1 -1
  475. package/dist/tools/vdb/index.d.ts +2 -1
  476. package/dist/tools/vdb/index.js.map +1 -1
  477. package/dist/tools/vdb/lz4.d.ts +30 -0
  478. package/dist/tools/vdb/lz4.js +228 -0
  479. package/dist/tools/vdb/lz4.js.map +1 -0
  480. package/dist/tools/vdb/metadata.js +1 -1
  481. package/dist/tools/vdb/metadata.js.map +1 -1
  482. package/dist/tools/vdb/parse.d.ts +24 -2
  483. package/dist/tools/vdb/parse.js +102 -32
  484. package/dist/tools/vdb/parse.js.map +1 -1
  485. package/dist/tools/vdb/point-render-data.d.ts +49 -1
  486. package/dist/tools/vdb/point-render-data.js +91 -11
  487. package/dist/tools/vdb/point-render-data.js.map +1 -1
  488. package/dist/tools/vdb/points.d.ts +26 -0
  489. package/dist/tools/vdb/points.js +46 -5
  490. package/dist/tools/vdb/points.js.map +1 -1
  491. package/dist/tools/vdb/types.d.ts +59 -2
  492. package/dist/tools/vdb/types.js.map +1 -1
  493. package/dist/tools/wvdb/bake.d.ts +38 -9
  494. package/dist/tools/wvdb/bake.js +63 -13
  495. package/dist/tools/wvdb/bake.js.map +1 -1
  496. package/dist/tools/wvdb/dense.d.ts +80 -1
  497. package/dist/tools/wvdb/dense.js +67 -8
  498. package/dist/tools/wvdb/dense.js.map +1 -1
  499. package/dist/tools/wvdb/format.d.ts +59 -0
  500. package/dist/tools/wvdb/format.js +3 -0
  501. package/dist/tools/wvdb/format.js.map +1 -1
  502. package/dist/tools/wvdb/index.d.ts +1 -0
  503. package/dist/tools/wvdb/index.js +1 -0
  504. package/dist/tools/wvdb/index.js.map +1 -1
  505. package/dist/tools/wvdb/level-set.d.ts +10 -2
  506. package/dist/tools/wvdb/level-set.js.map +1 -1
  507. package/dist/tools/wvdb/nanovdb.d.ts +6 -1
  508. package/dist/tools/wvdb/nanovdb.js +5 -1
  509. package/dist/tools/wvdb/nanovdb.js.map +1 -1
  510. package/dist/tools/wvdb/partial.d.ts +74 -0
  511. package/dist/tools/wvdb/partial.js +233 -0
  512. package/dist/tools/wvdb/partial.js.map +1 -0
  513. package/dist/tools/wvdb/read.d.ts +77 -1
  514. package/dist/tools/wvdb/read.js +30 -7
  515. package/dist/tools/wvdb/read.js.map +1 -1
  516. package/dist/tools/wvdb/write.d.ts +23 -1
  517. package/dist/tools/wvdb/write.js +8 -1
  518. package/dist/tools/wvdb/write.js.map +1 -1
  519. package/package.json +2 -1
  520. package/vendor/VENDOR.md +21 -6
  521. package/vendor/pnanovdb.wgsl +52 -14
  522. package/dist/three/frame/blackbody.d.ts +0 -42
  523. package/dist/three/frame/blackbody.js +0 -74
  524. package/dist/three/frame/blackbody.js.map +0 -1
  525. package/dist/three/frame/chunks.d.ts +0 -157
  526. package/dist/three/frame/chunks.js +0 -559
  527. package/dist/three/frame/chunks.js.map +0 -1
  528. package/dist/three/frame/density-material.d.ts +0 -53
  529. package/dist/three/frame/density-material.js +0 -353
  530. package/dist/three/frame/density-material.js.map +0 -1
  531. package/dist/three/frame/environment-grid-material.d.ts +0 -21
  532. package/dist/three/frame/environment-grid-material.js +0 -184
  533. package/dist/three/frame/environment-grid-material.js.map +0 -1
  534. package/dist/three/frame/environment-material.d.ts +0 -22
  535. package/dist/three/frame/environment-material.js +0 -87
  536. package/dist/three/frame/environment-material.js.map +0 -1
  537. package/dist/three/frame/grid-mip-material.d.ts +0 -12
  538. package/dist/three/frame/grid-mip-material.js +0 -61
  539. package/dist/three/frame/grid-mip-material.js.map +0 -1
  540. package/dist/three/frame/inject-material.d.ts +0 -56
  541. package/dist/three/frame/inject-material.js +0 -424
  542. package/dist/three/frame/inject-material.js.map +0 -1
  543. package/dist/three/frame/integrate-material.d.ts +0 -26
  544. package/dist/three/frame/integrate-material.js +0 -198
  545. package/dist/three/frame/integrate-material.js.map +0 -1
  546. package/dist/three/frame/layout.d.ts +0 -34
  547. package/dist/three/frame/layout.js +0 -48
  548. package/dist/three/frame/layout.js.map +0 -1
  549. package/dist/three/frame/lighting-material.d.ts +0 -41
  550. package/dist/three/frame/lighting-material.js +0 -257
  551. package/dist/three/frame/lighting-material.js.map +0 -1
  552. package/dist/three/frame/lights.d.ts +0 -11
  553. package/dist/three/frame/lights.js +0 -16
  554. package/dist/three/frame/lights.js.map +0 -1
  555. package/dist/three/frame/neural.d.ts +0 -14
  556. package/dist/three/frame/neural.js +0 -105
  557. package/dist/three/frame/neural.js.map +0 -1
  558. package/dist/three/frame/phase.d.ts +0 -44
  559. package/dist/three/frame/phase.js +0 -80
  560. package/dist/three/frame/phase.js.map +0 -1
  561. package/dist/three/frame/shadow-density-material.d.ts +0 -30
  562. package/dist/three/frame/shadow-density-material.js +0 -123
  563. package/dist/three/frame/shadow-density-material.js.map +0 -1
  564. package/dist/three/frame/temporal-material.d.ts +0 -29
  565. package/dist/three/frame/temporal-material.js +0 -152
  566. package/dist/three/frame/temporal-material.js.map +0 -1
  567. package/dist/three/frame/transmittance-material.d.ts +0 -31
  568. package/dist/three/frame/transmittance-material.js +0 -315
  569. package/dist/three/frame/transmittance-material.js.map +0 -1
  570. package/dist/three/frame/view.d.ts +0 -103
  571. package/dist/three/frame/view.js +0 -296
  572. package/dist/three/frame/view.js.map +0 -1
  573. package/dist/three/frame/volume-shadow-material.d.ts +0 -36
  574. package/dist/three/frame/volume-shadow-material.js +0 -128
  575. package/dist/three/frame/volume-shadow-material.js.map +0 -1
  576. package/dist/three/sequence.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"build-from-vdb.js","sourceRoot":"","sources":["../../../src/tools/nanovdb/build-from-vdb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGlE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EACL,0BAA0B,GAI3B,MAAM,gBAAgB,CAAC;AAiBxB,gGAAgG;AAChG,MAAM,UAAU,YAAY,CAAC,IAAa,EAAE,OAA4B,EAAE;IACxE,OAAO,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC;AAChD,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,oBAAoB,CAAC,IAAa,EAAE,OAA4B,EAAE;IAChF,IAAI,IAAI,CAAC,SAAS,KAAK,aAAa,EAAE,CAAC;QACrC,MAAM,IAAI,mBAAmB,CAC3B,uBAAuB,IAAI,CAAC,IAAI,qFAAqF,CACtH,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpE,MAAM,SAAS,GAA8B;QAC3C,SAAS;QACT,WAAW,EAAE,WAAW;QACxB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,IAAI,MAAM;QAC9C,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,eAAe,CAAC,IAAI,CAAC;QAClD,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC;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CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC;IACtE,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;QAC1B,MAAM,IAAI,mBAAmB,CAC3B,4BAA4B,CAAC,CAAC,IAAI,QAAQ,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,sBAAsB,GAAG;YAC/F,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK;YAClG,sGAAsG,CACzG,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,EAAE,CAAE,CAAC,EAAE,CAAC;AAChE,CAAC","sourcesContent":["/**\n * build-from-vdb.ts — bridges the `.vdb` parser to the NanoVDB serializer.\n *\n * A parsed {@link VdbGrid} exposes `iterLeaves()` (each leaf: 8-aligned origin,\n * 512 values, 512-bit value mask), `iterTiles()` (active tiles above leaf\n * level) and an index->world transform. `buildFromVdb` streams those leaves\n * straight into the leaf-iterator build path ({@link vdbBuildFromLeavesDetailed})\n * with the FLOAT codec — no dense array is materialised, so a 7M-active-voxel\n * teapot in a large bbox stays sparse — and writes the active tiles as NanoVDB\n * tiles at the same level (K4.1).\n *\n * Vector grids (`vec3s`, and `vec3d`/`vec3i` converted to f32) build a NanoVDB\n * Vec3f grid with the Vec3f leaf codec (K4.2). Point data grids have no NanoVDB\n * build here (use `grid.points()`).\n *\n * The `.vdb` transform is carried into the NanoVDB Map. v1 supports uniform\n * scale + translate only (which is what all four openvdb.org samples use); a\n * non-uniform scale, rotation or shear throws clearly (GPU resampling is the\n * roadmap for those).\n */\n\nimport { VDBToolsError, VDBUnsupportedError } from \"../errors.js\";\nimport type { VdbGrid, VdbTransformInfo } from \"../vdb/types.js\";\nimport type { TileInput } from \"./tree.js\";\nimport { VDB_FLOAT_LEAF_CODEC, VDB_VEC3F_LEAF_CODEC } from \"./leaf-codec.js\";\nimport {\n vdbBuildFromLeavesDetailed,\n type VDBBuildFromLeavesOptions,\n type VDBBuiltGrid,\n type GridClassName,\n} from \"./serialize.js\";\n\nexport interface BuildFromVdbOptions {\n /** Grid name for the output image. Default: the source grid's name (or \"grid\"). */\n gridName?: string;\n /** Grid class. Default: mapped from source metadata. */\n gridClass?: GridClassName;\n /**\n * Collapse uniform leaves and nodes into tiles (OpenVDB `prune`, tolerance 0;\n * K4.6). Default false: `nanovdb_convert` (CreateNanoGrid) copies the OpenVDB\n * tree as it is, and so do we, so our image of a `.vdb` keeps native's\n * topology (the parity fixtures). Files written by OpenVDB tools are usually\n * pruned already.\n */\n collapse?: boolean;\n}\n\n/** Builds a NanoVDB grid image (FLOAT, or Vec3f for vector grids) from a parsed `.vdb` grid. */\nexport function buildFromVdb(grid: VdbGrid, opts: BuildFromVdbOptions = {}): Uint32Array {\n return buildFromVdbDetailed(grid, opts).image;\n}\n\n/** As {@link buildFromVdb}, but returns the computed metadata alongside the image. */\nexport function buildFromVdbDetailed(grid: VdbGrid, opts: BuildFromVdbOptions = {}): VDBBuiltGrid {\n if (grid.valueType === \"ptdataidx32\") {\n throw new VDBUnsupportedError(\n `buildFromVdb: grid \"${grid.name}\" is a point data grid; NanoVDB point output is not implemented (use grid.points())`,\n );\n }\n const { voxelSize, translation } = uniformTransform(grid.transform);\n const buildOpts: VDBBuildFromLeavesOptions = {\n voxelSize,\n worldOrigin: translation,\n background: grid.background,\n gridName: opts.gridName ?? grid.name ?? \"grid\",\n gridClass: opts.gridClass ?? sourceGridClass(grid),\n tiles: allTiles(grid),\n collapse: opts.collapse === true,\n };\n const isVector = grid.valueType === \"vec3s\" || grid.valueType === \"vec3d\" || grid.valueType === \"vec3i\";\n const codec = isVector ? VDB_VEC3F_LEAF_CODEC : VDB_FLOAT_LEAF_CODEC;\n return vdbBuildFromLeavesDetailed(grid.iterLeaves(), codec, buildOpts);\n}\n\n/** Active tiles, then inactive tiles with a stored value (K4.9). */\nfunction* allTiles(grid: VdbGrid): Generator<TileInput> {\n for (const t of grid.iterTiles() as Iterable<TileInput>) yield { origin: t.origin, dim: t.dim, value: t.value, active: true };\n for (const t of (grid.iterInactiveTiles?.() ?? []) as Iterable<TileInput>) {\n yield { origin: t.origin, dim: t.dim, value: t.value, active: false };\n }\n}\n\n/** OpenVDB `GridClass` metadata -> NanoVDB class (CreateNanoGrid's `mapToGridClass`). */\nfunction sourceGridClass(grid: VdbGrid): GridClassName {\n const gridClass = typeof grid.metadata.class === \"string\" ? grid.metadata.class.toLowerCase() : \"\";\n if (gridClass === \"level set\" || gridClass === \"levelset\") return \"LevelSet\";\n if (gridClass === \"fog volume\" || gridClass === \"fogvolume\") return \"FogVolume\";\n if (gridClass === \"staggered\") return \"Staggered\";\n return \"Unknown\";\n}\n\n/**\n * Extracts a uniform scale + translation from a parsed `.vdb` transform's\n * row-major 4x4 index->world matrix. Throws (with a pointer to the GPU-resample\n * roadmap) on any rotation, shear or non-uniform scale — the serializer's Map is\n * axis-aligned and uniform-scale in v1.\n */\nexport function uniformTransform(t: VdbTransformInfo): {\n voxelSize: number;\n translation: [number, number, number];\n} {\n const m = t.matrix;\n if (m.length !== 16) {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", `buildFromVdb: expected a 4x4 (16-element) transform matrix, got ${m.length}`);\n }\n const sx = m[0]!;\n const sy = m[5]!;\n const sz = m[10]!;\n // Off-diagonal terms of the linear 3x3 block must vanish (no rotation/shear).\n const offDiagonal = [m[1]!, m[2]!, m[4]!, m[6]!, m[8]!, m[9]!];\n const eps = 1e-6 * Math.max(1, Math.abs(sx), Math.abs(sy), Math.abs(sz));\n const rotated = offDiagonal.some((v) => Math.abs(v) > eps);\n const nonUniform = Math.abs(sx - sy) > eps || Math.abs(sx - sz) > eps;\n if (rotated || nonUniform) {\n throw new VDBUnsupportedError(\n `buildFromVdb: transform \"${t.type}\" is ${rotated ? \"rotated/sheared\" : \"non-uniformly scaled\"} ` +\n `(scale [${sx}, ${sy}, ${sz}]${rotated ? `, off-diagonal ${JSON.stringify(offDiagonal)}` : \"\"}). ` +\n `v1 supports uniform scale + translate only; rotation/shear/anisotropy need GPU resampling (roadmap).`,\n );\n }\n return { voxelSize: sx, translation: [m[3]!, m[7]!, m[11]!] };\n}\n"]}
1
+ {"version":3,"file":"build-from-vdb.js","sourceRoot":"","sources":["../../../src/tools/nanovdb/build-from-vdb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGlE,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EACL,0BAA0B,GAI3B,MAAM,gBAAgB,CAAC;AAkBxB;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa,EAAE,OAA4B,EAAE;IACxE,OAAO,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAa,EAAE,OAA4B,EAAE;IAChF,IAAI,IAAI,CAAC,SAAS,KAAK,aAAa,EAAE,CAAC;QACrC,MAAM,IAAI,mBAAmB,CAC3B,uBAAuB,IAAI,CAAC,IAAI,qFAAqF,CACtH,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpE,MAAM,SAAS,GAA8B;QAC3C,SAAS;QACT,WAAW,EAAE,WAAW;QACxB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,QAAQ,EAAE,IAAI,CAA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AAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC;IACtE,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;QAC1B,MAAM,IAAI,mBAAmB,CAC3B,4BAA4B,CAAC,CAAC,IAAI,QAAQ,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,sBAAsB,GAAG;YAC/F,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK;YAClG,sGAAsG,CACzG,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,EAAE,CAAE,CAAC,EAAE,CAAC;AAChE,CAAC","sourcesContent":["/**\n * build-from-vdb.ts — bridges the `.vdb` parser to the NanoVDB serializer.\n *\n * A parsed {@link VdbGrid} exposes `iterLeaves()` (each leaf: 8-aligned origin,\n * 512 values, 512-bit value mask), `iterTiles()` (active tiles above leaf\n * level) and an index->world transform. `buildFromVdb` streams those leaves\n * straight into the leaf-iterator build path ({@link vdbBuildFromLeavesDetailed})\n * with the FLOAT codec — no dense array is materialised, so a 7M-active-voxel\n * teapot in a large bbox stays sparse — and writes the active tiles as NanoVDB\n * tiles at the same level (K4.1).\n *\n * Vector grids (`vec3s`, and `vec3d`/`vec3i` converted to f32) build a NanoVDB\n * Vec3f grid with the Vec3f leaf codec (K4.2). Point data grids have no NanoVDB\n * build here (use `grid.points()`).\n *\n * The `.vdb` transform is carried into the NanoVDB Map. v1 supports uniform\n * scale + translate only (which is what all four openvdb.org samples use); a\n * non-uniform scale, rotation or shear throws clearly (GPU resampling is the\n * roadmap for those).\n */\n\nimport { VDBToolsError, VDBUnsupportedError } from \"../errors.js\";\nimport type { VdbGrid, VdbTransformInfo } from \"../vdb/types.js\";\nimport type { TileInput } from \"./tree.js\";\nimport { VDB_FLOAT_LEAF_CODEC, VDB_VEC3F_LEAF_CODEC } from \"./leaf-codec.js\";\nimport {\n vdbBuildFromLeavesDetailed,\n type VDBBuildFromLeavesOptions,\n type VDBBuiltGrid,\n type GridClassName,\n} from \"./serialize.js\";\n\n/** Options of {@link buildFromVdb}. */\nexport interface BuildFromVdbOptions {\n /** Grid name for the output image. Default: the source grid's name (or \"grid\"). */\n gridName?: string;\n /** Grid class. Default: mapped from source metadata. */\n gridClass?: GridClassName;\n /**\n * Collapse uniform leaves and nodes into tiles (OpenVDB `prune`, tolerance 0;\n * K4.6). Default false: `nanovdb_convert` (CreateNanoGrid) copies the OpenVDB\n * tree as it is, and so do we, so our image of a `.vdb` keeps native's\n * topology (the parity fixtures). Files written by OpenVDB tools are usually\n * pruned already.\n */\n collapse?: boolean;\n}\n\n/** Builds a NanoVDB grid image (FLOAT, or Vec3f for vector grids) from a parsed `.vdb` grid.\n *\n * @param grid A float or vec3 grid from `parseVdb` (point data grids throw).\n * @param opts Grid name, class and leaf collapsing.\n */\nexport function buildFromVdb(grid: VdbGrid, opts: BuildFromVdbOptions = {}): Uint32Array {\n return buildFromVdbDetailed(grid, opts).image;\n}\n\n/** As {@link buildFromVdb}, but returns the computed metadata alongside the image.\n *\n * @param grid A float or vec3 grid from `parseVdb` (point data grids throw).\n * @param opts Grid name, class and leaf collapsing.\n */\nexport function buildFromVdbDetailed(grid: VdbGrid, opts: BuildFromVdbOptions = {}): VDBBuiltGrid {\n if (grid.valueType === \"ptdataidx32\") {\n throw new VDBUnsupportedError(\n `buildFromVdb: grid \"${grid.name}\" is a point data grid; NanoVDB point output is not implemented (use grid.points())`,\n );\n }\n const { voxelSize, translation } = uniformTransform(grid.transform);\n const buildOpts: VDBBuildFromLeavesOptions = {\n voxelSize,\n worldOrigin: translation,\n background: grid.background,\n gridName: opts.gridName ?? grid.name ?? \"grid\",\n gridClass: opts.gridClass ?? sourceGridClass(grid),\n tiles: allTiles(grid),\n collapse: opts.collapse === true,\n };\n const isVector = grid.valueType === \"vec3s\" || grid.valueType === \"vec3d\" || grid.valueType === \"vec3i\";\n const codec = isVector ? VDB_VEC3F_LEAF_CODEC : VDB_FLOAT_LEAF_CODEC;\n return vdbBuildFromLeavesDetailed(grid.iterLeaves(), codec, buildOpts);\n}\n\n/** Active tiles, then inactive tiles with a stored value (K4.9). */\nfunction* allTiles(grid: VdbGrid): Generator<TileInput> {\n for (const t of grid.iterTiles() as Iterable<TileInput>) yield { origin: t.origin, dim: t.dim, value: t.value, active: true };\n for (const t of (grid.iterInactiveTiles?.() ?? []) as Iterable<TileInput>) {\n yield { origin: t.origin, dim: t.dim, value: t.value, active: false };\n }\n}\n\n/** OpenVDB `GridClass` metadata -> NanoVDB class (CreateNanoGrid's `mapToGridClass`). */\nfunction sourceGridClass(grid: VdbGrid): GridClassName {\n const gridClass = typeof grid.metadata.class === \"string\" ? grid.metadata.class.toLowerCase() : \"\";\n if (gridClass === \"level set\" || gridClass === \"levelset\") return \"LevelSet\";\n if (gridClass === \"fog volume\" || gridClass === \"fogvolume\") return \"FogVolume\";\n if (gridClass === \"staggered\") return \"Staggered\";\n return \"Unknown\";\n}\n\n/**\n * Extracts a uniform scale + translation from a parsed `.vdb` transform's\n * row-major 4x4 index->world matrix. Throws (with a pointer to the GPU-resample\n * roadmap) on any rotation, shear or non-uniform scale — the serializer's Map is\n * axis-aligned and uniform-scale in v1.\n */\nexport function uniformTransform(t: VdbTransformInfo): {\n voxelSize: number;\n translation: [number, number, number];\n} {\n const m = t.matrix;\n if (m.length !== 16) {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", `buildFromVdb: expected a 4x4 (16-element) transform matrix, got ${m.length}`);\n }\n const sx = m[0]!;\n const sy = m[5]!;\n const sz = m[10]!;\n // Off-diagonal terms of the linear 3x3 block must vanish (no rotation/shear).\n const offDiagonal = [m[1]!, m[2]!, m[4]!, m[6]!, m[8]!, m[9]!];\n const eps = 1e-6 * Math.max(1, Math.abs(sx), Math.abs(sy), Math.abs(sz));\n const rotated = offDiagonal.some((v) => Math.abs(v) > eps);\n const nonUniform = Math.abs(sx - sy) > eps || Math.abs(sx - sz) > eps;\n if (rotated || nonUniform) {\n throw new VDBUnsupportedError(\n `buildFromVdb: transform \"${t.type}\" is ${rotated ? \"rotated/sheared\" : \"non-uniformly scaled\"} ` +\n `(scale [${sx}, ${sy}, ${sz}]${rotated ? `, off-diagonal ${JSON.stringify(offDiagonal)}` : \"\"}). ` +\n `v1 supports uniform scale + translate only; rotation/shear/anisotropy need GPU resampling (roadmap).`,\n );\n }\n return { voxelSize: sx, translation: [m[3]!, m[7]!, m[11]!] };\n}\n"]}
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * ## Provenance of the numbers
8
8
  *
9
- * Every constant below is the ABI-32.9.1 value extracted into
9
+ * Every constant below is the ABI-32 value extracted into
10
10
  * `packages/vdb/vendor/stride-tables.json` (itself generated from the
11
11
  * vendored `PNanoVDB.h`). They are duplicated here as named literals rather than
12
12
  * read from that JSON at runtime on purpose: `@pmndrs/vdb/tools` is the pure-TS,
@@ -23,9 +23,10 @@
23
23
  export declare const MAGIC_GRID = 3549474594348753230n;
24
24
  /** File-header magic `NanoVDB2` (u64) for the segment `.nvdb` container. */
25
25
  export declare const MAGIC_FILE = 3621532188386681166n;
26
+ /** Written into every grid and file header: 32.11.0, as native NanoVDB v14 and the reference header (K7.5a, D37). */
26
27
  export declare const MAJOR_VERSION = 32;
27
- export declare const MINOR_VERSION = 9;
28
- export declare const PATCH_VERSION = 1;
28
+ export declare const MINOR_VERSION = 11;
29
+ export declare const PATCH_VERSION = 0;
29
30
  /** Packed `Version`: major<<21 | minor<<10 | patch. */
30
31
  export declare const VERSION_PACKED: number;
31
32
  export declare const GRID_TYPE_FLOAT = 1;
@@ -33,6 +34,8 @@ export declare const GRID_TYPE_FP4 = 13;
33
34
  export declare const GRID_TYPE_FP8 = 14;
34
35
  export declare const GRID_TYPE_FP16 = 15;
35
36
  export declare const GRID_TYPE_FPN = 16;
37
+ /** NanoVDB `GridType::Half`: raw IEEE binary16 values (NanoVDB 13.2, K7.H). */
38
+ export declare const GRID_TYPE_HALF = 9;
36
39
  export declare const GRID_TYPE_VEC3F = 6;
37
40
  export declare const GRID_CLASS_UNKNOWN = 0;
38
41
  export declare const GRID_CLASS_LEVEL_SET = 1;
@@ -136,7 +139,7 @@ export declare const FP_LEAF_HEADER_SIZE = 96;
136
139
  /** FpN leaf `mFlags` (high byte of bbox_dif_and_flags): logBitWidth in bits 5-7,
137
140
  * plus the has-bbox bit the native encoder always sets (0x02). Fp8 uses 0x02. */
138
141
  export declare const LEAF_FLAG_HAS_BBOX = 2;
139
- /** Per-grid-type node sizes, stat offsets and table geometry (ABI 32.9.1). */
142
+ /** Per-grid-type node sizes, stat offsets and table geometry (ABI 32; same in 32.9.1 and 32.11.0). */
140
143
  export interface GridTypeLayout {
141
144
  readonly gridType: number;
142
145
  readonly rootSize: number;
@@ -177,6 +180,16 @@ export declare const FP4_LAYOUT: GridTypeLayout;
177
180
  export declare const FP16_LAYOUT: GridTypeLayout;
178
181
  /** FpN: variable bit-width. `leafSize` is the 96-byte base (see codec). */
179
182
  export declare const FPN_LAYOUT: GridTypeLayout;
183
+ /**
184
+ * Half (K7.H, NanoVDB `GridType::Half`): every value is a raw IEEE binary16
185
+ * (2 bytes) at every level (leaf table, tiles, background); `mMinimum` /
186
+ * `mMaximum` are binary16 too and `mAverage` / `mStdDevi` stay f32
187
+ * (`FloatTraits<Half>` is float). Table slots stay 8 bytes (the value in the
188
+ * low 2 bytes of the union with the i64 child offset); the leaf table is at 96
189
+ * (512 x 2 bytes, leaf 1120). Values from `PNANOVDB_GRID_TYPE_HALF` in the
190
+ * vendored stride tables (unchanged in NanoVDB v14.0.0's PNanoVDB.h).
191
+ */
192
+ export declare const HALF_LAYOUT: GridTypeLayout;
180
193
  /**
181
194
  * Vec3f (K4.2): every value is 3 f32 (12 bytes); `mMinimum`/`mMaximum` are
182
195
  * Vec3f and `mAverage`/`mStdDevi` stay f32 (`FloatTraits<Vec3f>` is float).
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * ## Provenance of the numbers
8
8
  *
9
- * Every constant below is the ABI-32.9.1 value extracted into
9
+ * Every constant below is the ABI-32 value extracted into
10
10
  * `packages/vdb/vendor/stride-tables.json` (itself generated from the
11
11
  * vendored `PNanoVDB.h`). They are duplicated here as named literals rather than
12
12
  * read from that JSON at runtime on purpose: `@pmndrs/vdb/tools` is the pure-TS,
@@ -26,9 +26,10 @@
26
26
  export const MAGIC_GRID = 0x314244566f6e614en; // "NanoVDB1"
27
27
  /** File-header magic `NanoVDB2` (u64) for the segment `.nvdb` container. */
28
28
  export const MAGIC_FILE = 0x324244566f6e614en; // "NanoVDB2"
29
+ /** Written into every grid and file header: 32.11.0, as native NanoVDB v14 and the reference header (K7.5a, D37). */
29
30
  export const MAJOR_VERSION = 32;
30
- export const MINOR_VERSION = 9;
31
- export const PATCH_VERSION = 1;
31
+ export const MINOR_VERSION = 11;
32
+ export const PATCH_VERSION = 0;
32
33
  /** Packed `Version`: major<<21 | minor<<10 | patch. */
33
34
  export const VERSION_PACKED = (MAJOR_VERSION << 21) | (MINOR_VERSION << 10) | PATCH_VERSION;
34
35
  export const GRID_TYPE_FLOAT = 1;
@@ -36,6 +37,8 @@ export const GRID_TYPE_FP4 = 13;
36
37
  export const GRID_TYPE_FP8 = 14;
37
38
  export const GRID_TYPE_FP16 = 15;
38
39
  export const GRID_TYPE_FPN = 16;
40
+ /** NanoVDB `GridType::Half`: raw IEEE binary16 values (NanoVDB 13.2, K7.H). */
41
+ export const GRID_TYPE_HALF = 9;
39
42
  export const GRID_TYPE_VEC3F = 6;
40
43
  export const GRID_CLASS_UNKNOWN = 0;
41
44
  export const GRID_CLASS_LEVEL_SET = 1;
@@ -223,6 +226,46 @@ export const FP4_LAYOUT = quantizedLayout(GRID_TYPE_FP4, 352);
223
226
  export const FP16_LAYOUT = quantizedLayout(GRID_TYPE_FP16, 1120);
224
227
  /** FpN: variable bit-width. `leafSize` is the 96-byte base (see codec). */
225
228
  export const FPN_LAYOUT = quantizedLayout(GRID_TYPE_FPN, FP_LEAF_HEADER_SIZE);
229
+ /**
230
+ * Half (K7.H, NanoVDB `GridType::Half`): every value is a raw IEEE binary16
231
+ * (2 bytes) at every level (leaf table, tiles, background); `mMinimum` /
232
+ * `mMaximum` are binary16 too and `mAverage` / `mStdDevi` stay f32
233
+ * (`FloatTraits<Half>` is float). Table slots stay 8 bytes (the value in the
234
+ * low 2 bytes of the union with the i64 child offset); the leaf table is at 96
235
+ * (512 x 2 bytes, leaf 1120). Values from `PNANOVDB_GRID_TYPE_HALF` in the
236
+ * vendored stride tables (unchanged in NanoVDB v14.0.0's PNanoVDB.h).
237
+ */
238
+ export const HALF_LAYOUT = {
239
+ gridType: GRID_TYPE_HALF,
240
+ rootSize: 64,
241
+ rootTileSize: 32,
242
+ rootTileOffValue: 20,
243
+ rootOffBackground: 28,
244
+ rootOffMin: 30,
245
+ rootOffMax: 32,
246
+ rootOffAve: 36,
247
+ rootOffStdDev: 40,
248
+ tableStride: 8,
249
+ valueStrideBits: 16,
250
+ upperSize: 270400,
251
+ upperOffTable: 8256,
252
+ upperOffMin: 8224,
253
+ upperOffMax: 8226,
254
+ upperOffAve: 8228,
255
+ upperOffStdDev: 8232,
256
+ lowerSize: 33856,
257
+ lowerOffTable: 1088,
258
+ lowerOffMin: 1056,
259
+ lowerOffMax: 1058,
260
+ lowerOffAve: 1060,
261
+ lowerOffStdDev: 1064,
262
+ leafSize: 1120,
263
+ leafOffTable: 96,
264
+ leafOffMin: 80,
265
+ leafOffMax: 82,
266
+ leafOffAve: 84,
267
+ leafOffStdDev: 88,
268
+ };
226
269
  /**
227
270
  * Vec3f (K4.2): every value is 3 f32 (12 bytes); `mMinimum`/`mMaximum` are
228
271
  * Vec3f and `mAverage`/`mStdDevi` stay f32 (`FloatTraits<Vec3f>` is float).
@@ -1 +1 @@
1
- {"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src/tools/nanovdb/bytes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,8EAA8E;AAC9E,yDAAyD;AACzD,8EAA8E;AAE9E;kEACkE;AAClE,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAC,CAAC,aAAa;AAC5D,4EAA4E;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAC,CAAC,aAAa;AAE5D,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAC/B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAC/B,uDAAuD;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,GAAG,aAAa,CAAC;AAE5F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,qBAA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,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,kFAAkF;IAClF,UAAU,CAAC,QAAgB,EAAE,QAAgB;QAC3C,MAAM,OAAO,GAAG,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CACjB,OAAO,EACP,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EACnE,IAAI,CACL,CAAC;IACJ,CAAC;IAED,2EAA2E;IAC3E,YAAY,CAAC,QAAgB,EAAE,KAAkB;QAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF","sourcesContent":["/**\n * bytes.ts — the single home for every NanoVDB struct offset/size constant and\n * the low-level little-endian writer used by the serializer. No other module in\n * `nanovdb/` writes a raw byte offset: they go through the named constants and\n * the {@link GridImageWriter} helpers here.\n *\n * ## Provenance of the numbers\n *\n * Every constant below is the ABI-32.9.1 value extracted into\n * `packages/vdb/vendor/stride-tables.json` (itself generated from the\n * vendored `PNanoVDB.h`). They are duplicated here as named literals rather than\n * read from that JSON at runtime on purpose: `@pmndrs/vdb/tools` is the pure-TS,\n * browser-first CPU half (decision D3) and must not pull in `node:fs`. To keep\n * the two provably in lockstep, `test/bytes-constants.test.ts` reads\n * stride-tables.json and asserts each constant here equals the extracted value.\n *\n * Only the FLOAT grid type is wired up in this wave; the per-grid-type layout\n * (`FLOAT` block below) is isolated so Fp8/FpN can be added as sibling blocks in\n * the quantization wave without touching the common offsets.\n */\n\n// ---------------------------------------------------------------------------\n// Magic numbers, versioning, enums (PNANOVDB_* #defines)\n// ---------------------------------------------------------------------------\n\n/** Grid-image magic `NanoVDB1` (u64, little-endian). This is what the raw grid\n * buffer starts with — what `readValue`/`NvdbFile` sniff for. */\nexport const MAGIC_GRID = 0x314244566f6e614en; // \"NanoVDB1\"\n/** File-header magic `NanoVDB2` (u64) for the segment `.nvdb` container. */\nexport const MAGIC_FILE = 0x324244566f6e614en; // \"NanoVDB2\"\n\nexport const MAJOR_VERSION = 32;\nexport const MINOR_VERSION = 9;\nexport const PATCH_VERSION = 1;\n/** Packed `Version`: major<<21 | minor<<10 | patch. */\nexport const VERSION_PACKED = (MAJOR_VERSION << 21) | (MINOR_VERSION << 10) | PATCH_VERSION;\n\nexport const GRID_TYPE_FLOAT = 1;\nexport const GRID_TYPE_FP4 = 13;\nexport const GRID_TYPE_FP8 = 14;\nexport const GRID_TYPE_FP16 = 15;\nexport const GRID_TYPE_FPN = 16;\nexport const GRID_TYPE_VEC3F = 6;\nexport const GRID_CLASS_UNKNOWN = 0;\nexport const GRID_CLASS_LEVEL_SET = 1;\nexport const GRID_CLASS_FOG_VOLUME = 2;\nexport const GRID_CLASS_STAGGERED = 3;\n\n/**\n * GridData.mFlags for a grid that carries a bbox and full min/max/ave/stddev\n * statistics and is laid out breadth-first — the exact value native\n * `nanovdb_convert` writes for a stats-bearing float FogVolume (verified:\n * `sphere_fog_float.nvdb` carries 0x3e). Bit0 (HasLongGridName) stays clear\n * because we reject names longer than the inline 256-byte field.\n * bit1 HasBBox | bit2 HasMinMax | bit3 HasAverage | bit4 HasStdDeviation |\n * bit5 IsBreadthFirst\n */\nexport const GRID_FLAGS_STATS_BBOX_BREADTH_FIRST = 0x3e;\n\n/**\n * Internal-node (`mFlags`, u64) and leaf (`bbox_dif_and_flags` high byte) flag\n * value written by native `nanovdb_convert` on every stats-bearing node\n * (verified: uppers, lowers and leaves in `sphere_fog_float.nvdb` all carry 2).\n * Neither the CPU (`read-value.ts`) nor WGSL FLOAT readers consult it; we mirror\n * it for structural fidelity with native output.\n */\nexport const NODE_FLAG_STATS = 2;\n\n// ---------------------------------------------------------------------------\n// GridData (672 bytes)\n// ---------------------------------------------------------------------------\n\nexport const GRID_SIZE = 672;\nexport const GRID_OFF_MAGIC = 0;\nexport const GRID_OFF_CHECKSUM = 8;\nexport const GRID_OFF_VERSION = 16;\nexport const GRID_OFF_FLAGS = 20;\nexport const GRID_OFF_GRID_INDEX = 24;\nexport const GRID_OFF_GRID_COUNT = 28;\nexport const GRID_OFF_GRID_SIZE = 32;\nexport const GRID_OFF_GRID_NAME = 40;\nexport const GRID_NAME_MAX = 256; // GridData::MaxNameSize\nexport const GRID_OFF_MAP = 296;\nexport const GRID_OFF_WORLD_BBOX = 560;\nexport const GRID_OFF_VOXEL_SIZE = 608;\nexport const GRID_OFF_GRID_CLASS = 632;\nexport const GRID_OFF_GRID_TYPE = 636;\nexport const GRID_OFF_BLIND_METADATA_OFFSET = 640;\nexport const GRID_OFF_BLIND_METADATA_COUNT = 648;\nexport const GRID_OFF_DATA0 = 652;\nexport const GRID_OFF_DATA1 = 656;\nexport const GRID_OFF_DATA2 = 664;\n\n/**\n * GridData.mChecksum sentinel meaning \"no checksum\" (NanoVDB `ChecksumMode`\n * Disable == ~uint64_t(0)). We write this rather than a real CRC: neither the\n * CPU reader, the WGSL reader, nor `NvdbFile.fromArrayBuffer` validates the\n * checksum (verified by reading their source — only magic, version and\n * mGridSize are cross-checked), so a disabled checksum round-trips cleanly.\n * Computing the native CRC48/Full checksum is deferred to the nanovdb_convert\n * byte-parity item (see build-from-dense.ts module doc).\n */\nexport const CHECKSUM_DISABLED = 0xffffffffffffffffn;\n\n// Map (affine transform), offsets relative to GRID_OFF_MAP.\nexport const MAP_OFF_MATF = 0; // float[9] row-major 3x3\nexport const MAP_OFF_INVMATF = 36; // float[9]\nexport const MAP_OFF_VECF = 72; // float[3] translation\nexport const MAP_OFF_TAPERF = 84; // float\nexport const MAP_OFF_MATD = 88; // double[9]\nexport const MAP_OFF_INVMATD = 160; // double[9]\nexport const MAP_OFF_VECD = 232; // double[3]\nexport const MAP_OFF_TAPERD = 256; // double\nexport const MAP_SIZE = 264;\n\n// ---------------------------------------------------------------------------\n// TreeData (64 bytes)\n// ---------------------------------------------------------------------------\n\nexport const TREE_SIZE = 64;\nexport const TREE_OFF_NODE_OFFSET_LEAF = 0; // u64, bytes from TreeData to first leaf\nexport const TREE_OFF_NODE_OFFSET_LOWER = 8; // u64\nexport const TREE_OFF_NODE_OFFSET_UPPER = 16; // u64\nexport const TREE_OFF_NODE_OFFSET_ROOT = 24; // u64\nexport const TREE_OFF_NODE_COUNT_LEAF = 32; // u32\nexport const TREE_OFF_NODE_COUNT_LOWER = 36; // u32\nexport const TREE_OFF_NODE_COUNT_UPPER = 40; // u32\nexport const TREE_OFF_TILE_COUNT_LOWER = 44; // u32 (active tiles)\nexport const TREE_OFF_TILE_COUNT_UPPER = 48; // u32\nexport const TREE_OFF_TILE_COUNT_ROOT = 52; // u32\nexport const TREE_OFF_VOXEL_COUNT = 56; // u64 (active voxels)\n\n// ---------------------------------------------------------------------------\n// RootData + RootTile\n// ---------------------------------------------------------------------------\n\nexport const ROOT_OFF_BBOX_MIN = 0; // i32[3]\nexport const ROOT_OFF_BBOX_MAX = 12; // i32[3]\nexport const ROOT_OFF_TABLE_SIZE = 24; // u32 (tile count)\n\nexport const ROOT_TILE_OFF_KEY = 0; // u64\nexport const ROOT_TILE_OFF_CHILD = 8; // i64 (bytes from RootData to child upper node)\nexport const ROOT_TILE_OFF_STATE = 16; // u32\n\n// ---------------------------------------------------------------------------\n// Internal node common offsets (same for upper and lower; masks differ in size)\n// ---------------------------------------------------------------------------\n\nexport const NODE_OFF_BBOX_MIN = 0; // i32[3]\nexport const NODE_OFF_BBOX_MAX = 12; // i32[3]\nexport const NODE_OFF_FLAGS = 24; // u64\nexport const NODE_OFF_VALUE_MASK = 32; // bit array\n\nexport const UPPER_OFF_CHILD_MASK = 4128; // after 32768-bit value mask\nexport const UPPER_TABLE_COUNT = 32768; // 32^3\nexport const LOWER_OFF_CHILD_MASK = 544; // after 4096-bit value mask\nexport const LOWER_TABLE_COUNT = 4096; // 16^3\n\n// ---------------------------------------------------------------------------\n// Leaf common offsets\n// ---------------------------------------------------------------------------\n\nexport const LEAF_OFF_BBOX_MIN = 0; // i32[3]\nexport const LEAF_OFF_BBOX_DIF_AND_FLAGS = 12; // u32: [difX,difY,difZ,flags] bytes\nexport const LEAF_OFF_VALUE_MASK = 16; // 512-bit array (64 bytes)\nexport const LEAF_TABLE_COUNT = 512; // 8^3\n\n// ---------------------------------------------------------------------------\n// Quantized-leaf (Fp8/FpN) header layout — `LeafFnBase` (NanoVDB.h). The 96-byte\n// header is common to Fp4/Fp8/Fp16/FpN; the compressed code array follows at 96.\n// Unlike FLOAT (which stores f32 stats), quantized leaves store the affine\n// (mMinimum, mQuantum) pair as f32 and the min/max/ave/dev *statistics* as\n// uint16 codes quantized against that same (min, quantum). Verified against the\n// native box/sphere fp8+fpn fixtures.\n// ---------------------------------------------------------------------------\n\nexport const LEAF_OFF_FP_MINIMUM = 80; // f32 mMinimum (== value at code 0)\nexport const LEAF_OFF_FP_QUANTUM = 84; // f32 mQuantum (== (max-min)/((1<<bits)-1))\nexport const LEAF_OFF_FP_STAT_MIN = 88; // u16 quantized min of active values\nexport const LEAF_OFF_FP_STAT_MAX = 90; // u16\nexport const LEAF_OFF_FP_STAT_AVG = 92; // u16\nexport const LEAF_OFF_FP_STAT_DEV = 94; // u16\nexport const LEAF_OFF_FP_CODES = 96; // start of the packed code array\nexport const FP_LEAF_HEADER_SIZE = 96;\n\n/** FpN leaf `mFlags` (high byte of bbox_dif_and_flags): logBitWidth in bits 5-7,\n * plus the has-bbox bit the native encoder always sets (0x02). Fp8 uses 0x02. */\nexport const LEAF_FLAG_HAS_BBOX = 2;\n\n// ---------------------------------------------------------------------------\n// Per-grid-type layout (FLOAT). Fp8/FpN add sibling blocks in the next wave.\n// ---------------------------------------------------------------------------\n\n/** Per-grid-type node sizes, stat offsets and table geometry (ABI 32.9.1). */\nexport interface GridTypeLayout {\n readonly gridType: number;\n readonly rootSize: number;\n readonly rootTileSize: number;\n readonly rootTileOffValue: number;\n readonly rootOffBackground: number;\n readonly rootOffMin: number;\n readonly rootOffMax: number;\n readonly rootOffAve: number;\n readonly rootOffStdDev: number;\n readonly tableStride: number; // bytes per internal-node table slot\n readonly valueStrideBits: number; // bits per leaf value\n readonly upperSize: number;\n readonly upperOffTable: number;\n readonly upperOffMin: number;\n readonly upperOffMax: number;\n readonly upperOffAve: number;\n readonly upperOffStdDev: number;\n readonly lowerSize: number;\n readonly lowerOffTable: number;\n readonly lowerOffMin: number;\n readonly lowerOffMax: number;\n readonly lowerOffAve: number;\n readonly lowerOffStdDev: number;\n readonly leafSize: number;\n readonly leafOffTable: number;\n readonly leafOffMin: number;\n readonly leafOffMax: number;\n readonly leafOffAve: number;\n readonly leafOffStdDev: number;\n}\n\nexport const FLOAT_LAYOUT: GridTypeLayout = {\n gridType: GRID_TYPE_FLOAT,\n rootSize: 64,\n rootTileSize: 32,\n rootTileOffValue: 20,\n rootOffBackground: 28,\n rootOffMin: 32,\n rootOffMax: 36,\n rootOffAve: 40,\n rootOffStdDev: 44,\n tableStride: 8,\n valueStrideBits: 32,\n upperSize: 270400,\n upperOffTable: 8256,\n upperOffMin: 8224,\n upperOffMax: 8228,\n upperOffAve: 8232,\n upperOffStdDev: 8236,\n lowerSize: 33856,\n lowerOffTable: 1088,\n lowerOffMin: 1056,\n lowerOffMax: 1060,\n lowerOffAve: 1064,\n lowerOffStdDev: 1068,\n leafSize: 2144,\n leafOffTable: 96,\n leafOffMin: 80,\n leafOffMax: 84,\n leafOffAve: 88,\n leafOffStdDev: 92,\n};\n\n/**\n * Quantized (Fp8/FpN) grid layout. Root/upper/lower blocks are byte-for-byte\n * identical to FLOAT (their tiles/stats stay f32); only the leaf differs. For\n * Fp8 `leafSize` is a fixed 608 (96 header + 512 one-byte codes). For FpN the\n * leaf is variable-sized (96 + bitWidth*64), so `leafSize` here is the 96-byte\n * base — the real per-leaf size comes from the codec. The `leafOff*` stat\n * offsets are the u16 statistic slots (the codec writes them directly).\n */\nfunction quantizedLayout(gridType: number, leafSize: number): GridTypeLayout {\n return {\n ...FLOAT_LAYOUT,\n gridType,\n valueStrideBits: 0, // not a uniform stride for quantized leaves\n leafSize,\n leafOffTable: LEAF_OFF_FP_CODES,\n leafOffMin: LEAF_OFF_FP_STAT_MIN,\n leafOffMax: LEAF_OFF_FP_STAT_MAX,\n leafOffAve: LEAF_OFF_FP_STAT_AVG,\n leafOffStdDev: LEAF_OFF_FP_STAT_DEV,\n };\n}\n\n/** Fp8: fixed 8-bit codes. Leaf = 96-byte header + 512 bytes = 608. */\nexport const FP8_LAYOUT: GridTypeLayout = quantizedLayout(GRID_TYPE_FP8, 608);\n/** Fp4: fixed 4-bit codes. Leaf = 96-byte header + 256 bytes = 352. */\nexport const FP4_LAYOUT: GridTypeLayout = quantizedLayout(GRID_TYPE_FP4, 352);\n/** Fp16: fixed 16-bit codes. Leaf = 96-byte header + 1024 bytes = 1120. */\nexport const FP16_LAYOUT: GridTypeLayout = quantizedLayout(GRID_TYPE_FP16, 1120);\n/** FpN: variable bit-width. `leafSize` is the 96-byte base (see codec). */\nexport const FPN_LAYOUT: GridTypeLayout = quantizedLayout(GRID_TYPE_FPN, FP_LEAF_HEADER_SIZE);\n\n/**\n * Vec3f (K4.2): every value is 3 f32 (12 bytes); `mMinimum`/`mMaximum` are\n * Vec3f and `mAverage`/`mStdDevi` stay f32 (`FloatTraits<Vec3f>` is float).\n * Internal-node table slots are 16 bytes (the union of a 12-byte value and an\n * i64 child offset); the leaf table is 32-byte aligned at 128. Values from\n * `PNANOVDB_GRID_TYPE_VEC3F` in the vendored stride tables.\n */\nexport const VEC3F_LAYOUT: GridTypeLayout = {\n gridType: GRID_TYPE_VEC3F,\n rootSize: 96,\n rootTileSize: 32,\n rootTileOffValue: 20,\n rootOffBackground: 28,\n rootOffMin: 40,\n rootOffMax: 52,\n rootOffAve: 64,\n rootOffStdDev: 68,\n tableStride: 16,\n valueStrideBits: 96,\n upperSize: 532544,\n upperOffTable: 8256,\n upperOffMin: 8224,\n upperOffMax: 8236,\n upperOffAve: 8248,\n upperOffStdDev: 8252,\n lowerSize: 66624,\n lowerOffTable: 1088,\n lowerOffMin: 1056,\n lowerOffMax: 1068,\n lowerOffAve: 1080,\n lowerOffStdDev: 1084,\n leafSize: 6272,\n leafOffTable: 128,\n leafOffMin: 80,\n leafOffMax: 92,\n leafOffAve: 104,\n leafOffStdDev: 108,\n};\n\n// ---------------------------------------------------------------------------\n// coord -> key / coord -> offset (structural bit math, identical for all types)\n// ---------------------------------------------------------------------------\n\n/** pnanovdb_coord_to_key — root-tile key for a voxel coord (native-64 branch). */\nexport function coordToKey(x: number, y: number, z: number): bigint {\n const iu = BigInt(x >>> 12);\n const ju = BigInt(y >>> 12);\n const ku = BigInt(z >>> 12);\n return ku | (ju << 21n) | (iu << 42n);\n}\n\n/** pnanovdb_upper_coord_to_offset — lower-table slot within a 32^3 upper. */\nexport function upperCoordToOffset(x: number, y: number, z: number): number {\n return (((x & 4095) >> 7) << 10) + (((y & 4095) >> 7) << 5) + ((z & 4095) >> 7);\n}\n\n/** pnanovdb_lower_coord_to_offset — leaf-table slot within a 16^3 lower. */\nexport function lowerCoordToOffset(x: number, y: number, z: number): number {\n return (((x & 127) >> 3) << 8) + (((y & 127) >> 3) << 4) + ((z & 127) >> 3);\n}\n\n/** pnanovdb_leaf_coord_to_offset — voxel slot within an 8^3 leaf, 0..511. */\nexport function leafCoordToOffset(x: number, y: number, z: number): number {\n return ((x & 7) << 6) + ((y & 7) << 3) + (z & 7);\n}\n\n// ---------------------------------------------------------------------------\n// GridImageWriter — typed little-endian struct writer over one grid image.\n// ---------------------------------------------------------------------------\n\n/**\n * A thin, endianness-explicit writer over a single grid image's backing\n * `ArrayBuffer`. All NanoVDB integers/floats are little-endian; every setter\n * here passes `true` so the code never repeats the flag. Mask helpers implement\n * `pnanovdb_*_mask` bit addressing (32-bit words, LSB-first within a word).\n */\nexport class GridImageWriter {\n readonly bytes: Uint8Array;\n readonly u32: Uint32Array;\n private readonly view: DataView;\n\n constructor(byteLength: number) {\n if (byteLength % 4 !== 0) {\n throw new Error(`GridImageWriter: byteLength ${byteLength} must be a multiple of 4`);\n }\n const buffer = new ArrayBuffer(byteLength);\n this.bytes = new Uint8Array(buffer);\n this.u32 = new Uint32Array(buffer);\n this.view = new DataView(buffer);\n }\n\n setU16(off: number, v: number): void {\n this.view.setUint16(off, v & 0xffff, true);\n }\n setU32(off: number, v: number): void {\n this.view.setUint32(off, v >>> 0, true);\n }\n setI32(off: number, v: number): void {\n this.view.setInt32(off, v | 0, true);\n }\n setU64(off: number, v: bigint): void {\n this.view.setBigUint64(off, v, true);\n }\n setI64(off: number, v: bigint): void {\n this.view.setBigInt64(off, v, true);\n }\n setF32(off: number, v: number): void {\n this.view.setFloat32(off, v, true);\n }\n setF64(off: number, v: number): void {\n this.view.setFloat64(off, v, true);\n }\n\n /** Writes `len` bytes of `src` at `off`, zero-filling nothing beyond it. */\n setBytes(off: number, src: Uint8Array): void {\n this.bytes.set(src, off);\n }\n\n /** Sets bit `bitIndex` of a mask word array whose word 0 starts at `maskBase`. */\n setMaskBit(maskBase: number, bitIndex: number): void {\n const wordOff = maskBase + 4 * (bitIndex >>> 5);\n this.view.setUint32(\n wordOff,\n (this.view.getUint32(wordOff, true) | (1 << (bitIndex & 31))) >>> 0,\n true,\n );\n }\n\n /** Copies a whole precomputed 32-bit mask (`words` u32s) to `maskBase`. */\n setMaskWords(maskBase: number, words: Uint32Array): void {\n for (let i = 0; i < words.length; i++) {\n this.view.setUint32(maskBase + i * 4, words[i]! >>> 0, true);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src/tools/nanovdb/bytes.ts"],"names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AAC,EAAE,IAAI,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF","sourcesContent":["/**\n * bytes.ts — the single home for every NanoVDB struct offset/size constant and\n * the low-level little-endian writer used by the serializer. No other module in\n * `nanovdb/` writes a raw byte offset: they go through the named constants and\n * the {@link GridImageWriter} helpers here.\n *\n * ## Provenance of the numbers\n *\n * Every constant below is the ABI-32 value extracted into\n * `packages/vdb/vendor/stride-tables.json` (itself generated from the\n * vendored `PNanoVDB.h`). They are duplicated here as named literals rather than\n * read from that JSON at runtime on purpose: `@pmndrs/vdb/tools` is the pure-TS,\n * browser-first CPU half (decision D3) and must not pull in `node:fs`. To keep\n * the two provably in lockstep, `test/bytes-constants.test.ts` reads\n * stride-tables.json and asserts each constant here equals the extracted value.\n *\n * Only the FLOAT grid type is wired up in this wave; the per-grid-type layout\n * (`FLOAT` block below) is isolated so Fp8/FpN can be added as sibling blocks in\n * the quantization wave without touching the common offsets.\n */\n\n// ---------------------------------------------------------------------------\n// Magic numbers, versioning, enums (PNANOVDB_* #defines)\n// ---------------------------------------------------------------------------\n\n/** Grid-image magic `NanoVDB1` (u64, little-endian). This is what the raw grid\n * buffer starts with — what `readValue`/`NvdbFile` sniff for. */\nexport const MAGIC_GRID = 0x314244566f6e614en; // \"NanoVDB1\"\n/** File-header magic `NanoVDB2` (u64) for the segment `.nvdb` container. */\nexport const MAGIC_FILE = 0x324244566f6e614en; // \"NanoVDB2\"\n\n/** Written into every grid and file header: 32.11.0, as native NanoVDB v14 and the reference header (K7.5a, D37). */\nexport const MAJOR_VERSION = 32;\nexport const MINOR_VERSION = 11;\nexport const PATCH_VERSION = 0;\n/** Packed `Version`: major<<21 | minor<<10 | patch. */\nexport const VERSION_PACKED = (MAJOR_VERSION << 21) | (MINOR_VERSION << 10) | PATCH_VERSION;\n\nexport const GRID_TYPE_FLOAT = 1;\nexport const GRID_TYPE_FP4 = 13;\nexport const GRID_TYPE_FP8 = 14;\nexport const GRID_TYPE_FP16 = 15;\nexport const GRID_TYPE_FPN = 16;\n/** NanoVDB `GridType::Half`: raw IEEE binary16 values (NanoVDB 13.2, K7.H). */\nexport const GRID_TYPE_HALF = 9;\nexport const GRID_TYPE_VEC3F = 6;\nexport const GRID_CLASS_UNKNOWN = 0;\nexport const GRID_CLASS_LEVEL_SET = 1;\nexport const GRID_CLASS_FOG_VOLUME = 2;\nexport const GRID_CLASS_STAGGERED = 3;\n\n/**\n * GridData.mFlags for a grid that carries a bbox and full min/max/ave/stddev\n * statistics and is laid out breadth-first — the exact value native\n * `nanovdb_convert` writes for a stats-bearing float FogVolume (verified:\n * `sphere_fog_float.nvdb` carries 0x3e). Bit0 (HasLongGridName) stays clear\n * because we reject names longer than the inline 256-byte field.\n * bit1 HasBBox | bit2 HasMinMax | bit3 HasAverage | bit4 HasStdDeviation |\n * bit5 IsBreadthFirst\n */\nexport const GRID_FLAGS_STATS_BBOX_BREADTH_FIRST = 0x3e;\n\n/**\n * Internal-node (`mFlags`, u64) and leaf (`bbox_dif_and_flags` high byte) flag\n * value written by native `nanovdb_convert` on every stats-bearing node\n * (verified: uppers, lowers and leaves in `sphere_fog_float.nvdb` all carry 2).\n * Neither the CPU (`read-value.ts`) nor WGSL FLOAT readers consult it; we mirror\n * it for structural fidelity with native output.\n */\nexport const NODE_FLAG_STATS = 2;\n\n// ---------------------------------------------------------------------------\n// GridData (672 bytes)\n// ---------------------------------------------------------------------------\n\nexport const GRID_SIZE = 672;\nexport const GRID_OFF_MAGIC = 0;\nexport const GRID_OFF_CHECKSUM = 8;\nexport const GRID_OFF_VERSION = 16;\nexport const GRID_OFF_FLAGS = 20;\nexport const GRID_OFF_GRID_INDEX = 24;\nexport const GRID_OFF_GRID_COUNT = 28;\nexport const GRID_OFF_GRID_SIZE = 32;\nexport const GRID_OFF_GRID_NAME = 40;\nexport const GRID_NAME_MAX = 256; // GridData::MaxNameSize\nexport const GRID_OFF_MAP = 296;\nexport const GRID_OFF_WORLD_BBOX = 560;\nexport const GRID_OFF_VOXEL_SIZE = 608;\nexport const GRID_OFF_GRID_CLASS = 632;\nexport const GRID_OFF_GRID_TYPE = 636;\nexport const GRID_OFF_BLIND_METADATA_OFFSET = 640;\nexport const GRID_OFF_BLIND_METADATA_COUNT = 648;\nexport const GRID_OFF_DATA0 = 652;\nexport const GRID_OFF_DATA1 = 656;\nexport const GRID_OFF_DATA2 = 664;\n\n/**\n * GridData.mChecksum sentinel meaning \"no checksum\" (NanoVDB `ChecksumMode`\n * Disable == ~uint64_t(0)). We write this rather than a real CRC: neither the\n * CPU reader, the WGSL reader, nor `NvdbFile.fromArrayBuffer` validates the\n * checksum (verified by reading their source — only magic, version and\n * mGridSize are cross-checked), so a disabled checksum round-trips cleanly.\n * Computing the native CRC48/Full checksum is deferred to the nanovdb_convert\n * byte-parity item (see build-from-dense.ts module doc).\n */\nexport const CHECKSUM_DISABLED = 0xffffffffffffffffn;\n\n// Map (affine transform), offsets relative to GRID_OFF_MAP.\nexport const MAP_OFF_MATF = 0; // float[9] row-major 3x3\nexport const MAP_OFF_INVMATF = 36; // float[9]\nexport const MAP_OFF_VECF = 72; // float[3] translation\nexport const MAP_OFF_TAPERF = 84; // float\nexport const MAP_OFF_MATD = 88; // double[9]\nexport const MAP_OFF_INVMATD = 160; // double[9]\nexport const MAP_OFF_VECD = 232; // double[3]\nexport const MAP_OFF_TAPERD = 256; // double\nexport const MAP_SIZE = 264;\n\n// ---------------------------------------------------------------------------\n// TreeData (64 bytes)\n// ---------------------------------------------------------------------------\n\nexport const TREE_SIZE = 64;\nexport const TREE_OFF_NODE_OFFSET_LEAF = 0; // u64, bytes from TreeData to first leaf\nexport const TREE_OFF_NODE_OFFSET_LOWER = 8; // u64\nexport const TREE_OFF_NODE_OFFSET_UPPER = 16; // u64\nexport const TREE_OFF_NODE_OFFSET_ROOT = 24; // u64\nexport const TREE_OFF_NODE_COUNT_LEAF = 32; // u32\nexport const TREE_OFF_NODE_COUNT_LOWER = 36; // u32\nexport const TREE_OFF_NODE_COUNT_UPPER = 40; // u32\nexport const TREE_OFF_TILE_COUNT_LOWER = 44; // u32 (active tiles)\nexport const TREE_OFF_TILE_COUNT_UPPER = 48; // u32\nexport const TREE_OFF_TILE_COUNT_ROOT = 52; // u32\nexport const TREE_OFF_VOXEL_COUNT = 56; // u64 (active voxels)\n\n// ---------------------------------------------------------------------------\n// RootData + RootTile\n// ---------------------------------------------------------------------------\n\nexport const ROOT_OFF_BBOX_MIN = 0; // i32[3]\nexport const ROOT_OFF_BBOX_MAX = 12; // i32[3]\nexport const ROOT_OFF_TABLE_SIZE = 24; // u32 (tile count)\n\nexport const ROOT_TILE_OFF_KEY = 0; // u64\nexport const ROOT_TILE_OFF_CHILD = 8; // i64 (bytes from RootData to child upper node)\nexport const ROOT_TILE_OFF_STATE = 16; // u32\n\n// ---------------------------------------------------------------------------\n// Internal node common offsets (same for upper and lower; masks differ in size)\n// ---------------------------------------------------------------------------\n\nexport const NODE_OFF_BBOX_MIN = 0; // i32[3]\nexport const NODE_OFF_BBOX_MAX = 12; // i32[3]\nexport const NODE_OFF_FLAGS = 24; // u64\nexport const NODE_OFF_VALUE_MASK = 32; // bit array\n\nexport const UPPER_OFF_CHILD_MASK = 4128; // after 32768-bit value mask\nexport const UPPER_TABLE_COUNT = 32768; // 32^3\nexport const LOWER_OFF_CHILD_MASK = 544; // after 4096-bit value mask\nexport const LOWER_TABLE_COUNT = 4096; // 16^3\n\n// ---------------------------------------------------------------------------\n// Leaf common offsets\n// ---------------------------------------------------------------------------\n\nexport const LEAF_OFF_BBOX_MIN = 0; // i32[3]\nexport const LEAF_OFF_BBOX_DIF_AND_FLAGS = 12; // u32: [difX,difY,difZ,flags] bytes\nexport const LEAF_OFF_VALUE_MASK = 16; // 512-bit array (64 bytes)\nexport const LEAF_TABLE_COUNT = 512; // 8^3\n\n// ---------------------------------------------------------------------------\n// Quantized-leaf (Fp8/FpN) header layout — `LeafFnBase` (NanoVDB.h). The 96-byte\n// header is common to Fp4/Fp8/Fp16/FpN; the compressed code array follows at 96.\n// Unlike FLOAT (which stores f32 stats), quantized leaves store the affine\n// (mMinimum, mQuantum) pair as f32 and the min/max/ave/dev *statistics* as\n// uint16 codes quantized against that same (min, quantum). Verified against the\n// native box/sphere fp8+fpn fixtures.\n// ---------------------------------------------------------------------------\n\nexport const LEAF_OFF_FP_MINIMUM = 80; // f32 mMinimum (== value at code 0)\nexport const LEAF_OFF_FP_QUANTUM = 84; // f32 mQuantum (== (max-min)/((1<<bits)-1))\nexport const LEAF_OFF_FP_STAT_MIN = 88; // u16 quantized min of active values\nexport const LEAF_OFF_FP_STAT_MAX = 90; // u16\nexport const LEAF_OFF_FP_STAT_AVG = 92; // u16\nexport const LEAF_OFF_FP_STAT_DEV = 94; // u16\nexport const LEAF_OFF_FP_CODES = 96; // start of the packed code array\nexport const FP_LEAF_HEADER_SIZE = 96;\n\n/** FpN leaf `mFlags` (high byte of bbox_dif_and_flags): logBitWidth in bits 5-7,\n * plus the has-bbox bit the native encoder always sets (0x02). Fp8 uses 0x02. */\nexport const LEAF_FLAG_HAS_BBOX = 2;\n\n// ---------------------------------------------------------------------------\n// Per-grid-type layout (FLOAT). Fp8/FpN add sibling blocks in the next wave.\n// ---------------------------------------------------------------------------\n\n/** Per-grid-type node sizes, stat offsets and table geometry (ABI 32; same in 32.9.1 and 32.11.0). */\nexport interface GridTypeLayout {\n readonly gridType: number;\n readonly rootSize: number;\n readonly rootTileSize: number;\n readonly rootTileOffValue: number;\n readonly rootOffBackground: number;\n readonly rootOffMin: number;\n readonly rootOffMax: number;\n readonly rootOffAve: number;\n readonly rootOffStdDev: number;\n readonly tableStride: number; // bytes per internal-node table slot\n readonly valueStrideBits: number; // bits per leaf value\n readonly upperSize: number;\n readonly upperOffTable: number;\n readonly upperOffMin: number;\n readonly upperOffMax: number;\n readonly upperOffAve: number;\n readonly upperOffStdDev: number;\n readonly lowerSize: number;\n readonly lowerOffTable: number;\n readonly lowerOffMin: number;\n readonly lowerOffMax: number;\n readonly lowerOffAve: number;\n readonly lowerOffStdDev: number;\n readonly leafSize: number;\n readonly leafOffTable: number;\n readonly leafOffMin: number;\n readonly leafOffMax: number;\n readonly leafOffAve: number;\n readonly leafOffStdDev: number;\n}\n\nexport const FLOAT_LAYOUT: GridTypeLayout = {\n gridType: GRID_TYPE_FLOAT,\n rootSize: 64,\n rootTileSize: 32,\n rootTileOffValue: 20,\n rootOffBackground: 28,\n rootOffMin: 32,\n rootOffMax: 36,\n rootOffAve: 40,\n rootOffStdDev: 44,\n tableStride: 8,\n valueStrideBits: 32,\n upperSize: 270400,\n upperOffTable: 8256,\n upperOffMin: 8224,\n upperOffMax: 8228,\n upperOffAve: 8232,\n upperOffStdDev: 8236,\n lowerSize: 33856,\n lowerOffTable: 1088,\n lowerOffMin: 1056,\n lowerOffMax: 1060,\n lowerOffAve: 1064,\n lowerOffStdDev: 1068,\n leafSize: 2144,\n leafOffTable: 96,\n leafOffMin: 80,\n leafOffMax: 84,\n leafOffAve: 88,\n leafOffStdDev: 92,\n};\n\n/**\n * Quantized (Fp8/FpN) grid layout. Root/upper/lower blocks are byte-for-byte\n * identical to FLOAT (their tiles/stats stay f32); only the leaf differs. For\n * Fp8 `leafSize` is a fixed 608 (96 header + 512 one-byte codes). For FpN the\n * leaf is variable-sized (96 + bitWidth*64), so `leafSize` here is the 96-byte\n * base — the real per-leaf size comes from the codec. The `leafOff*` stat\n * offsets are the u16 statistic slots (the codec writes them directly).\n */\nfunction quantizedLayout(gridType: number, leafSize: number): GridTypeLayout {\n return {\n ...FLOAT_LAYOUT,\n gridType,\n valueStrideBits: 0, // not a uniform stride for quantized leaves\n leafSize,\n leafOffTable: LEAF_OFF_FP_CODES,\n leafOffMin: LEAF_OFF_FP_STAT_MIN,\n leafOffMax: LEAF_OFF_FP_STAT_MAX,\n leafOffAve: LEAF_OFF_FP_STAT_AVG,\n leafOffStdDev: LEAF_OFF_FP_STAT_DEV,\n };\n}\n\n/** Fp8: fixed 8-bit codes. Leaf = 96-byte header + 512 bytes = 608. */\nexport const FP8_LAYOUT: GridTypeLayout = quantizedLayout(GRID_TYPE_FP8, 608);\n/** Fp4: fixed 4-bit codes. Leaf = 96-byte header + 256 bytes = 352. */\nexport const FP4_LAYOUT: GridTypeLayout = quantizedLayout(GRID_TYPE_FP4, 352);\n/** Fp16: fixed 16-bit codes. Leaf = 96-byte header + 1024 bytes = 1120. */\nexport const FP16_LAYOUT: GridTypeLayout = quantizedLayout(GRID_TYPE_FP16, 1120);\n/** FpN: variable bit-width. `leafSize` is the 96-byte base (see codec). */\nexport const FPN_LAYOUT: GridTypeLayout = quantizedLayout(GRID_TYPE_FPN, FP_LEAF_HEADER_SIZE);\n\n/**\n * Half (K7.H, NanoVDB `GridType::Half`): every value is a raw IEEE binary16\n * (2 bytes) at every level (leaf table, tiles, background); `mMinimum` /\n * `mMaximum` are binary16 too and `mAverage` / `mStdDevi` stay f32\n * (`FloatTraits<Half>` is float). Table slots stay 8 bytes (the value in the\n * low 2 bytes of the union with the i64 child offset); the leaf table is at 96\n * (512 x 2 bytes, leaf 1120). Values from `PNANOVDB_GRID_TYPE_HALF` in the\n * vendored stride tables (unchanged in NanoVDB v14.0.0's PNanoVDB.h).\n */\nexport const HALF_LAYOUT: GridTypeLayout = {\n gridType: GRID_TYPE_HALF,\n rootSize: 64,\n rootTileSize: 32,\n rootTileOffValue: 20,\n rootOffBackground: 28,\n rootOffMin: 30,\n rootOffMax: 32,\n rootOffAve: 36,\n rootOffStdDev: 40,\n tableStride: 8,\n valueStrideBits: 16,\n upperSize: 270400,\n upperOffTable: 8256,\n upperOffMin: 8224,\n upperOffMax: 8226,\n upperOffAve: 8228,\n upperOffStdDev: 8232,\n lowerSize: 33856,\n lowerOffTable: 1088,\n lowerOffMin: 1056,\n lowerOffMax: 1058,\n lowerOffAve: 1060,\n lowerOffStdDev: 1064,\n leafSize: 1120,\n leafOffTable: 96,\n leafOffMin: 80,\n leafOffMax: 82,\n leafOffAve: 84,\n leafOffStdDev: 88,\n};\n\n/**\n * Vec3f (K4.2): every value is 3 f32 (12 bytes); `mMinimum`/`mMaximum` are\n * Vec3f and `mAverage`/`mStdDevi` stay f32 (`FloatTraits<Vec3f>` is float).\n * Internal-node table slots are 16 bytes (the union of a 12-byte value and an\n * i64 child offset); the leaf table is 32-byte aligned at 128. Values from\n * `PNANOVDB_GRID_TYPE_VEC3F` in the vendored stride tables.\n */\nexport const VEC3F_LAYOUT: GridTypeLayout = {\n gridType: GRID_TYPE_VEC3F,\n rootSize: 96,\n rootTileSize: 32,\n rootTileOffValue: 20,\n rootOffBackground: 28,\n rootOffMin: 40,\n rootOffMax: 52,\n rootOffAve: 64,\n rootOffStdDev: 68,\n tableStride: 16,\n valueStrideBits: 96,\n upperSize: 532544,\n upperOffTable: 8256,\n upperOffMin: 8224,\n upperOffMax: 8236,\n upperOffAve: 8248,\n upperOffStdDev: 8252,\n lowerSize: 66624,\n lowerOffTable: 1088,\n lowerOffMin: 1056,\n lowerOffMax: 1068,\n lowerOffAve: 1080,\n lowerOffStdDev: 1084,\n leafSize: 6272,\n leafOffTable: 128,\n leafOffMin: 80,\n leafOffMax: 92,\n leafOffAve: 104,\n leafOffStdDev: 108,\n};\n\n// ---------------------------------------------------------------------------\n// coord -> key / coord -> offset (structural bit math, identical for all types)\n// ---------------------------------------------------------------------------\n\n/** pnanovdb_coord_to_key — root-tile key for a voxel coord (native-64 branch). */\nexport function coordToKey(x: number, y: number, z: number): bigint {\n const iu = BigInt(x >>> 12);\n const ju = BigInt(y >>> 12);\n const ku = BigInt(z >>> 12);\n return ku | (ju << 21n) | (iu << 42n);\n}\n\n/** pnanovdb_upper_coord_to_offset — lower-table slot within a 32^3 upper. */\nexport function upperCoordToOffset(x: number, y: number, z: number): number {\n return (((x & 4095) >> 7) << 10) + (((y & 4095) >> 7) << 5) + ((z & 4095) >> 7);\n}\n\n/** pnanovdb_lower_coord_to_offset — leaf-table slot within a 16^3 lower. */\nexport function lowerCoordToOffset(x: number, y: number, z: number): number {\n return (((x & 127) >> 3) << 8) + (((y & 127) >> 3) << 4) + ((z & 127) >> 3);\n}\n\n/** pnanovdb_leaf_coord_to_offset — voxel slot within an 8^3 leaf, 0..511. */\nexport function leafCoordToOffset(x: number, y: number, z: number): number {\n return ((x & 7) << 6) + ((y & 7) << 3) + (z & 7);\n}\n\n// ---------------------------------------------------------------------------\n// GridImageWriter — typed little-endian struct writer over one grid image.\n// ---------------------------------------------------------------------------\n\n/**\n * A thin, endianness-explicit writer over a single grid image's backing\n * `ArrayBuffer`. All NanoVDB integers/floats are little-endian; every setter\n * here passes `true` so the code never repeats the flag. Mask helpers implement\n * `pnanovdb_*_mask` bit addressing (32-bit words, LSB-first within a word).\n */\nexport class GridImageWriter {\n readonly bytes: Uint8Array;\n readonly u32: Uint32Array;\n private readonly view: DataView;\n\n constructor(byteLength: number) {\n if (byteLength % 4 !== 0) {\n throw new Error(`GridImageWriter: byteLength ${byteLength} must be a multiple of 4`);\n }\n const buffer = new ArrayBuffer(byteLength);\n this.bytes = new Uint8Array(buffer);\n this.u32 = new Uint32Array(buffer);\n this.view = new DataView(buffer);\n }\n\n setU16(off: number, v: number): void {\n this.view.setUint16(off, v & 0xffff, true);\n }\n setU32(off: number, v: number): void {\n this.view.setUint32(off, v >>> 0, true);\n }\n setI32(off: number, v: number): void {\n this.view.setInt32(off, v | 0, true);\n }\n setU64(off: number, v: bigint): void {\n this.view.setBigUint64(off, v, true);\n }\n setI64(off: number, v: bigint): void {\n this.view.setBigInt64(off, v, true);\n }\n setF32(off: number, v: number): void {\n this.view.setFloat32(off, v, true);\n }\n setF64(off: number, v: number): void {\n this.view.setFloat64(off, v, true);\n }\n\n /** Writes `len` bytes of `src` at `off`, zero-filling nothing beyond it. */\n setBytes(off: number, src: Uint8Array): void {\n this.bytes.set(src, off);\n }\n\n /** Sets bit `bitIndex` of a mask word array whose word 0 starts at `maskBase`. */\n setMaskBit(maskBase: number, bitIndex: number): void {\n const wordOff = maskBase + 4 * (bitIndex >>> 5);\n this.view.setUint32(\n wordOff,\n (this.view.getUint32(wordOff, true) | (1 << (bitIndex & 31))) >>> 0,\n true,\n );\n }\n\n /** Copies a whole precomputed 32-bit mask (`words` u32s) to `maskBase`. */\n setMaskWords(maskBase: number, words: Uint32Array): void {\n for (let i = 0; i < words.length; i++) {\n this.view.setUint32(maskBase + i * 4, words[i]! >>> 0, true);\n }\n }\n}\n"]}
@@ -11,10 +11,13 @@
11
11
  * (`parseNvdbLodName`), the full grid keeps the source name, so a native
12
12
  * reader that selects by name (`io::readGrid(file, "density")`) gets the
13
13
  * full grid. A reader that takes grid 0 gets the coarsest preview (K4.17).
14
+ * `segments: 'per-grid'` writes one segment per grid, so native index reads
15
+ * (`io::readGrid(file, n)`) work too (K7.12).
14
16
  */
15
17
  import type { VdbFile, VdbGrid } from "../vdb/types.js";
16
18
  import { type VDBQuantizeMode } from "./quantize.js";
17
19
  import { type VDBResampleFilter } from "./resample.js";
20
+ /** Options of {@link vdbBakeCoarseFirst}. */
18
21
  export interface VDBBakeCoarseFirstOptions {
19
22
  /**
20
23
  * Preview resolution(s): voxels on the longest side of the source's active
@@ -40,11 +43,21 @@ export interface VDBBakeCoarseFirstOptions {
40
43
  /**
41
44
  * Per-grid codec. Default `'zip'` (K4.18): the preview is ~12 KiB inside the
42
45
  * file whatever the host does; `'none'` relies on HTTP compression (a raw
43
- * preview is ~300 KiB, the 270 KB upper node).
46
+ * preview is ~300 KiB, the 270 KB upper node); `'blosc'` (K7.C1) writes
47
+ * NanoVDB's LZ4 Blosc frames (larger than ZIP, faster to decode natively).
44
48
  */
45
- codec?: "none" | "zip";
49
+ codec?: "none" | "zip" | "blosc";
46
50
  /** zlib level for `codec: 'zip'`. Default 9. */
47
51
  zipLevel?: number;
52
+ /**
53
+ * Segment layout (K7.12, `writeNvdb`'s `segments`). `'one'` (default): every grid in one segment, so a stream
54
+ * reader knows the full grid's size, type and voxel size before the preview's data (`vdbStreamCoarseFirst`
55
+ * reserves the full size at the preview: no pool growth at the swap). `'per-grid'`: one segment per grid, so
56
+ * native `io::readGrid(file, n)` reads every grid (v14 misreads n >= 1 inside a multi-grid segment, K7.13); a
57
+ * stream then learns of the full grid only when its segment starts (the swap moves the grid to a larger range,
58
+ * and the preview's `voxelRatio` / `types` cover only the grids announced so far).
59
+ */
60
+ segments?: "one" | "per-grid";
48
61
  /** Which float grid of a `VdbFile` to bake. Default: the first float grid. */
49
62
  sourceGridName?: string;
50
63
  /**
@@ -57,6 +70,9 @@ export interface VDBBakeCoarseFirstOptions {
57
70
  }
58
71
  /**
59
72
  * Bakes a coarse-first `.nvdb`: previews at `previewResolution` (coarsest
60
- * first), then the full grid, in one segment, as file bytes.
73
+ * first), then the full grid, in one segment (or one per grid), as file bytes.
74
+ *
75
+ * @param source The full grid: a NanoVDB image, a parsed `.vdb` grid, or a parsed `.vdb` file (its first float grid).
76
+ * @param options Preview resolution(s), filter, quantization, tolerance, codec and segment layout.
61
77
  */
62
78
  export declare function vdbBakeCoarseFirst(source: Uint32Array | VdbGrid | VdbFile, options?: VDBBakeCoarseFirstOptions): Uint8Array;
@@ -11,6 +11,8 @@
11
11
  * (`parseNvdbLodName`), the full grid keeps the source name, so a native
12
12
  * reader that selects by name (`io::readGrid(file, "density")`) gets the
13
13
  * full grid. A reader that takes grid 0 gets the coarsest preview (K4.17).
14
+ * `segments: 'per-grid'` writes one segment per grid, so native index reads
15
+ * (`io::readGrid(file, n)`) work too (K7.12).
14
16
  */
15
17
  import { VDBToolsError } from "../errors.js";
16
18
  import { nvdbLodName } from "../nvdb-stream.js";
@@ -34,7 +36,10 @@ function pickGrid(file, name) {
34
36
  }
35
37
  /**
36
38
  * Bakes a coarse-first `.nvdb`: previews at `previewResolution` (coarsest
37
- * first), then the full grid, in one segment, as file bytes.
39
+ * first), then the full grid, in one segment (or one per grid), as file bytes.
40
+ *
41
+ * @param source The full grid: a NanoVDB image, a parsed `.vdb` grid, or a parsed `.vdb` file (its first float grid).
42
+ * @param options Preview resolution(s), filter, quantization, tolerance, codec and segment layout.
38
43
  */
39
44
  export function vdbBakeCoarseFirst(source, options = {}) {
40
45
  const resolutions = [options.previewResolution ?? 48].flat();
@@ -80,6 +85,7 @@ export function vdbBakeCoarseFirst(source, options = {}) {
80
85
  const file = writeNvdb([...previews, full], {
81
86
  codec: options.codec ?? "zip",
82
87
  ...(options.zipLevel === undefined ? {} : { zipLevel: options.zipLevel }),
88
+ ...(options.segments === undefined ? {} : { segments: options.segments }),
83
89
  });
84
90
  return new Uint8Array(file);
85
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"coarse-first.js","sourceRoot":"","sources":["../../../src/tools/nanovdb/coarse-first.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAwB,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,eAAe,EAA0B,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA2C5C,SAAS,SAAS,CAAC,KAAkB;IACnC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,GAAG,kBAAkB,EAAE,aAAa,CAAC,CAAC;IACjG,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,QAAQ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AG,SAAS,CAAC,IAAI,CAAC,CAAC;IAE7B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAC9B,CAAC,UAAU,EAAE,EAAE,CACb,eAAe,CAAC,cAAc,EAAE;QAC9B,UAAU;QACV,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,WAAW;QACrC,GAAG,CAAC,eAAe,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;QACpE,GAAG,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;QAC5E,QAAQ,EAAE,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC;QACvC,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;KAC1E,CAAC,CAAC,KAAK,CACX,CAAC;IAEF,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,GAAG,QAAQ,EAAE,IAAI,CAAC,EAAE;QAC1C,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;QAC7B,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;KAC1E,CAAC,CAAC;IACH,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/**\n * coarse-first.ts — `vdbBakeCoarseFirst` (K4.16): the K4.5 option (a) bake. A\n * small preview grid (or a chain, coarsest first) and then the full grid, in\n * one multi-grid `.nvdb` (docs/dev/design/K4-5-coarse-first.md):\n *\n * [ <name>.lod48 , <name> ]\n *\n * Previews are `vdbResampleGrid(source, { resolution, filter, quantize })` over\n * the source's active cell box, so they draw where the full grid draws.\n * Readers tell them apart by name: a preview is `<name>.lod<resolution>`\n * (`parseNvdbLodName`), the full grid keeps the source name, so a native\n * reader that selects by name (`io::readGrid(file, \"density\")`) gets the\n * full grid. A reader that takes grid 0 gets the coarsest preview (K4.17).\n */\n\nimport { VDBToolsError } from \"../errors.js\";\nimport { nvdbLodName } from \"../nvdb-stream.js\";\nimport type { VdbFile, VdbGrid } from \"../vdb/types.js\";\nimport { GRID_NAME_MAX, GRID_OFF_GRID_NAME } from \"./bytes.js\";\nimport { buildFromVdb } from \"./build-from-vdb.js\";\nimport { vdbCollapseGrid, vdbQuantize, type VDBQuantizeMode } from \"./quantize.js\";\nimport { vdbResampleGrid, type VDBResampleFilter } from \"./resample.js\";\nimport { writeNvdb } from \"./write-nvdb.js\";\n\nexport interface VDBBakeCoarseFirstOptions {\n /**\n * Preview resolution(s): voxels on the longest side of the source's active\n * box (`vdbResampleGrid`'s `resolution`). Several give a chain, written\n * coarsest first. Default 48 (the K4.5 recommendation).\n */\n previewResolution?: number | number[];\n /**\n * Preview filter. Default `'trilinear'` (D26: ~1 dB closer to the full render than `'box'` at resolution 48\n * in the K4.19 A/B). Use `'box'` for thin or high-frequency data (most phase-stable, conserves mass).\n */\n filter?: VDBResampleFilter;\n /** Preview encoding. Default `'fpn'`. */\n quantize?: VDBQuantizeMode | \"none\";\n /** FpN tolerance for the previews (and a quantized full grid). Default `quantize`'s (0.01). */\n tolerance?: number;\n /**\n * Full-grid encoding. Default: the image as given for a NanoVDB source, and\n * `quantize`'s value for a parsed `.vdb` source (built with `buildFromVdb`\n * first). Quantizing needs a FLOAT image.\n */\n fullQuantize?: VDBQuantizeMode | \"none\";\n /**\n * Per-grid codec. Default `'zip'` (K4.18): the preview is ~12 KiB inside the\n * file whatever the host does; `'none'` relies on HTTP compression (a raw\n * preview is ~300 KiB, the 270 KB upper node).\n */\n codec?: \"none\" | \"zip\";\n /** zlib level for `codec: 'zip'`. Default 9. */\n zipLevel?: number;\n /** Which float grid of a `VdbFile` to bake. Default: the first float grid. */\n sourceGridName?: string;\n /**\n * Collapse uniform regions into tiles (K4.6). Default: on for the previews\n * (`vdbResampleGrid`'s default) and off for the full grid (an image keeps its\n * topology; a `.vdb` grid is built as `nanovdb_convert` builds it). A value\n * given applies to every grid.\n */\n collapse?: boolean;\n}\n\nfunction imageName(image: Uint32Array): string {\n const bytes = new Uint8Array(image.buffer, image.byteOffset + GRID_OFF_GRID_NAME, GRID_NAME_MAX);\n const end = bytes.indexOf(0);\n return new TextDecoder().decode(bytes.subarray(0, end < 0 ? bytes.length : end));\n}\n\nfunction pickGrid(file: VdbFile, name: string | undefined): VdbGrid {\n const grid = file.grids.find((g) => g.valueType === \"float\" && (name === undefined || g.name === name));\n if (!grid) {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", \n `vdbBakeCoarseFirst: no float grid${name === undefined ? \"\" : ` named \"${name}\"`} in the file ` +\n `(grids: ${file.grids.map((g) => `${g.name}:${g.valueType}`).join(\", \") || \"none\"})`,\n );\n }\n return grid;\n}\n\n/**\n * Bakes a coarse-first `.nvdb`: previews at `previewResolution` (coarsest\n * first), then the full grid, in one segment, as file bytes.\n */\nexport function vdbBakeCoarseFirst(source: Uint32Array | VdbGrid | VdbFile, options: VDBBakeCoarseFirstOptions = {}): Uint8Array {\n const resolutions = [options.previewResolution ?? 48].flat();\n if (resolutions.length === 0) throw new VDBToolsError(\"VDB_BAD_OPTION\", \"vdbBakeCoarseFirst: previewResolution is empty\");\n for (const r of resolutions) {\n if (!Number.isInteger(r) || r < 1) throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbBakeCoarseFirst: previewResolution must be positive integers, got ${r}`);\n }\n if (new Set(resolutions).size !== resolutions.length) throw new VDBToolsError(\"VDB_BAD_OPTION\", \"vdbBakeCoarseFirst: previewResolution has duplicates\");\n resolutions.sort((a, b) => a - b);\n const previewQuantize = options.quantize ?? \"fpn\";\n\n // The full grid.\n let full: Uint32Array;\n let resampleSource: Uint32Array | VdbGrid;\n if (source instanceof Uint32Array) {\n full = source;\n resampleSource = source;\n const q = options.fullQuantize ?? \"none\";\n if (q !== \"none\") full = vdbQuantize(source, q, options.tolerance, { collapse: options.collapse === true });\n else if (options.collapse === true) full = vdbCollapseGrid(source).image;\n } else {\n const grid = \"grids\" in source ? pickGrid(source, options.sourceGridName) : source;\n resampleSource = grid;\n full = buildFromVdb(grid, { collapse: options.collapse === true });\n const q = options.fullQuantize ?? previewQuantize;\n if (q !== \"none\") full = vdbQuantize(full, q, options.tolerance);\n }\n const name = imageName(full);\n\n const previews = resolutions.map(\n (resolution) =>\n vdbResampleGrid(resampleSource, {\n resolution,\n filter: options.filter ?? \"trilinear\",\n ...(previewQuantize === \"none\" ? {} : { quantize: previewQuantize }),\n ...(options.tolerance === undefined ? {} : { tolerance: options.tolerance }),\n gridName: nvdbLodName(name, resolution),\n ...(options.collapse === undefined ? {} : { collapse: options.collapse }),\n }).image,\n );\n\n const file = writeNvdb([...previews, full], {\n codec: options.codec ?? \"zip\",\n ...(options.zipLevel === undefined ? {} : { zipLevel: options.zipLevel }),\n });\n return new Uint8Array(file);\n}\n"]}
1
+ {"version":3,"file":"coarse-first.js","sourceRoot":"","sources":["../../../src/tools/nanovdb/coarse-first.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAwB,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,eAAe,EAA0B,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;A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C,KAAK,IAAI,KAAK;QAC7B,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;KAC1E,CAAC,CAAC;IACH,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/**\n * coarse-first.ts — `vdbBakeCoarseFirst` (K4.16): the K4.5 option (a) bake. A\n * small preview grid (or a chain, coarsest first) and then the full grid, in\n * one multi-grid `.nvdb` (docs/dev/design/K4-5-coarse-first.md):\n *\n * [ <name>.lod48 , <name> ]\n *\n * Previews are `vdbResampleGrid(source, { resolution, filter, quantize })` over\n * the source's active cell box, so they draw where the full grid draws.\n * Readers tell them apart by name: a preview is `<name>.lod<resolution>`\n * (`parseNvdbLodName`), the full grid keeps the source name, so a native\n * reader that selects by name (`io::readGrid(file, \"density\")`) gets the\n * full grid. A reader that takes grid 0 gets the coarsest preview (K4.17).\n * `segments: 'per-grid'` writes one segment per grid, so native index reads\n * (`io::readGrid(file, n)`) work too (K7.12).\n */\n\nimport { VDBToolsError } from \"../errors.js\";\nimport { nvdbLodName } from \"../nvdb-stream.js\";\nimport type { VdbFile, VdbGrid } from \"../vdb/types.js\";\nimport { GRID_NAME_MAX, GRID_OFF_GRID_NAME } from \"./bytes.js\";\nimport { buildFromVdb } from \"./build-from-vdb.js\";\nimport { vdbCollapseGrid, vdbQuantize, type VDBQuantizeMode } from \"./quantize.js\";\nimport { vdbResampleGrid, type VDBResampleFilter } from \"./resample.js\";\nimport { writeNvdb } from \"./write-nvdb.js\";\n\n/** Options of {@link vdbBakeCoarseFirst}. */\nexport interface VDBBakeCoarseFirstOptions {\n /**\n * Preview resolution(s): voxels on the longest side of the source's active\n * box (`vdbResampleGrid`'s `resolution`). Several give a chain, written\n * coarsest first. Default 48 (the K4.5 recommendation).\n */\n previewResolution?: number | number[];\n /**\n * Preview filter. Default `'trilinear'` (D26: ~1 dB closer to the full render than `'box'` at resolution 48\n * in the K4.19 A/B). Use `'box'` for thin or high-frequency data (most phase-stable, conserves mass).\n */\n filter?: VDBResampleFilter;\n /** Preview encoding. Default `'fpn'`. */\n quantize?: VDBQuantizeMode | \"none\";\n /** FpN tolerance for the previews (and a quantized full grid). Default `quantize`'s (0.01). */\n tolerance?: number;\n /**\n * Full-grid encoding. Default: the image as given for a NanoVDB source, and\n * `quantize`'s value for a parsed `.vdb` source (built with `buildFromVdb`\n * first). Quantizing needs a FLOAT image.\n */\n fullQuantize?: VDBQuantizeMode | \"none\";\n /**\n * Per-grid codec. Default `'zip'` (K4.18): the preview is ~12 KiB inside the\n * file whatever the host does; `'none'` relies on HTTP compression (a raw\n * preview is ~300 KiB, the 270 KB upper node); `'blosc'` (K7.C1) writes\n * NanoVDB's LZ4 Blosc frames (larger than ZIP, faster to decode natively).\n */\n codec?: \"none\" | \"zip\" | \"blosc\";\n /** zlib level for `codec: 'zip'`. Default 9. */\n zipLevel?: number;\n /**\n * Segment layout (K7.12, `writeNvdb`'s `segments`). `'one'` (default): every grid in one segment, so a stream\n * reader knows the full grid's size, type and voxel size before the preview's data (`vdbStreamCoarseFirst`\n * reserves the full size at the preview: no pool growth at the swap). `'per-grid'`: one segment per grid, so\n * native `io::readGrid(file, n)` reads every grid (v14 misreads n >= 1 inside a multi-grid segment, K7.13); a\n * stream then learns of the full grid only when its segment starts (the swap moves the grid to a larger range,\n * and the preview's `voxelRatio` / `types` cover only the grids announced so far).\n */\n segments?: \"one\" | \"per-grid\";\n /** Which float grid of a `VdbFile` to bake. Default: the first float grid. */\n sourceGridName?: string;\n /**\n * Collapse uniform regions into tiles (K4.6). Default: on for the previews\n * (`vdbResampleGrid`'s default) and off for the full grid (an image keeps its\n * topology; a `.vdb` grid is built as `nanovdb_convert` builds it). A value\n * given applies to every grid.\n */\n collapse?: boolean;\n}\n\nfunction imageName(image: Uint32Array): string {\n const bytes = new Uint8Array(image.buffer, image.byteOffset + GRID_OFF_GRID_NAME, GRID_NAME_MAX);\n const end = bytes.indexOf(0);\n return new TextDecoder().decode(bytes.subarray(0, end < 0 ? bytes.length : end));\n}\n\nfunction pickGrid(file: VdbFile, name: string | undefined): VdbGrid {\n const grid = file.grids.find((g) => g.valueType === \"float\" && (name === undefined || g.name === name));\n if (!grid) {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", \n `vdbBakeCoarseFirst: no float grid${name === undefined ? \"\" : ` named \"${name}\"`} in the file ` +\n `(grids: ${file.grids.map((g) => `${g.name}:${g.valueType}`).join(\", \") || \"none\"})`,\n );\n }\n return grid;\n}\n\n/**\n * Bakes a coarse-first `.nvdb`: previews at `previewResolution` (coarsest\n * first), then the full grid, in one segment (or one per grid), as file bytes.\n *\n * @param source The full grid: a NanoVDB image, a parsed `.vdb` grid, or a parsed `.vdb` file (its first float grid).\n * @param options Preview resolution(s), filter, quantization, tolerance, codec and segment layout.\n */\nexport function vdbBakeCoarseFirst(source: Uint32Array | VdbGrid | VdbFile, options: VDBBakeCoarseFirstOptions = {}): Uint8Array {\n const resolutions = [options.previewResolution ?? 48].flat();\n if (resolutions.length === 0) throw new VDBToolsError(\"VDB_BAD_OPTION\", \"vdbBakeCoarseFirst: previewResolution is empty\");\n for (const r of resolutions) {\n if (!Number.isInteger(r) || r < 1) throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbBakeCoarseFirst: previewResolution must be positive integers, got ${r}`);\n }\n if (new Set(resolutions).size !== resolutions.length) throw new VDBToolsError(\"VDB_BAD_OPTION\", \"vdbBakeCoarseFirst: previewResolution has duplicates\");\n resolutions.sort((a, b) => a - b);\n const previewQuantize = options.quantize ?? \"fpn\";\n\n // The full grid.\n let full: Uint32Array;\n let resampleSource: Uint32Array | VdbGrid;\n if (source instanceof Uint32Array) {\n full = source;\n resampleSource = source;\n const q = options.fullQuantize ?? \"none\";\n if (q !== \"none\") full = vdbQuantize(source, q, options.tolerance, { collapse: options.collapse === true });\n else if (options.collapse === true) full = vdbCollapseGrid(source).image;\n } else {\n const grid = \"grids\" in source ? pickGrid(source, options.sourceGridName) : source;\n resampleSource = grid;\n full = buildFromVdb(grid, { collapse: options.collapse === true });\n const q = options.fullQuantize ?? previewQuantize;\n if (q !== \"none\") full = vdbQuantize(full, q, options.tolerance);\n }\n const name = imageName(full);\n\n const previews = resolutions.map(\n (resolution) =>\n vdbResampleGrid(resampleSource, {\n resolution,\n filter: options.filter ?? \"trilinear\",\n ...(previewQuantize === \"none\" ? {} : { quantize: previewQuantize }),\n ...(options.tolerance === undefined ? {} : { tolerance: options.tolerance }),\n gridName: nvdbLodName(name, resolution),\n ...(options.collapse === undefined ? {} : { collapse: options.collapse }),\n }).image,\n );\n\n const file = writeNvdb([...previews, full], {\n codec: options.codec ?? \"zip\",\n ...(options.zipLevel === undefined ? {} : { zipLevel: options.zipLevel }),\n ...(options.segments === undefined ? {} : { segments: options.segments }),\n });\n return new Uint8Array(file);\n}\n"]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * half.ts — IEEE 754 binary16 ("half") conversions for NanoVDB Half grids
3
+ * (`GridType::Half` = 9, raw 16-bit values; NanoVDB 13.2, K7.H).
4
+ *
5
+ * Both directions are ports of NanoVDB's `nanovdb/math/HalfLite.h`
6
+ * (`HalfToFloat`, `FloatToHalf`; derived from Imath's `half.h`), which
7
+ * `tools::createNanoGrid` uses to convert float grids to Half grids. So a value
8
+ * we write is the bit pattern native NanoVDB writes for the same f32:
9
+ *
10
+ * - `vdbFloatToHalf`: round to nearest, ties to even; values past the largest
11
+ * half (65504, or exactly: `|v| > 0x477fefff` as f32 bits) become signed
12
+ * infinity; tiny values become signed zero or a subnormal; NaN keeps its sign
13
+ * and top 10 payload bits (forced non-zero). The input is rounded to f32 first,
14
+ * as `createNanoGrid` converts a double to float before calling it.
15
+ * - `vdbHalfToFloat`: exact (every half, subnormals included, is an f32).
16
+ */
17
+ /** The value of binary16 bit pattern `bits` (low 16 bits used). Exact. */
18
+ export declare function vdbHalfToFloat(bits: number): number;
19
+ /** The binary16 bit pattern of `value` (rounded to f32 first): NanoVDB `math::FloatToHalf`. */
20
+ export declare function vdbFloatToHalf(value: number): number;
21
+ /** `value` rounded to the nearest half (as a number): `vdbHalfToFloat(vdbFloatToHalf(value))`. */
22
+ export declare function vdbRoundToHalf(value: number): number;
@@ -0,0 +1,73 @@
1
+ // Portions ported from OpenVDB nanovdb/nanovdb/math/HalfLite.h (v14.0.0), Copyright Contributors to the OpenVDB
2
+ // Project, Apache-2.0; which derives HalfToFloat / FloatToHalf from Imath's half.h, Copyright Contributors to the
3
+ // OpenEXR Project, BSD-3-Clause (primary original authors Florian Kainz, Rod Bogart). See THIRD_PARTY_NOTICES.md.
4
+ /**
5
+ * half.ts — IEEE 754 binary16 ("half") conversions for NanoVDB Half grids
6
+ * (`GridType::Half` = 9, raw 16-bit values; NanoVDB 13.2, K7.H).
7
+ *
8
+ * Both directions are ports of NanoVDB's `nanovdb/math/HalfLite.h`
9
+ * (`HalfToFloat`, `FloatToHalf`; derived from Imath's `half.h`), which
10
+ * `tools::createNanoGrid` uses to convert float grids to Half grids. So a value
11
+ * we write is the bit pattern native NanoVDB writes for the same f32:
12
+ *
13
+ * - `vdbFloatToHalf`: round to nearest, ties to even; values past the largest
14
+ * half (65504, or exactly: `|v| > 0x477fefff` as f32 bits) become signed
15
+ * infinity; tiny values become signed zero or a subnormal; NaN keeps its sign
16
+ * and top 10 payload bits (forced non-zero). The input is rounded to f32 first,
17
+ * as `createNanoGrid` converts a double to float before calling it.
18
+ * - `vdbHalfToFloat`: exact (every half, subnormals included, is an f32).
19
+ */
20
+ const f32 = new Float32Array(1);
21
+ const u32 = new Uint32Array(f32.buffer);
22
+ /** The value of binary16 bit pattern `bits` (low 16 bits used). Exact. */
23
+ export function vdbHalfToFloat(bits) {
24
+ const h = bits & 0xffff;
25
+ const sign = h & 0x8000 ? -1 : 1;
26
+ const exp = (h >>> 10) & 0x1f;
27
+ const man = h & 0x3ff;
28
+ if (exp === 0)
29
+ return sign * man * 2 ** -24;
30
+ if (exp === 31)
31
+ return man === 0 ? sign * Infinity : NaN;
32
+ return sign * (1024 + man) * 2 ** (exp - 25);
33
+ }
34
+ /** The binary16 bit pattern of `value` (rounded to f32 first): NanoVDB `math::FloatToHalf`. */
35
+ export function vdbFloatToHalf(value) {
36
+ f32[0] = value;
37
+ const bits = u32[0];
38
+ const ui = bits & 0x7fffffff;
39
+ let h = (bits >>> 16) & 0x8000;
40
+ if (ui >= 0x38800000) {
41
+ // Infinity or NaN: keep the sign and the available payload bits.
42
+ if (ui >= 0x7f800000) {
43
+ h |= 0x7c00;
44
+ if (ui === 0x7f800000)
45
+ return h;
46
+ const m = (ui & 0x7fffff) >>> 13;
47
+ return h | m | (m === 0 ? 1 : 0);
48
+ }
49
+ // Overflow (rounds past 65504).
50
+ if (ui > 0x477fefff)
51
+ return h | 0x7c00;
52
+ // Normal: rebias, round to nearest even.
53
+ const r = ui - 0x38000000;
54
+ return h | ((r + 0x00000fff + ((r >>> 13) & 1)) >>> 13);
55
+ }
56
+ // Zero or a value that rounds to zero.
57
+ if (ui < 0x33000001)
58
+ return h;
59
+ // Subnormal half.
60
+ const e = ui >>> 23;
61
+ const shift = 0x7e - e;
62
+ const m = 0x800000 | (ui & 0x7fffff);
63
+ const r = (m << (32 - shift)) >>> 0;
64
+ h |= m >>> shift;
65
+ if (r > 0x80000000 || (r === 0x80000000 && (h & 1) !== 0))
66
+ h++;
67
+ return h;
68
+ }
69
+ /** `value` rounded to the nearest half (as a number): `vdbHalfToFloat(vdbFloatToHalf(value))`. */
70
+ export function vdbRoundToHalf(value) {
71
+ return vdbHalfToFloat(vdbFloatToHalf(value));
72
+ }
73
+ //# sourceMappingURL=half.js.map
@@ -0,0 +1 @@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C,CAAC;AACX,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["// Portions ported from OpenVDB nanovdb/nanovdb/math/HalfLite.h (v14.0.0), Copyright Contributors to the OpenVDB\n// Project, Apache-2.0; which derives HalfToFloat / FloatToHalf from Imath's half.h, Copyright Contributors to the\n// OpenEXR Project, BSD-3-Clause (primary original authors Florian Kainz, Rod Bogart). See THIRD_PARTY_NOTICES.md.\n/**\n * half.ts — IEEE 754 binary16 (\"half\") conversions for NanoVDB Half grids\n * (`GridType::Half` = 9, raw 16-bit values; NanoVDB 13.2, K7.H).\n *\n * Both directions are ports of NanoVDB's `nanovdb/math/HalfLite.h`\n * (`HalfToFloat`, `FloatToHalf`; derived from Imath's `half.h`), which\n * `tools::createNanoGrid` uses to convert float grids to Half grids. So a value\n * we write is the bit pattern native NanoVDB writes for the same f32:\n *\n * - `vdbFloatToHalf`: round to nearest, ties to even; values past the largest\n * half (65504, or exactly: `|v| > 0x477fefff` as f32 bits) become signed\n * infinity; tiny values become signed zero or a subnormal; NaN keeps its sign\n * and top 10 payload bits (forced non-zero). The input is rounded to f32 first,\n * as `createNanoGrid` converts a double to float before calling it.\n * - `vdbHalfToFloat`: exact (every half, subnormals included, is an f32).\n */\n\nconst f32 = new Float32Array(1);\nconst u32 = new Uint32Array(f32.buffer);\n\n/** The value of binary16 bit pattern `bits` (low 16 bits used). Exact. */\nexport function vdbHalfToFloat(bits: number): number {\n const h = bits & 0xffff;\n const sign = h & 0x8000 ? -1 : 1;\n const exp = (h >>> 10) & 0x1f;\n const man = h & 0x3ff;\n if (exp === 0) return sign * man * 2 ** -24;\n if (exp === 31) return man === 0 ? sign * Infinity : NaN;\n return sign * (1024 + man) * 2 ** (exp - 25);\n}\n\n/** The binary16 bit pattern of `value` (rounded to f32 first): NanoVDB `math::FloatToHalf`. */\nexport function vdbFloatToHalf(value: number): number {\n f32[0] = value;\n const bits = u32[0]!;\n const ui = bits & 0x7fffffff;\n let h = (bits >>> 16) & 0x8000;\n\n if (ui >= 0x38800000) {\n // Infinity or NaN: keep the sign and the available payload bits.\n if (ui >= 0x7f800000) {\n h |= 0x7c00;\n if (ui === 0x7f800000) return h;\n const m = (ui & 0x7fffff) >>> 13;\n return h | m | (m === 0 ? 1 : 0);\n }\n // Overflow (rounds past 65504).\n if (ui > 0x477fefff) return h | 0x7c00;\n // Normal: rebias, round to nearest even.\n const r = ui - 0x38000000;\n return h | ((r + 0x00000fff + ((r >>> 13) & 1)) >>> 13);\n }\n\n // Zero or a value that rounds to zero.\n if (ui < 0x33000001) return h;\n\n // Subnormal half.\n const e = ui >>> 23;\n const shift = 0x7e - e;\n const m = 0x800000 | (ui & 0x7fffff);\n const r = (m << (32 - shift)) >>> 0;\n h |= m >>> shift;\n if (r > 0x80000000 || (r === 0x80000000 && (h & 1) !== 0)) h++;\n return h;\n}\n\n/** `value` rounded to the nearest half (as a number): `vdbHalfToFloat(vdbFloatToHalf(value))`. */\nexport function vdbRoundToHalf(value: number): number {\n return vdbHalfToFloat(vdbFloatToHalf(value));\n}\n"]}
@@ -14,10 +14,11 @@
14
14
  */
15
15
  export { vdbBuildFromDense, vdbBuildFromDenseDetailed, vdbBuildFromLeavesDetailed, } from "./serialize.js";
16
16
  export type { VDBBuildFromDenseOptions, VDBBuildFromLeavesOptions, VDBBuiltGrid } from "./serialize.js";
17
+ export type { VDBDenseLayout } from "./tree.js";
17
18
  export { writeNvdb } from "./write-nvdb.js";
18
19
  export type { WriteNvdbOptions } from "./write-nvdb.js";
19
20
  export type { VDBLeafCodec } from "./leaf-codec.js";
20
- export { VDB_FLOAT_LEAF_CODEC, VDB_FP4_LEAF_CODEC, VDB_FP8_LEAF_CODEC, VDB_FP16_LEAF_CODEC, vdbMakeFpNLeafCodec, FPN_DEFAULT_TOLERANCE, VDB_VEC3F_LEAF_CODEC, } from "./leaf-codec.js";
21
+ export { VDB_FLOAT_LEAF_CODEC, VDB_FP4_LEAF_CODEC, VDB_FP8_LEAF_CODEC, VDB_FP16_LEAF_CODEC, VDB_HALF_LEAF_CODEC, vdbMakeFpNLeafCodec, FPN_DEFAULT_TOLERANCE, VDB_VEC3F_LEAF_CODEC, } from "./leaf-codec.js";
21
22
  export { buildFromVdb, buildFromVdbDetailed } from "./build-from-vdb.js";
22
23
  export type { BuildFromVdbOptions } from "./build-from-vdb.js";
23
24
  export { vdbCollapseGrid, vdbQuantize, vdbQuantizeDetailed } from "./quantize.js";
@@ -29,4 +30,5 @@ export type { VDBGridTransformInput, VDBTransformSpec } from "./transform.js";
29
30
  export { vdbBakeCoarseFirst } from "./coarse-first.js";
30
31
  export type { VDBBakeCoarseFirstOptions } from "./coarse-first.js";
31
32
  export { vdbInspect } from "./inspect.js";
33
+ export { vdbFloatToHalf, vdbHalfToFloat, vdbRoundToHalf } from "./half.js";
32
34
  export type { VDBInspectReport } from "./inspect.js";
@@ -14,11 +14,12 @@
14
14
  */
15
15
  export { vdbBuildFromDense, vdbBuildFromDenseDetailed, vdbBuildFromLeavesDetailed, } from "./serialize.js";
16
16
  export { writeNvdb } from "./write-nvdb.js";
17
- export { VDB_FLOAT_LEAF_CODEC, VDB_FP4_LEAF_CODEC, VDB_FP8_LEAF_CODEC, VDB_FP16_LEAF_CODEC, vdbMakeFpNLeafCodec, FPN_DEFAULT_TOLERANCE, VDB_VEC3F_LEAF_CODEC, } from "./leaf-codec.js";
17
+ export { VDB_FLOAT_LEAF_CODEC, VDB_FP4_LEAF_CODEC, VDB_FP8_LEAF_CODEC, VDB_FP16_LEAF_CODEC, VDB_HALF_LEAF_CODEC, vdbMakeFpNLeafCodec, FPN_DEFAULT_TOLERANCE, VDB_VEC3F_LEAF_CODEC, } from "./leaf-codec.js";
18
18
  export { buildFromVdb, buildFromVdbDetailed } from "./build-from-vdb.js";
19
19
  export { vdbCollapseGrid, vdbQuantize, vdbQuantizeDetailed } from "./quantize.js";
20
20
  export { vdbResampleGrid, vdbResampleError, vdbResampleDense } from "./resample.js";
21
21
  export { vdbTransform } from "./transform.js";
22
22
  export { vdbBakeCoarseFirst } from "./coarse-first.js";
23
23
  export { vdbInspect } from "./inspect.js";
24
+ export { vdbFloatToHalf, vdbHalfToFloat, vdbRoundToHalf } from "./half.js";
24
25
  //# sourceMappingURL=index.js.map