@pmndrs/vdb 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (570) hide show
  1. package/CHANGELOG.md +727 -0
  2. package/LICENSE +21 -0
  3. package/README.md +496 -2
  4. package/THIRD_PARTY_NOTICES.md +315 -0
  5. package/dist/core/compute/atlas.d.ts +102 -0
  6. package/dist/core/compute/atlas.js +103 -0
  7. package/dist/core/compute/atlas.js.map +1 -0
  8. package/dist/core/compute/index.d.ts +13 -0
  9. package/dist/core/compute/index.js +9 -0
  10. package/dist/core/compute/index.js.map +1 -0
  11. package/dist/core/compute/majorant-build.d.ts +45 -0
  12. package/dist/core/compute/majorant-build.js +193 -0
  13. package/dist/core/compute/majorant-build.js.map +1 -0
  14. package/dist/core/compute/multi-scale.d.ts +155 -0
  15. package/dist/core/compute/multi-scale.js +684 -0
  16. package/dist/core/compute/multi-scale.js.map +1 -0
  17. package/dist/core/compute/pyramid.d.ts +120 -0
  18. package/dist/core/compute/pyramid.js +468 -0
  19. package/dist/core/compute/pyramid.js.map +1 -0
  20. package/dist/core/compute/shared.d.ts +116 -0
  21. package/dist/core/compute/shared.js +211 -0
  22. package/dist/core/compute/shared.js.map +1 -0
  23. package/dist/core/compute/stats.d.ts +78 -0
  24. package/dist/core/compute/stats.js +193 -0
  25. package/dist/core/compute/stats.js.map +1 -0
  26. package/dist/core/compute/value-transform.d.ts +30 -0
  27. package/dist/core/compute/value-transform.js +64 -0
  28. package/dist/core/compute/value-transform.js.map +1 -0
  29. package/dist/core/errors.d.ts +21 -0
  30. package/dist/core/errors.js +17 -0
  31. package/dist/core/errors.js.map +1 -0
  32. package/dist/core/frame/emission.d.ts +85 -0
  33. package/dist/core/frame/emission.js +422 -0
  34. package/dist/core/frame/emission.js.map +1 -0
  35. package/dist/core/frame/environment.d.ts +47 -0
  36. package/dist/core/frame/environment.js +178 -0
  37. package/dist/core/frame/environment.js.map +1 -0
  38. package/dist/core/frame/index.d.ts +39 -0
  39. package/dist/core/frame/index.js +27 -0
  40. package/dist/core/frame/index.js.map +1 -0
  41. package/dist/core/frame/kernels.d.ts +115 -0
  42. package/dist/core/frame/kernels.js +496 -0
  43. package/dist/core/frame/kernels.js.map +1 -0
  44. package/dist/core/frame/limits.d.ts +67 -0
  45. package/dist/core/frame/limits.js +109 -0
  46. package/dist/core/frame/limits.js.map +1 -0
  47. package/dist/core/frame/phase.d.ts +17 -0
  48. package/dist/core/frame/phase.js +53 -0
  49. package/dist/core/frame/phase.js.map +1 -0
  50. package/dist/core/frame/pipelines.d.ts +49 -0
  51. package/dist/core/frame/pipelines.js +147 -0
  52. package/dist/core/frame/pipelines.js.map +1 -0
  53. package/dist/core/frame/renderer.d.ts +122 -0
  54. package/dist/core/frame/renderer.js +1712 -0
  55. package/dist/core/frame/renderer.js.map +1 -0
  56. package/dist/core/frame/resources.d.ts +71 -0
  57. package/dist/core/frame/resources.js +100 -0
  58. package/dist/core/frame/resources.js.map +1 -0
  59. package/dist/core/frame/scattering.d.ts +97 -0
  60. package/dist/core/frame/scattering.js +332 -0
  61. package/dist/core/frame/scattering.js.map +1 -0
  62. package/dist/core/frame/settings.d.ts +243 -0
  63. package/dist/core/frame/settings.js +67 -0
  64. package/dist/core/frame/settings.js.map +1 -0
  65. package/dist/core/frame/shadows.d.ts +55 -0
  66. package/dist/core/frame/shadows.js +460 -0
  67. package/dist/core/frame/shadows.js.map +1 -0
  68. package/dist/core/frame/types.d.ts +415 -0
  69. package/dist/core/frame/types.js +49 -0
  70. package/dist/core/frame/types.js.map +1 -0
  71. package/dist/core/frame/uniforms.d.ts +105 -0
  72. package/dist/core/frame/uniforms.js +276 -0
  73. package/dist/core/frame/uniforms.js.map +1 -0
  74. package/dist/core/frame/wgsl/chunks.d.ts +4 -0
  75. package/dist/core/frame/wgsl/chunks.js +728 -0
  76. package/dist/core/frame/wgsl/chunks.js.map +1 -0
  77. package/dist/core/frame/wgsl/emission.d.ts +82 -0
  78. package/dist/core/frame/wgsl/emission.js +353 -0
  79. package/dist/core/frame/wgsl/emission.js.map +1 -0
  80. package/dist/core/frame/wgsl/environment.d.ts +42 -0
  81. package/dist/core/frame/wgsl/environment.js +711 -0
  82. package/dist/core/frame/wgsl/environment.js.map +1 -0
  83. package/dist/core/frame/wgsl/gather.d.ts +55 -0
  84. package/dist/core/frame/wgsl/gather.js +850 -0
  85. package/dist/core/frame/wgsl/gather.js.map +1 -0
  86. package/dist/core/frame/wgsl/integrate.d.ts +78 -0
  87. package/dist/core/frame/wgsl/integrate.js +213 -0
  88. package/dist/core/frame/wgsl/integrate.js.map +1 -0
  89. package/dist/core/frame/wgsl/lighting.d.ts +103 -0
  90. package/dist/core/frame/wgsl/lighting.js +1636 -0
  91. package/dist/core/frame/wgsl/lighting.js.map +1 -0
  92. package/dist/core/frame/wgsl/occluders.d.ts +20 -0
  93. package/dist/core/frame/wgsl/occluders.js +95 -0
  94. package/dist/core/frame/wgsl/occluders.js.map +1 -0
  95. package/dist/core/frame/wgsl/resolve.d.ts +19 -0
  96. package/dist/core/frame/wgsl/resolve.js +205 -0
  97. package/dist/core/frame/wgsl/resolve.js.map +1 -0
  98. package/dist/core/frame/wgsl/shadows.d.ts +35 -0
  99. package/dist/core/frame/wgsl/shadows.js +328 -0
  100. package/dist/core/frame/wgsl/shadows.js.map +1 -0
  101. package/dist/core/half.d.ts +11 -0
  102. package/dist/core/half.js +22 -0
  103. package/dist/core/half.js.map +1 -0
  104. package/dist/core/index.d.ts +52 -0
  105. package/dist/core/index.js +46 -0
  106. package/dist/core/index.js.map +1 -0
  107. package/dist/core/internal.d.ts +31 -0
  108. package/dist/core/internal.js +32 -0
  109. package/dist/core/internal.js.map +1 -0
  110. package/dist/core/pool/affine.d.ts +34 -0
  111. package/dist/core/pool/affine.js +100 -0
  112. package/dist/core/pool/affine.js.map +1 -0
  113. package/dist/core/pool/allocator.d.ts +32 -0
  114. package/dist/core/pool/allocator.js +81 -0
  115. package/dist/core/pool/allocator.js.map +1 -0
  116. package/dist/core/pool/image-header.d.ts +93 -0
  117. package/dist/core/pool/image-header.js +194 -0
  118. package/dist/core/pool/image-header.js.map +1 -0
  119. package/dist/core/pool/layout.d.ts +198 -0
  120. package/dist/core/pool/layout.js +316 -0
  121. package/dist/core/pool/layout.js.map +1 -0
  122. package/dist/core/pool/limits.d.ts +41 -0
  123. package/dist/core/pool/limits.js +80 -0
  124. package/dist/core/pool/limits.js.map +1 -0
  125. package/dist/core/pool/pool.d.ts +384 -0
  126. package/dist/core/pool/pool.js +1184 -0
  127. package/dist/core/pool/pool.js.map +1 -0
  128. package/dist/core/reference/index.d.ts +6 -0
  129. package/dist/core/reference/index.js +7 -0
  130. package/dist/core/reference/index.js.map +1 -0
  131. package/dist/core/reference/renderer.d.ts +105 -0
  132. package/dist/core/reference/renderer.js +474 -0
  133. package/dist/core/reference/renderer.js.map +1 -0
  134. package/dist/core/reference/wgsl.d.ts +65 -0
  135. package/dist/core/reference/wgsl.js +803 -0
  136. package/dist/core/reference/wgsl.js.map +1 -0
  137. package/dist/core/sequence.d.ts +347 -0
  138. package/dist/core/sequence.js +548 -0
  139. package/dist/core/sequence.js.map +1 -0
  140. package/dist/core/source/brick-cache.d.ts +165 -0
  141. package/dist/core/source/brick-cache.js +627 -0
  142. package/dist/core/source/brick-cache.js.map +1 -0
  143. package/dist/core/source/dense-fill.d.ts +53 -0
  144. package/dist/core/source/dense-fill.js +377 -0
  145. package/dist/core/source/dense-fill.js.map +1 -0
  146. package/dist/core/source/dense.d.ts +50 -0
  147. package/dist/core/source/dense.js +384 -0
  148. package/dist/core/source/dense.js.map +1 -0
  149. package/dist/core/source/sparse-wgsl.d.ts +92 -0
  150. package/dist/core/source/sparse-wgsl.js +481 -0
  151. package/dist/core/source/sparse-wgsl.js.map +1 -0
  152. package/dist/core/source/sparse.d.ts +192 -0
  153. package/dist/core/source/sparse.js +762 -0
  154. package/dist/core/source/sparse.js.map +1 -0
  155. package/dist/core/source/types.d.ts +120 -0
  156. package/dist/core/source/types.js +9 -0
  157. package/dist/core/source/types.js.map +1 -0
  158. package/dist/core/surface/index.d.ts +10 -0
  159. package/dist/core/surface/index.js +9 -0
  160. package/dist/core/surface/index.js.map +1 -0
  161. package/dist/core/surface/level-set-pass.d.ts +140 -0
  162. package/dist/core/surface/level-set-pass.js +291 -0
  163. package/dist/core/surface/level-set-pass.js.map +1 -0
  164. package/dist/core/surface/level-set-wgsl.d.ts +46 -0
  165. package/dist/core/surface/level-set-wgsl.js +99 -0
  166. package/dist/core/surface/level-set-wgsl.js.map +1 -0
  167. package/dist/core/surface/points.d.ts +109 -0
  168. package/dist/core/surface/points.js +226 -0
  169. package/dist/core/surface/points.js.map +1 -0
  170. package/dist/core/types.d.ts +37 -0
  171. package/dist/core/types.js +32 -0
  172. package/dist/core/types.js.map +1 -0
  173. package/dist/core/wgsl/api.d.ts +65 -0
  174. package/dist/core/wgsl/api.js +546 -0
  175. package/dist/core/wgsl/api.js.map +1 -0
  176. package/dist/core/wgsl/generate.d.ts +90 -0
  177. package/dist/core/wgsl/generate.js +678 -0
  178. package/dist/core/wgsl/generate.js.map +1 -0
  179. package/dist/core/wgsl/lean.d.ts +50 -0
  180. package/dist/core/wgsl/lean.js +327 -0
  181. package/dist/core/wgsl/lean.js.map +1 -0
  182. package/dist/core/wgsl/level-set.d.ts +58 -0
  183. package/dist/core/wgsl/level-set.js +200 -0
  184. package/dist/core/wgsl/level-set.js.map +1 -0
  185. package/dist/core/wgsl/majorant.d.ts +62 -0
  186. package/dist/core/wgsl/majorant.js +381 -0
  187. package/dist/core/wgsl/majorant.js.map +1 -0
  188. package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
  189. package/dist/core/wgsl/pnanovdb.chunks.generated.js +333 -0
  190. package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -0
  191. package/dist/core/wgsl/reserved.d.ts +9 -0
  192. package/dist/core/wgsl/reserved.js +26 -0
  193. package/dist/core/wgsl/reserved.js.map +1 -0
  194. package/dist/core/wgsl/types.d.ts +198 -0
  195. package/dist/core/wgsl/types.js +2 -0
  196. package/dist/core/wgsl/types.js.map +1 -0
  197. package/dist/three/coarse-first.d.ts +207 -0
  198. package/dist/three/coarse-first.js +205 -0
  199. package/dist/three/coarse-first.js.map +1 -0
  200. package/dist/three/compute.d.ts +73 -0
  201. package/dist/three/compute.js +66 -0
  202. package/dist/three/compute.js.map +1 -0
  203. package/dist/three/device.d.ts +66 -0
  204. package/dist/three/device.js +62 -0
  205. package/dist/three/device.js.map +1 -0
  206. package/dist/three/frame/core-environment.d.ts +38 -0
  207. package/dist/three/frame/core-environment.js +154 -0
  208. package/dist/three/frame/core-environment.js.map +1 -0
  209. package/dist/three/frame/core-integrate-material.d.ts +34 -0
  210. package/dist/three/frame/core-integrate-material.js +162 -0
  211. package/dist/three/frame/core-integrate-material.js.map +1 -0
  212. package/dist/three/frame/core-occluders.d.ts +53 -0
  213. package/dist/three/frame/core-occluders.js +193 -0
  214. package/dist/three/frame/core-occluders.js.map +1 -0
  215. package/dist/three/frame/core-structs.d.ts +34 -0
  216. package/dist/three/frame/core-structs.js +61 -0
  217. package/dist/three/frame/core-structs.js.map +1 -0
  218. package/dist/three/frame/core-textures.d.ts +41 -0
  219. package/dist/three/frame/core-textures.js +114 -0
  220. package/dist/three/frame/core-textures.js.map +1 -0
  221. package/dist/three/frame/emission-light.d.ts +117 -0
  222. package/dist/three/frame/emission-light.js +276 -0
  223. package/dist/three/frame/emission-light.js.map +1 -0
  224. package/dist/three/frame/index.d.ts +19 -0
  225. package/dist/three/frame/index.js +15 -0
  226. package/dist/three/frame/index.js.map +1 -0
  227. package/dist/three/frame/medium.d.ts +33 -0
  228. package/dist/three/frame/medium.js +29 -0
  229. package/dist/three/frame/medium.js.map +1 -0
  230. package/dist/three/frame/renderer.d.ts +97 -0
  231. package/dist/three/frame/renderer.js +480 -0
  232. package/dist/three/frame/renderer.js.map +1 -0
  233. package/dist/three/frame/spectrum.d.ts +4 -0
  234. package/dist/three/frame/spectrum.js +15 -0
  235. package/dist/three/frame/spectrum.js.map +1 -0
  236. package/dist/three/frame/three-internals.d.ts +60 -0
  237. package/dist/three/frame/three-internals.js +152 -0
  238. package/dist/three/frame/three-internals.js.map +1 -0
  239. package/dist/three/frame/volume-shadows.d.ts +139 -0
  240. package/dist/three/frame/volume-shadows.js +403 -0
  241. package/dist/three/frame/volume-shadows.js.map +1 -0
  242. package/dist/three/frame/volume.d.ts +230 -0
  243. package/dist/three/frame/volume.js +268 -0
  244. package/dist/three/frame/volume.js.map +1 -0
  245. package/dist/three/grid-node.d.ts +229 -0
  246. package/dist/three/grid-node.js +545 -0
  247. package/dist/three/grid-node.js.map +1 -0
  248. package/dist/three/index.d.ts +52 -0
  249. package/dist/three/index.js +58 -0
  250. package/dist/three/index.js.map +1 -0
  251. package/dist/three/internal.d.ts +20 -0
  252. package/dist/three/internal.js +18 -0
  253. package/dist/three/internal.js.map +1 -0
  254. package/dist/three/level-set-material.d.ts +185 -0
  255. package/dist/three/level-set-material.js +241 -0
  256. package/dist/three/level-set-material.js.map +1 -0
  257. package/dist/three/level-set-physical-material.d.ts +154 -0
  258. package/dist/three/level-set-physical-material.js +253 -0
  259. package/dist/three/level-set-physical-material.js.map +1 -0
  260. package/dist/three/level-set-velocity.d.ts +94 -0
  261. package/dist/three/level-set-velocity.js +208 -0
  262. package/dist/three/level-set-velocity.js.map +1 -0
  263. package/dist/three/material.d.ts +324 -0
  264. package/dist/three/material.js +502 -0
  265. package/dist/three/material.js.map +1 -0
  266. package/dist/three/points.d.ts +140 -0
  267. package/dist/three/points.js +261 -0
  268. package/dist/three/points.js.map +1 -0
  269. package/dist/three/sparse-source.d.ts +165 -0
  270. package/dist/three/sparse-source.js +405 -0
  271. package/dist/three/sparse-source.js.map +1 -0
  272. package/dist/three/volume-source.d.ts +22 -0
  273. package/dist/three/volume-source.js +110 -0
  274. package/dist/three/volume-source.js.map +1 -0
  275. package/dist/tools/cpu/brick-atlas.d.ts +36 -0
  276. package/dist/tools/cpu/brick-atlas.js +129 -0
  277. package/dist/tools/cpu/brick-atlas.js.map +1 -0
  278. package/dist/tools/cpu/compute.d.ts +116 -0
  279. package/dist/tools/cpu/compute.js +239 -0
  280. package/dist/tools/cpu/compute.js.map +1 -0
  281. package/dist/tools/cpu/lean-reads.d.ts +81 -0
  282. package/dist/tools/cpu/lean-reads.js +262 -0
  283. package/dist/tools/cpu/lean-reads.js.map +1 -0
  284. package/dist/tools/cpu/level-set.d.ts +111 -0
  285. package/dist/tools/cpu/level-set.js +313 -0
  286. package/dist/tools/cpu/level-set.js.map +1 -0
  287. package/dist/tools/cpu/majorant.d.ts +265 -0
  288. package/dist/tools/cpu/majorant.js +541 -0
  289. package/dist/tools/cpu/majorant.js.map +1 -0
  290. package/dist/tools/cpu/march.d.ts +297 -0
  291. package/dist/tools/cpu/march.js +726 -0
  292. package/dist/tools/cpu/march.js.map +1 -0
  293. package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
  294. package/dist/tools/cpu/mesh-decimate.js +1225 -0
  295. package/dist/tools/cpu/mesh-decimate.js.map +1 -0
  296. package/dist/tools/cpu/points.d.ts +29 -0
  297. package/dist/tools/cpu/points.js +38 -0
  298. package/dist/tools/cpu/points.js.map +1 -0
  299. package/dist/tools/cpu/probe-coords.d.ts +70 -0
  300. package/dist/tools/cpu/probe-coords.js +116 -0
  301. package/dist/tools/cpu/probe-coords.js.map +1 -0
  302. package/dist/tools/cpu/read-value.d.ts +44 -0
  303. package/dist/tools/cpu/read-value.js +351 -0
  304. package/dist/tools/cpu/read-value.js.map +1 -0
  305. package/dist/tools/cpu/sample-trilinear.d.ts +43 -0
  306. package/dist/tools/cpu/sample-trilinear.js +168 -0
  307. package/dist/tools/cpu/sample-trilinear.js.map +1 -0
  308. package/dist/tools/cpu/stride-tables.d.ts +56 -0
  309. package/dist/tools/cpu/stride-tables.generated.d.ts +1059 -0
  310. package/dist/tools/cpu/stride-tables.generated.js +1267 -0
  311. package/dist/tools/cpu/stride-tables.generated.js.map +1 -0
  312. package/dist/tools/cpu/stride-tables.js +78 -0
  313. package/dist/tools/cpu/stride-tables.js.map +1 -0
  314. package/dist/tools/cpu/surface-nets.d.ts +90 -0
  315. package/dist/tools/cpu/surface-nets.js +597 -0
  316. package/dist/tools/cpu/surface-nets.js.map +1 -0
  317. package/dist/tools/errors.d.ts +66 -0
  318. package/dist/tools/errors.js +67 -0
  319. package/dist/tools/errors.js.map +1 -0
  320. package/dist/tools/frame/ambient.d.ts +98 -0
  321. package/dist/tools/frame/ambient.js +274 -0
  322. package/dist/tools/frame/ambient.js.map +1 -0
  323. package/dist/tools/frame/blackbody.d.ts +57 -0
  324. package/dist/tools/frame/blackbody.js +151 -0
  325. package/dist/tools/frame/blackbody.js.map +1 -0
  326. package/dist/tools/frame/brick-cache.d.ts +165 -0
  327. package/dist/tools/frame/brick-cache.js +326 -0
  328. package/dist/tools/frame/brick-cache.js.map +1 -0
  329. package/dist/tools/frame/emission.d.ts +137 -0
  330. package/dist/tools/frame/emission.js +290 -0
  331. package/dist/tools/frame/emission.js.map +1 -0
  332. package/dist/tools/frame/environment-gpu.d.ts +111 -0
  333. package/dist/tools/frame/environment-gpu.js +280 -0
  334. package/dist/tools/frame/environment-gpu.js.map +1 -0
  335. package/dist/tools/frame/environment.d.ts +106 -0
  336. package/dist/tools/frame/environment.js +272 -0
  337. package/dist/tools/frame/environment.js.map +1 -0
  338. package/dist/tools/frame/froxel.d.ts +58 -0
  339. package/dist/tools/frame/froxel.js +115 -0
  340. package/dist/tools/frame/froxel.js.map +1 -0
  341. package/dist/tools/frame/grid.d.ts +392 -0
  342. package/dist/tools/frame/grid.js +802 -0
  343. package/dist/tools/frame/grid.js.map +1 -0
  344. package/dist/tools/frame/index.d.ts +150 -0
  345. package/dist/tools/frame/index.js +389 -0
  346. package/dist/tools/frame/index.js.map +1 -0
  347. package/dist/tools/frame/medium.d.ts +77 -0
  348. package/dist/tools/frame/medium.js +101 -0
  349. package/dist/tools/frame/medium.js.map +1 -0
  350. package/dist/tools/frame/mie-table.d.ts +6 -0
  351. package/dist/tools/frame/mie-table.js +16 -0
  352. package/dist/tools/frame/mie-table.js.map +1 -0
  353. package/dist/tools/frame/mie.d.ts +63 -0
  354. package/dist/tools/frame/mie.js +194 -0
  355. package/dist/tools/frame/mie.js.map +1 -0
  356. package/dist/tools/frame/mlp-nn.d.ts +36 -0
  357. package/dist/tools/frame/mlp-nn.js +159 -0
  358. package/dist/tools/frame/mlp-nn.js.map +1 -0
  359. package/dist/tools/frame/mlp-tza.d.ts +29 -0
  360. package/dist/tools/frame/mlp-tza.js +186 -0
  361. package/dist/tools/frame/mlp-tza.js.map +1 -0
  362. package/dist/tools/frame/mlp.d.ts +183 -0
  363. package/dist/tools/frame/mlp.js +434 -0
  364. package/dist/tools/frame/mlp.js.map +1 -0
  365. package/dist/tools/frame/ms-exit.d.ts +42 -0
  366. package/dist/tools/frame/ms-exit.js +90 -0
  367. package/dist/tools/frame/ms-exit.js.map +1 -0
  368. package/dist/tools/frame/multi-scale.d.ts +152 -0
  369. package/dist/tools/frame/multi-scale.js +302 -0
  370. package/dist/tools/frame/multi-scale.js.map +1 -0
  371. package/dist/tools/frame/neural-weights.d.ts +10 -0
  372. package/dist/tools/frame/neural-weights.js +244 -0
  373. package/dist/tools/frame/neural-weights.js.map +1 -0
  374. package/dist/tools/frame/neural.d.ts +80 -0
  375. package/dist/tools/frame/neural.js +150 -0
  376. package/dist/tools/frame/neural.js.map +1 -0
  377. package/dist/tools/frame/occluders.d.ts +51 -0
  378. package/dist/tools/frame/occluders.js +72 -0
  379. package/dist/tools/frame/occluders.js.map +1 -0
  380. package/dist/tools/frame/pyramid-layout.d.ts +55 -0
  381. package/dist/tools/frame/pyramid-layout.js +100 -0
  382. package/dist/tools/frame/pyramid-layout.js.map +1 -0
  383. package/dist/tools/frame/shadows.d.ts +190 -0
  384. package/dist/tools/frame/shadows.js +468 -0
  385. package/dist/tools/frame/shadows.js.map +1 -0
  386. package/dist/tools/frame/sparse.d.ts +147 -0
  387. package/dist/tools/frame/sparse.js +432 -0
  388. package/dist/tools/frame/sparse.js.map +1 -0
  389. package/dist/tools/frame/spectral-stack.d.ts +159 -0
  390. package/dist/tools/frame/spectral-stack.js +391 -0
  391. package/dist/tools/frame/spectral-stack.js.map +1 -0
  392. package/dist/tools/frame/spectral.d.ts +222 -0
  393. package/dist/tools/frame/spectral.js +572 -0
  394. package/dist/tools/frame/spectral.js.map +1 -0
  395. package/dist/tools/frame/stack.d.ts +115 -0
  396. package/dist/tools/frame/stack.js +290 -0
  397. package/dist/tools/frame/stack.js.map +1 -0
  398. package/dist/tools/frame/view.d.ts +131 -0
  399. package/dist/tools/frame/view.js +337 -0
  400. package/dist/tools/frame/view.js.map +1 -0
  401. package/dist/tools/index.d.ts +157 -0
  402. package/dist/tools/index.js +132 -0
  403. package/dist/tools/index.js.map +1 -0
  404. package/dist/tools/internal.d.ts +87 -0
  405. package/dist/tools/internal.js +85 -0
  406. package/dist/tools/internal.js.map +1 -0
  407. package/dist/tools/nanovdb/build-from-vdb.d.ts +59 -0
  408. package/dist/tools/nanovdb/build-from-vdb.js +100 -0
  409. package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
  410. package/dist/tools/nanovdb/bytes.d.ts +233 -0
  411. package/dist/tools/nanovdb/bytes.js +388 -0
  412. package/dist/tools/nanovdb/bytes.js.map +1 -0
  413. package/dist/tools/nanovdb/coarse-first.d.ts +78 -0
  414. package/dist/tools/nanovdb/coarse-first.js +92 -0
  415. package/dist/tools/nanovdb/coarse-first.js.map +1 -0
  416. package/dist/tools/nanovdb/half.d.ts +22 -0
  417. package/dist/tools/nanovdb/half.js +73 -0
  418. package/dist/tools/nanovdb/half.js.map +1 -0
  419. package/dist/tools/nanovdb/index.d.ts +34 -0
  420. package/dist/tools/nanovdb/index.js +25 -0
  421. package/dist/tools/nanovdb/index.js.map +1 -0
  422. package/dist/tools/nanovdb/inspect.d.ts +33 -0
  423. package/dist/tools/nanovdb/inspect.js +70 -0
  424. package/dist/tools/nanovdb/inspect.js.map +1 -0
  425. package/dist/tools/nanovdb/leaf-codec.d.ts +119 -0
  426. package/dist/tools/nanovdb/leaf-codec.js +356 -0
  427. package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
  428. package/dist/tools/nanovdb/quantize.d.ts +72 -0
  429. package/dist/tools/nanovdb/quantize.js +329 -0
  430. package/dist/tools/nanovdb/quantize.js.map +1 -0
  431. package/dist/tools/nanovdb/resample.d.ts +177 -0
  432. package/dist/tools/nanovdb/resample.js +692 -0
  433. package/dist/tools/nanovdb/resample.js.map +1 -0
  434. package/dist/tools/nanovdb/serialize.d.ts +176 -0
  435. package/dist/tools/nanovdb/serialize.js +439 -0
  436. package/dist/tools/nanovdb/serialize.js.map +1 -0
  437. package/dist/tools/nanovdb/stats.d.ts +87 -0
  438. package/dist/tools/nanovdb/stats.js +225 -0
  439. package/dist/tools/nanovdb/stats.js.map +1 -0
  440. package/dist/tools/nanovdb/transform.d.ts +30 -0
  441. package/dist/tools/nanovdb/transform.js +94 -0
  442. package/dist/tools/nanovdb/transform.js.map +1 -0
  443. package/dist/tools/nanovdb/tree.d.ts +186 -0
  444. package/dist/tools/nanovdb/tree.js +530 -0
  445. package/dist/tools/nanovdb/tree.js.map +1 -0
  446. package/dist/tools/nanovdb/write-nvdb.d.ts +74 -0
  447. package/dist/tools/nanovdb/write-nvdb.js +290 -0
  448. package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
  449. package/dist/tools/nvdb-file.d.ts +265 -0
  450. package/dist/tools/nvdb-file.js +763 -0
  451. package/dist/tools/nvdb-file.js.map +1 -0
  452. package/dist/tools/nvdb-stream.d.ts +154 -0
  453. package/dist/tools/nvdb-stream.js +409 -0
  454. package/dist/tools/nvdb-stream.js.map +1 -0
  455. package/dist/tools/reference/analytic.d.ts +41 -0
  456. package/dist/tools/reference/analytic.js +95 -0
  457. package/dist/tools/reference/analytic.js.map +1 -0
  458. package/dist/tools/reference/environment.d.ts +62 -0
  459. package/dist/tools/reference/environment.js +154 -0
  460. package/dist/tools/reference/environment.js.map +1 -0
  461. package/dist/tools/reference/index.d.ts +12 -0
  462. package/dist/tools/reference/index.js +13 -0
  463. package/dist/tools/reference/index.js.map +1 -0
  464. package/dist/tools/reference/media.d.ts +14 -0
  465. package/dist/tools/reference/media.js +30 -0
  466. package/dist/tools/reference/media.js.map +1 -0
  467. package/dist/tools/reference/rng.d.ts +20 -0
  468. package/dist/tools/reference/rng.js +30 -0
  469. package/dist/tools/reference/rng.js.map +1 -0
  470. package/dist/tools/reference/scene.d.ts +312 -0
  471. package/dist/tools/reference/scene.js +169 -0
  472. package/dist/tools/reference/scene.js.map +1 -0
  473. package/dist/tools/reference/tables.d.ts +98 -0
  474. package/dist/tools/reference/tables.js +264 -0
  475. package/dist/tools/reference/tables.js.map +1 -0
  476. package/dist/tools/reference/trace.d.ts +160 -0
  477. package/dist/tools/reference/trace.js +497 -0
  478. package/dist/tools/reference/trace.js.map +1 -0
  479. package/dist/tools/vdb/bit-utils.d.ts +20 -0
  480. package/dist/tools/vdb/bit-utils.js +42 -0
  481. package/dist/tools/vdb/bit-utils.js.map +1 -0
  482. package/dist/tools/vdb/blosc-write.d.ts +43 -0
  483. package/dist/tools/vdb/blosc-write.js +197 -0
  484. package/dist/tools/vdb/blosc-write.js.map +1 -0
  485. package/dist/tools/vdb/blosc.d.ts +86 -0
  486. package/dist/tools/vdb/blosc.js +287 -0
  487. package/dist/tools/vdb/blosc.js.map +1 -0
  488. package/dist/tools/vdb/blosclz.d.ts +33 -0
  489. package/dist/tools/vdb/blosclz.js +112 -0
  490. package/dist/tools/vdb/blosclz.js.map +1 -0
  491. package/dist/tools/vdb/byte-reader.d.ts +50 -0
  492. package/dist/tools/vdb/byte-reader.js +161 -0
  493. package/dist/tools/vdb/byte-reader.js.map +1 -0
  494. package/dist/tools/vdb/compression.d.ts +81 -0
  495. package/dist/tools/vdb/compression.js +260 -0
  496. package/dist/tools/vdb/compression.js.map +1 -0
  497. package/dist/tools/vdb/errors.d.ts +10 -0
  498. package/dist/tools/vdb/errors.js +11 -0
  499. package/dist/tools/vdb/errors.js.map +1 -0
  500. package/dist/tools/vdb/grid.d.ts +37 -0
  501. package/dist/tools/vdb/grid.js +153 -0
  502. package/dist/tools/vdb/grid.js.map +1 -0
  503. package/dist/tools/vdb/half-float.d.ts +9 -0
  504. package/dist/tools/vdb/half-float.js +24 -0
  505. package/dist/tools/vdb/half-float.js.map +1 -0
  506. package/dist/tools/vdb/index.d.ts +4 -0
  507. package/dist/tools/vdb/index.js +3 -0
  508. package/dist/tools/vdb/index.js.map +1 -0
  509. package/dist/tools/vdb/inflate.d.ts +24 -0
  510. package/dist/tools/vdb/inflate.js +334 -0
  511. package/dist/tools/vdb/inflate.js.map +1 -0
  512. package/dist/tools/vdb/lz4.d.ts +30 -0
  513. package/dist/tools/vdb/lz4.js +228 -0
  514. package/dist/tools/vdb/lz4.js.map +1 -0
  515. package/dist/tools/vdb/metadata.d.ts +17 -0
  516. package/dist/tools/vdb/metadata.js +72 -0
  517. package/dist/tools/vdb/metadata.js.map +1 -0
  518. package/dist/tools/vdb/parse.d.ts +47 -0
  519. package/dist/tools/vdb/parse.js +241 -0
  520. package/dist/tools/vdb/parse.js.map +1 -0
  521. package/dist/tools/vdb/point-render-data.d.ts +79 -0
  522. package/dist/tools/vdb/point-render-data.js +137 -0
  523. package/dist/tools/vdb/point-render-data.js.map +1 -0
  524. package/dist/tools/vdb/points.d.ts +186 -0
  525. package/dist/tools/vdb/points.js +835 -0
  526. package/dist/tools/vdb/points.js.map +1 -0
  527. package/dist/tools/vdb/transform.d.ts +23 -0
  528. package/dist/tools/vdb/transform.js +54 -0
  529. package/dist/tools/vdb/transform.js.map +1 -0
  530. package/dist/tools/vdb/tree.d.ts +111 -0
  531. package/dist/tools/vdb/tree.js +228 -0
  532. package/dist/tools/vdb/tree.js.map +1 -0
  533. package/dist/tools/vdb/types.d.ts +195 -0
  534. package/dist/tools/vdb/types.js +3 -0
  535. package/dist/tools/vdb/types.js.map +1 -0
  536. package/dist/tools/wvdb/bake.d.ts +145 -0
  537. package/dist/tools/wvdb/bake.js +361 -0
  538. package/dist/tools/wvdb/bake.js.map +1 -0
  539. package/dist/tools/wvdb/dense.d.ts +191 -0
  540. package/dist/tools/wvdb/dense.js +368 -0
  541. package/dist/tools/wvdb/dense.js.map +1 -0
  542. package/dist/tools/wvdb/format.d.ts +220 -0
  543. package/dist/tools/wvdb/format.js +306 -0
  544. package/dist/tools/wvdb/format.js.map +1 -0
  545. package/dist/tools/wvdb/index.d.ts +14 -0
  546. package/dist/tools/wvdb/index.js +15 -0
  547. package/dist/tools/wvdb/index.js.map +1 -0
  548. package/dist/tools/wvdb/level-set.d.ts +56 -0
  549. package/dist/tools/wvdb/level-set.js +153 -0
  550. package/dist/tools/wvdb/level-set.js.map +1 -0
  551. package/dist/tools/wvdb/nanovdb.d.ts +59 -0
  552. package/dist/tools/wvdb/nanovdb.js +64 -0
  553. package/dist/tools/wvdb/nanovdb.js.map +1 -0
  554. package/dist/tools/wvdb/partial.d.ts +74 -0
  555. package/dist/tools/wvdb/partial.js +233 -0
  556. package/dist/tools/wvdb/partial.js.map +1 -0
  557. package/dist/tools/wvdb/read.d.ts +336 -0
  558. package/dist/tools/wvdb/read.js +766 -0
  559. package/dist/tools/wvdb/read.js.map +1 -0
  560. package/dist/tools/wvdb/sha256.d.ts +7 -0
  561. package/dist/tools/wvdb/sha256.js +76 -0
  562. package/dist/tools/wvdb/sha256.js.map +1 -0
  563. package/dist/tools/wvdb/write.d.ts +149 -0
  564. package/dist/tools/wvdb/write.js +403 -0
  565. package/dist/tools/wvdb/write.js.map +1 -0
  566. package/package.json +83 -4
  567. package/vendor/LICENSE +201 -0
  568. package/vendor/NOTICE +19 -0
  569. package/vendor/VENDOR.md +100 -0
  570. package/vendor/pnanovdb.wgsl +1577 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * level-set.ts — mjurczyk's level-set bake sampler (`sampleLevelSet`), an
