@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
@@ -4,12 +4,13 @@
4
4
  // Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
5
5
  // Changes: TypeScript; takes a VDBVolumeSource (dense `.wvdb`, or the sparse pool since K3.2) instead of resampling grids
6
6
  // on the CPU (his L279–552: conversion, progressive upload, level sets, points, instances); one
7
- // volume per frame volume; the mean density is the source's. Divergences: DIVERGES.md (K3.1 rows),
8
- // V23–V25.
7
+ // volume per frame volume; the mean density is the source's; K6.8: the props are the core's `VDBFrameVolumeParams`
8
+ // (the renderer copies them each update), the emission colour is core data (`VDBEmissionColor`). Divergences:
9
+ // DIVERGES.md (K3.1 rows), V23–V25.
9
10
  /**
10
11
  * A volume in the froxel renderer (his `FrameVolume`, R1 §2): a `Group` whose proxy mesh draws the
11
- * frame. Its props are his (same names and defaults) for the ported subset; density is read only
12
- * through the source's nodes (`vdbVolumeNodes`), so Step 2 swaps in the sparse source.
12
+ * frame. Its props are his (same names and defaults) for the ported subset; the renderer copies them into the core's
13
+ * `VDBFrameVolumeParams` at each render.
13
14
  *
14
15
  * const source = vdbDenseTextures(wvdbDenseVolume(readWvdb(bytes)));
15
16
  * const volume = new VDBFrameVolume(source, { extinction: 100 }); // box: the source's (volume.bbox)
@@ -26,8 +27,7 @@
26
27
  */
27
28
  import * as THREE from "three";
28
29
  import { VDBError } from "../../core/errors.js";
29
- import { vdbVolumeUniforms } from "../volume-source.js";
30
- import { vdbFrameAllLights } from "./lights.js";
30
+ import { VDB_FRAME_ALL_LIGHTS } from "../../core/frame/types.js";
31
31
  import { getFrameMediumProps } from "./medium.js";
32
32
  import { vdbFrameRenderer } from "./renderer.js";
33
33
  // NOTE Draw the frame after all other transparent objects
@@ -46,46 +46,72 @@ const boxMatrix = (box, target) => {
46
46
  const size = box.getSize(new THREE.Vector3()).max(new THREE.Vector3(1e-6, 1e-6, 1e-6));
47
47
  return target.compose(center, new THREE.Quaternion(), size);
48
48
  };
