@pmndrs/vdb 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (570) hide show
  1. package/CHANGELOG.md +727 -0
  2. package/LICENSE +21 -0
  3. package/README.md +496 -2
  4. package/THIRD_PARTY_NOTICES.md +315 -0
  5. package/dist/core/compute/atlas.d.ts +102 -0
  6. package/dist/core/compute/atlas.js +103 -0
  7. package/dist/core/compute/atlas.js.map +1 -0
  8. package/dist/core/compute/index.d.ts +13 -0
  9. package/dist/core/compute/index.js +9 -0
  10. package/dist/core/compute/index.js.map +1 -0
  11. package/dist/core/compute/majorant-build.d.ts +45 -0
  12. package/dist/core/compute/majorant-build.js +193 -0
  13. package/dist/core/compute/majorant-build.js.map +1 -0
  14. package/dist/core/compute/multi-scale.d.ts +155 -0
  15. package/dist/core/compute/multi-scale.js +684 -0
  16. package/dist/core/compute/multi-scale.js.map +1 -0
  17. package/dist/core/compute/pyramid.d.ts +120 -0
  18. package/dist/core/compute/pyramid.js +468 -0
  19. package/dist/core/compute/pyramid.js.map +1 -0
  20. package/dist/core/compute/shared.d.ts +116 -0
  21. package/dist/core/compute/shared.js +211 -0
  22. package/dist/core/compute/shared.js.map +1 -0
  23. package/dist/core/compute/stats.d.ts +78 -0
  24. package/dist/core/compute/stats.js +193 -0
  25. package/dist/core/compute/stats.js.map +1 -0
  26. package/dist/core/compute/value-transform.d.ts +30 -0
  27. package/dist/core/compute/value-transform.js +64 -0
  28. package/dist/core/compute/value-transform.js.map +1 -0
  29. package/dist/core/errors.d.ts +21 -0
  30. package/dist/core/errors.js +17 -0
  31. package/dist/core/errors.js.map +1 -0
  32. package/dist/core/frame/emission.d.ts +85 -0
  33. package/dist/core/frame/emission.js +422 -0
  34. package/dist/core/frame/emission.js.map +1 -0
  35. package/dist/core/frame/environment.d.ts +47 -0
  36. package/dist/core/frame/environment.js +178 -0
  37. package/dist/core/frame/environment.js.map +1 -0
  38. package/dist/core/frame/index.d.ts +39 -0
  39. package/dist/core/frame/index.js +27 -0
  40. package/dist/core/frame/index.js.map +1 -0
  41. package/dist/core/frame/kernels.d.ts +115 -0
  42. package/dist/core/frame/kernels.js +496 -0
  43. package/dist/core/frame/kernels.js.map +1 -0
  44. package/dist/core/frame/limits.d.ts +67 -0
  45. package/dist/core/frame/limits.js +109 -0
  46. package/dist/core/frame/limits.js.map +1 -0
  47. package/dist/core/frame/phase.d.ts +17 -0
  48. package/dist/core/frame/phase.js +53 -0
  49. package/dist/core/frame/phase.js.map +1 -0
  50. package/dist/core/frame/pipelines.d.ts +49 -0
  51. package/dist/core/frame/pipelines.js +147 -0
  52. package/dist/core/frame/pipelines.js.map +1 -0
  53. package/dist/core/frame/renderer.d.ts +122 -0
  54. package/dist/core/frame/renderer.js +1712 -0
  55. package/dist/core/frame/renderer.js.map +1 -0
  56. package/dist/core/frame/resources.d.ts +71 -0
  57. package/dist/core/frame/resources.js +100 -0
  58. package/dist/core/frame/resources.js.map +1 -0
  59. package/dist/core/frame/scattering.d.ts +97 -0
  60. package/dist/core/frame/scattering.js +332 -0
  61. package/dist/core/frame/scattering.js.map +1 -0
  62. package/dist/core/frame/settings.d.ts +243 -0
  63. package/dist/core/frame/settings.js +67 -0
  64. package/dist/core/frame/settings.js.map +1 -0
  65. package/dist/core/frame/shadows.d.ts +55 -0
  66. package/dist/core/frame/shadows.js +460 -0
  67. package/dist/core/frame/shadows.js.map +1 -0
  68. package/dist/core/frame/types.d.ts +415 -0
  69. package/dist/core/frame/types.js +49 -0
  70. package/dist/core/frame/types.js.map +1 -0
  71. package/dist/core/frame/uniforms.d.ts +105 -0
  72. package/dist/core/frame/uniforms.js +276 -0
  73. package/dist/core/frame/uniforms.js.map +1 -0
  74. package/dist/core/frame/wgsl/chunks.d.ts +4 -0
  75. package/dist/core/frame/wgsl/chunks.js +728 -0
  76. package/dist/core/frame/wgsl/chunks.js.map +1 -0
  77. package/dist/core/frame/wgsl/emission.d.ts +82 -0
  78. package/dist/core/frame/wgsl/emission.js +353 -0
  79. package/dist/core/frame/wgsl/emission.js.map +1 -0
  80. package/dist/core/frame/wgsl/environment.d.ts +42 -0
  81. package/dist/core/frame/wgsl/environment.js +711 -0
  82. package/dist/core/frame/wgsl/environment.js.map +1 -0
  83. package/dist/core/frame/wgsl/gather.d.ts +55 -0
  84. package/dist/core/frame/wgsl/gather.js +850 -0
  85. package/dist/core/frame/wgsl/gather.js.map +1 -0
  86. package/dist/core/frame/wgsl/integrate.d.ts +78 -0
  87. package/dist/core/frame/wgsl/integrate.js +213 -0
  88. package/dist/core/frame/wgsl/integrate.js.map +1 -0
  89. package/dist/core/frame/wgsl/lighting.d.ts +103 -0
  90. package/dist/core/frame/wgsl/lighting.js +1636 -0
  91. package/dist/core/frame/wgsl/lighting.js.map +1 -0
  92. package/dist/core/frame/wgsl/occluders.d.ts +20 -0
  93. package/dist/core/frame/wgsl/occluders.js +95 -0
  94. package/dist/core/frame/wgsl/occluders.js.map +1 -0
  95. package/dist/core/frame/wgsl/resolve.d.ts +19 -0
  96. package/dist/core/frame/wgsl/resolve.js +205 -0
  97. package/dist/core/frame/wgsl/resolve.js.map +1 -0
  98. package/dist/core/frame/wgsl/shadows.d.ts +35 -0
  99. package/dist/core/frame/wgsl/shadows.js +328 -0
  100. package/dist/core/frame/wgsl/shadows.js.map +1 -0
  101. package/dist/core/half.d.ts +11 -0
  102. package/dist/core/half.js +22 -0
  103. package/dist/core/half.js.map +1 -0
  104. package/dist/core/index.d.ts +52 -0
  105. package/dist/core/index.js +46 -0
  106. package/dist/core/index.js.map +1 -0
  107. package/dist/core/internal.d.ts +31 -0
  108. package/dist/core/internal.js +32 -0
  109. package/dist/core/internal.js.map +1 -0
  110. package/dist/core/pool/affine.d.ts +34 -0
  111. package/dist/core/pool/affine.js +100 -0
  112. package/dist/core/pool/affine.js.map +1 -0
  113. package/dist/core/pool/allocator.d.ts +32 -0
  114. package/dist/core/pool/allocator.js +81 -0
  115. package/dist/core/pool/allocator.js.map +1 -0
  116. package/dist/core/pool/image-header.d.ts +93 -0
  117. package/dist/core/pool/image-header.js +194 -0
  118. package/dist/core/pool/image-header.js.map +1 -0
  119. package/dist/core/pool/layout.d.ts +198 -0
  120. package/dist/core/pool/layout.js +316 -0
  121. package/dist/core/pool/layout.js.map +1 -0
  122. package/dist/core/pool/limits.d.ts +41 -0
  123. package/dist/core/pool/limits.js +80 -0
  124. package/dist/core/pool/limits.js.map +1 -0
  125. package/dist/core/pool/pool.d.ts +384 -0
  126. package/dist/core/pool/pool.js +1184 -0
  127. package/dist/core/pool/pool.js.map +1 -0
  128. package/dist/core/reference/index.d.ts +6 -0
  129. package/dist/core/reference/index.js +7 -0
  130. package/dist/core/reference/index.js.map +1 -0
  131. package/dist/core/reference/renderer.d.ts +105 -0
  132. package/dist/core/reference/renderer.js +474 -0
  133. package/dist/core/reference/renderer.js.map +1 -0
  134. package/dist/core/reference/wgsl.d.ts +65 -0
  135. package/dist/core/reference/wgsl.js +803 -0
  136. package/dist/core/reference/wgsl.js.map +1 -0
  137. package/dist/core/sequence.d.ts +347 -0
  138. package/dist/core/sequence.js +548 -0
  139. package/dist/core/sequence.js.map +1 -0
  140. package/dist/core/source/brick-cache.d.ts +165 -0
  141. package/dist/core/source/brick-cache.js +627 -0
  142. package/dist/core/source/brick-cache.js.map +1 -0
  143. package/dist/core/source/dense-fill.d.ts +53 -0
  144. package/dist/core/source/dense-fill.js +377 -0
  145. package/dist/core/source/dense-fill.js.map +1 -0
  146. package/dist/core/source/dense.d.ts +50 -0
  147. package/dist/core/source/dense.js +384 -0
  148. package/dist/core/source/dense.js.map +1 -0
  149. package/dist/core/source/sparse-wgsl.d.ts +92 -0
  150. package/dist/core/source/sparse-wgsl.js +481 -0
  151. package/dist/core/source/sparse-wgsl.js.map +1 -0
  152. package/dist/core/source/sparse.d.ts +192 -0
  153. package/dist/core/source/sparse.js +762 -0
  154. package/dist/core/source/sparse.js.map +1 -0
  155. package/dist/core/source/types.d.ts +120 -0
  156. package/dist/core/source/types.js +9 -0
  157. package/dist/core/source/types.js.map +1 -0
  158. package/dist/core/surface/index.d.ts +10 -0
  159. package/dist/core/surface/index.js +9 -0
  160. package/dist/core/surface/index.js.map +1 -0
  161. package/dist/core/surface/level-set-pass.d.ts +140 -0
  162. package/dist/core/surface/level-set-pass.js +291 -0
  163. package/dist/core/surface/level-set-pass.js.map +1 -0
  164. package/dist/core/surface/level-set-wgsl.d.ts +46 -0
  165. package/dist/core/surface/level-set-wgsl.js +99 -0
  166. package/dist/core/surface/level-set-wgsl.js.map +1 -0
  167. package/dist/core/surface/points.d.ts +109 -0
  168. package/dist/core/surface/points.js +226 -0
  169. package/dist/core/surface/points.js.map +1 -0
  170. package/dist/core/types.d.ts +37 -0
  171. package/dist/core/types.js +32 -0
  172. package/dist/core/types.js.map +1 -0
  173. package/dist/core/wgsl/api.d.ts +65 -0
  174. package/dist/core/wgsl/api.js +546 -0
  175. package/dist/core/wgsl/api.js.map +1 -0
  176. package/dist/core/wgsl/generate.d.ts +90 -0
  177. package/dist/core/wgsl/generate.js +678 -0
  178. package/dist/core/wgsl/generate.js.map +1 -0
  179. package/dist/core/wgsl/lean.d.ts +50 -0
  180. package/dist/core/wgsl/lean.js +327 -0
  181. package/dist/core/wgsl/lean.js.map +1 -0
  182. package/dist/core/wgsl/level-set.d.ts +58 -0
  183. package/dist/core/wgsl/level-set.js +200 -0
  184. package/dist/core/wgsl/level-set.js.map +1 -0
  185. package/dist/core/wgsl/majorant.d.ts +62 -0
  186. package/dist/core/wgsl/majorant.js +381 -0
  187. package/dist/core/wgsl/majorant.js.map +1 -0
  188. package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
  189. package/dist/core/wgsl/pnanovdb.chunks.generated.js +333 -0
  190. package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -0
  191. package/dist/core/wgsl/reserved.d.ts +9 -0
  192. package/dist/core/wgsl/reserved.js +26 -0
  193. package/dist/core/wgsl/reserved.js.map +1 -0
  194. package/dist/core/wgsl/types.d.ts +198 -0
  195. package/dist/core/wgsl/types.js +2 -0
  196. package/dist/core/wgsl/types.js.map +1 -0
  197. package/dist/three/coarse-first.d.ts +207 -0
  198. package/dist/three/coarse-first.js +205 -0
  199. package/dist/three/coarse-first.js.map +1 -0
  200. package/dist/three/compute.d.ts +73 -0
  201. package/dist/three/compute.js +66 -0
  202. package/dist/three/compute.js.map +1 -0
  203. package/dist/three/device.d.ts +66 -0
  204. package/dist/three/device.js +62 -0
  205. package/dist/three/device.js.map +1 -0
  206. package/dist/three/frame/core-environment.d.ts +38 -0
  207. package/dist/three/frame/core-environment.js +154 -0
  208. package/dist/three/frame/core-environment.js.map +1 -0
  209. package/dist/three/frame/core-integrate-material.d.ts +34 -0
  210. package/dist/three/frame/core-integrate-material.js +162 -0
  211. package/dist/three/frame/core-integrate-material.js.map +1 -0
  212. package/dist/three/frame/core-occluders.d.ts +53 -0
  213. package/dist/three/frame/core-occluders.js +193 -0
  214. package/dist/three/frame/core-occluders.js.map +1 -0
  215. package/dist/three/frame/core-structs.d.ts +34 -0
  216. package/dist/three/frame/core-structs.js +61 -0
  217. package/dist/three/frame/core-structs.js.map +1 -0
  218. package/dist/three/frame/core-textures.d.ts +41 -0
  219. package/dist/three/frame/core-textures.js +114 -0
  220. package/dist/three/frame/core-textures.js.map +1 -0
  221. package/dist/three/frame/emission-light.d.ts +117 -0
  222. package/dist/three/frame/emission-light.js +276 -0
  223. package/dist/three/frame/emission-light.js.map +1 -0
  224. package/dist/three/frame/index.d.ts +19 -0
  225. package/dist/three/frame/index.js +15 -0
  226. package/dist/three/frame/index.js.map +1 -0
  227. package/dist/three/frame/medium.d.ts +33 -0
  228. package/dist/three/frame/medium.js +29 -0
  229. package/dist/three/frame/medium.js.map +1 -0
  230. package/dist/three/frame/renderer.d.ts +97 -0
  231. package/dist/three/frame/renderer.js +480 -0
  232. package/dist/three/frame/renderer.js.map +1 -0
  233. package/dist/three/frame/spectrum.d.ts +4 -0
  234. package/dist/three/frame/spectrum.js +15 -0
  235. package/dist/three/frame/spectrum.js.map +1 -0
  236. package/dist/three/frame/three-internals.d.ts +60 -0
  237. package/dist/three/frame/three-internals.js +152 -0
  238. package/dist/three/frame/three-internals.js.map +1 -0
  239. package/dist/three/frame/volume-shadows.d.ts +139 -0
  240. package/dist/three/frame/volume-shadows.js +403 -0
  241. package/dist/three/frame/volume-shadows.js.map +1 -0
  242. package/dist/three/frame/volume.d.ts +230 -0
  243. package/dist/three/frame/volume.js +268 -0
  244. package/dist/three/frame/volume.js.map +1 -0
  245. package/dist/three/grid-node.d.ts +229 -0
  246. package/dist/three/grid-node.js +545 -0
  247. package/dist/three/grid-node.js.map +1 -0
  248. package/dist/three/index.d.ts +52 -0
  249. package/dist/three/index.js +58 -0
  250. package/dist/three/index.js.map +1 -0
  251. package/dist/three/internal.d.ts +20 -0
  252. package/dist/three/internal.js +18 -0
  253. package/dist/three/internal.js.map +1 -0
  254. package/dist/three/level-set-material.d.ts +185 -0
  255. package/dist/three/level-set-material.js +241 -0
  256. package/dist/three/level-set-material.js.map +1 -0
  257. package/dist/three/level-set-physical-material.d.ts +154 -0
  258. package/dist/three/level-set-physical-material.js +253 -0
  259. package/dist/three/level-set-physical-material.js.map +1 -0
  260. package/dist/three/level-set-velocity.d.ts +94 -0
  261. package/dist/three/level-set-velocity.js +208 -0
  262. package/dist/three/level-set-velocity.js.map +1 -0
  263. package/dist/three/material.d.ts +324 -0
  264. package/dist/three/material.js +502 -0
  265. package/dist/three/material.js.map +1 -0
  266. package/dist/three/points.d.ts +140 -0
  267. package/dist/three/points.js +261 -0
  268. package/dist/three/points.js.map +1 -0
  269. package/dist/three/sparse-source.d.ts +165 -0
  270. package/dist/three/sparse-source.js +405 -0
  271. package/dist/three/sparse-source.js.map +1 -0
  272. package/dist/three/volume-source.d.ts +22 -0
  273. package/dist/three/volume-source.js +110 -0
  274. package/dist/three/volume-source.js.map +1 -0
  275. package/dist/tools/cpu/brick-atlas.d.ts +36 -0
  276. package/dist/tools/cpu/brick-atlas.js +129 -0
  277. package/dist/tools/cpu/brick-atlas.js.map +1 -0
  278. package/dist/tools/cpu/compute.d.ts +116 -0
  279. package/dist/tools/cpu/compute.js +239 -0
  280. package/dist/tools/cpu/compute.js.map +1 -0
  281. package/dist/tools/cpu/lean-reads.d.ts +81 -0
  282. package/dist/tools/cpu/lean-reads.js +262 -0
  283. package/dist/tools/cpu/lean-reads.js.map +1 -0
  284. package/dist/tools/cpu/level-set.d.ts +111 -0
  285. package/dist/tools/cpu/level-set.js +313 -0
  286. package/dist/tools/cpu/level-set.js.map +1 -0
  287. package/dist/tools/cpu/majorant.d.ts +265 -0
  288. package/dist/tools/cpu/majorant.js +541 -0
  289. package/dist/tools/cpu/majorant.js.map +1 -0
  290. package/dist/tools/cpu/march.d.ts +297 -0
  291. package/dist/tools/cpu/march.js +726 -0
  292. package/dist/tools/cpu/march.js.map +1 -0
  293. package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
  294. package/dist/tools/cpu/mesh-decimate.js +1225 -0
  295. package/dist/tools/cpu/mesh-decimate.js.map +1 -0
  296. package/dist/tools/cpu/points.d.ts +29 -0
  297. package/dist/tools/cpu/points.js +38 -0
  298. package/dist/tools/cpu/points.js.map +1 -0
  299. package/dist/tools/cpu/probe-coords.d.ts +70 -0
  300. package/dist/tools/cpu/probe-coords.js +116 -0
  301. package/dist/tools/cpu/probe-coords.js.map +1 -0
  302. package/dist/tools/cpu/read-value.d.ts +44 -0
  303. package/dist/tools/cpu/read-value.js +351 -0
  304. package/dist/tools/cpu/read-value.js.map +1 -0
  305. package/dist/tools/cpu/sample-trilinear.d.ts +43 -0
  306. package/dist/tools/cpu/sample-trilinear.js +168 -0
  307. package/dist/tools/cpu/sample-trilinear.js.map +1 -0
  308. package/dist/tools/cpu/stride-tables.d.ts +56 -0
  309. package/dist/tools/cpu/stride-tables.generated.d.ts +1059 -0
  310. package/dist/tools/cpu/stride-tables.generated.js +1267 -0
  311. package/dist/tools/cpu/stride-tables.generated.js.map +1 -0
  312. package/dist/tools/cpu/stride-tables.js +78 -0
  313. package/dist/tools/cpu/stride-tables.js.map +1 -0
  314. package/dist/tools/cpu/surface-nets.d.ts +90 -0
  315. package/dist/tools/cpu/surface-nets.js +597 -0
  316. package/dist/tools/cpu/surface-nets.js.map +1 -0
  317. package/dist/tools/errors.d.ts +66 -0
  318. package/dist/tools/errors.js +67 -0
  319. package/dist/tools/errors.js.map +1 -0
  320. package/dist/tools/frame/ambient.d.ts +98 -0
  321. package/dist/tools/frame/ambient.js +274 -0
  322. package/dist/tools/frame/ambient.js.map +1 -0
  323. package/dist/tools/frame/blackbody.d.ts +57 -0
  324. package/dist/tools/frame/blackbody.js +151 -0
  325. package/dist/tools/frame/blackbody.js.map +1 -0
  326. package/dist/tools/frame/brick-cache.d.ts +165 -0
  327. package/dist/tools/frame/brick-cache.js +326 -0
  328. package/dist/tools/frame/brick-cache.js.map +1 -0
  329. package/dist/tools/frame/emission.d.ts +137 -0
  330. package/dist/tools/frame/emission.js +290 -0
  331. package/dist/tools/frame/emission.js.map +1 -0
  332. package/dist/tools/frame/environment-gpu.d.ts +111 -0
  333. package/dist/tools/frame/environment-gpu.js +280 -0
  334. package/dist/tools/frame/environment-gpu.js.map +1 -0
  335. package/dist/tools/frame/environment.d.ts +106 -0
  336. package/dist/tools/frame/environment.js +272 -0
  337. package/dist/tools/frame/environment.js.map +1 -0
  338. package/dist/tools/frame/froxel.d.ts +58 -0
  339. package/dist/tools/frame/froxel.js +115 -0
  340. package/dist/tools/frame/froxel.js.map +1 -0
  341. package/dist/tools/frame/grid.d.ts +392 -0
  342. package/dist/tools/frame/grid.js +802 -0
  343. package/dist/tools/frame/grid.js.map +1 -0
  344. package/dist/tools/frame/index.d.ts +150 -0
  345. package/dist/tools/frame/index.js +389 -0
  346. package/dist/tools/frame/index.js.map +1 -0
  347. package/dist/tools/frame/medium.d.ts +77 -0
  348. package/dist/tools/frame/medium.js +101 -0
  349. package/dist/tools/frame/medium.js.map +1 -0
  350. package/dist/tools/frame/mie-table.d.ts +6 -0
  351. package/dist/tools/frame/mie-table.js +16 -0
  352. package/dist/tools/frame/mie-table.js.map +1 -0
  353. package/dist/tools/frame/mie.d.ts +63 -0
  354. package/dist/tools/frame/mie.js +194 -0
  355. package/dist/tools/frame/mie.js.map +1 -0
  356. package/dist/tools/frame/mlp-nn.d.ts +36 -0
  357. package/dist/tools/frame/mlp-nn.js +159 -0
  358. package/dist/tools/frame/mlp-nn.js.map +1 -0
  359. package/dist/tools/frame/mlp-tza.d.ts +29 -0
  360. package/dist/tools/frame/mlp-tza.js +186 -0
  361. package/dist/tools/frame/mlp-tza.js.map +1 -0
  362. package/dist/tools/frame/mlp.d.ts +183 -0
  363. package/dist/tools/frame/mlp.js +434 -0
  364. package/dist/tools/frame/mlp.js.map +1 -0
  365. package/dist/tools/frame/ms-exit.d.ts +42 -0
  366. package/dist/tools/frame/ms-exit.js +90 -0
  367. package/dist/tools/frame/ms-exit.js.map +1 -0
  368. package/dist/tools/frame/multi-scale.d.ts +152 -0
  369. package/dist/tools/frame/multi-scale.js +302 -0
  370. package/dist/tools/frame/multi-scale.js.map +1 -0
  371. package/dist/tools/frame/neural-weights.d.ts +10 -0
  372. package/dist/tools/frame/neural-weights.js +244 -0
  373. package/dist/tools/frame/neural-weights.js.map +1 -0
  374. package/dist/tools/frame/neural.d.ts +80 -0
  375. package/dist/tools/frame/neural.js +150 -0
  376. package/dist/tools/frame/neural.js.map +1 -0
  377. package/dist/tools/frame/occluders.d.ts +51 -0
  378. package/dist/tools/frame/occluders.js +72 -0
  379. package/dist/tools/frame/occluders.js.map +1 -0
  380. package/dist/tools/frame/pyramid-layout.d.ts +55 -0
  381. package/dist/tools/frame/pyramid-layout.js +100 -0
  382. package/dist/tools/frame/pyramid-layout.js.map +1 -0
  383. package/dist/tools/frame/shadows.d.ts +190 -0
  384. package/dist/tools/frame/shadows.js +468 -0
  385. package/dist/tools/frame/shadows.js.map +1 -0
  386. package/dist/tools/frame/sparse.d.ts +147 -0
  387. package/dist/tools/frame/sparse.js +432 -0
  388. package/dist/tools/frame/sparse.js.map +1 -0
  389. package/dist/tools/frame/spectral-stack.d.ts +159 -0
  390. package/dist/tools/frame/spectral-stack.js +391 -0
  391. package/dist/tools/frame/spectral-stack.js.map +1 -0
  392. package/dist/tools/frame/spectral.d.ts +222 -0
  393. package/dist/tools/frame/spectral.js +572 -0
  394. package/dist/tools/frame/spectral.js.map +1 -0
  395. package/dist/tools/frame/stack.d.ts +115 -0
  396. package/dist/tools/frame/stack.js +290 -0
  397. package/dist/tools/frame/stack.js.map +1 -0
  398. package/dist/tools/frame/view.d.ts +131 -0
  399. package/dist/tools/frame/view.js +337 -0
  400. package/dist/tools/frame/view.js.map +1 -0
  401. package/dist/tools/index.d.ts +157 -0
  402. package/dist/tools/index.js +132 -0
  403. package/dist/tools/index.js.map +1 -0
  404. package/dist/tools/internal.d.ts +87 -0
  405. package/dist/tools/internal.js +85 -0
  406. package/dist/tools/internal.js.map +1 -0
  407. package/dist/tools/nanovdb/build-from-vdb.d.ts +59 -0
  408. package/dist/tools/nanovdb/build-from-vdb.js +100 -0
  409. package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
  410. package/dist/tools/nanovdb/bytes.d.ts +233 -0
  411. package/dist/tools/nanovdb/bytes.js +388 -0
  412. package/dist/tools/nanovdb/bytes.js.map +1 -0
  413. package/dist/tools/nanovdb/coarse-first.d.ts +78 -0
  414. package/dist/tools/nanovdb/coarse-first.js +92 -0
  415. package/dist/tools/nanovdb/coarse-first.js.map +1 -0
  416. package/dist/tools/nanovdb/half.d.ts +22 -0
  417. package/dist/tools/nanovdb/half.js +73 -0
  418. package/dist/tools/nanovdb/half.js.map +1 -0
  419. package/dist/tools/nanovdb/index.d.ts +34 -0
  420. package/dist/tools/nanovdb/index.js +25 -0
  421. package/dist/tools/nanovdb/index.js.map +1 -0
  422. package/dist/tools/nanovdb/inspect.d.ts +33 -0
  423. package/dist/tools/nanovdb/inspect.js +70 -0
  424. package/dist/tools/nanovdb/inspect.js.map +1 -0
  425. package/dist/tools/nanovdb/leaf-codec.d.ts +119 -0
  426. package/dist/tools/nanovdb/leaf-codec.js +356 -0
  427. package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
  428. package/dist/tools/nanovdb/quantize.d.ts +72 -0
  429. package/dist/tools/nanovdb/quantize.js +329 -0
  430. package/dist/tools/nanovdb/quantize.js.map +1 -0
  431. package/dist/tools/nanovdb/resample.d.ts +177 -0
  432. package/dist/tools/nanovdb/resample.js +692 -0
  433. package/dist/tools/nanovdb/resample.js.map +1 -0
  434. package/dist/tools/nanovdb/serialize.d.ts +176 -0
  435. package/dist/tools/nanovdb/serialize.js +439 -0
  436. package/dist/tools/nanovdb/serialize.js.map +1 -0
  437. package/dist/tools/nanovdb/stats.d.ts +87 -0
  438. package/dist/tools/nanovdb/stats.js +225 -0
  439. package/dist/tools/nanovdb/stats.js.map +1 -0
  440. package/dist/tools/nanovdb/transform.d.ts +30 -0
  441. package/dist/tools/nanovdb/transform.js +94 -0
  442. package/dist/tools/nanovdb/transform.js.map +1 -0
  443. package/dist/tools/nanovdb/tree.d.ts +186 -0
  444. package/dist/tools/nanovdb/tree.js +530 -0
  445. package/dist/tools/nanovdb/tree.js.map +1 -0
  446. package/dist/tools/nanovdb/write-nvdb.d.ts +74 -0
  447. package/dist/tools/nanovdb/write-nvdb.js +290 -0
  448. package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
  449. package/dist/tools/nvdb-file.d.ts +265 -0
  450. package/dist/tools/nvdb-file.js +763 -0
  451. package/dist/tools/nvdb-file.js.map +1 -0
  452. package/dist/tools/nvdb-stream.d.ts +154 -0
  453. package/dist/tools/nvdb-stream.js +409 -0
  454. package/dist/tools/nvdb-stream.js.map +1 -0
  455. package/dist/tools/reference/analytic.d.ts +41 -0
  456. package/dist/tools/reference/analytic.js +95 -0
  457. package/dist/tools/reference/analytic.js.map +1 -0
  458. package/dist/tools/reference/environment.d.ts +62 -0
  459. package/dist/tools/reference/environment.js +154 -0
  460. package/dist/tools/reference/environment.js.map +1 -0
  461. package/dist/tools/reference/index.d.ts +12 -0
  462. package/dist/tools/reference/index.js +13 -0
  463. package/dist/tools/reference/index.js.map +1 -0
  464. package/dist/tools/reference/media.d.ts +14 -0
  465. package/dist/tools/reference/media.js +30 -0
  466. package/dist/tools/reference/media.js.map +1 -0
  467. package/dist/tools/reference/rng.d.ts +20 -0
  468. package/dist/tools/reference/rng.js +30 -0
  469. package/dist/tools/reference/rng.js.map +1 -0
  470. package/dist/tools/reference/scene.d.ts +312 -0
  471. package/dist/tools/reference/scene.js +169 -0
  472. package/dist/tools/reference/scene.js.map +1 -0
  473. package/dist/tools/reference/tables.d.ts +98 -0
  474. package/dist/tools/reference/tables.js +264 -0
  475. package/dist/tools/reference/tables.js.map +1 -0
  476. package/dist/tools/reference/trace.d.ts +160 -0
  477. package/dist/tools/reference/trace.js +497 -0
  478. package/dist/tools/reference/trace.js.map +1 -0
  479. package/dist/tools/vdb/bit-utils.d.ts +20 -0
  480. package/dist/tools/vdb/bit-utils.js +42 -0
  481. package/dist/tools/vdb/bit-utils.js.map +1 -0
  482. package/dist/tools/vdb/blosc-write.d.ts +43 -0
  483. package/dist/tools/vdb/blosc-write.js +197 -0
  484. package/dist/tools/vdb/blosc-write.js.map +1 -0
  485. package/dist/tools/vdb/blosc.d.ts +86 -0
  486. package/dist/tools/vdb/blosc.js +287 -0
  487. package/dist/tools/vdb/blosc.js.map +1 -0
  488. package/dist/tools/vdb/blosclz.d.ts +33 -0
  489. package/dist/tools/vdb/blosclz.js +112 -0
  490. package/dist/tools/vdb/blosclz.js.map +1 -0
  491. package/dist/tools/vdb/byte-reader.d.ts +50 -0
  492. package/dist/tools/vdb/byte-reader.js +161 -0
  493. package/dist/tools/vdb/byte-reader.js.map +1 -0
  494. package/dist/tools/vdb/compression.d.ts +81 -0
  495. package/dist/tools/vdb/compression.js +260 -0
  496. package/dist/tools/vdb/compression.js.map +1 -0
  497. package/dist/tools/vdb/errors.d.ts +10 -0
  498. package/dist/tools/vdb/errors.js +11 -0
  499. package/dist/tools/vdb/errors.js.map +1 -0
  500. package/dist/tools/vdb/grid.d.ts +37 -0
  501. package/dist/tools/vdb/grid.js +153 -0
  502. package/dist/tools/vdb/grid.js.map +1 -0
  503. package/dist/tools/vdb/half-float.d.ts +9 -0
  504. package/dist/tools/vdb/half-float.js +24 -0
  505. package/dist/tools/vdb/half-float.js.map +1 -0
  506. package/dist/tools/vdb/index.d.ts +4 -0
  507. package/dist/tools/vdb/index.js +3 -0
  508. package/dist/tools/vdb/index.js.map +1 -0
  509. package/dist/tools/vdb/inflate.d.ts +24 -0
  510. package/dist/tools/vdb/inflate.js +334 -0
  511. package/dist/tools/vdb/inflate.js.map +1 -0
  512. package/dist/tools/vdb/lz4.d.ts +30 -0
  513. package/dist/tools/vdb/lz4.js +228 -0
  514. package/dist/tools/vdb/lz4.js.map +1 -0
  515. package/dist/tools/vdb/metadata.d.ts +17 -0
  516. package/dist/tools/vdb/metadata.js +72 -0
  517. package/dist/tools/vdb/metadata.js.map +1 -0
  518. package/dist/tools/vdb/parse.d.ts +47 -0
  519. package/dist/tools/vdb/parse.js +241 -0
  520. package/dist/tools/vdb/parse.js.map +1 -0
  521. package/dist/tools/vdb/point-render-data.d.ts +79 -0
  522. package/dist/tools/vdb/point-render-data.js +137 -0
  523. package/dist/tools/vdb/point-render-data.js.map +1 -0
  524. package/dist/tools/vdb/points.d.ts +186 -0
  525. package/dist/tools/vdb/points.js +835 -0
  526. package/dist/tools/vdb/points.js.map +1 -0
  527. package/dist/tools/vdb/transform.d.ts +23 -0
  528. package/dist/tools/vdb/transform.js +54 -0
  529. package/dist/tools/vdb/transform.js.map +1 -0
  530. package/dist/tools/vdb/tree.d.ts +111 -0
  531. package/dist/tools/vdb/tree.js +228 -0
  532. package/dist/tools/vdb/tree.js.map +1 -0
  533. package/dist/tools/vdb/types.d.ts +195 -0
  534. package/dist/tools/vdb/types.js +3 -0
  535. package/dist/tools/vdb/types.js.map +1 -0
  536. package/dist/tools/wvdb/bake.d.ts +145 -0
  537. package/dist/tools/wvdb/bake.js +361 -0
  538. package/dist/tools/wvdb/bake.js.map +1 -0
  539. package/dist/tools/wvdb/dense.d.ts +191 -0
  540. package/dist/tools/wvdb/dense.js +368 -0
  541. package/dist/tools/wvdb/dense.js.map +1 -0
  542. package/dist/tools/wvdb/format.d.ts +220 -0
  543. package/dist/tools/wvdb/format.js +306 -0
  544. package/dist/tools/wvdb/format.js.map +1 -0
  545. package/dist/tools/wvdb/index.d.ts +14 -0
  546. package/dist/tools/wvdb/index.js +15 -0
  547. package/dist/tools/wvdb/index.js.map +1 -0
  548. package/dist/tools/wvdb/level-set.d.ts +56 -0
  549. package/dist/tools/wvdb/level-set.js +153 -0
  550. package/dist/tools/wvdb/level-set.js.map +1 -0
  551. package/dist/tools/wvdb/nanovdb.d.ts +59 -0
  552. package/dist/tools/wvdb/nanovdb.js +64 -0
  553. package/dist/tools/wvdb/nanovdb.js.map +1 -0
  554. package/dist/tools/wvdb/partial.d.ts +74 -0
  555. package/dist/tools/wvdb/partial.js +233 -0
  556. package/dist/tools/wvdb/partial.js.map +1 -0
  557. package/dist/tools/wvdb/read.d.ts +336 -0
  558. package/dist/tools/wvdb/read.js +766 -0
  559. package/dist/tools/wvdb/read.js.map +1 -0
  560. package/dist/tools/wvdb/sha256.d.ts +7 -0
  561. package/dist/tools/wvdb/sha256.js +76 -0
  562. package/dist/tools/wvdb/sha256.js.map +1 -0
  563. package/dist/tools/wvdb/write.d.ts +149 -0
  564. package/dist/tools/wvdb/write.js +403 -0
  565. package/dist/tools/wvdb/write.js.map +1 -0
  566. package/package.json +83 -4
  567. package/vendor/LICENSE +201 -0
  568. package/vendor/NOTICE +19 -0
  569. package/vendor/VENDOR.md +100 -0
  570. package/vendor/pnanovdb.wgsl +1577 -0