3
+ * option of the `.wvdb` bake (`levelSetSampler: 'surface-mean'`, K4.13).
4
+ *
5
+ * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345:
6
+ * `src/openvdb/utils/levelSet.js` (`sampleLevelSet`, `getVoxelDistance`,
7
+ * `getTrilinearDistance`) and `src/wvdb/bake.js` (`sampleLevelSetGrid`, the
8
+ * band limit). His arithmetic order is kept so the output is bit-identical.
9
+ *
10
+ * What it does (his notes, restated): a level set's narrow band is often
11
+ * thinner than a texel, so a point sample is only inside or outside and the
12
+ * surface gets steps. When texels are larger than a voxel, a texel whose eight
13
+ * corners do not all have the same sign (it crosses the surface) is the mean
14
+ * of 4x4x4 sub-samples inside it; every other texel is a trilinear sample at
15
+ * its centre (only near the surface; far voxels keep the nearest value). A
16
+ * voxel's distance is its value clamped to `±background` when active, and
17
+ * `±background` by sign when inactive. Finally, values inside the band are
18
+ * clamped one quantization step inside it (`background - 2·background /
19
+ * (2^bits - 1)`) so they never decode as outside.
20
+ *
21
+ * The spec text (§8) instead point-samples and encodes by the source's active
22
+ * state; that stays the default (`levelSetSampler: 'spec'`, DIVERGES V17).
23
+ */
24
+ import type { WvdbBits, WvdbBox, WvdbVec3 } from "./format.js";
25
+ /** Index-space access to a sample source (axis-aligned or affine map). */
26
+ export interface WvdbIndexAccess {
27
+ /**
28
+ * World position → fractional index coordinate (the grid's inverse map), into `out`.
29
+ * @param world The world position.
30
+ * @param out Receives the index coordinate (returned).
31
+ */
32
+ toIndex(world: WvdbVec3, out: WvdbVec3): WvdbVec3;
33
+ /**
34
+ * A world-space vector → index units (the inverse Jacobian), into `out`.
35
+ * @param vector The world-space vector.
36
+ * @param out Receives the vector in index units (returned).
37
+ */
38
+ toIndexVector(vector: WvdbVec3, out: WvdbVec3): WvdbVec3;
39
+ /** Value and active state of an integer voxel (inactive tile values included). */
40
+ voxel(ijk: [number, number, number]): {
41
+ value: number;
42
+ active: boolean;
43
+ };
44
+ }
45
+ /** The part of a sample source this sampler reads. */
46
+ export interface WvdbLevelSetSource {
47
+ name: string;
48
+ background: number;
49
+ bbox: WvdbBox | null;
50
+ index?: WvdbIndexAccess;
51
+ }
52
+ /**
53
+ * His `sampleLevelSetGrid`: samples a level set over `bbox` at `dimensions`
54
+ * (x fastest) and applies the band limit for `bits`.
55
+ */
56
+ export declare function sampleWvdbLevelSetSurfaceMean(source: WvdbLevelSetSource, bbox: WvdbBox | null, dimensions: WvdbVec3, bits?: WvdbBits): Float32Array;
@@ -0,0 +1,153 @@
1
+ /**
2
+ * level-set.ts — mjurczyk's level-set bake sampler (`sampleLevelSet`), an
3
+ * option of the `.wvdb` bake (`levelSetSampler: 'surface-mean'`, K4.13).
4
+ *
5
+ * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345:
6
+ * `src/openvdb/utils/levelSet.js` (`sampleLevelSet`, `getVoxelDistance`,
7
+ * `getTrilinearDistance`) and `src/wvdb/bake.js` (`sampleLevelSetGrid`, the
8
+ * band limit). His arithmetic order is kept so the output is bit-identical.
9
+ *
10
+ * What it does (his notes, restated): a level set's narrow band is often
11
+ * thinner than a texel, so a point sample is only inside or outside and the
12
+ * surface gets steps. When texels are larger than a voxel, a texel whose eight
13
+ * corners do not all have the same sign (it crosses the surface) is the mean
14
+ * of 4x4x4 sub-samples inside it; every other texel is a trilinear sample at
15
+ * its centre (only near the surface; far voxels keep the nearest value). A
16
+ * voxel's distance is its value clamped to `±background` when active, and
17
+ * `±background` by sign when inactive. Finally, values inside the band are
18
+ * clamped one quantization step inside it (`background - 2·background /
19
+ * (2^bits - 1)`) so they never decode as outside.
20
+ *
21
+ * The spec text (§8) instead point-samples and encodes by the source's active
22
+ * state; that stays the default (`levelSetSampler: 'spec'`, DIVERGES V17).
23
+ */
24
+ import { VDBToolsError } from "../errors.js";
25
+ /** Sub-samples on each axis for texels that cross the surface (his `filterSamples`). */
26
+ const FILTER_SAMPLES = 4;
27
+ /**
28
+ * His `sampleLevelSetGrid`: samples a level set over `bbox` at `dimensions`
29
+ * (x fastest) and applies the band limit for `bits`.
30
+ */
31
+ export function sampleWvdbLevelSetSurfaceMean(source, bbox, dimensions, bits = 8) {
32
+ const [width, height, depth] = dimensions;
33
+ const values = new Float32Array(width * height * depth);
34
+ const background = source.background;
35
+ if (!source.bbox || !bbox)
36
+ return values.fill(background);
37
+ const access = source.index;
38
+ if (!access) {
39
+ throw new VDBToolsError("VDB_BAD_OPTION", `levelSetSampler 'surface-mean': source "${source.name}" has no index access (use wvdbSourceFromVdbGrid or wvdbSourceFromNvdb)`);
40
+ }
41
+ const min = bbox[0];
42
+ const size = [bbox[1][0] - min[0], bbox[1][1] - min[1], bbox[1][2] - min[2]];
43
+ const world = [0, 0, 0];
44
+ const index = [0, 0, 0];
45
+ const rounded = [0, 0, 0];
46
+ const corner = [0, 0, 0];
47
+ const toIndex = (x, y, z) => {
48
+ world[0] = min[0] + (x / width) * size[0];
49
+ world[1] = min[1] + (y / height) * size[1];
50
+ world[2] = min[2] + (z / depth) * size[2];
51
+ return access.toIndex(world, index);
52
+ };
53
+ // His grid.getValue / isActive round the position (Vector3.round: Math.round per axis).
54
+ const lookup = (p) => {
55
+ rounded[0] = Math.round(p[0]);
56
+ rounded[1] = Math.round(p[1]);
57
+ rounded[2] = Math.round(p[2]);
58
+ return access.voxel(rounded);
59
+ };
60
+ // getVoxelDistance: inactive voxels are only outside (+b) or inside (-b); values clamp to the band.
61
+ const voxelDistance = (p) => {
62
+ const { value, active } = lookup(p);
63
+ if (!Number.isFinite(value))
64
+ return background;
65
+ if (!active)
66
+ return value < 0.0 ? -background : background;
67
+ return Math.min(Math.max(value, -background), background);
68
+ };
69
+ // getTrilinearDistance: trilinear only near the surface; far voxels keep the nearest value.
70
+ const trilinearDistance = (p) => {
71
+ const nearest = voxelDistance(p);
72
+ if (Math.abs(nearest) >= background)
73
+ return nearest;
74
+ const x0 = Math.floor(p[0]);
75
+ const y0 = Math.floor(p[1]);
76
+ const z0 = Math.floor(p[2]);
77
+ const wx = p[0] - x0;
78
+ const wy = p[1] - y0;
79
+ const wz = p[2] - z0;
80
+ let value = 0.0;
81
+ for (let i = 0; i < 8; i++) {
82
+ const dx = i & 1;
83
+ const dy = (i >> 1) & 1;
84
+ const dz = (i >> 2) & 1;
85
+ const weight = (dx ? wx : 1.0 - wx) * (dy ? wy : 1.0 - wy) * (dz ? wz : 1.0 - wz);
86
+ if (weight > 0.0) {
87
+ corner[0] = x0 + dx;
88
+ corner[1] = y0 + dy;
89
+ corner[2] = z0 + dz;
90
+ value += weight * voxelDistance(corner);
91
+ }
92
+ }
93
+ return value;
94
+ };
95
+ // Texel size in voxels.
96
+ const texel = access.toIndexVector([size[0] / width, size[1] / height, size[2] / depth], [0, 0, 0]);
97
+ const filter = Math.max(Math.abs(texel[0]), Math.abs(texel[1]), Math.abs(texel[2])) > 1.0;
98
+ // Signs at texel corners, one corner slice for each side of the texel row.
99
+ const cornersX = width + 1;
100
+ const cornerSlice = cornersX * (height + 1);
101
+ let lowerSigns = new Uint8Array(filter ? cornerSlice : 0);
102
+ let upperSigns = new Uint8Array(filter ? cornerSlice : 0);
103
+ const fillSigns = (signs, z) => {
104
+ for (let y = 0; y <= height; y++) {
105
+ for (let x = 0; x <= width; x++) {
106
+ signs[x + y * cornersX] = lookup(toIndex(x, y, z)).value < 0.0 ? 1 : 0;
107
+ }
108
+ }
109
+ };
110
+ const crossesSurface = (x, y) => {
111
+ const first = lowerSigns[x + y * cornersX];
112
+ for (let i = 1; i < 8; i++) {
113
+ const signs = (i >> 2) & 1 ? upperSigns : lowerSigns;
114
+ if (signs[x + (i & 1) + (y + ((i >> 1) & 1)) * cornersX] !== first)
115
+ return true;
116
+ }
117
+ return false;
118
+ };
119
+ if (filter)
120
+ fillSigns(lowerSigns, 0);
121
+ const subSamples = FILTER_SAMPLES * FILTER_SAMPLES * FILTER_SAMPLES;
122
+ let offset = 0;
123
+ for (let z = 0; z < depth; z++) {
124
+ if (filter)
125
+ fillSigns(upperSigns, z + 1);
126
+ for (let y = 0; y < height; y++) {
127
+ for (let x = 0; x < width; x++, offset++) {
128
+ if (filter && crossesSurface(x, y)) {
129
+ let sum = 0.0;
130
+ for (let i = 0; i < subSamples; i++) {
131
+ const sx = (i % FILTER_SAMPLES) + 0.5;
132
+ const sy = (Math.floor(i / FILTER_SAMPLES) % FILTER_SAMPLES) + 0.5;
133
+ const sz = Math.floor(i / (FILTER_SAMPLES * FILTER_SAMPLES)) + 0.5;
134
+ sum += voxelDistance(toIndex(x + sx / FILTER_SAMPLES, y + sy / FILTER_SAMPLES, z + sz / FILTER_SAMPLES));
135
+ }
136
+ values[offset] = sum / subSamples;
137
+ }
138
+ else {
139
+ values[offset] = trilinearDistance(toIndex(x + 0.5, y + 0.5, z + 0.5));
140
+ }
141
+ }
142
+ }
143
+ [lowerSigns, upperSigns] = [upperSigns, lowerSigns];
144
+ }
145
+ // Values in the band stay one quantization step inside it, so they never decode as outside.
146
+ const bandLimit = background - (2.0 * background) / ((1 << bits) - 1);
147
+ for (let i = 0; i < values.length; i++) {
148
+ if (Math.abs(values[i]) < background)
149
+ values[i] = Math.min(Math.max(values[i], -bandLimit), bandLimit);
150
+ }
151
+ return values;
152
+ }
153
+ //# sourceMappingURL=level-set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"level-set.js","sourceRoot":"","sources":["../../../src/tools/wvdb/level-set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA6B7C,wFAAwF;AACxF,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAA0B,EAC1B,IAAoB,EACpB,UAAoB,EACpB,OAAiB,CAAC;IAElB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,KAAK,GAAG,MAAM,GAAG,KA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AE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;gBACzE,CAAC;YACH,CAAC;QACH,CAAC;QACD,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;IAED,4FAA4F;IAC5F,MAAM,SAAS,GAAG,UAAU,GAAG,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,GAAG,UAAU;YAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;IAC3G,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * level-set.ts — mjurczyk's level-set bake sampler (`sampleLevelSet`), an\n * option of the `.wvdb` bake (`levelSetSampler: 'surface-mean'`, K4.13).\n *\n * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345:\n * `src/openvdb/utils/levelSet.js` (`sampleLevelSet`, `getVoxelDistance`,\n * `getTrilinearDistance`) and `src/wvdb/bake.js` (`sampleLevelSetGrid`, the\n * band limit). His arithmetic order is kept so the output is bit-identical.\n *\n * What it does (his notes, restated): a level set's narrow band is often\n * thinner than a texel, so a point sample is only inside or outside and the\n * surface gets steps. When texels are larger than a voxel, a texel whose eight\n * corners do not all have the same sign (it crosses the surface) is the mean\n * of 4x4x4 sub-samples inside it; every other texel is a trilinear sample at\n * its centre (only near the surface; far voxels keep the nearest value). A\n * voxel's distance is its value clamped to `±background` when active, and\n * `±background` by sign when inactive. Finally, values inside the band are\n * clamped one quantization step inside it (`background - 2·background /\n * (2^bits - 1)`) so they never decode as outside.\n *\n * The spec text (§8) instead point-samples and encodes by the source's active\n * state; that stays the default (`levelSetSampler: 'spec'`, DIVERGES V17).\n */\n\nimport { VDBToolsError } from \"../errors.js\";\nimport type { WvdbBits, WvdbBox, WvdbVec3 } from \"./format.js\";\n\n/** Index-space access to a sample source (axis-aligned or affine map). */\nexport interface WvdbIndexAccess {\n /**\n * World position → fractional index coordinate (the grid's inverse map), into `out`.\n * @param world The world position.\n * @param out Receives the index coordinate (returned).\n */\n toIndex(world: WvdbVec3, out: WvdbVec3): WvdbVec3;\n /**\n * A world-space vector → index units (the inverse Jacobian), into `out`.\n * @param vector The world-space vector.\n * @param out Receives the vector in index units (returned).\n */\n toIndexVector(vector: WvdbVec3, out: WvdbVec3): WvdbVec3;\n /** Value and active state of an integer voxel (inactive tile values included). */\n voxel(ijk: [number, number, number]): { value: number; active: boolean };\n}\n\n/** The part of a sample source this sampler reads. */\nexport interface WvdbLevelSetSource {\n name: string;\n background: number;\n bbox: WvdbBox | null;\n index?: WvdbIndexAccess;\n}\n\n/** Sub-samples on each axis for texels that cross the surface (his `filterSamples`). */\nconst FILTER_SAMPLES = 4;\n\n/**\n * His `sampleLevelSetGrid`: samples a level set over `bbox` at `dimensions`\n * (x fastest) and applies the band limit for `bits`.\n */\nexport function sampleWvdbLevelSetSurfaceMean(\n source: WvdbLevelSetSource,\n bbox: WvdbBox | null,\n dimensions: WvdbVec3,\n bits: WvdbBits = 8,\n): Float32Array {\n const [width, height, depth] = dimensions;\n const values = new Float32Array(width * height * depth);\n const background = source.background;\n if (!source.bbox || !bbox) return values.fill(background);\n const access = source.index;\n if (!access) {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", `levelSetSampler 'surface-mean': source \"${source.name}\" has no index access (use wvdbSourceFromVdbGrid or wvdbSourceFromNvdb)`);\n }\n const min = bbox[0];\n const size: WvdbVec3 = [bbox[1][0] - min[0], bbox[1][1] - min[1], bbox[1][2] - min[2]];\n\n const world: WvdbVec3 = [0, 0, 0];\n const index: WvdbVec3 = [0, 0, 0];\n const rounded: [number, number, number] = [0, 0, 0];\n const corner: WvdbVec3 = [0, 0, 0];\n\n const toIndex = (x: number, y: number, z: number): WvdbVec3 => {\n world[0] = min[0] + (x / width) * size[0];\n world[1] = min[1] + (y / height) * size[1];\n world[2] = min[2] + (z / depth) * size[2];\n return access.toIndex(world, index);\n };\n\n // His grid.getValue / isActive round the position (Vector3.round: Math.round per axis).\n const lookup = (p: WvdbVec3): { value: number; active: boolean } => {\n rounded[0] = Math.round(p[0]);\n rounded[1] = Math.round(p[1]);\n rounded[2] = Math.round(p[2]);\n return access.voxel(rounded);\n };\n\n // getVoxelDistance: inactive voxels are only outside (+b) or inside (-b); values clamp to the band.\n const voxelDistance = (p: WvdbVec3): number => {\n const { value, active } = lookup(p);\n if (!Number.isFinite(value)) return background;\n if (!active) return value < 0.0 ? -background : background;\n return Math.min(Math.max(value, -background), background);\n };\n\n // getTrilinearDistance: trilinear only near the surface; far voxels keep the nearest value.\n const trilinearDistance = (p: WvdbVec3): number => {\n const nearest = voxelDistance(p);\n if (Math.abs(nearest) >= background) return nearest;\n const x0 = Math.floor(p[0]);\n const y0 = Math.floor(p[1]);\n const z0 = Math.floor(p[2]);\n const wx = p[0] - x0;\n const wy = p[1] - y0;\n const wz = p[2] - z0;\n let value = 0.0;\n for (let i = 0; i < 8; i++) {\n const dx = i & 1;\n const dy = (i >> 1) & 1;\n const dz = (i >> 2) & 1;\n const weight = (dx ? wx : 1.0 - wx) * (dy ? wy : 1.0 - wy) * (dz ? wz : 1.0 - wz);\n if (weight > 0.0) {\n corner[0] = x0 + dx;\n corner[1] = y0 + dy;\n corner[2] = z0 + dz;\n value += weight * voxelDistance(corner);\n }\n }\n return value;\n };\n\n // Texel size in voxels.\n const texel = access.toIndexVector([size[0] / width, size[1] / height, size[2] / depth], [0, 0, 0]);\n const filter = Math.max(Math.abs(texel[0]), Math.abs(texel[1]), Math.abs(texel[2])) > 1.0;\n\n // Signs at texel corners, one corner slice for each side of the texel row.\n const cornersX = width + 1;\n const cornerSlice = cornersX * (height + 1);\n let lowerSigns = new Uint8Array(filter ? cornerSlice : 0);\n let upperSigns = new Uint8Array(filter ? cornerSlice : 0);\n\n const fillSigns = (signs: Uint8Array, z: number): void => {\n for (let y = 0; y <= height; y++) {\n for (let x = 0; x <= width; x++) {\n signs[x + y * cornersX] = lookup(toIndex(x, y, z)).value < 0.0 ? 1 : 0;\n }\n }\n };\n\n const crossesSurface = (x: number, y: number): boolean => {\n const first = lowerSigns[x + y * cornersX];\n for (let i = 1; i < 8; i++) {\n const signs = (i >> 2) & 1 ? upperSigns : lowerSigns;\n if (signs[x + (i & 1) + (y + ((i >> 1) & 1)) * cornersX] !== first) return true;\n }\n return false;\n };\n\n if (filter) fillSigns(lowerSigns, 0);\n const subSamples = FILTER_SAMPLES * FILTER_SAMPLES * FILTER_SAMPLES;\n let offset = 0;\n for (let z = 0; z < depth; z++) {\n if (filter) fillSigns(upperSigns, z + 1);\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++, offset++) {\n if (filter && crossesSurface(x, y)) {\n let sum = 0.0;\n for (let i = 0; i < subSamples; i++) {\n const sx = (i % FILTER_SAMPLES) + 0.5;\n const sy = (Math.floor(i / FILTER_SAMPLES) % FILTER_SAMPLES) + 0.5;\n const sz = Math.floor(i / (FILTER_SAMPLES * FILTER_SAMPLES)) + 0.5;\n sum += voxelDistance(toIndex(x + sx / FILTER_SAMPLES, y + sy / FILTER_SAMPLES, z + sz / FILTER_SAMPLES));\n }\n values[offset] = sum / subSamples;\n } else {\n values[offset] = trilinearDistance(toIndex(x + 0.5, y + 0.5, z + 0.5));\n }\n }\n }\n [lowerSigns, upperSigns] = [upperSigns, lowerSigns];\n }\n\n // Values in the band stay one quantization step inside it, so they never decode as outside.\n const bandLimit = background - (2.0 * background) / ((1 << bits) - 1);\n for (let i = 0; i < values.length; i++) {\n if (Math.abs(values[i]!) < background) values[i] = Math.min(Math.max(values[i]!, -bandLimit), bandLimit);\n }\n return values;\n}\n"]}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * `.wvdb` dense level → NanoVDB FLOAT grid with identical voxels (K3.2, R1 §6 Step 2 A/B).
3
+ *
4
+ * The sparse-vs-dense A/B renders the same voxels through both samplers, so the only difference
5
+ * is the sampler (hardware trilinear on `r8unorm` vs the sparse 8-tap trilinear). This takes the
6
+ * exact texels the dense source uploads (`wvdbDenseVolume`, his 8-bit `clamp(v / scale, 0, 1)`) and
7
+ * writes each one as the f32 the GPU decodes from `r8unorm`: `k / 255`. Texel `(x, y, z)` becomes
8
+ * index voxel `(x, y, z)`; non-zero texels are active, zero texels are the 0 background (so the
9
+ * grid's stats are the mean of the non-zero texels, his `getDensityStats` rule up to the f32 sum).
10
+ *
11
+ * The unit box of the volume maps to the index box `[0, dims − 1]` (pass it as the sparse source's
12
+ * `indexBox`: the built grid's own bbox is the active voxels' only). The Map scales each axis by that
13
+ * axis's voxel size in the `.wvdb` box (`(bbox.max − bbox.min) / dims`: a bake rounds each side's
14
+ * texel count on its own, so voxels are generally not cubic) with the first voxel centre at
15
+ * `bbox.min + voxel / 2`, where the dense texture puts it. CPU tools (`vdbResampleError`, a
16
+ * world-space sample through the Map) then compare the grid with its source in world space; the
17
+ * froxel renderer places volumes by their box, not the grid's Map. Without a box the Map is the identity.
18
+ */
19
+ import { type VDBBuiltGrid } from "../nanovdb/serialize.js";
20
+ import type { WvdbDenseVolume } from "./dense.js";
21
+ /** Options of {@link wvdbDenseToNvdb}. */
22
+ export interface WvdbDenseToNvdbOptions {
23
+ /** Channel to convert (a scalar one). Default `'density'`. */
24
+ channel?: "density" | "mask" | "emission";
25
+ /** Grid name. Default: the channel's grid name in the `.wvdb`. */
26
+ gridName?: string;
27
+ }
28
+ /** The converted grid plus the index box the dense texture covered. */
29
+ export interface WvdbNvdbGrid extends VDBBuiltGrid {
30
+ /** `[0, 0, 0]` to `dims − 1`: the dense texture's voxels (inclusive). */
31
+ readonly textureIndexBox: {
32
+ min: [number, number, number];
33
+ max: [number, number, number];
34
+ };
35
+ /**
36
+ * K5.9: the `vdbSparseSource` options (`@pmndrs/vdb/three`) that line a sparse copy up with the dense source: the
37
+ * texture's index box, the dense density stats (so `normalizeDensity` divides by the same mean) and the `.wvdb`
38
+ * box (when it has one). Spread them in: `vdbSparseSource(grids, { density: id }, { ...grid.sparseSourceOptions, lod })`.
39
+ * For an aux channel (mask, emission) pass `textureIndexBox` as its `auxIndexBoxes` entry instead.
40
+ */
41
+ readonly sparseSourceOptions: {
42
+ readonly indexBox: {
43
+ min: [number, number, number];
44
+ max: [number, number, number];
45
+ };
46
+ readonly stats: {
47
+ meanNonZero: number;
48
+ max: number;
49
+ activeVoxels: number;
50
+ };
51
+ readonly bbox?: [[number, number, number], [number, number, number]];
52
+ };
53
+ }
54
+ /**
55
+ * Converts one scalar channel of a dense `.wvdb` level to a NanoVDB FLOAT grid, voxel for voxel.
56
+ * @param volume The dense volume ({@link wvdbDenseVolume}).
57
+ * @param o The channel and the grid name.
58
+ */
59
+ export declare function wvdbDenseToNvdb(volume: WvdbDenseVolume, o?: WvdbDenseToNvdbOptions): WvdbNvdbGrid;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * `.wvdb` dense level → NanoVDB FLOAT grid with identical voxels (K3.2, R1 §6 Step 2 A/B).
3
+ *
4
+ * The sparse-vs-dense A/B renders the same voxels through both samplers, so the only difference
5
+ * is the sampler (hardware trilinear on `r8unorm` vs the sparse 8-tap trilinear). This takes the
6
+ * exact texels the dense source uploads (`wvdbDenseVolume`, his 8-bit `clamp(v / scale, 0, 1)`) and
7
+ * writes each one as the f32 the GPU decodes from `r8unorm`: `k / 255`. Texel `(x, y, z)` becomes
8
+ * index voxel `(x, y, z)`; non-zero texels are active, zero texels are the 0 background (so the
9
+ * grid's stats are the mean of the non-zero texels, his `getDensityStats` rule up to the f32 sum).
10
+ *
11
+ * The unit box of the volume maps to the index box `[0, dims − 1]` (pass it as the sparse source's
12
+ * `indexBox`: the built grid's own bbox is the active voxels' only). The Map scales each axis by that
13
+ * axis's voxel size in the `.wvdb` box (`(bbox.max − bbox.min) / dims`: a bake rounds each side's
14
+ * texel count on its own, so voxels are generally not cubic) with the first voxel centre at
15
+ * `bbox.min + voxel / 2`, where the dense texture puts it. CPU tools (`vdbResampleError`, a
16
+ * world-space sample through the Map) then compare the grid with its source in world space; the
17
+ * froxel renderer places volumes by their box, not the grid's Map. Without a box the Map is the identity.
18
+ */
19
+ import { VDBToolsError } from "../errors.js";
20
+ import { vdbBuildFromDenseDetailed } from "../nanovdb/serialize.js";
21
+ /**
22
+ * Converts one scalar channel of a dense `.wvdb` level to a NanoVDB FLOAT grid, voxel for voxel.
23
+ * @param volume The dense volume ({@link wvdbDenseVolume}).
24
+ * @param o The channel and the grid name.
25
+ */
26
+ export function wvdbDenseToNvdb(volume, o = {}) {
27
+ const channel = o.channel ?? "density";
28
+ const tex = volume[channel];
29
+ if (!tex)
30
+ throw new VDBToolsError("VDB_BAD_OPTION", `wvdbDenseToNvdb: the volume has no ${channel} channel`);
31
+ if (tex.texelBytes !== 1)
32
+ throw new VDBToolsError("VDB_BAD_OPTION", `wvdbDenseToNvdb: the ${channel} channel is not scalar (r8unorm)`);
33
+ const [w, h, d] = tex.dimensions;
34
+ const values = new Float32Array(w * h * d);
35
+ // Texels are x fastest (x + (y + z·h)·w); vdbBuildFromDense reads x-major ((x·h + y)·d + z).
36
+ for (let z = 0; z < d; z++)
37
+ for (let y = 0; y < h; y++)
38
+ for (let x = 0; x < w; x++)
39
+ values[(x * h + y) * d + z] = tex.data[x + (y + z * h) * w] / 255;
40
+ const bbox = volume.bbox;
41
+ // Per axis (G15a): a bake rounds each side's texel count on its own, so the voxels are not cubic.
42
+ const voxelSize = [w, h, d].map((n, a) => {
43
+ const v = bbox ? (bbox[1][a] - bbox[0][a]) / n : 1;
44
+ return v > 0 && Number.isFinite(v) ? v : 1;
45
+ });
46
+ const worldOrigin = bbox
47
+ ? [bbox[0][0] + voxelSize[0] / 2, bbox[0][1] + voxelSize[1] / 2, bbox[0][2] + voxelSize[2] / 2]
48
+ : [0, 0, 0];
49
+ const built = vdbBuildFromDenseDetailed(values, [w, h, d], {
50
+ voxelSize,
51
+ worldOrigin,
52
+ background: 0,
53
+ gridName: o.gridName ?? volume.gridNames[channel] ?? channel,
54
+ gridClass: "FogVolume",
55
+ });
56
+ const textureIndexBox = { min: [0, 0, 0], max: [w - 1, h - 1, d - 1] };
57
+ const sparseSourceOptions = {
58
+ indexBox: { min: [...textureIndexBox.min], max: [...textureIndexBox.max] },
59
+ stats: { meanNonZero: volume.meanDensity, max: volume.maxDensity, activeVoxels: volume.activeTexels },
60
+ ...(bbox ? { bbox: [[...bbox[0]], [...bbox[1]]] } : {}),
61
+ };
62
+ return { ...built, textureIndexBox, sparseSourceOptions };
63
+ }
64
+ //# sourceMappingURL=nanovdb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nanovdb.js","sourceRoot":"","sources":["../../../src/tools/wvdb/nanovdb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAqB,MAAM,yBAAyB,CAAC;AA4BvF;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB,EAAE,IAA4B,EAAE;IACrF,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,IAAI,SAAS,CAAC;IACvC,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,aAAa,CAAC,gBAAgB,EAAE,sCAAsC,OAAO,UAAU,CAAC,CAAC;IAC7G,IAAI,GAAG,CAAC,UAAU,KAAK,CAAC;QAAE,MAAM,IAAI,aAAa,CAAC,gBAAgB,EAAE,wB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,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAyD,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChH,CAAC;IACF,OAAO,EAAE,GAAG,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["/**\n * `.wvdb` dense level → NanoVDB FLOAT grid with identical voxels (K3.2, R1 §6 Step 2 A/B).\n *\n * The sparse-vs-dense A/B renders the same voxels through both samplers, so the only difference\n * is the sampler (hardware trilinear on `r8unorm` vs the sparse 8-tap trilinear). This takes the\n * exact texels the dense source uploads (`wvdbDenseVolume`, his 8-bit `clamp(v / scale, 0, 1)`) and\n * writes each one as the f32 the GPU decodes from `r8unorm`: `k / 255`. Texel `(x, y, z)` becomes\n * index voxel `(x, y, z)`; non-zero texels are active, zero texels are the 0 background (so the\n * grid's stats are the mean of the non-zero texels, his `getDensityStats` rule up to the f32 sum).\n *\n * The unit box of the volume maps to the index box `[0, dims − 1]` (pass it as the sparse source's\n * `indexBox`: the built grid's own bbox is the active voxels' only). The Map scales each axis by that\n * axis's voxel size in the `.wvdb` box (`(bbox.max − bbox.min) / dims`: a bake rounds each side's\n * texel count on its own, so voxels are generally not cubic) with the first voxel centre at\n * `bbox.min + voxel / 2`, where the dense texture puts it. CPU tools (`vdbResampleError`, a\n * world-space sample through the Map) then compare the grid with its source in world space; the\n * froxel renderer places volumes by their box, not the grid's Map. Without a box the Map is the identity.\n */\n\nimport { VDBToolsError } from \"../errors.js\";\nimport { vdbBuildFromDenseDetailed, type VDBBuiltGrid } from \"../nanovdb/serialize.js\";\nimport type { WvdbDenseVolume } from \"./dense.js\";\n\n/** Options of {@link wvdbDenseToNvdb}. */\nexport interface WvdbDenseToNvdbOptions {\n /** Channel to convert (a scalar one). Default `'density'`. */\n channel?: \"density\" | \"mask\" | \"emission\";\n /** Grid name. Default: the channel's grid name in the `.wvdb`. */\n gridName?: string;\n}\n\n/** The converted grid plus the index box the dense texture covered. */\nexport interface WvdbNvdbGrid extends VDBBuiltGrid {\n /** `[0, 0, 0]` to `dims − 1`: the dense texture's voxels (inclusive). */\n readonly textureIndexBox: { min: [number, number, number]; max: [number, number, number] };\n /**\n * K5.9: the `vdbSparseSource` options (`@pmndrs/vdb/three`) that line a sparse copy up with the dense source: the\n * texture's index box, the dense density stats (so `normalizeDensity` divides by the same mean) and the `.wvdb`\n * box (when it has one). Spread them in: `vdbSparseSource(grids, { density: id }, { ...grid.sparseSourceOptions, lod })`.\n * For an aux channel (mask, emission) pass `textureIndexBox` as its `auxIndexBoxes` entry instead.\n */\n readonly sparseSourceOptions: {\n readonly indexBox: { min: [number, number, number]; max: [number, number, number] };\n readonly stats: { meanNonZero: number; max: number; activeVoxels: number };\n readonly bbox?: [[number, number, number], [number, number, number]];\n };\n}\n\n/**\n * Converts one scalar channel of a dense `.wvdb` level to a NanoVDB FLOAT grid, voxel for voxel.\n * @param volume The dense volume ({@link wvdbDenseVolume}).\n * @param o The channel and the grid name.\n */\nexport function wvdbDenseToNvdb(volume: WvdbDenseVolume, o: WvdbDenseToNvdbOptions = {}): WvdbNvdbGrid {\n const channel = o.channel ?? \"density\";\n const tex = volume[channel];\n if (!tex) throw new VDBToolsError(\"VDB_BAD_OPTION\", `wvdbDenseToNvdb: the volume has no ${channel} channel`);\n if (tex.texelBytes !== 1) throw new VDBToolsError(\"VDB_BAD_OPTION\", `wvdbDenseToNvdb: the ${channel} channel is not scalar (r8unorm)`);\n const [w, h, d] = tex.dimensions;\n const values = new Float32Array(w * h * d);\n // Texels are x fastest (x + (y + z·h)·w); vdbBuildFromDense reads x-major ((x·h + y)·d + z).\n for (let z = 0; z < d; z++)\n for (let y = 0; y < h; y++)\n for (let x = 0; x < w; x++) values[(x * h + y) * d + z] = tex.data[x + (y + z * h) * w]! / 255;\n const bbox = volume.bbox;\n // Per axis (G15a): a bake rounds each side's texel count on its own, so the voxels are not cubic.\n const voxelSize = [w, h, d].map((n, a) => {\n const v = bbox ? (bbox[1][a]! - bbox[0][a]!) / n : 1;\n return v > 0 && Number.isFinite(v) ? v : 1;\n }) as [number, number, number];\n const worldOrigin: [number, number, number] = bbox\n ? [bbox[0][0] + voxelSize[0] / 2, bbox[0][1] + voxelSize[1] / 2, bbox[0][2] + voxelSize[2] / 2]\n : [0, 0, 0];\n const built = vdbBuildFromDenseDetailed(values, [w, h, d], {\n voxelSize,\n worldOrigin,\n background: 0,\n gridName: o.gridName ?? volume.gridNames[channel] ?? channel,\n gridClass: \"FogVolume\",\n });\n const textureIndexBox = { min: [0, 0, 0] as [number, number, number], max: [w - 1, h - 1, d - 1] as [number, number, number] };\n const sparseSourceOptions = {\n indexBox: { min: [...textureIndexBox.min] as [number, number, number], max: [...textureIndexBox.max] as [number, number, number] },\n stats: { meanNonZero: volume.meanDensity, max: volume.maxDensity, activeVoxels: volume.activeTexels },\n ...(bbox ? { bbox: [[...bbox[0]], [...bbox[1]]] as [[number, number, number], [number, number, number]] } : {}),\n };\n return { ...built, textureIndexBox, sparseSourceOptions };\n}\n"]}
@@ -0,0 +1,74 @@
1
+ import type { WvdbFile, WvdbLodEvent, WvdbVolumeLevel } from "./read.js";
2
+ import { type WvdbDenseOptions, type WvdbDenseTexture, type WvdbDenseVolume } from "./dense.js";
3
+ /** How {@link wvdbDensePartialVolume} shows the bricks of a partial LOD that have not arrived yet. */
4
+ export type WvdbDensePartialFill = "upsample" | "background";
5
+ /** Options of {@link wvdbDensePartialVolume}: those of `wvdbDenseVolume` (but the LOD: the event's) and the fill. */
6
+ export interface WvdbDensePartialOptions extends Omit<WvdbDenseOptions, "lod"> {
7
+ /**
8
+ * Bricks stored but not decoded yet: `'upsample'` (default) fills them from the finest complete coarser LOD
9
+ * (his kernel's trilinear upsample; a `fill` on each texture, done by the core's dense source on the GPU or by
10
+ * {@link wvdbDenseResolve}); `'background'` leaves the background there until their page lands.
11
+ */
12
+ fill?: WvdbDensePartialFill;
13
+ /**
14
+ * The mip atlas of an upsampled partial LOD (`WvdbDenseFill.mips`): `'coarse'` (default) takes level 1 of the
15
+ * pending bricks from the coarser LOD, `'box'` builds it from the upsampled texels as his renderer does.
16
+ */
17
+ fillMips?: "coarse" | "box";
18
+ }
19
+ /** Weights are integers in [0, 256]: 8 fractional bits, as a GPU's trilinear filter. */
20
+ export declare const WVDB_UPSAMPLE_WEIGHT_ONE = 256;
21
+ /**
22
+ * One axis of the upsample from `sourceSize` texels to `size` (his `axis`, wvdbKernel.js L125–135): target texel `i`
23
+ * reads source position `clamp((i + ½)·sourceSize/size − ½, 0, sourceSize − 1)`; `lower`/`upper` are the two taps
24
+ * and `weight` the upper tap's weight in 1/256 (the exact fraction rounded half up), in integers.
25
+ */
26
+ export declare function wvdbUpsampleAxis(size: number, sourceSize: number): {
27
+ lower: Uint32Array;
28
+ upper: Uint32Array;
29
+ weight: Uint32Array;
30
+ };
31
+ /** The bricks of `level` that are stored and not decoded yet (one bit per brick), and their count. */
32
+ export declare function wvdbPendingBricks(level: WvdbVolumeLevel): {
33
+ pending: Uint32Array;
34
+ count: number;
35
+ };
36
+ /**
37
+ * CPU twin of the core's fill kernel (`vdbDenseFillCs`): `tex.data` with every pending brick replaced by the
38
+ * coarser texels upsampled to its size, per component, in integers: `c = Σ v · wx · wy · wz` over the 8 taps
39
+ * (weights in 1/256), then `(c + 2²³) >> 24`. Without a fill, a copy of `tex.data`.
40
+ */
41
+ export declare function wvdbUpsampleTexels(tex: WvdbDenseTexture): Uint8Array<ArrayBuffer>;
42
+ /** True when a fill's mip level 1 comes from its coarser LOD: `mips: 'coarse'` and the coarse size is level 1's. */
43
+ export declare function wvdbFillCoarseMips(tex: WvdbDenseTexture): boolean;
44
+ /**
45
+ * CPU twin of a texture's GPU fill: the filled texels and (with a mip atlas) the atlas built from them, level 1 of
46
+ * the pending bricks from the coarser LOD with `mips: 'coarse'` (`vdbDenseMipCs`); no `fill`.
47
+ */
48
+ export declare function wvdbDenseResolveTexture(tex: WvdbDenseTexture): WvdbDenseTexture;
49
+ /**
50
+ * The CPU twin of the core dense source's fill (K4.22): `volume` with every texture's pending bricks upsampled
51
+ * from its coarser LOD and its mip atlas rebuilt from the result, as plain textures (no `fill`). Byte for byte
52
+ * what `vdbDenseSource` uploads for `volume` on the GPU. A host without the core uploads this instead. The
53
+ * stats are `volume`'s (baked, or from the texels with the pending bricks at background).
54
+ */
55
+ export declare function wvdbDenseResolve(volume: WvdbDenseVolume): WvdbDenseVolume;
56
+ /**
57
+ * The dense volume of a `.wvdb` stream event (`WvdbStreamReader({ partialLods: true })`): for a complete LOD,
58
+ * `wvdbDenseVolume(file, { lod })`; for a partial one, the LOD's levels as decoded so far, with (by default) a
59
+ * `fill` on each texture: its stored, undecoded bricks and the finest complete coarser LOD's texels to upsample
60
+ * there. Pass the result to `vdbDenseSource.replace` / `vdbDenseTextures(…).replace` like any LOD; the core fills
61
+ * on the GPU. The texels are copied now: later pages do not change the returned volume.
62
+ *
63
+ * The density mean is the header's baked one when the file has it (scale 1); else it comes from the decoded
64
+ * texels (pending bricks at background), so `normalizeDensity` may move while a LOD streams in. `maxDensity`
65
+ * also bounds the coarse texels (an upsampled texel never exceeds them).
66
+ *
67
+ * const reader = new WvdbStreamReader({ partialLods: true });
68
+ * for (const e of reader.push(bytes)) source.replace(wvdbDensePartialVolume(reader.file!, e));
69
+ *
70
+ * @param file The reader's file (`reader.file`): its grids hold the complete coarser LODs.
71
+ * @param event A stream event (partial or complete).
72
+ * @param o Grids, scales, mipmaps (as `wvdbDenseVolume`) and the fill.
73
+ */
74
+ export declare function wvdbDensePartialVolume(file: WvdbFile, event: WvdbLodEvent, o?: WvdbDensePartialOptions): WvdbDenseVolume;