49
+ /**
50
+ * A volume drawn by the froxel renderer: a `Group` whose proxy mesh composites the volume's density and light over
51
+ * the scene (his `FrameVolume`). Add it to a scene and render as usual; its props are live fields.
52
+ */
49
53
  export class VDBFrameVolume extends THREE.Group {
54
+ /** Type flag. */
50
55
  isVDBFrameVolume = true;
56
+ /** The volume source the density (and emission) is read from. */
51
57
  source;
52
- sourceUniforms;
58
+ /** The froxel renderer that draws this volume. */
53
59
  frameRenderer;
60
+ /** The proxy mesh whose draw triggers the frame render and composites the volume. */
54
61
  proxy;
55
- volumes;
56
- /** Built by the renderer on first use (the source is compiled into it). */
57
- injectMaterial = null;
58
- /** 'frame' lighting: the density and shadow density materials, built by the renderer on first use (K3.3). */
59
- densityMaterial = null;
60
- shadowDensityMaterial = null;
61
- /** K3.6: the emission light's direction-pass material of this volume (made by the light on first use). */
62
- emissionDirectionMaterial = null;
62
+ /** The unit box → the volume box in local space (his `boxMatrix`); follows {@link VDBFrameVolume.bbox}. */
63
+ boxMatrix;
64
+ /** `matrixWorld × boxMatrix` of the last render (the core's `params.matrixWorld`). */
65
+ boxMatrixWorld = new THREE.Matrix4();
66
+ /** The emission colour; see {@link VDBFrameVolumeProps.emissionColor}. */
63
67
  emissionColor;
68
+ /** Albedo of the medium; see {@link VDBFrameVolumeProps.baseColor}. */
64
69
  baseColor;
70
+ /** Colour added to the emission; see {@link VDBFrameVolumeProps.scatterColor}. */
65
71
  scatterColor;
72
+ /** Optical depth of the longest box side at the mean density (with `normalizeDensity`). */
66
73
  extinction;
74
+ /** Extinction scale of each channel (spectral rendering). */
67
75
  extinctionScale;
76
+ /** Ångström exponent of the extinction spectrum: a number or a preset name. */
68
77
  angstromExponent;
69
78
  /** `'volume'` lighting: phase overrides (null: the renderer's `settings`); see {@link VDBFrameVolumeProps.phase}. */
70
79
  phase;
80
+ /** Forward `g` override of `'volume'` lighting (null: the renderer's). */
71
81
  phaseG;
82
+ /** Backward-lobe `g` override (null: the renderer's). */
72
83
  phaseBackG;
84
+ /** Backward-lobe weight override (null: the renderer's). */
73
85
  phaseBackWeight;
86
+ /** Wavelength exponent of `g` override (null: the renderer's). */
74
87
  phaseGExponent;
88
+ /** Multiplier of the density; see {@link VDBFrameVolumeProps.densityScale}. */
75
89
  densityScale;
90
+ /** Whether the density scale is divided by the mean density. */
76
91
  normalizeDensity;
77
92
  /** See {@link VDBFrameVolumeProps.densityMean}; null: the source's mean. */
78
93
  densityMean;
94
+ /** Densities at or below this read as 0. */
79
95
  densityCutoff;
96
+ /** Scales the optical depth of the shadow march. */
80
97
  absorbance;
98
+ /** Opacity of the composited volume, 0 to 1. */
81
99
  opacity;
100
+ /** Multiplier of the emission. */
82
101
  emissiveIntensity;
102
+ /** Kelvin at emission values 0 (x) and 1 (y). */
83
103
  temperatureRange;
104
+ /** Offset of the texture lookup in texture coordinates. */
84
105
  offset3D;
106
+ /** Texture wrapping of the lookup. */
85
107
  wrap3D;
108
+ /** Light types bitmask (`VDB_FRAME_LIGHT_BITS`) this volume receives. */
86
109
  lights;
110
+ /** Steps of the shadow march in `'volume'` lighting. */
87
111
  shadowSteps;
112
+ /** Whether the source's mip levels are sampled. */
88
113
  mipmaps;
114
+ /** Whether the sparse source's shadow march skips empty space (no effect on dense sources). */
89
115
  hdda;
90
116
  /**
91
117
  * The volume's box in its local space: the `bbox` prop, else the source's box, re-read
@@ -96,18 +122,27 @@ export class VDBFrameVolume extends THREE.Group {
96
122
  bbox;
97
123
  /** The medium fields at construction, for `setMedium(null)`. */
98
124
  initialMedium;
99
- /** `source.version` the uniforms were last updated for. */
125
+ /** `source.version` the box was last read at. */
100
126
  sourceVersion;
101
127
  /** G16a / RV: the box is the source's (no `bbox` prop), so it follows the source. */
102
128
  boxFromSource;
103
- resolvedPhase = { phase: "henyey-greenstein", phaseG: 0.8, phaseBackG: -0.3, phaseBackWeight: 0.2, phaseGExponent: 0.0 };
129
+ resolvedPhase = { phase: "dual-lobe", phaseG: 0.8, phaseBackG: -0.3, phaseBackWeight: 0.2, phaseGExponent: 0.0 };
130
+ /**
131
+ * Makes a volume over a dense or sparse source. Throws `VDB_BAD_OPTION` for a source that is neither.
132
+ * @param source A source from `vdbDenseTextures()` or `vdbSparseSource()`.
133
+ * @param props {@link VDBFrameVolumeProps}; all optional.
134
+ */
104
135
  constructor(source, props = {}) {
105
136
  super();
106
- const ok = source && ((source.kind === "dense" && !!source.textures?.density) || (source.kind === "sparse" && typeof source.createNodes === "function"));
137
+ const ok = source && ((source.kind === "dense" && !!source.volume?.density) || (source.kind === "sparse" && !!source.grids));
107
138
  if (!ok) {
108
139
  throw new VDBError("VDB_BAD_OPTION", "VDBFrameVolume: pass a volume source from vdbDenseTextures() or vdbSparseSource() (@pmndrs/vdb/three).");
109
140
  }
110
- const { frameRenderer = vdbFrameRenderer(), bbox, baseColor = 0xffffff, scatterColor = 0x000000, extinction = 100.0, extinctionScale = [1.0, 1.0, 1.0], angstromExponent = "cloud", phase = null, phaseG = null, phaseBackG = null, phaseBackWeight = null, phaseGExponent = null, densityScale = 1.0, normalizeDensity = true, densityMean = null, densityCutoff = 0.0, absorbance = 1.0, opacity = 1.0, emissiveIntensity = 1.0, temperatureRange = [0.0, 6500.0], offset3D = new THREE.Vector3(), wrap3D = THREE.ClampToEdgeWrapping, lights = vdbFrameAllLights, shadowSteps = 32, mipmaps = true, emissionColor, hdda = false, } = props;
141
+ const color = props.emissionColor;
142
+ if (typeof color === "function") {
143
+ throw new VDBError("VDB_BAD_OPTION", "VDBFrameVolume: emissionColor is core data since 0.2.0 ('white', { spectrum: 'planck' | 'soot', exponent }, { lut } or { wgsl }), not a TSL hook; vdbFrameBlackbodyEmission(s, e) is { spectrum: s, exponent: e }.");
144
+ }
145
+ const { frameRenderer = vdbFrameRenderer(), bbox, baseColor = 0xffffff, scatterColor = 0x000000, extinction = 100.0, extinctionScale = [1.0, 1.0, 1.0], angstromExponent = "cloud", phase = null, phaseG = null, phaseBackG = null, phaseBackWeight = null, phaseGExponent = null, densityScale = 1.0, normalizeDensity = true, densityMean = null, densityCutoff = 0.0, absorbance = 1.0, opacity = 1.0, emissiveIntensity = 1.0, temperatureRange = [0.0, 6500.0], offset3D = new THREE.Vector3(), wrap3D = THREE.ClampToEdgeWrapping, lights = VDB_FRAME_ALL_LIGHTS, shadowSteps = 32, mipmaps = true, emissionColor, hdda = false, } = props;
111
146
  this.source = source;
112
147
  this.frameRenderer = frameRenderer;
113
148
  this.emissionColor = emissionColor;
@@ -136,9 +171,8 @@ export class VDBFrameVolume extends THREE.Group {
136
171
  this.mipmaps = mipmaps;
137
172
  this.hdda = hdda;
138
173
  this.initialMedium = { baseColor: this.baseColor.clone(), extinctionScale: this.extinctionScale.clone(), angstromExponent };
139
- this.sourceUniforms = vdbVolumeUniforms(source, { extinction, densityScale, normalizeDensity });
140
174
  this.sourceVersion = source.version;
141
- this.proxy = new THREE.Mesh(frameRenderer.createProxyGeometry(), frameRenderer.integrateMaterial);
175
+ this.proxy = new THREE.Mesh(frameRenderer.createProxyGeometry(), frameRenderer.proxyMaterial());
142
176
  this.proxy.frustumCulled = false;
143
177
  this.proxy.renderOrder = frameRenderOrder;
144
178
  this.proxy.onBeforeRender = (renderer, scene, camera) => {
@@ -149,19 +183,7 @@ export class VDBFrameVolume extends THREE.Group {
149
183
  const box = toBox(bbox, source);
150
184
  this.bbox = box;
151
185
  this.boxFromSource = bbox === undefined;
152
- this.volumes = [
153
- {
154
- matrix: boxMatrix(box, new THREE.Matrix4()),
155
- matrixWorld: new THREE.Matrix4(),
156
- localToView: new THREE.Matrix4(),
157
- viewToLocal: new THREE.Matrix4(),
158
- worldToLocal: new THREE.Matrix4(),
159
- worldBox: new THREE.Box3(),
160
- viewNear: 0.0,
161
- viewFar: 0.0,
162
- ready: true,
163
- },
164
- ];
186
+ this.boxMatrix = boxMatrix(box, new THREE.Matrix4());
165
187
  }
166
188
  /** The mean density `normalizeDensity` divides by: `densityMean` when set, else the source's mean of the non-zero texels (his `meanDensity`). */
167
189
  get meanDensity() {
@@ -208,18 +230,18 @@ export class VDBFrameVolume extends THREE.Group {
208
230
  s.spectral = true;
209
231
  return props;
210
232
  }
211
- /** densityScale for the shaders. normalizeDensity divides it by the mean density. */
233
+ /** The density scale the renderer draws with: `densityScale`, divided by the mean density with `normalizeDensity`. */
212
234
  getDensityScale() {
213
235
  const meanDensity = this.meanDensity;
214
236
  return this.normalizeDensity && meanDensity > 0.0 ? this.densityScale / meanDensity : this.densityScale;
215
237
  }
216
238
  /**
217
- * Re-read the source (textures, sizes, LOD levels). The renderer calls {@link VDBFrameVolume.syncSource} before
218
- * every draw, so a `source.replace()` needs no call; this forces it.
239
+ * Re-reads the source's box (a dense frame with another `.wvdb` box, or a `followImage` sparse source after its grid's
240
+ * image changed). The renderer calls {@link VDBFrameVolume.syncSource} before every render, so a `source.replace()`
241
+ * needs no call; this forces it.
219
242
  */
220
243
  updateSource() {
221
244
  this.sourceVersion = this.source.version;
222
- this.sourceUniforms.update(this.source, { densityScale: this.densityScale, normalizeDensity: this.normalizeDensity });
223
245
  // G16a: a sparse source's box (a followImage source re-reads it after an image change). RV: a dense frame's
224
246
  // .wvdb box (his WVDB sequences give every frame its own box; a null box, an empty frame, keeps the last one).
225
247
  const sourceBox = this.source.kind === "sparse" ? this.source.bbox : this.source.volume.bbox;
@@ -229,27 +251,17 @@ export class VDBFrameVolume extends THREE.Group {
229
251
  if (b.min.x !== min[0] || b.min.y !== min[1] || b.min.z !== min[2] || b.max.x !== max[0] || b.max.y !== max[1] || b.max.z !== max[2]) {
230
252
  b.min.set(...min);
231
253
  b.max.set(...max);
232
- for (const volume of this.volumes)
233
- boxMatrix(b, volume.matrix);
254
+ boxMatrix(b, this.boxMatrix);
234
255
  }
235
256
  }
236
257
  }
237
- /** {@link VDBFrameVolume.updateSource} if the source changed since (its `version`: a resized dense frame, a replaced pool image). Cheap; called per draw. */
258
+ /** {@link VDBFrameVolume.updateSource} if the source changed since (its `version`: a resized dense frame, a replaced pool image). Cheap; called per render. */
238
259
  syncSource() {
239
260
  if (this.source.version !== this.sourceVersion)
240
261
  this.updateSource();
241
262
  }
242
- /** Frees the proxy geometry and the pass materials, and stops following the source (its uniforms). The source belongs to the caller. */
263
+ /** Frees the proxy geometry. The source belongs to the caller; the renderer drops the volume when it leaves the scene. */
243
264
  dispose() {
244
- this.sourceUniforms.dispose();
245
- this.injectMaterial?.dispose();
246
- this.injectMaterial = null;
247
- this.densityMaterial?.dispose();
248
- this.densityMaterial = null;
249
- this.shadowDensityMaterial?.dispose();
250
- this.shadowDensityMaterial = null;
251
- this.emissionDirectionMaterial?.dispose();
252
- this.emissionDirectionMaterial = null;
253
265
  this.proxy.geometry.dispose();
254
266
  }
255
267
  }
@@ -1 +1 @@
1
- {"version":3,"file":"volume.js","sourceRoot":"","sources":["../../../src/three/frame/volume.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mGAAmG;AACnG,mFAAmF;AACnF,4GAA4G;AAC5G,0HAA0H;AAC1H,gGAAgG;AAChG,mGAAmG;AACnG,WAAW;AAEX;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAkC,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAyB,MAAM,eAAe,CAAC;AAGxE,0DAA0D;AAC1D,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAiEjC,MAAM,KAAK,GAAG,CAAC,IAAiC,EAAE,MAA4B,EAAc,EAAE;IAC5F,IAAI,IAAI,YAAY,KAA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G,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;gBAClB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;oBAAE,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;IACH,CAAC;IAED,6JAA6J;IAC7J,UAAU;QACR,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,YAAY,EAAE,CAAC;IACtE,CAAC;IAED,wIAAwI;IACxI,OAAO;QACL,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,qBAAqB,EAAE,OAAO,EAAE,CAAC;QACtC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,yBAAyB,EAAE,OAAO,EAAE,CAAC;QAC1C,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/core/FrameVolume.js L8–11 (render order, all lights), L152–270 (props,\n// proxy), L339–353 (box matrix), L554–568 (getDensityScale), L624–650 (dispose).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript; takes a VDBVolumeSource (dense `.wvdb`, or the sparse pool since K3.2) instead of resampling grids\n// on the CPU (his L279–552: conversion, progressive upload, level sets, points, instances); one\n// volume per frame volume; the mean density is the source's. Divergences: DIVERGES.md (K3.1 rows),\n// V23–V25.\n\n/**\n * A volume in the froxel renderer (his `FrameVolume`, R1 §2): a `Group` whose proxy mesh draws the\n * frame. Its props are his (same names and defaults) for the ported subset; density is read only\n * through the source's nodes (`vdbVolumeNodes`), so Step 2 swaps in the sparse source.\n *\n * const source = vdbDenseTextures(wvdbDenseVolume(readWvdb(bytes)));\n * const volume = new VDBFrameVolume(source, { extinction: 100 }); // box: the source's (volume.bbox)\n * scene.add(volume); // then renderer.render(scene, camera) as usual\n * volume.frameRenderer.settings.multipleScattering = false;\n * volume.setMedium(\"fog\"); // a measured medium: albedo, spectrum, the renderer's phase\n *\n * The phase (K5.9): the renderer's `settings.phase*` is the phase of every volume it draws. `'frame'`\n * lighting lights all volumes in one pass with it; in `'volume'` lighting (each volume marches its own\n * light) a volume's own `phase*` props, when set, override it for that volume. The source (dense or\n * sparse), its kind and its LOD are fixed at construction: make a new source and a new volume to change\n * them (`source.replace` swaps a dense frame of the same channels; the volume follows it by itself). A sparse\n * source made with `followImage` follows a `pool.replace` of its grid (a coarse-first swap), box included (G16a).\n */\n\nimport * as THREE from \"three\";\nimport { VDBError } from \"../../core/errors.js\";\nimport type { VDBThreeVolumeSource, VDBVolumeNodesOptions, VDBVolumeUniforms } from \"../volume-source.js\";\nimport { vdbVolumeUniforms } from \"../volume-source.js\";\nimport type { VDBFrameDensityMaterial } from \"./density-material.js\";\nimport type { VDBFrameInjectMaterial } from \"./inject-material.js\";\nimport type { VDBFrameShadowDensityMaterial } from \"./shadow-density-material.js\";\nimport type { VDBFrameEmissionDirectionMaterial } from \"./emission-light.js\";\nimport { vdbFrameAllLights } from \"./lights.js\";\nimport type { VDBFramePhase, VDBFramePhaseSource } from \"./phase.js\";\nimport { getFrameMediumProps, type VDBFrameMediumVolumeProps } from \"./medium.js\";\nimport { vdbFrameRenderer, type VDBFrameRenderer } from \"./renderer.js\";\nimport type { FrameVolumeRecord } from \"./view.js\";\n\n// NOTE Draw the frame after all other transparent objects\nconst frameRenderOrder = 1000000;\n\n/** Props of {@link VDBFrameVolume}: his `FrameVolume` props (names and defaults) for the ported subset. */\nexport interface VDBFrameVolumeProps {\n /**\n * The froxel renderer (default: the shared {@link vdbFrameRenderer}). Its `settings` apply to every\n * volume that uses it; pass your own `new VDBFrameRenderer()` (or `vdbFrameRenderer(threeRenderer)`)\n * for separate settings.\n */\n frameRenderer?: VDBFrameRenderer;\n /**\n * Box of the volume in its local space (default: the source's box: the `.wvdb` bbox or the sparse grid's world\n * box; else the unit box at the origin). Read back as {@link VDBFrameVolume.bbox}.\n */\n bbox?: THREE.Box3 | [[number, number, number], [number, number, number]];\n baseColor?: THREE.ColorRepresentation;\n scatterColor?: THREE.ColorRepresentation;\n /** With normalizeDensity: optical depth of the longest box side at the mean density (default 100). */\n extinction?: number;\n /** Extinction scale of each channel (renderer `settings.spectral`; with `angstromExponent`, spectrum.ts). */\n extinctionScale?: [number, number, number] | THREE.Vector3Like;\n /** Ångström exponent of the extinction spectrum: a number or a name of `frameAngstromExponents` (default 'cloud': 0, grey). */\n angstromExponent?: string | number;\n /**\n * `'volume'` lighting only: this volume's phase, overriding the renderer's `settings.phase` (default: unset, the\n * renderer's). `'frame'` lighting always uses the renderer's (one lighting pass for all volumes). The same for\n * `phaseG`, `phaseBackG`, `phaseBackWeight` and `phaseGExponent`, field by field.\n */\n phase?: VDBFramePhase | null;\n phaseG?: number | null;\n phaseBackG?: number | null;\n phaseBackWeight?: number | null;\n phaseGExponent?: number | null;\n densityScale?: number;\n normalizeDensity?: boolean;\n /**\n * The mean density `normalizeDensity` divides by (default: unset, the source's `stats.meanNonZero`, which follows\n * `source.replace`). Set one value for a sequence so every frame has the same extinction scale: his sequences divide\n * by the mean of all frames' non-zero texels (`FrameVolume.getDensityScale`).\n */\n densityMean?: number | null;\n densityCutoff?: number;\n absorbance?: number;\n opacity?: number;\n emissiveIntensity?: number;\n /** Kelvin at emission values 0 and 1. */\n temperatureRange?: [number, number];\n offset3D?: THREE.Vector3Like;\n wrap3D?: THREE.Wrapping;\n /** Light types bitmask ({@link vdbFrameLights}); default all. */\n lights?: number;\n shadowSteps?: number;\n /** Sample the source's mip levels (default true; needs a source with a mip atlas). */\n mipmaps?: boolean;\n /** Emission colour hook (DIVERGES V24); default white. */\n emissionColor?: VDBVolumeNodesOptions[\"emissionColor\"];\n /**\n * HDDA empty-space skipping in the shadow march (sparse sources; K3.2). Skipped samples are exactly\n * 0, so the image does not change (within float noise); dense sources ignore it. Default false (D30: on the Apple GPU it\n * slowed the shadow march 1.07–3.31× in all 12 paired runs, +7 to +26 ms per frame; owner rule D29 was \"on\n * unless the cost is large\"). Timings in docs/archive/handoffs/K3-2a.md.\n */\n hdda?: boolean;\n}\n\nconst toBox = (bbox: VDBFrameVolumeProps[\"bbox\"], source: VDBThreeVolumeSource): THREE.Box3 => {\n if (bbox instanceof THREE.Box3) return bbox.clone();\n const b = bbox ?? (source.kind === \"dense\" ? source.volume.bbox : source.bbox);\n if (!b) return new THREE.Box3(new THREE.Vector3(-0.5, -0.5, -0.5), new THREE.Vector3(0.5, 0.5, 0.5));\n return new THREE.Box3(new THREE.Vector3(...b[0]), new THREE.Vector3(...b[1]));\n};\n\n/** FrameVolume.js L339–353: the volume box as a matrix of the unit box (into `target`). */\nconst boxMatrix = (box: THREE.Box3, target: THREE.Matrix4): THREE.Matrix4 => {\n const center = box.getCenter(new THREE.Vector3());\n const size = box.getSize(new THREE.Vector3()).max(new THREE.Vector3(1e-6, 1e-6, 1e-6));\n return target.compose(center, new THREE.Quaternion(), size);\n};\n\nexport class VDBFrameVolume extends THREE.Group {\n readonly isVDBFrameVolume = true as const;\n readonly source: VDBThreeVolumeSource;\n readonly sourceUniforms: VDBVolumeUniforms;\n readonly frameRenderer: VDBFrameRenderer;\n readonly proxy: THREE.Mesh<THREE.InstancedBufferGeometry>;\n readonly volumes: FrameVolumeRecord[];\n /** Built by the renderer on first use (the source is compiled into it). */\n injectMaterial: VDBFrameInjectMaterial | null = null;\n /** 'frame' lighting: the density and shadow density materials, built by the renderer on first use (K3.3). */\n densityMaterial: VDBFrameDensityMaterial | null = null;\n shadowDensityMaterial: VDBFrameShadowDensityMaterial | null = null;\n /** K3.6: the emission light's direction-pass material of this volume (made by the light on first use). */\n emissionDirectionMaterial: VDBFrameEmissionDirectionMaterial | null = null;\n readonly emissionColor: VDBVolumeNodesOptions[\"emissionColor\"];\n\n baseColor: THREE.Color;\n scatterColor: THREE.Color;\n extinction: number;\n extinctionScale: THREE.Vector3;\n angstromExponent: string | number;\n /** `'volume'` lighting: phase overrides (null: the renderer's `settings`); see {@link VDBFrameVolumeProps.phase}. */\n phase: VDBFramePhase | null;\n phaseG: number | null;\n phaseBackG: number | null;\n phaseBackWeight: number | null;\n phaseGExponent: number | null;\n densityScale: number;\n normalizeDensity: boolean;\n /** See {@link VDBFrameVolumeProps.densityMean}; null: the source's mean. */\n densityMean: number | null;\n densityCutoff: number;\n absorbance: number;\n opacity: number;\n emissiveIntensity: number;\n temperatureRange: THREE.Vector2;\n offset3D: THREE.Vector3;\n wrap3D: THREE.Wrapping;\n lights: number;\n shadowSteps: number;\n mipmaps: boolean;\n hdda: boolean;\n /**\n * The volume's box in its local space: the `bbox` prop, else the source's box, re-read\n * when the source's `version` moves: a dense frame with another `.wvdb` box (a sequence frame; RV, as his WVDB sequences)\n * or a sparse source made with `followImage` after its grid's image changed (G16a, e.g. a coarse-first\n * swap), so this object is updated in place then. Do not mutate.\n */\n readonly bbox: THREE.Box3;\n\n /** The medium fields at construction, for `setMedium(null)`. */\n private readonly initialMedium: { baseColor: THREE.Color; extinctionScale: THREE.Vector3; angstromExponent: string | number };\n /** `source.version` the uniforms were last updated for. */\n private sourceVersion: number;\n /** G16a / RV: the box is the source's (no `bbox` prop), so it follows the source. */\n private readonly boxFromSource: boolean;\n private readonly resolvedPhase: VDBFramePhaseSource = { phase: \"henyey-greenstein\", phaseG: 0.8, phaseBackG: -0.3, phaseBackWeight: 0.2, phaseGExponent: 0.0 };\n\n constructor(source: VDBThreeVolumeSource, props: VDBFrameVolumeProps = {}) {\n super();\n\n const ok = source && ((source.kind === \"dense\" && !!source.textures?.density) || (source.kind === \"sparse\" && typeof source.createNodes === \"function\"));\n if (!ok) {\n throw new VDBError(\"VDB_BAD_OPTION\", \"VDBFrameVolume: pass a volume source from vdbDenseTextures() or vdbSparseSource() (@pmndrs/vdb/three).\");\n }\n\n const {\n frameRenderer = vdbFrameRenderer(),\n bbox,\n baseColor = 0xffffff,\n scatterColor = 0x000000,\n extinction = 100.0,\n extinctionScale = [1.0, 1.0, 1.0],\n angstromExponent = \"cloud\",\n phase = null,\n phaseG = null,\n phaseBackG = null,\n phaseBackWeight = null,\n phaseGExponent = null,\n densityScale = 1.0,\n normalizeDensity = true,\n densityMean = null,\n densityCutoff = 0.0,\n absorbance = 1.0,\n opacity = 1.0,\n emissiveIntensity = 1.0,\n temperatureRange = [0.0, 6500.0],\n offset3D = new THREE.Vector3(),\n wrap3D = THREE.ClampToEdgeWrapping,\n lights = vdbFrameAllLights,\n shadowSteps = 32,\n mipmaps = true,\n emissionColor,\n hdda = false,\n } = props;\n\n this.source = source;\n this.frameRenderer = frameRenderer;\n this.emissionColor = emissionColor;\n this.baseColor = new THREE.Color(baseColor);\n this.scatterColor = new THREE.Color(scatterColor);\n this.extinction = extinction;\n this.extinctionScale = Array.isArray(extinctionScale) ? new THREE.Vector3().fromArray(extinctionScale) : new THREE.Vector3().copy(extinctionScale);\n this.angstromExponent = angstromExponent;\n this.phase = phase;\n this.phaseG = phaseG;\n this.phaseBackG = phaseBackG;\n this.phaseBackWeight = phaseBackWeight;\n this.phaseGExponent = phaseGExponent;\n this.densityScale = densityScale;\n this.normalizeDensity = normalizeDensity;\n this.densityMean = densityMean;\n this.densityCutoff = densityCutoff;\n this.absorbance = absorbance;\n this.opacity = opacity;\n this.emissiveIntensity = emissiveIntensity;\n this.temperatureRange = new THREE.Vector2().fromArray(temperatureRange);\n this.offset3D = new THREE.Vector3().copy(offset3D);\n this.wrap3D = wrap3D;\n this.lights = lights;\n this.shadowSteps = shadowSteps;\n this.mipmaps = mipmaps;\n this.hdda = hdda;\n this.initialMedium = { baseColor: this.baseColor.clone(), extinctionScale: this.extinctionScale.clone(), angstromExponent };\n\n this.sourceUniforms = vdbVolumeUniforms(source, { extinction, densityScale, normalizeDensity });\n this.sourceVersion = source.version;\n\n this.proxy = new THREE.Mesh(frameRenderer.createProxyGeometry(), frameRenderer.integrateMaterial);\n this.proxy.frustumCulled = false;\n this.proxy.renderOrder = frameRenderOrder;\n this.proxy.onBeforeRender = (renderer, scene, camera) => {\n frameRenderer.render(renderer as never, scene, camera, this.proxy);\n };\n this.add(this.proxy);\n\n // FrameVolume.js L339–353: the volume box as a matrix of the unit box.\n const box = toBox(bbox, source);\n this.bbox = box;\n this.boxFromSource = bbox === undefined;\n\n this.volumes = [\n {\n matrix: boxMatrix(box, new THREE.Matrix4()),\n matrixWorld: new THREE.Matrix4(),\n localToView: new THREE.Matrix4(),\n viewToLocal: new THREE.Matrix4(),\n worldToLocal: new THREE.Matrix4(),\n worldBox: new THREE.Box3(),\n viewNear: 0.0,\n viewFar: 0.0,\n ready: true,\n },\n ];\n }\n\n /** The mean density `normalizeDensity` divides by: `densityMean` when set, else the source's mean of the non-zero texels (his `meanDensity`). */\n get meanDensity(): number {\n return this.densityMean ?? this.source.stats.meanNonZero;\n }\n\n /** The phase this volume is drawn with in `'volume'` lighting: its own `phase*` fields where set, else the renderer's `settings` (a reused object). */\n getPhase(): Readonly<VDBFramePhaseSource> {\n const s = this.frameRenderer.settings;\n const p = this.resolvedPhase;\n p.phase = this.phase ?? s.phase;\n p.phaseG = this.phaseG ?? s.phaseG;\n p.phaseBackG = this.phaseBackG ?? s.phaseBackG;\n p.phaseBackWeight = this.phaseBackWeight ?? s.phaseBackWeight;\n p.phaseGExponent = this.phaseGExponent ?? s.phaseGExponent;\n return p;\n }\n\n /**\n * A measured medium in one call (`'cloud'`, `'fog'`, `'ice'`, `'soot'`, `'white-smoke'`, `'dark-smoke'`, `'haze'`,\n * `'dust'`, or {@link VDBFrameMediumVolumeProps} from `vdbFrameMedium`), as his GUI's 'Medium' field: the volume's\n * `baseColor`, `extinctionScale` and `angstromExponent`; the phase on the renderer (`frameRenderer.settings.phase`,\n * `phaseG`, `phaseGExponent`: the phase of 'frame' lighting and the default of 'volume' lighting; the volume's own\n * phase overrides are cleared) and `settings.spectral` on. The renderer's settings are shared by every volume it\n * draws. `null` restores the volume's constructor colour, extinction scale and Ångström exponent (the renderer is left\n * as it is). Returns the props applied (null for `null`); an unknown name throws `VDB_BAD_OPTION`.\n */\n setMedium(medium: string | VDBFrameMediumVolumeProps | null): VDBFrameMediumVolumeProps | null {\n if (medium === null) {\n this.baseColor.copy(this.initialMedium.baseColor);\n this.extinctionScale.copy(this.initialMedium.extinctionScale);\n this.angstromExponent = this.initialMedium.angstromExponent;\n return null;\n }\n const props = typeof medium === \"string\" ? getFrameMediumProps(medium) : medium;\n if (!props) throw new VDBError(\"VDB_BAD_OPTION\", `VDBFrameVolume.setMedium: unknown medium ${JSON.stringify(medium)}; use one of vdbFrameMediumNames (@pmndrs/vdb/tools).`);\n this.baseColor.copy(props.baseColor);\n this.extinctionScale.copy(props.extinctionScale);\n this.angstromExponent = props.angstromExponent;\n this.phase = this.phaseG = this.phaseBackG = this.phaseBackWeight = this.phaseGExponent = null;\n const s = this.frameRenderer.settings;\n s.phase = props.phase;\n s.phaseG = props.phaseG;\n s.phaseGExponent = props.phaseGExponent;\n s.spectral = true;\n return props;\n }\n\n /** densityScale for the shaders. normalizeDensity divides it by the mean density. */\n getDensityScale(): number {\n const meanDensity = this.meanDensity;\n\n return this.normalizeDensity && meanDensity > 0.0 ? this.densityScale / meanDensity : this.densityScale;\n }\n\n /**\n * Re-read the source (textures, sizes, LOD levels). The renderer calls {@link VDBFrameVolume.syncSource} before\n * every draw, so a `source.replace()` needs no call; this forces it.\n */\n updateSource(): void {\n this.sourceVersion = this.source.version;\n this.sourceUniforms.update(this.source, { densityScale: this.densityScale, normalizeDensity: this.normalizeDensity });\n // G16a: a sparse source's box (a followImage source re-reads it after an image change). RV: a dense frame's\n // .wvdb box (his WVDB sequences give every frame its own box; a null box, an empty frame, keeps the last one).\n const sourceBox = this.source.kind === \"sparse\" ? this.source.bbox : this.source.volume.bbox;\n if (this.boxFromSource && sourceBox) {\n const [min, max] = sourceBox;\n const b = this.bbox;\n if (b.min.x !== min[0] || b.min.y !== min[1] || b.min.z !== min[2] || b.max.x !== max[0] || b.max.y !== max[1] || b.max.z !== max[2]) {\n b.min.set(...min);\n b.max.set(...max);\n for (const volume of this.volumes) boxMatrix(b, volume.matrix);\n }\n }\n }\n\n /** {@link VDBFrameVolume.updateSource} if the source changed since (its `version`: a resized dense frame, a replaced pool image). Cheap; called per draw. */\n syncSource(): void {\n if (this.source.version !== this.sourceVersion) this.updateSource();\n }\n\n /** Frees the proxy geometry and the pass materials, and stops following the source (its uniforms). The source belongs to the caller. */\n dispose(): void {\n this.sourceUniforms.dispose();\n this.injectMaterial?.dispose();\n this.injectMaterial = null;\n this.densityMaterial?.dispose();\n this.densityMaterial = null;\n this.shadowDensityMaterial?.dispose();\n this.shadowDensityMaterial = null;\n this.emissionDirectionMaterial?.dispose();\n this.emissionDirectionMaterial = null;\n this.proxy.geometry.dispose();\n }\n}\n"]}
1
+ {"version":3,"file":"volume.js","sourceRoot":"","sources":["../../../src/three/frame/volume.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mGAAmG;AACnG,mFAAmF;AACnF,4GAA4G;AAC5G,0HAA0H;AAC1H,gGAAgG;AAChG,mHAAmH;AACnH,8GAA8G;AAC9G,oCAAoC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAyB,MAAM,2BAA2B,CAAC;AAGxF,OAAO,EAAE,mBAAmB,EAAkC,MAAM,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,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;gBAClB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;gBAClB,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED,+JAA+J;IAC/J,UAAU;QACR,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,YAAY,EAAE,CAAC;IACtE,CAAC;IAED,0HAA0H;IAC1H,OAAO;QACL,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/core/FrameVolume.js L8–11 (render order, all lights), L152–270 (props,\n// proxy), L339–353 (box matrix), L554–568 (getDensityScale), L624–650 (dispose).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript; takes a VDBVolumeSource (dense `.wvdb`, or the sparse pool since K3.2) instead of resampling grids\n// on the CPU (his L279–552: conversion, progressive upload, level sets, points, instances); one\n// volume per frame volume; the mean density is the source's; K6.8: the props are the core's `VDBFrameVolumeParams`\n// (the renderer copies them each update), the emission colour is core data (`VDBEmissionColor`). Divergences:\n// DIVERGES.md (K3.1 rows), V23–V25.\n\n/**\n * A volume in the froxel renderer (his `FrameVolume`, R1 §2): a `Group` whose proxy mesh draws the\n * frame. Its props are his (same names and defaults) for the ported subset; the renderer copies them into the core's\n * `VDBFrameVolumeParams` at each render.\n *\n * const source = vdbDenseTextures(wvdbDenseVolume(readWvdb(bytes)));\n * const volume = new VDBFrameVolume(source, { extinction: 100 }); // box: the source's (volume.bbox)\n * scene.add(volume); // then renderer.render(scene, camera) as usual\n * volume.frameRenderer.settings.multipleScattering = false;\n * volume.setMedium(\"fog\"); // a measured medium: albedo, spectrum, the renderer's phase\n *\n * The phase (K5.9): the renderer's `settings.phase*` is the phase of every volume it draws. `'frame'`\n * lighting lights all volumes in one pass with it; in `'volume'` lighting (each volume marches its own\n * light) a volume's own `phase*` props, when set, override it for that volume. The source (dense or\n * sparse), its kind and its LOD are fixed at construction: make a new source and a new volume to change\n * them (`source.replace` swaps a dense frame of the same channels; the volume follows it by itself). A sparse\n * source made with `followImage` follows a `pool.replace` of its grid (a coarse-first swap), box included (G16a).\n */\n\nimport * as THREE from \"three\";\nimport { VDBError } from \"../../core/errors.js\";\nimport { VDB_FRAME_ALL_LIGHTS, type VDBEmissionColor } from \"../../core/frame/types.js\";\nimport type { VDBFramePhaseName } from \"../../core/frame/settings.js\";\nimport type { VDBThreeVolumeSource } from \"../volume-source.js\";\nimport { getFrameMediumProps, type VDBFrameMediumVolumeProps } from \"./medium.js\";\nimport { vdbFrameRenderer, type VDBFrameRenderer } from \"./renderer.js\";\n\n// NOTE Draw the frame after all other transparent objects\nconst frameRenderOrder = 1000000;\n\n/** Props of {@link VDBFrameVolume}: his `FrameVolume` props (names and defaults) for the ported subset. */\nexport interface VDBFrameVolumeProps {\n /**\n * The froxel renderer (default: the shared {@link vdbFrameRenderer}). Its `settings` apply to every\n * volume that uses it; pass your own `new VDBFrameRenderer()` (or `vdbFrameRenderer(threeRenderer)`)\n * for separate settings.\n */\n frameRenderer?: VDBFrameRenderer;\n /**\n * Box of the volume in its local space (default: the source's box: the `.wvdb` bbox or the sparse grid's world\n * box; else the unit box at the origin). Read back as {@link VDBFrameVolume.bbox}.\n */\n bbox?: THREE.Box3 | [[number, number, number], [number, number, number]];\n /** Albedo (single-scattering colour) of the medium (default white). */\n baseColor?: THREE.ColorRepresentation;\n /** Colour added to the volume's own emission, so it shows without light (default black). */\n scatterColor?: THREE.ColorRepresentation;\n /** With normalizeDensity: optical depth of the longest box side at the mean density (default 100). */\n extinction?: number;\n /** Extinction scale of each channel (renderer `settings.spectral`; with `angstromExponent`). */\n extinctionScale?: [number, number, number] | THREE.Vector3Like;\n /** Ångström exponent of the extinction spectrum: a number or a preset name (`'cloud'` 0, `'dust'`, `'smoke'`, `'air'`; default 'cloud': grey). */\n angstromExponent?: string | number;\n /**\n * `'volume'` lighting only: this volume's phase, overriding the renderer's `settings.phase` (default: unset, the\n * renderer's). `'frame'` lighting always uses the renderer's (one lighting pass for all volumes). The same for\n * `phaseG`, `phaseBackG`, `phaseBackWeight` and `phaseGExponent`, field by field.\n */\n phase?: VDBFramePhaseName | null;\n /** Forward `g` of this volume's phase in `'volume'` lighting (null: the renderer's). */\n phaseG?: number | null;\n /** Backward-lobe `g` in `'volume'` lighting (null: the renderer's). */\n phaseBackG?: number | null;\n /** Backward-lobe weight in `'volume'` lighting (null: the renderer's). */\n phaseBackWeight?: number | null;\n /** Wavelength exponent of `g` in spectral rendering (null: the renderer's). */\n phaseGExponent?: number | null;\n /** Multiplier of the density (default 1; divided by the mean density with `normalizeDensity`). */\n densityScale?: number;\n /** Divide `densityScale` by the mean density so `extinction` sets the optical depth (default true). */\n normalizeDensity?: boolean;\n /**\n * The mean density `normalizeDensity` divides by (default: unset, the source's `stats.meanNonZero`, which follows\n * `source.replace`). Set one value for a sequence so every frame has the same extinction scale: his sequences divide\n * by the mean of all frames' non-zero texels (`FrameVolume.getDensityScale`).\n */\n densityMean?: number | null;\n /** Densities at or below this read as 0 (default 0). */\n densityCutoff?: number;\n /** Scales the optical depth of the shadow march (0 turns the volume's own shadow off; default 1). */\n absorbance?: number;\n /** Opacity of the composited volume, 0 to 1 (default 1). */\n opacity?: number;\n /** Multiplier of the emission (default 1). */\n emissiveIntensity?: number;\n /** Kelvin at emission values 0 and 1. */\n temperatureRange?: [number, number];\n /**\n * Offset of the texture lookup in texture coordinates (default 0); a sparse source with a nonzero offset turns HDDA\n * skipping off.\n */\n offset3D?: THREE.Vector3Like;\n /** Texture wrapping of the lookup (default clamp to edge); wrapping turns a sparse source's HDDA skipping off. */\n wrap3D?: THREE.Wrapping;\n /** Light types bitmask (`VDB_FRAME_LIGHT_BITS`); default all (`VDB_FRAME_ALL_LIGHTS`). */\n lights?: number;\n /** Steps of the shadow march toward each light in `'volume'` lighting (default 32). */\n shadowSteps?: number;\n /** Sample the source's mip levels (default true; needs a source with a mip atlas). */\n mipmaps?: boolean;\n /**\n * The emission colour (K6.5, core data): `'white'` (default), `{ spectrum: 'planck' | 'soot', exponent }` (his\n * blackbody spectra), `{ lut }` (a 256-texel rgb row over log temperature 500–40,000 K) or `{ wgsl }` (a validated\n * WGSL hook, `fn vdbEmissionColor(temperature: f32) -> vec3f`).\n */\n emissionColor?: VDBEmissionColor;\n /**\n * HDDA empty-space skipping in the shadow march (sparse sources; K3.2). Skipped samples are exactly\n * 0, so the image does not change (within float noise); dense sources ignore it. Default false (D30: on the Apple GPU it\n * slowed the shadow march 1.07–3.31× in all 12 paired runs, +7 to +26 ms per frame; owner rule D29 was \"on\n * unless the cost is large\"). Timings in docs/archive/handoffs/K3-2a.md.\n */\n hdda?: boolean;\n}\n\nconst toBox = (bbox: VDBFrameVolumeProps[\"bbox\"], source: VDBThreeVolumeSource): THREE.Box3 => {\n if (bbox instanceof THREE.Box3) return bbox.clone();\n const b = bbox ?? (source.kind === \"dense\" ? source.volume.bbox : source.bbox);\n if (!b) return new THREE.Box3(new THREE.Vector3(-0.5, -0.5, -0.5), new THREE.Vector3(0.5, 0.5, 0.5));\n return new THREE.Box3(new THREE.Vector3(...b[0]), new THREE.Vector3(...b[1]));\n};\n\n/** FrameVolume.js L339–353: the volume box as a matrix of the unit box (into `target`). */\nconst boxMatrix = (box: THREE.Box3, target: THREE.Matrix4): THREE.Matrix4 => {\n const center = box.getCenter(new THREE.Vector3());\n const size = box.getSize(new THREE.Vector3()).max(new THREE.Vector3(1e-6, 1e-6, 1e-6));\n return target.compose(center, new THREE.Quaternion(), size);\n};\n\n/** The phase a volume draws with in `'volume'` lighting (its own fields where set, else the renderer's). */\nexport interface VDBFramePhaseSettings {\n phase: VDBFramePhaseName;\n phaseG: number;\n phaseBackG: number;\n phaseBackWeight: number;\n phaseGExponent: number;\n}\n\n/**\n * A volume drawn by the froxel renderer: a `Group` whose proxy mesh composites the volume's density and light over\n * the scene (his `FrameVolume`). Add it to a scene and render as usual; its props are live fields.\n */\nexport class VDBFrameVolume extends THREE.Group {\n /** Type flag. */\n readonly isVDBFrameVolume = true as const;\n /** The volume source the density (and emission) is read from. */\n readonly source: VDBThreeVolumeSource;\n /** The froxel renderer that draws this volume. */\n readonly frameRenderer: VDBFrameRenderer;\n /** The proxy mesh whose draw triggers the frame render and composites the volume. */\n readonly proxy: THREE.Mesh<THREE.InstancedBufferGeometry>;\n /** The unit box → the volume box in local space (his `boxMatrix`); follows {@link VDBFrameVolume.bbox}. */\n readonly boxMatrix: THREE.Matrix4;\n /** `matrixWorld × boxMatrix` of the last render (the core's `params.matrixWorld`). */\n readonly boxMatrixWorld = new THREE.Matrix4();\n /** The emission colour; see {@link VDBFrameVolumeProps.emissionColor}. */\n emissionColor: VDBEmissionColor | undefined;\n\n /** Albedo of the medium; see {@link VDBFrameVolumeProps.baseColor}. */\n baseColor: THREE.Color;\n /** Colour added to the emission; see {@link VDBFrameVolumeProps.scatterColor}. */\n scatterColor: THREE.Color;\n /** Optical depth of the longest box side at the mean density (with `normalizeDensity`). */\n extinction: number;\n /** Extinction scale of each channel (spectral rendering). */\n extinctionScale: THREE.Vector3;\n /** Ångström exponent of the extinction spectrum: a number or a preset name. */\n angstromExponent: string | number;\n /** `'volume'` lighting: phase overrides (null: the renderer's `settings`); see {@link VDBFrameVolumeProps.phase}. */\n phase: VDBFramePhaseName | null;\n /** Forward `g` override of `'volume'` lighting (null: the renderer's). */\n phaseG: number | null;\n /** Backward-lobe `g` override (null: the renderer's). */\n phaseBackG: number | null;\n /** Backward-lobe weight override (null: the renderer's). */\n phaseBackWeight: number | null;\n /** Wavelength exponent of `g` override (null: the renderer's). */\n phaseGExponent: number | null;\n /** Multiplier of the density; see {@link VDBFrameVolumeProps.densityScale}. */\n densityScale: number;\n /** Whether the density scale is divided by the mean density. */\n normalizeDensity: boolean;\n /** See {@link VDBFrameVolumeProps.densityMean}; null: the source's mean. */\n densityMean: number | null;\n /** Densities at or below this read as 0. */\n densityCutoff: number;\n /** Scales the optical depth of the shadow march. */\n absorbance: number;\n /** Opacity of the composited volume, 0 to 1. */\n opacity: number;\n /** Multiplier of the emission. */\n emissiveIntensity: number;\n /** Kelvin at emission values 0 (x) and 1 (y). */\n temperatureRange: THREE.Vector2;\n /** Offset of the texture lookup in texture coordinates. */\n offset3D: THREE.Vector3;\n /** Texture wrapping of the lookup. */\n wrap3D: THREE.Wrapping;\n /** Light types bitmask (`VDB_FRAME_LIGHT_BITS`) this volume receives. */\n lights: number;\n /** Steps of the shadow march in `'volume'` lighting. */\n shadowSteps: number;\n /** Whether the source's mip levels are sampled. */\n mipmaps: boolean;\n /** Whether the sparse source's shadow march skips empty space (no effect on dense sources). */\n hdda: boolean;\n /**\n * The volume's box in its local space: the `bbox` prop, else the source's box, re-read\n * when the source's `version` moves: a dense frame with another `.wvdb` box (a sequence frame; RV, as his WVDB sequences)\n * or a sparse source made with `followImage` after its grid's image changed (G16a, e.g. a coarse-first\n * swap), so this object is updated in place then. Do not mutate.\n */\n readonly bbox: THREE.Box3;\n\n /** The medium fields at construction, for `setMedium(null)`. */\n private readonly initialMedium: { baseColor: THREE.Color; extinctionScale: THREE.Vector3; angstromExponent: string | number };\n /** `source.version` the box was last read at. */\n private sourceVersion: number;\n /** G16a / RV: the box is the source's (no `bbox` prop), so it follows the source. */\n private readonly boxFromSource: boolean;\n private readonly resolvedPhase: VDBFramePhaseSettings = { phase: \"dual-lobe\", phaseG: 0.8, phaseBackG: -0.3, phaseBackWeight: 0.2, phaseGExponent: 0.0 };\n\n /**\n * Makes a volume over a dense or sparse source. Throws `VDB_BAD_OPTION` for a source that is neither.\n * @param source A source from `vdbDenseTextures()` or `vdbSparseSource()`.\n * @param props {@link VDBFrameVolumeProps}; all optional.\n */\n constructor(source: VDBThreeVolumeSource, props: VDBFrameVolumeProps = {}) {\n super();\n\n const ok = source && ((source.kind === \"dense\" && !!source.volume?.density) || (source.kind === \"sparse\" && !!source.grids));\n if (!ok) {\n throw new VDBError(\"VDB_BAD_OPTION\", \"VDBFrameVolume: pass a volume source from vdbDenseTextures() or vdbSparseSource() (@pmndrs/vdb/three).\");\n }\n const color = props.emissionColor as unknown;\n if (typeof color === \"function\") {\n throw new VDBError(\"VDB_BAD_OPTION\", \"VDBFrameVolume: emissionColor is core data since 0.2.0 ('white', { spectrum: 'planck' | 'soot', exponent }, { lut } or { wgsl }), not a TSL hook; vdbFrameBlackbodyEmission(s, e) is { spectrum: s, exponent: e }.\");\n }\n\n const {\n frameRenderer = vdbFrameRenderer(),\n bbox,\n baseColor = 0xffffff,\n scatterColor = 0x000000,\n extinction = 100.0,\n extinctionScale = [1.0, 1.0, 1.0],\n angstromExponent = \"cloud\",\n phase = null,\n phaseG = null,\n phaseBackG = null,\n phaseBackWeight = null,\n phaseGExponent = null,\n densityScale = 1.0,\n normalizeDensity = true,\n densityMean = null,\n densityCutoff = 0.0,\n absorbance = 1.0,\n opacity = 1.0,\n emissiveIntensity = 1.0,\n temperatureRange = [0.0, 6500.0],\n offset3D = new THREE.Vector3(),\n wrap3D = THREE.ClampToEdgeWrapping,\n lights = VDB_FRAME_ALL_LIGHTS,\n shadowSteps = 32,\n mipmaps = true,\n emissionColor,\n hdda = false,\n } = props;\n\n this.source = source;\n this.frameRenderer = frameRenderer;\n this.emissionColor = emissionColor;\n this.baseColor = new THREE.Color(baseColor);\n this.scatterColor = new THREE.Color(scatterColor);\n this.extinction = extinction;\n this.extinctionScale = Array.isArray(extinctionScale) ? new THREE.Vector3().fromArray(extinctionScale) : new THREE.Vector3().copy(extinctionScale);\n this.angstromExponent = angstromExponent;\n this.phase = phase;\n this.phaseG = phaseG;\n this.phaseBackG = phaseBackG;\n this.phaseBackWeight = phaseBackWeight;\n this.phaseGExponent = phaseGExponent;\n this.densityScale = densityScale;\n this.normalizeDensity = normalizeDensity;\n this.densityMean = densityMean;\n this.densityCutoff = densityCutoff;\n this.absorbance = absorbance;\n this.opacity = opacity;\n this.emissiveIntensity = emissiveIntensity;\n this.temperatureRange = new THREE.Vector2().fromArray(temperatureRange);\n this.offset3D = new THREE.Vector3().copy(offset3D);\n this.wrap3D = wrap3D;\n this.lights = lights;\n this.shadowSteps = shadowSteps;\n this.mipmaps = mipmaps;\n this.hdda = hdda;\n this.initialMedium = { baseColor: this.baseColor.clone(), extinctionScale: this.extinctionScale.clone(), angstromExponent };\n this.sourceVersion = source.version;\n\n this.proxy = new THREE.Mesh(frameRenderer.createProxyGeometry(), frameRenderer.proxyMaterial());\n this.proxy.frustumCulled = false;\n this.proxy.renderOrder = frameRenderOrder;\n this.proxy.onBeforeRender = (renderer, scene, camera) => {\n frameRenderer.render(renderer as never, scene, camera, this.proxy);\n };\n this.add(this.proxy);\n\n // FrameVolume.js L339–353: the volume box as a matrix of the unit box.\n const box = toBox(bbox, source);\n this.bbox = box;\n this.boxFromSource = bbox === undefined;\n this.boxMatrix = boxMatrix(box, new THREE.Matrix4());\n }\n\n /** The mean density `normalizeDensity` divides by: `densityMean` when set, else the source's mean of the non-zero texels (his `meanDensity`). */\n get meanDensity(): number {\n return this.densityMean ?? this.source.stats.meanNonZero;\n }\n\n /** The phase this volume is drawn with in `'volume'` lighting: its own `phase*` fields where set, else the renderer's `settings` (a reused object). */\n getPhase(): Readonly<VDBFramePhaseSettings> {\n const s = this.frameRenderer.settings;\n const p = this.resolvedPhase;\n p.phase = this.phase ?? s.phase;\n p.phaseG = this.phaseG ?? s.phaseG;\n p.phaseBackG = this.phaseBackG ?? s.phaseBackG;\n p.phaseBackWeight = this.phaseBackWeight ?? s.phaseBackWeight;\n p.phaseGExponent = this.phaseGExponent ?? s.phaseGExponent;\n return p;\n }\n\n /**\n * A measured medium in one call (`'cloud'`, `'fog'`, `'ice'`, `'soot'`, `'white-smoke'`, `'dark-smoke'`, `'haze'`,\n * `'dust'`, or {@link VDBFrameMediumVolumeProps} from `vdbFrameMedium`), as his GUI's 'Medium' field: the volume's\n * `baseColor`, `extinctionScale` and `angstromExponent`; the phase on the renderer (`frameRenderer.settings.phase`,\n * `phaseG`, `phaseGExponent`: the phase of 'frame' lighting and the default of 'volume' lighting; the volume's own\n * phase overrides are cleared) and `settings.spectral` on. The renderer's settings are shared by every volume it\n * draws. `null` restores the volume's constructor colour, extinction scale and Ångström exponent (the renderer is left\n * as it is). Returns the props applied (null for `null`); an unknown name throws `VDB_BAD_OPTION`.\n */\n setMedium(medium: string | VDBFrameMediumVolumeProps | null): VDBFrameMediumVolumeProps | null {\n if (medium === null) {\n this.baseColor.copy(this.initialMedium.baseColor);\n this.extinctionScale.copy(this.initialMedium.extinctionScale);\n this.angstromExponent = this.initialMedium.angstromExponent;\n return null;\n }\n const props = typeof medium === \"string\" ? getFrameMediumProps(medium) : medium;\n if (!props) throw new VDBError(\"VDB_BAD_OPTION\", `VDBFrameVolume.setMedium: unknown medium ${JSON.stringify(medium)}; use one of vdbFrameMediumNames (@pmndrs/vdb/tools).`);\n this.baseColor.copy(props.baseColor);\n this.extinctionScale.copy(props.extinctionScale);\n this.angstromExponent = props.angstromExponent;\n this.phase = this.phaseG = this.phaseBackG = this.phaseBackWeight = this.phaseGExponent = null;\n const s = this.frameRenderer.settings;\n s.phase = props.phase;\n s.phaseG = props.phaseG;\n s.phaseGExponent = props.phaseGExponent;\n s.spectral = true;\n return props;\n }\n\n /** The density scale the renderer draws with: `densityScale`, divided by the mean density with `normalizeDensity`. */\n getDensityScale(): number {\n const meanDensity = this.meanDensity;\n return this.normalizeDensity && meanDensity > 0.0 ? this.densityScale / meanDensity : this.densityScale;\n }\n\n /**\n * Re-reads the source's box (a dense frame with another `.wvdb` box, or a `followImage` sparse source after its grid's\n * image changed). The renderer calls {@link VDBFrameVolume.syncSource} before every render, so a `source.replace()`\n * needs no call; this forces it.\n */\n updateSource(): void {\n this.sourceVersion = this.source.version;\n // G16a: a sparse source's box (a followImage source re-reads it after an image change). RV: a dense frame's\n // .wvdb box (his WVDB sequences give every frame its own box; a null box, an empty frame, keeps the last one).\n const sourceBox = this.source.kind === \"sparse\" ? this.source.bbox : this.source.volume.bbox;\n if (this.boxFromSource && sourceBox) {\n const [min, max] = sourceBox;\n const b = this.bbox;\n if (b.min.x !== min[0] || b.min.y !== min[1] || b.min.z !== min[2] || b.max.x !== max[0] || b.max.y !== max[1] || b.max.z !== max[2]) {\n b.min.set(...min);\n b.max.set(...max);\n boxMatrix(b, this.boxMatrix);\n }\n }\n }\n\n /** {@link VDBFrameVolume.updateSource} if the source changed since (its `version`: a resized dense frame, a replaced pool image). Cheap; called per render. */\n syncSource(): void {\n if (this.source.version !== this.sourceVersion) this.updateSource();\n }\n\n /** Frees the proxy geometry. The source belongs to the caller; the renderer drops the volume when it leaves the scene. */\n dispose(): void {\n this.proxy.geometry.dispose();\n }\n}\n"]}
@@ -58,17 +58,21 @@
58
58
  * runs a self-test of the disposal path before any pool buffer reaches three
59
59
  * (`VDB_ENGINE_MISMATCH` if three would destroy a buffer behind the guard).
60
60
  */
61
- import { type Node, type NodeBuilder } from "three/webgpu";
61
+ import { StorageBufferAttribute, type Node, type NodeBuilder } from "three/webgpu";
62
62
  import type { VDBModuleHelper, VDBModuleOptions, VDBModuleProfile } from "../core/wgsl/types.js";
63
63
  import type { VDBGridTypeName } from "../core/types.js";
64
64
  import { type VDBThreeRendererLike } from "./device.js";
65
65
  /** What `VDBGridNode` needs from a pool; a `VDBGridPool` is one. */
66
66
  export interface VDBGridNodePoolLike {
67
+ /** The device the pool lives on; it must be the renderer's. */
67
68
  readonly device: GPUDevice;
68
69
  /** Replaced only when `version` changes. */
69
70
  readonly buffer: GPUBuffer;
71
+ /** Changes when the pool's buffer is replaced. */
70
72
  readonly version: number;
73
+ /** The pool's GPU layout version. */
71
74
  readonly layoutVersion: number;
75
+ /** Grid types the pool holds now. */
72
76
  readonly types: Iterable<VDBGridTypeName>;
73
77
  }
74
78
  /** Options of {@link VDBGridNode}: the module options, minus the binding (the adapter owns it). */
@@ -77,8 +81,11 @@ export interface VDBGridNodeOptions {
77
81
  readonly types?: Iterable<VDBGridTypeName> | undefined;
78
82
  /** `'read'`, `'sample'` (default) or `'march'`. `vdbSample` needs `sample`+. */
79
83
  readonly profile?: Exclude<VDBModuleProfile, "majorant"> | undefined;
84
+ /** `vdbSample`'s filter: `'trilinear'` (default) or `'nearest'`. */
80
85
  readonly sampler?: VDBModuleOptions["sampler"];
86
+ /** Whether the module has `vdbIsActive` (default true). */
81
87
  readonly isActive?: VDBModuleOptions["isActive"];
88
+ /** What `vdbSample` returns outside the index box: `'background'` (default) or `'zero'`. */
82
89
  readonly outside?: VDBModuleOptions["outside"];
83
90
  /**
84
91
  * Opt-in WGSL helpers for the module (`'rayClipSupport'`, and with `march`
@@ -117,6 +124,16 @@ type ModuleOptions = Omit<VDBModuleOptions, "slot" | "buffer" | "helpers"> & {
117
124
  readonly profile: VDBModuleProfile;
118
125
  readonly helpers?: readonly VDBModuleHelper[];
119
126
  };
127
+ /**
128
+ * @internal K6.8a: a three `StorageBufferAttribute` whose GPU buffer is `buffer`, a buffer someone else owns (a core
129
+ * frame renderer's volume shadow view): the `VDBGridNode` pool-buffer pattern for any storage buffer. three binds it as
130
+ * made, never creates one for it and never destroys it (the destroy guard); the attribute self-test runs once per
131
+ * backend first. Bind it with `storage(attribute, type, count).toReadOnly()`; swap the storage node's `value` to rebind,
132
+ * and `dispose()` the old attribute (the guard swaps a throwaway in). `buffer` needs `STORAGE` usage.
133
+ *
134
+ * @throws VDBError `VDB_ENGINE_MISMATCH` when three's internals differ (see `threeInternals`).
135
+ */
136
+ export declare function vdbThreeStorageStandIn(renderer: object, buffer: GPUBuffer, name: string): StorageBufferAttribute;
120
137
  type HelperKind = "sampleWorld" | "sampleIndex" | "readValue";
121
138
  /**
122
139
  * A `VDBGridPool` in three's node system; see the file comment. Not itself a
@@ -144,6 +161,13 @@ export declare class VDBGridNode {
144
161
  private disposed;
145
162
  private readonly verified;
146
163
  private readonly helpers;
164
+ /**
165
+ * Wraps `pool` for the renderer's shaders.
166
+ *
167
+ * @param renderer The initialized `WebGPURenderer` (on its WebGPU backend) that will render with this node.
168
+ * @param pool The pool (a `VDBGridPool`) created on the renderer's device.
169
+ * @param options The module options (types, profile, sampler, helpers, binding name).
170
+ */
147
171
  constructor(renderer: VDBThreeRendererLike, pool: VDBGridNodePoolLike, options?: VDBGridNodeOptions);
148
172
  /** The pool version bound now (the pool's at construction or the last {@link update} that rebound). */
149
173
  get version(): number;
@@ -185,12 +209,21 @@ export interface VDBSampleOptions {
185
209
  * (`trilinear` or `nearest`) and `outside` mode. `gridIndex` is a `uint` node
186
210
  * or a number (the id `pool.add` returned). Needs profile `sample` or `march`.
187
211
  * A dead id, or a grid type the module does not compile, reads 0.
212
+ *
213
+ * @param grids The node whose module is compiled into the shader.
214
+ * @param gridIndex The grid's pool id: a number or a `uint` node.
215
+ * @param position A `vec3` node in the space chosen by `options.space`.
216
+ * @param options `space`: `'world'` (default) or `'index'`.
188
217
  */
189
218
  export declare function vdbSample(grids: VDBGridNode, gridIndex: VDBTslNode | number, position: VDBTslNode, options?: VDBSampleOptions): VDBTslNode;
190
219
  /**
191
220
  * TSL: the grid's value at index coordinate `ijk` (an `ivec3` node; a float
192
221
  * vector converts by truncation). Any profile. A dead id, or a grid type the
193
222
  * module does not compile, reads 0.
223
+ *
224
+ * @param grids The node whose module is compiled into the shader.
225
+ * @param gridIndex The grid's pool id: a number or a `uint` node.
226
+ * @param ijk An `ivec3` node: the voxel's index coordinate.
194
227
  */
195
228
  export declare function vdbReadValue(grids: VDBGridNode, gridIndex: VDBTslNode | number, ijk: VDBTslNode): VDBTslNode;
196
229
  export {};
@@ -291,6 +291,25 @@ function warnOwnDevice(backend) {
291
291
  "buffer on it, the VDBGridPool's included. For a pool that outlives the renderer, create the device yourself " +
292
292
  "(adapter.requestDevice({ requiredLimits: VDBGridPool.requiredLimits(adapter) })) and pass new WebGPURenderer({ device }).");
293
293
  }
294
+ /**
295
+ * @internal K6.8a: a three `StorageBufferAttribute` whose GPU buffer is `buffer`, a buffer someone else owns (a core
296
+ * frame renderer's volume shadow view): the `VDBGridNode` pool-buffer pattern for any storage buffer. three binds it as
297
+ * made, never creates one for it and never destroys it (the destroy guard); the attribute self-test runs once per
298
+ * backend first. Bind it with `storage(attribute, type, count).toReadOnly()`; swap the storage node's `value` to rebind,
299
+ * and `dispose()` the old attribute (the guard swaps a throwaway in). `buffer` needs `STORAGE` usage.
300
+ *
301
+ * @throws VDBError `VDB_ENGINE_MISMATCH` when three's internals differ (see `threeInternals`).
302
+ */
303
+ export function vdbThreeStorageStandIn(renderer, buffer, name) {
304
+ const three = renderer;
305
+ threeInternals.check(three);
306
+ threeInternals.selfTest(three);
307
+ const attribute = new StorageBufferAttribute(new Uint32Array(4), 4);
308
+ attribute.name = buffer.label || name;
309
+ threeInternals.bind(three.backend, attribute, buffer);
310
+ threeInternals.guardDestroy(three.backend, attribute);
311
+ return attribute;
312
+ }
294
313
  const HELPER_WGSL = {
295
314
  sampleWorld: /* wgsl */ `fn vdbThreeSampleWorld(g: u32, p: vec3f) -> f32 {
296
315
  var a = vdbAccessorInit(g);
@@ -331,6 +350,13 @@ export class VDBGridNode {
331
350
  disposed = false;
332
351
  verified = new WeakSet();
333
352
  helpers = new Map();
353
+ /**
354
+ * Wraps `pool` for the renderer's shaders.
355
+ *
356
+ * @param renderer The initialized `WebGPURenderer` (on its WebGPU backend) that will render with this node.
357
+ * @param pool The pool (a `VDBGridPool`) created on the renderer's device.
358
+ * @param options The module options (types, profile, sampler, helpers, binding name).
359
+ */
334
360
  constructor(renderer, pool, options = {}) {
335
361
  this.pool = pool;
336
362
  const backend = webgpuBackendOf(renderer, "VDBGridNode");
@@ -354,7 +380,7 @@ export class VDBGridNode {
354
380
  throw bad(`unknown option '${key}'; use ${[...OPTION_KEYS].join(", ")}.`);
355
381
  }
356
382
  if (options.profile === "majorant") {
357
- throw new VDBError("VDB_BAD_OPTION", "VDBGridNode: profile 'majorant' is deferred past 0.1 (D22). Use 'read', 'sample' or 'march'.");
383
+ throw new VDBError("VDB_BAD_OPTION", "VDBGridNode: profile 'majorant' is for raw WGSL hosts (vdbModuleWgsl; P1). Use 'read', 'sample' or 'march'.");
358
384
  }
359
385
  const name = options.name ?? "vdbPool";
360
386
  const explicitTypes = options.types !== undefined;
@@ -492,6 +518,11 @@ function gridId(index) {
492
518
  * (`trilinear` or `nearest`) and `outside` mode. `gridIndex` is a `uint` node
493
519
  * or a number (the id `pool.add` returned). Needs profile `sample` or `march`.
494
520
  * A dead id, or a grid type the module does not compile, reads 0.
521
+ *
522
+ * @param grids The node whose module is compiled into the shader.
523
+ * @param gridIndex The grid's pool id: a number or a `uint` node.
524
+ * @param position A `vec3` node in the space chosen by `options.space`.
525
+ * @param options `space`: `'world'` (default) or `'index'`.
495
526
  */
496
527
  export function vdbSample(grids, gridIndex, position, options = {}) {
497
528
  const space = options.space ?? "world";
@@ -503,6 +534,10 @@ export function vdbSample(grids, gridIndex, position, options = {}) {
503
534
  * TSL: the grid's value at index coordinate `ijk` (an `ivec3` node; a float
504
535
  * vector converts by truncation). Any profile. A dead id, or a grid type the
505
536
  * module does not compile, reads 0.
537
+ *
538
+ * @param grids The node whose module is compiled into the shader.
539
+ * @param gridIndex The grid's pool id: a number or a `uint` node.
540
+ * @param ijk An `ivec3` node: the voxel's index coordinate.
506
541
  */
507
542
  export function vdbReadValue(grids, gridIndex, ijk) {
508
543
  return grids.helper("readValue")(gridId(gridIndex), ijk);