@@ -0,0 +1,230 @@
1
+ /**
2
+ * A volume in the froxel renderer (his `FrameVolume`, R1 §2): a `Group` whose proxy mesh draws the
3
+ * frame. Its props are his (same names and defaults) for the ported subset; the renderer copies them into the core's
4
+ * `VDBFrameVolumeParams` at each render.
5
+ *
6
+ * const source = vdbDenseTextures(wvdbDenseVolume(readWvdb(bytes)));
7
+ * const volume = new VDBFrameVolume(source, { extinction: 100 }); // box: the source's (volume.bbox)
8
+ * scene.add(volume); // then renderer.render(scene, camera) as usual
9
+ * volume.frameRenderer.settings.multipleScattering = false;
10
+ * volume.setMedium("fog"); // a measured medium: albedo, spectrum, the renderer's phase
11
+ *
12
+ * The phase (K5.9): the renderer's `settings.phase*` is the phase of every volume it draws. `'frame'`
13
+ * lighting lights all volumes in one pass with it; in `'volume'` lighting (each volume marches its own
14
+ * light) a volume's own `phase*` props, when set, override it for that volume. The source (dense or
15
+ * sparse), its kind and its LOD are fixed at construction: make a new source and a new volume to change
16
+ * them (`source.replace` swaps a dense frame of the same channels; the volume follows it by itself). A sparse
17
+ * source made with `followImage` follows a `pool.replace` of its grid (a coarse-first swap), box included (G16a).
18
+ */
19
+ import * as THREE from "three";
20
+ import { type VDBEmissionColor } from "../../core/frame/types.js";
21
+ import type { VDBFramePhaseName } from "../../core/frame/settings.js";
22
+ import type { VDBThreeVolumeSource } from "../volume-source.js";
23
+ import { type VDBFrameMediumVolumeProps } from "./medium.js";
24
+ import { type VDBFrameRenderer } from "./renderer.js";
25
+ /** Props of {@link VDBFrameVolume}: his `FrameVolume` props (names and defaults) for the ported subset. */
26
+ export interface VDBFrameVolumeProps {
27
+ /**
28
+ * The froxel renderer (default: the shared {@link vdbFrameRenderer}). Its `settings` apply to every
29
+ * volume that uses it; pass your own `new VDBFrameRenderer()` (or `vdbFrameRenderer(threeRenderer)`)
30
+ * for separate settings.
31
+ */
32
+ frameRenderer?: VDBFrameRenderer;
33
+ /**
34
+ * Box of the volume in its local space (default: the source's box: the `.wvdb` bbox or the sparse grid's world
35
+ * box; else the unit box at the origin). Read back as {@link VDBFrameVolume.bbox}.
36
+ */
37
+ bbox?: THREE.Box3 | [[number, number, number], [number, number, number]];
38
+ /** Albedo (single-scattering colour) of the medium (default white). */
39
+ baseColor?: THREE.ColorRepresentation;
40
+ /** Colour added to the volume's own emission, so it shows without light (default black). */
41
+ scatterColor?: THREE.ColorRepresentation;
42
+ /** With normalizeDensity: optical depth of the longest box side at the mean density (default 100). */
43
+ extinction?: number;
44
+ /** Extinction scale of each channel (renderer `settings.spectral`; with `angstromExponent`). */
45
+ extinctionScale?: [number, number, number] | THREE.Vector3Like;
46
+ /** Ångström exponent of the extinction spectrum: a number or a preset name (`'cloud'` 0, `'dust'`, `'smoke'`, `'air'`; default 'cloud': grey). */
47
+ angstromExponent?: string | number;
48
+ /**
49
+ * `'volume'` lighting only: this volume's phase, overriding the renderer's `settings.phase` (default: unset, the
50
+ * renderer's). `'frame'` lighting always uses the renderer's (one lighting pass for all volumes). The same for
51
+ * `phaseG`, `phaseBackG`, `phaseBackWeight` and `phaseGExponent`, field by field.
52
+ */
53
+ phase?: VDBFramePhaseName | null;
54
+ /** Forward `g` of this volume's phase in `'volume'` lighting (null: the renderer's). */
55
+ phaseG?: number | null;
56
+ /** Backward-lobe `g` in `'volume'` lighting (null: the renderer's). */
57
+ phaseBackG?: number | null;
58
+ /** Backward-lobe weight in `'volume'` lighting (null: the renderer's). */
59
+ phaseBackWeight?: number | null;
60
+ /** Wavelength exponent of `g` in spectral rendering (null: the renderer's). */
61
+ phaseGExponent?: number | null;
62
+ /** Multiplier of the density (default 1; divided by the mean density with `normalizeDensity`). */
63
+ densityScale?: number;
64
+ /** Divide `densityScale` by the mean density so `extinction` sets the optical depth (default true). */
65
+ normalizeDensity?: boolean;
66
+ /**
67
+ * The mean density `normalizeDensity` divides by (default: unset, the source's `stats.meanNonZero`, which follows
68
+ * `source.replace`). Set one value for a sequence so every frame has the same extinction scale: his sequences divide
69
+ * by the mean of all frames' non-zero texels (`FrameVolume.getDensityScale`).
70
+ */
71
+ densityMean?: number | null;
72
+ /** Densities at or below this read as 0 (default 0). */
73
+ densityCutoff?: number;
74
+ /** Scales the optical depth of the shadow march (0 turns the volume's own shadow off; default 1). */
75
+ absorbance?: number;
76
+ /** Opacity of the composited volume, 0 to 1 (default 1). */
77
+ opacity?: number;
78
+ /** Multiplier of the emission (default 1). */
79
+ emissiveIntensity?: number;
80
+ /** Kelvin at emission values 0 and 1. */
81
+ temperatureRange?: [number, number];
82
+ /**
83
+ * Offset of the texture lookup in texture coordinates (default 0); a sparse source with a nonzero offset turns HDDA
84
+ * skipping off.
85
+ */
86
+ offset3D?: THREE.Vector3Like;
87
+ /** Texture wrapping of the lookup (default clamp to edge); wrapping turns a sparse source's HDDA skipping off. */
88
+ wrap3D?: THREE.Wrapping;
89
+ /** Light types bitmask (`VDB_FRAME_LIGHT_BITS`); default all (`VDB_FRAME_ALL_LIGHTS`). */
90
+ lights?: number;
91
+ /** Steps of the shadow march toward each light in `'volume'` lighting (default 32). */
92
+ shadowSteps?: number;
93
+ /** Sample the source's mip levels (default true; needs a source with a mip atlas). */
94
+ mipmaps?: boolean;
95
+ /**
96
+ * The emission colour (K6.5, core data): `'white'` (default), `{ spectrum: 'planck' | 'soot', exponent }` (his
97
+ * blackbody spectra), `{ lut }` (a 256-texel rgb row over log temperature 500–40,000 K) or `{ wgsl }` (a validated
98
+ * WGSL hook, `fn vdbEmissionColor(temperature: f32) -> vec3f`).
99
+ */
100
+ emissionColor?: VDBEmissionColor;
101
+ /**
102
+ * HDDA empty-space skipping in the shadow march (sparse sources; K3.2). Skipped samples are exactly
103
+ * 0, so the image does not change (within float noise); dense sources ignore it. Default false (D30: on the Apple GPU it
104
+ * slowed the shadow march 1.07–3.31× in all 12 paired runs, +7 to +26 ms per frame; owner rule D29 was "on
105
+ * unless the cost is large"). Timings in docs/archive/handoffs/K3-2a.md.
106
+ */
107
+ hdda?: boolean;
108
+ }
109
+ /** The phase a volume draws with in `'volume'` lighting (its own fields where set, else the renderer's). */
110
+ export interface VDBFramePhaseSettings {
111
+ phase: VDBFramePhaseName;
112
+ phaseG: number;
113
+ phaseBackG: number;
114
+ phaseBackWeight: number;
115
+ phaseGExponent: number;
116
+ }
117
+ /**
118
+ * A volume drawn by the froxel renderer: a `Group` whose proxy mesh composites the volume's density and light over
119
+ * the scene (his `FrameVolume`). Add it to a scene and render as usual; its props are live fields.
120
+ */
121
+ export declare class VDBFrameVolume extends THREE.Group {
122
+ /** Type flag. */
123
+ readonly isVDBFrameVolume: true;
124
+ /** The volume source the density (and emission) is read from. */
125
+ readonly source: VDBThreeVolumeSource;
126
+ /** The froxel renderer that draws this volume. */
127
+ readonly frameRenderer: VDBFrameRenderer;
128
+ /** The proxy mesh whose draw triggers the frame render and composites the volume. */
129
+ readonly proxy: THREE.Mesh<THREE.InstancedBufferGeometry>;
130
+ /** The unit box → the volume box in local space (his `boxMatrix`); follows {@link VDBFrameVolume.bbox}. */
131
+ readonly boxMatrix: THREE.Matrix4;
132
+ /** `matrixWorld × boxMatrix` of the last render (the core's `params.matrixWorld`). */
133
+ readonly boxMatrixWorld: THREE.Matrix4;
134
+ /** The emission colour; see {@link VDBFrameVolumeProps.emissionColor}. */
135
+ emissionColor: VDBEmissionColor | undefined;
136
+ /** Albedo of the medium; see {@link VDBFrameVolumeProps.baseColor}. */
137
+ baseColor: THREE.Color;
138
+ /** Colour added to the emission; see {@link VDBFrameVolumeProps.scatterColor}. */
139
+ scatterColor: THREE.Color;
140
+ /** Optical depth of the longest box side at the mean density (with `normalizeDensity`). */
141
+ extinction: number;
142
+ /** Extinction scale of each channel (spectral rendering). */
143
+ extinctionScale: THREE.Vector3;
144
+ /** Ångström exponent of the extinction spectrum: a number or a preset name. */
145
+ angstromExponent: string | number;
146
+ /** `'volume'` lighting: phase overrides (null: the renderer's `settings`); see {@link VDBFrameVolumeProps.phase}. */
147
+ phase: VDBFramePhaseName | null;
148
+ /** Forward `g` override of `'volume'` lighting (null: the renderer's). */
149
+ phaseG: number | null;
150
+ /** Backward-lobe `g` override (null: the renderer's). */
151
+ phaseBackG: number | null;
152
+ /** Backward-lobe weight override (null: the renderer's). */
153
+ phaseBackWeight: number | null;
154
+ /** Wavelength exponent of `g` override (null: the renderer's). */
155
+ phaseGExponent: number | null;
156
+ /** Multiplier of the density; see {@link VDBFrameVolumeProps.densityScale}. */
157
+ densityScale: number;
158
+ /** Whether the density scale is divided by the mean density. */
159
+ normalizeDensity: boolean;
160
+ /** See {@link VDBFrameVolumeProps.densityMean}; null: the source's mean. */
161
+ densityMean: number | null;
162
+ /** Densities at or below this read as 0. */
163
+ densityCutoff: number;
164
+ /** Scales the optical depth of the shadow march. */
165
+ absorbance: number;
166
+ /** Opacity of the composited volume, 0 to 1. */
167
+ opacity: number;
168
+ /** Multiplier of the emission. */
169
+ emissiveIntensity: number;
170
+ /** Kelvin at emission values 0 (x) and 1 (y). */
171
+ temperatureRange: THREE.Vector2;
172
+ /** Offset of the texture lookup in texture coordinates. */
173
+ offset3D: THREE.Vector3;
174
+ /** Texture wrapping of the lookup. */
175
+ wrap3D: THREE.Wrapping;
176
+ /** Light types bitmask (`VDB_FRAME_LIGHT_BITS`) this volume receives. */
177
+ lights: number;
178
+ /** Steps of the shadow march in `'volume'` lighting. */
179
+ shadowSteps: number;
180
+ /** Whether the source's mip levels are sampled. */
181
+ mipmaps: boolean;
182
+ /** Whether the sparse source's shadow march skips empty space (no effect on dense sources). */
183
+ hdda: boolean;
184
+ /**
185
+ * The volume's box in its local space: the `bbox` prop, else the source's box, re-read
186
+ * when the source's `version` moves: a dense frame with another `.wvdb` box (a sequence frame; RV, as his WVDB sequences)
187
+ * or a sparse source made with `followImage` after its grid's image changed (G16a, e.g. a coarse-first
188
+ * swap), so this object is updated in place then. Do not mutate.
189
+ */
190
+ readonly bbox: THREE.Box3;
191
+ /** The medium fields at construction, for `setMedium(null)`. */
192
+ private readonly initialMedium;
193
+ /** `source.version` the box was last read at. */
194
+ private sourceVersion;
195
+ /** G16a / RV: the box is the source's (no `bbox` prop), so it follows the source. */
196
+ private readonly boxFromSource;
197
+ private readonly resolvedPhase;
198
+ /**
199
+ * Makes a volume over a dense or sparse source. Throws `VDB_BAD_OPTION` for a source that is neither.
200
+ * @param source A source from `vdbDenseTextures()` or `vdbSparseSource()`.
201
+ * @param props {@link VDBFrameVolumeProps}; all optional.
202
+ */
203
+ constructor(source: VDBThreeVolumeSource, props?: VDBFrameVolumeProps);
204
+ /** The mean density `normalizeDensity` divides by: `densityMean` when set, else the source's mean of the non-zero texels (his `meanDensity`). */
205
+ get meanDensity(): number;
206
+ /** The phase this volume is drawn with in `'volume'` lighting: its own `phase*` fields where set, else the renderer's `settings` (a reused object). */
207
+ getPhase(): Readonly<VDBFramePhaseSettings>;
208
+ /**
209
+ * A measured medium in one call (`'cloud'`, `'fog'`, `'ice'`, `'soot'`, `'white-smoke'`, `'dark-smoke'`, `'haze'`,
210
+ * `'dust'`, or {@link VDBFrameMediumVolumeProps} from `vdbFrameMedium`), as his GUI's 'Medium' field: the volume's
211
+ * `baseColor`, `extinctionScale` and `angstromExponent`; the phase on the renderer (`frameRenderer.settings.phase`,
212
+ * `phaseG`, `phaseGExponent`: the phase of 'frame' lighting and the default of 'volume' lighting; the volume's own
213
+ * phase overrides are cleared) and `settings.spectral` on. The renderer's settings are shared by every volume it
214
+ * draws. `null` restores the volume's constructor colour, extinction scale and Ångström exponent (the renderer is left
215
+ * as it is). Returns the props applied (null for `null`); an unknown name throws `VDB_BAD_OPTION`.
216
+ */
217
+ setMedium(medium: string | VDBFrameMediumVolumeProps | null): VDBFrameMediumVolumeProps | null;
218
+ /** The density scale the renderer draws with: `densityScale`, divided by the mean density with `normalizeDensity`. */
219
+ getDensityScale(): number;
220
+ /**
221
+ * Re-reads the source's box (a dense frame with another `.wvdb` box, or a `followImage` sparse source after its grid's
222
+ * image changed). The renderer calls {@link VDBFrameVolume.syncSource} before every render, so a `source.replace()`
223
+ * needs no call; this forces it.
224
+ */
225
+ updateSource(): void;
226
+ /** {@link VDBFrameVolume.updateSource} if the source changed since (its `version`: a resized dense frame, a replaced pool image). Cheap; called per render. */
227
+ syncSource(): void;
228
+ /** Frees the proxy geometry. The source belongs to the caller; the renderer drops the volume when it leaves the scene. */
229
+ dispose(): void;
230
+ }
@@ -0,0 +1,268 @@
1
+ // Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
2
+ // src/three-openvdb/frame/core/FrameVolume.js L8–11 (render order, all lights), L152–270 (props,
3
+ // proxy), L339–353 (box matrix), L554–568 (getDensityScale), L624–650 (dispose).
4
+ // Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
5
+ // Changes: TypeScript; takes a VDBVolumeSource (dense `.wvdb`, or the sparse pool since K3.2) instead of resampling grids
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; 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.
10
+ /**
11
+ * A volume in the froxel renderer (his `FrameVolume`, R1 §2): a `Group` whose proxy mesh draws the
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.
14
+ *
15
+ * const source = vdbDenseTextures(wvdbDenseVolume(readWvdb(bytes)));
16
+ * const volume = new VDBFrameVolume(source, { extinction: 100 }); // box: the source's (volume.bbox)
17
+ * scene.add(volume); // then renderer.render(scene, camera) as usual
18
+ * volume.frameRenderer.settings.multipleScattering = false;
19
+ * volume.setMedium("fog"); // a measured medium: albedo, spectrum, the renderer's phase
20
+ *
21
+ * The phase (K5.9): the renderer's `settings.phase*` is the phase of every volume it draws. `'frame'`
22
+ * lighting lights all volumes in one pass with it; in `'volume'` lighting (each volume marches its own
23
+ * light) a volume's own `phase*` props, when set, override it for that volume. The source (dense or
24
+ * sparse), its kind and its LOD are fixed at construction: make a new source and a new volume to change
25
+ * them (`source.replace` swaps a dense frame of the same channels; the volume follows it by itself). A sparse
26
+ * source made with `followImage` follows a `pool.replace` of its grid (a coarse-first swap), box included (G16a).
27
+ */
28
+ import * as THREE from "three";
29
+ import { VDBError } from "../../core/errors.js";
30
+ import { VDB_FRAME_ALL_LIGHTS } from "../../core/frame/types.js";
31
+ import { getFrameMediumProps } from "./medium.js";
32
+ import { vdbFrameRenderer } from "./renderer.js";
33
+ // NOTE Draw the frame after all other transparent objects
34
+ const frameRenderOrder = 1000000;
35
+ const toBox = (bbox, source) => {
36
+ if (bbox instanceof THREE.Box3)
37
+ return bbox.clone();
38
+ const b = bbox ?? (source.kind === "dense" ? source.volume.bbox : source.bbox);
39
+ if (!b)
40
+ return new THREE.Box3(new THREE.Vector3(-0.5, -0.5, -0.5), new THREE.Vector3(0.5, 0.5, 0.5));
41
+ return new THREE.Box3(new THREE.Vector3(...b[0]), new THREE.Vector3(...b[1]));
42
+ };
43
+ /** FrameVolume.js L339–353: the volume box as a matrix of the unit box (into `target`). */
44
+ const boxMatrix = (box, target) => {
45
+ const center = box.getCenter(new THREE.Vector3());
46
+ const size = box.getSize(new THREE.Vector3()).max(new THREE.Vector3(1e-6, 1e-6, 1e-6));
47
+ return target.compose(center, new THREE.Quaternion(), size);
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
+ */
53
+ export class VDBFrameVolume extends THREE.Group {
54
+ /** Type flag. */
55
+ isVDBFrameVolume = true;
56
+ /** The volume source the density (and emission) is read from. */
57
+ source;
58
+ /** The froxel renderer that draws this volume. */
59
+ frameRenderer;
60
+ /** The proxy mesh whose draw triggers the frame render and composites the volume. */
61
+ proxy;
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}. */
67
+ emissionColor;
68
+ /** Albedo of the medium; see {@link VDBFrameVolumeProps.baseColor}. */
69
+ baseColor;
70
+ /** Colour added to the emission; see {@link VDBFrameVolumeProps.scatterColor}. */
71
+ scatterColor;
72
+ /** Optical depth of the longest box side at the mean density (with `normalizeDensity`). */
73
+ extinction;
74
+ /** Extinction scale of each channel (spectral rendering). */
75
+ extinctionScale;
76
+ /** Ångström exponent of the extinction spectrum: a number or a preset name. */
77
+ angstromExponent;
78
+ /** `'volume'` lighting: phase overrides (null: the renderer's `settings`); see {@link VDBFrameVolumeProps.phase}. */
79
+ phase;
80
+ /** Forward `g` override of `'volume'` lighting (null: the renderer's). */
81
+ phaseG;
82
+ /** Backward-lobe `g` override (null: the renderer's). */
83
+ phaseBackG;
84
+ /** Backward-lobe weight override (null: the renderer's). */
85
+ phaseBackWeight;
86
+ /** Wavelength exponent of `g` override (null: the renderer's). */
87
+ phaseGExponent;
88
+ /** Multiplier of the density; see {@link VDBFrameVolumeProps.densityScale}. */
89
+ densityScale;
90
+ /** Whether the density scale is divided by the mean density. */
91
+ normalizeDensity;
92
+ /** See {@link VDBFrameVolumeProps.densityMean}; null: the source's mean. */
93
+ densityMean;
94
+ /** Densities at or below this read as 0. */
95
+ densityCutoff;
96
+ /** Scales the optical depth of the shadow march. */
97
+ absorbance;
98
+ /** Opacity of the composited volume, 0 to 1. */
99
+ opacity;
100
+ /** Multiplier of the emission. */
101
+ emissiveIntensity;
102
+ /** Kelvin at emission values 0 (x) and 1 (y). */
103
+ temperatureRange;
104
+ /** Offset of the texture lookup in texture coordinates. */
105
+ offset3D;
106
+ /** Texture wrapping of the lookup. */
107
+ wrap3D;
108
+ /** Light types bitmask (`VDB_FRAME_LIGHT_BITS`) this volume receives. */
109
+ lights;
110
+ /** Steps of the shadow march in `'volume'` lighting. */
111
+ shadowSteps;
112
+ /** Whether the source's mip levels are sampled. */
113
+ mipmaps;
114
+ /** Whether the sparse source's shadow march skips empty space (no effect on dense sources). */
115
+ hdda;
116
+ /**
117
+ * The volume's box in its local space: the `bbox` prop, else the source's box, re-read
118
+ * when the source's `version` moves: a dense frame with another `.wvdb` box (a sequence frame; RV, as his WVDB sequences)
119
+ * or a sparse source made with `followImage` after its grid's image changed (G16a, e.g. a coarse-first
120
+ * swap), so this object is updated in place then. Do not mutate.
121
+ */
122
+ bbox;
123
+ /** The medium fields at construction, for `setMedium(null)`. */
124
+ initialMedium;
125
+ /** `source.version` the box was last read at. */
126
+ sourceVersion;
127
+ /** G16a / RV: the box is the source's (no `bbox` prop), so it follows the source. */
128
+ boxFromSource;
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
+ */
135
+ constructor(source, props = {}) {
136
+ super();
137
+ const ok = source && ((source.kind === "dense" && !!source.volume?.density) || (source.kind === "sparse" && !!source.grids));
138
+ if (!ok) {
139
+ throw new VDBError("VDB_BAD_OPTION", "VDBFrameVolume: pass a volume source from vdbDenseTextures() or vdbSparseSource() (@pmndrs/vdb/three).");
140
+ }
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;
146
+ this.source = source;
147
+ this.frameRenderer = frameRenderer;
148
+ this.emissionColor = emissionColor;
149
+ this.baseColor = new THREE.Color(baseColor);
150
+ this.scatterColor = new THREE.Color(scatterColor);
151
+ this.extinction = extinction;
152
+ this.extinctionScale = Array.isArray(extinctionScale) ? new THREE.Vector3().fromArray(extinctionScale) : new THREE.Vector3().copy(extinctionScale);
153
+ this.angstromExponent = angstromExponent;
154
+ this.phase = phase;
155
+ this.phaseG = phaseG;
156
+ this.phaseBackG = phaseBackG;
157
+ this.phaseBackWeight = phaseBackWeight;
158
+ this.phaseGExponent = phaseGExponent;
159
+ this.densityScale = densityScale;
160
+ this.normalizeDensity = normalizeDensity;
161
+ this.densityMean = densityMean;
162
+ this.densityCutoff = densityCutoff;
163
+ this.absorbance = absorbance;
164
+ this.opacity = opacity;
165
+ this.emissiveIntensity = emissiveIntensity;
166
+ this.temperatureRange = new THREE.Vector2().fromArray(temperatureRange);
167
+ this.offset3D = new THREE.Vector3().copy(offset3D);
168
+ this.wrap3D = wrap3D;
169
+ this.lights = lights;
170
+ this.shadowSteps = shadowSteps;
171
+ this.mipmaps = mipmaps;
172
+ this.hdda = hdda;
173
+ this.initialMedium = { baseColor: this.baseColor.clone(), extinctionScale: this.extinctionScale.clone(), angstromExponent };
174
+ this.sourceVersion = source.version;
175
+ this.proxy = new THREE.Mesh(frameRenderer.createProxyGeometry(), frameRenderer.proxyMaterial());
176
+ this.proxy.frustumCulled = false;
177
+ this.proxy.renderOrder = frameRenderOrder;
178
+ this.proxy.onBeforeRender = (renderer, scene, camera) => {
179
+ frameRenderer.render(renderer, scene, camera, this.proxy);
180
+ };
181
+ this.add(this.proxy);
182
+ // FrameVolume.js L339–353: the volume box as a matrix of the unit box.
183
+ const box = toBox(bbox, source);
184
+ this.bbox = box;
185
+ this.boxFromSource = bbox === undefined;
186
+ this.boxMatrix = boxMatrix(box, new THREE.Matrix4());
187
+ }
188
+ /** The mean density `normalizeDensity` divides by: `densityMean` when set, else the source's mean of the non-zero texels (his `meanDensity`). */
189
+ get meanDensity() {
190
+ return this.densityMean ?? this.source.stats.meanNonZero;
191
+ }
192
+ /** The phase this volume is drawn with in `'volume'` lighting: its own `phase*` fields where set, else the renderer's `settings` (a reused object). */
193
+ getPhase() {
194
+ const s = this.frameRenderer.settings;
195
+ const p = this.resolvedPhase;
196
+ p.phase = this.phase ?? s.phase;
197
+ p.phaseG = this.phaseG ?? s.phaseG;
198
+ p.phaseBackG = this.phaseBackG ?? s.phaseBackG;
199
+ p.phaseBackWeight = this.phaseBackWeight ?? s.phaseBackWeight;
200
+ p.phaseGExponent = this.phaseGExponent ?? s.phaseGExponent;
201
+ return p;
202
+ }
203
+ /**
204
+ * A measured medium in one call (`'cloud'`, `'fog'`, `'ice'`, `'soot'`, `'white-smoke'`, `'dark-smoke'`, `'haze'`,
205
+ * `'dust'`, or {@link VDBFrameMediumVolumeProps} from `vdbFrameMedium`), as his GUI's 'Medium' field: the volume's
206
+ * `baseColor`, `extinctionScale` and `angstromExponent`; the phase on the renderer (`frameRenderer.settings.phase`,
207
+ * `phaseG`, `phaseGExponent`: the phase of 'frame' lighting and the default of 'volume' lighting; the volume's own
208
+ * phase overrides are cleared) and `settings.spectral` on. The renderer's settings are shared by every volume it
209
+ * draws. `null` restores the volume's constructor colour, extinction scale and Ångström exponent (the renderer is left
210
+ * as it is). Returns the props applied (null for `null`); an unknown name throws `VDB_BAD_OPTION`.
211
+ */
212
+ setMedium(medium) {
213
+ if (medium === null) {
214
+ this.baseColor.copy(this.initialMedium.baseColor);
215
+ this.extinctionScale.copy(this.initialMedium.extinctionScale);
216
+ this.angstromExponent = this.initialMedium.angstromExponent;
217
+ return null;
218
+ }
219
+ const props = typeof medium === "string" ? getFrameMediumProps(medium) : medium;
220
+ if (!props)
221
+ throw new VDBError("VDB_BAD_OPTION", `VDBFrameVolume.setMedium: unknown medium ${JSON.stringify(medium)}; use one of vdbFrameMediumNames (@pmndrs/vdb/tools).`);
222
+ this.baseColor.copy(props.baseColor);
223
+ this.extinctionScale.copy(props.extinctionScale);
224
+ this.angstromExponent = props.angstromExponent;
225
+ this.phase = this.phaseG = this.phaseBackG = this.phaseBackWeight = this.phaseGExponent = null;
226
+ const s = this.frameRenderer.settings;
227
+ s.phase = props.phase;
228
+ s.phaseG = props.phaseG;
229
+ s.phaseGExponent = props.phaseGExponent;
230
+ s.spectral = true;
231
+ return props;
232
+ }
233
+ /** The density scale the renderer draws with: `densityScale`, divided by the mean density with `normalizeDensity`. */
234
+ getDensityScale() {
235
+ const meanDensity = this.meanDensity;
236
+ return this.normalizeDensity && meanDensity > 0.0 ? this.densityScale / meanDensity : this.densityScale;
237
+ }
238
+ /**
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.
242
+ */
243
+ updateSource() {
244
+ this.sourceVersion = this.source.version;
245
+ // G16a: a sparse source's box (a followImage source re-reads it after an image change). RV: a dense frame's
246
+ // .wvdb box (his WVDB sequences give every frame its own box; a null box, an empty frame, keeps the last one).
247
+ const sourceBox = this.source.kind === "sparse" ? this.source.bbox : this.source.volume.bbox;
248
+ if (this.boxFromSource && sourceBox) {
249
+ const [min, max] = sourceBox;
250
+ const b = this.bbox;
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]) {
252
+ b.min.set(...min);
253
+ b.max.set(...max);
254
+ boxMatrix(b, this.boxMatrix);
255
+ }
256
+ }
257
+ }
258
+ /** {@link VDBFrameVolume.updateSource} if the source changed since (its `version`: a resized dense frame, a replaced pool image). Cheap; called per render. */
259
+ syncSource() {
260
+ if (this.source.version !== this.sourceVersion)
261
+ this.updateSource();
262
+ }
263
+ /** Frees the proxy geometry. The source belongs to the caller; the renderer drops the volume when it leaves the scene. */
264
+ dispose() {
265
+ this.proxy.geometry.dispose();
266
+ }
267
+ }
268
+ //# sourceMappingURL=volume.js.map
@@ -0,0 +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,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,aAAa,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAyB,MAAM,eAAe,CAAC;AAExE,0DAA0D;AAC1D,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAuFjC,MAAM,KAAK,GAAG,CAAC,IAAiC,EAAE,MAA4B,EAAc,EAAE;IAC5F,IAAI,IAAI,YAAY,KAAK,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACpD,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/E,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAA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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"]}