@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.
- package/CHANGELOG.md +592 -2
- package/README.md +85 -37
- package/THIRD_PARTY_NOTICES.md +197 -29
- package/dist/core/compute/atlas.d.ts +10 -2
- package/dist/core/compute/atlas.js +6 -1
- package/dist/core/compute/atlas.js.map +1 -1
- package/dist/core/compute/index.d.ts +3 -3
- package/dist/core/compute/index.js +2 -2
- package/dist/core/compute/index.js.map +1 -1
- package/dist/core/compute/majorant-build.d.ts +45 -0
- package/dist/core/compute/majorant-build.js +193 -0
- package/dist/core/compute/majorant-build.js.map +1 -0
- package/dist/core/compute/multi-scale.d.ts +155 -0
- package/dist/core/compute/multi-scale.js +684 -0
- package/dist/core/compute/multi-scale.js.map +1 -0
- package/dist/core/compute/pyramid.d.ts +22 -7
- package/dist/core/compute/pyramid.js +22 -9
- package/dist/core/compute/pyramid.js.map +1 -1
- package/dist/core/compute/shared.d.ts +1 -0
- package/dist/core/compute/shared.js.map +1 -1
- package/dist/core/compute/stats.d.ts +10 -3
- package/dist/core/compute/stats.js +6 -1
- package/dist/core/compute/stats.js.map +1 -1
- package/dist/core/compute/value-transform.d.ts +8 -1
- package/dist/core/compute/value-transform.js +9 -3
- package/dist/core/compute/value-transform.js.map +1 -1
- package/dist/core/errors.d.ts +10 -0
- package/dist/core/errors.js +8 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/frame/emission.d.ts +85 -0
- package/dist/core/frame/emission.js +422 -0
- package/dist/core/frame/emission.js.map +1 -0
- package/dist/core/frame/environment.d.ts +47 -0
- package/dist/core/frame/environment.js +178 -0
- package/dist/core/frame/environment.js.map +1 -0
- package/dist/core/frame/index.d.ts +39 -0
- package/dist/core/frame/index.js +27 -0
- package/dist/core/frame/index.js.map +1 -0
- package/dist/core/frame/kernels.d.ts +115 -0
- package/dist/core/frame/kernels.js +496 -0
- package/dist/core/frame/kernels.js.map +1 -0
- package/dist/core/frame/limits.d.ts +67 -0
- package/dist/core/frame/limits.js +109 -0
- package/dist/core/frame/limits.js.map +1 -0
- package/dist/core/frame/phase.d.ts +17 -0
- package/dist/core/frame/phase.js +53 -0
- package/dist/core/frame/phase.js.map +1 -0
- package/dist/core/frame/pipelines.d.ts +49 -0
- package/dist/core/frame/pipelines.js +147 -0
- package/dist/core/frame/pipelines.js.map +1 -0
- package/dist/core/frame/renderer.d.ts +122 -0
- package/dist/core/frame/renderer.js +1712 -0
- package/dist/core/frame/renderer.js.map +1 -0
- package/dist/core/frame/resources.d.ts +71 -0
- package/dist/core/frame/resources.js +100 -0
- package/dist/core/frame/resources.js.map +1 -0
- package/dist/core/frame/scattering.d.ts +97 -0
- package/dist/core/frame/scattering.js +332 -0
- package/dist/core/frame/scattering.js.map +1 -0
- package/dist/core/frame/settings.d.ts +243 -0
- package/dist/core/frame/settings.js +67 -0
- package/dist/core/frame/settings.js.map +1 -0
- package/dist/core/frame/shadows.d.ts +55 -0
- package/dist/core/frame/shadows.js +460 -0
- package/dist/core/frame/shadows.js.map +1 -0
- package/dist/core/frame/types.d.ts +415 -0
- package/dist/core/frame/types.js +49 -0
- package/dist/core/frame/types.js.map +1 -0
- package/dist/core/frame/uniforms.d.ts +105 -0
- package/dist/core/frame/uniforms.js +276 -0
- package/dist/core/frame/uniforms.js.map +1 -0
- package/dist/core/frame/wgsl/chunks.d.ts +4 -0
- package/dist/core/frame/wgsl/chunks.js +728 -0
- package/dist/core/frame/wgsl/chunks.js.map +1 -0
- package/dist/core/frame/wgsl/emission.d.ts +82 -0
- package/dist/core/frame/wgsl/emission.js +353 -0
- package/dist/core/frame/wgsl/emission.js.map +1 -0
- package/dist/core/frame/wgsl/environment.d.ts +42 -0
- package/dist/core/frame/wgsl/environment.js +711 -0
- package/dist/core/frame/wgsl/environment.js.map +1 -0
- package/dist/core/frame/wgsl/gather.d.ts +55 -0
- package/dist/core/frame/wgsl/gather.js +850 -0
- package/dist/core/frame/wgsl/gather.js.map +1 -0
- package/dist/core/frame/wgsl/integrate.d.ts +78 -0
- package/dist/core/frame/wgsl/integrate.js +213 -0
- package/dist/core/frame/wgsl/integrate.js.map +1 -0
- package/dist/core/frame/wgsl/lighting.d.ts +103 -0
- package/dist/core/frame/wgsl/lighting.js +1636 -0
- package/dist/core/frame/wgsl/lighting.js.map +1 -0
- package/dist/core/frame/wgsl/occluders.d.ts +20 -0
- package/dist/core/frame/wgsl/occluders.js +95 -0
- package/dist/core/frame/wgsl/occluders.js.map +1 -0
- package/dist/core/frame/wgsl/resolve.d.ts +19 -0
- package/dist/core/frame/wgsl/resolve.js +205 -0
- package/dist/core/frame/wgsl/resolve.js.map +1 -0
- package/dist/core/frame/wgsl/shadows.d.ts +35 -0
- package/dist/core/frame/wgsl/shadows.js +328 -0
- package/dist/core/frame/wgsl/shadows.js.map +1 -0
- package/dist/core/half.d.ts +11 -0
- package/dist/core/half.js +22 -0
- package/dist/core/half.js.map +1 -0
- package/dist/core/index.d.ts +25 -3
- package/dist/core/index.js +23 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/internal.d.ts +17 -1
- package/dist/core/internal.js +18 -1
- package/dist/core/internal.js.map +1 -1
- package/dist/core/pool/image-header.d.ts +13 -2
- package/dist/core/pool/image-header.js +24 -5
- package/dist/core/pool/image-header.js.map +1 -1
- package/dist/core/pool/layout.d.ts +35 -1
- package/dist/core/pool/layout.js +51 -2
- package/dist/core/pool/layout.js.map +1 -1
- package/dist/core/pool/limits.d.ts +1 -0
- package/dist/core/pool/limits.js +1 -0
- package/dist/core/pool/limits.js.map +1 -1
- package/dist/core/pool/pool.d.ts +120 -15
- package/dist/core/pool/pool.js +255 -24
- package/dist/core/pool/pool.js.map +1 -1
- package/dist/core/reference/index.d.ts +6 -0
- package/dist/core/reference/index.js +7 -0
- package/dist/core/reference/index.js.map +1 -0
- package/dist/core/reference/renderer.d.ts +105 -0
- package/dist/core/reference/renderer.js +474 -0
- package/dist/core/reference/renderer.js.map +1 -0
- package/dist/core/reference/wgsl.d.ts +65 -0
- package/dist/core/reference/wgsl.js +803 -0
- package/dist/core/reference/wgsl.js.map +1 -0
- package/dist/{three → core}/sequence.d.ts +32 -2
- package/dist/{three → core}/sequence.js +24 -2
- package/dist/core/sequence.js.map +1 -0
- package/dist/core/source/brick-cache.d.ts +165 -0
- package/dist/core/source/brick-cache.js +627 -0
- package/dist/core/source/brick-cache.js.map +1 -0
- package/dist/core/source/dense-fill.d.ts +53 -0
- package/dist/core/source/dense-fill.js +377 -0
- package/dist/core/source/dense-fill.js.map +1 -0
- package/dist/core/source/dense.d.ts +33 -2
- package/dist/core/source/dense.js +121 -24
- package/dist/core/source/dense.js.map +1 -1
- package/dist/core/source/sparse-wgsl.d.ts +92 -0
- package/dist/core/source/sparse-wgsl.js +481 -0
- package/dist/core/source/sparse-wgsl.js.map +1 -0
- package/dist/core/source/sparse.d.ts +192 -0
- package/dist/core/source/sparse.js +762 -0
- package/dist/core/source/sparse.js.map +1 -0
- package/dist/core/source/types.d.ts +59 -2
- package/dist/core/source/types.js.map +1 -1
- package/dist/core/surface/index.d.ts +10 -0
- package/dist/core/surface/index.js +9 -0
- package/dist/core/surface/index.js.map +1 -0
- package/dist/core/surface/level-set-pass.d.ts +140 -0
- package/dist/core/surface/level-set-pass.js +291 -0
- package/dist/core/surface/level-set-pass.js.map +1 -0
- package/dist/core/surface/level-set-wgsl.d.ts +46 -0
- package/dist/core/surface/level-set-wgsl.js +99 -0
- package/dist/core/surface/level-set-wgsl.js.map +1 -0
- package/dist/core/surface/points.d.ts +109 -0
- package/dist/core/surface/points.js +226 -0
- package/dist/core/surface/points.js.map +1 -0
- package/dist/core/types.d.ts +12 -3
- package/dist/core/types.js +6 -2
- package/dist/core/types.js.map +1 -1
- package/dist/core/wgsl/api.d.ts +29 -5
- package/dist/core/wgsl/api.js +110 -27
- package/dist/core/wgsl/api.js.map +1 -1
- package/dist/core/wgsl/generate.d.ts +8 -0
- package/dist/core/wgsl/generate.js +195 -22
- package/dist/core/wgsl/generate.js.map +1 -1
- package/dist/core/wgsl/lean.d.ts +50 -0
- package/dist/core/wgsl/lean.js +327 -0
- package/dist/core/wgsl/lean.js.map +1 -0
- package/dist/core/wgsl/level-set.d.ts +5 -1
- package/dist/core/wgsl/level-set.js +11 -5
- package/dist/core/wgsl/level-set.js.map +1 -1
- package/dist/core/wgsl/majorant.d.ts +62 -0
- package/dist/core/wgsl/majorant.js +381 -0
- package/dist/core/wgsl/majorant.js.map +1 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +2 -2
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +15 -12
- package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -1
- package/dist/core/wgsl/types.d.ts +97 -3
- package/dist/core/wgsl/types.js.map +1 -1
- package/dist/three/coarse-first.d.ts +53 -8
- package/dist/three/coarse-first.js +24 -6
- package/dist/three/coarse-first.js.map +1 -1
- package/dist/three/compute.d.ts +12 -2
- package/dist/three/compute.js +16 -6
- package/dist/three/compute.js.map +1 -1
- package/dist/three/device.d.ts +7 -0
- package/dist/three/device.js +3 -0
- package/dist/three/device.js.map +1 -1
- package/dist/three/frame/core-environment.d.ts +38 -0
- package/dist/three/frame/core-environment.js +154 -0
- package/dist/three/frame/core-environment.js.map +1 -0
- package/dist/three/frame/core-integrate-material.d.ts +34 -0
- package/dist/three/frame/core-integrate-material.js +162 -0
- package/dist/three/frame/core-integrate-material.js.map +1 -0
- package/dist/three/frame/core-occluders.d.ts +53 -0
- package/dist/three/frame/core-occluders.js +193 -0
- package/dist/three/frame/core-occluders.js.map +1 -0
- package/dist/three/frame/core-structs.d.ts +34 -0
- package/dist/three/frame/core-structs.js +61 -0
- package/dist/three/frame/core-structs.js.map +1 -0
- package/dist/three/frame/core-textures.d.ts +41 -0
- package/dist/three/frame/core-textures.js +114 -0
- package/dist/three/frame/core-textures.js.map +1 -0
- package/dist/three/frame/emission-light.d.ts +64 -114
- package/dist/three/frame/emission-light.js +188 -567
- package/dist/three/frame/emission-light.js.map +1 -1
- package/dist/three/frame/index.d.ts +11 -31
- package/dist/three/frame/index.js +9 -29
- package/dist/three/frame/index.js.map +1 -1
- package/dist/three/frame/medium.d.ts +12 -0
- package/dist/three/frame/medium.js.map +1 -1
- package/dist/three/frame/renderer.d.ts +58 -454
- package/dist/three/frame/renderer.js +409 -1427
- package/dist/three/frame/renderer.js.map +1 -1
- package/dist/three/frame/spectrum.d.ts +0 -14
- package/dist/three/frame/spectrum.js +2 -23
- package/dist/three/frame/spectrum.js.map +1 -1
- package/dist/three/frame/three-internals.d.ts +3 -8
- package/dist/three/frame/three-internals.js +13 -11
- package/dist/three/frame/three-internals.js.map +1 -1
- package/dist/three/frame/volume-shadows.d.ts +93 -107
- package/dist/three/frame/volume-shadows.js +278 -631
- package/dist/three/frame/volume-shadows.js.map +1 -1
- package/dist/three/frame/volume.d.ts +91 -33
- package/dist/three/frame/volume.js +63 -51
- package/dist/three/frame/volume.js.map +1 -1
- package/dist/three/grid-node.d.ts +34 -1
- package/dist/three/grid-node.js +36 -1
- package/dist/three/grid-node.js.map +1 -1
- package/dist/three/index.d.ts +20 -11
- package/dist/three/index.js +21 -12
- package/dist/three/index.js.map +1 -1
- package/dist/three/internal.d.ts +14 -8
- package/dist/three/internal.js +11 -7
- package/dist/three/internal.js.map +1 -1
- package/dist/three/level-set-material.d.ts +81 -8
- package/dist/three/level-set-material.js +162 -125
- package/dist/three/level-set-material.js.map +1 -1
- package/dist/three/level-set-physical-material.d.ts +154 -0
- package/dist/three/level-set-physical-material.js +253 -0
- package/dist/three/level-set-physical-material.js.map +1 -0
- package/dist/three/level-set-velocity.d.ts +94 -0
- package/dist/three/level-set-velocity.js +208 -0
- package/dist/three/level-set-velocity.js.map +1 -0
- package/dist/three/material.d.ts +141 -11
- package/dist/three/material.js +161 -18
- package/dist/three/material.js.map +1 -1
- package/dist/three/points.d.ts +60 -4
- package/dist/three/points.js +140 -9
- package/dist/three/points.js.map +1 -1
- package/dist/three/sparse-source.d.ts +49 -117
- package/dist/three/sparse-source.js +109 -580
- package/dist/three/sparse-source.js.map +1 -1
- package/dist/three/volume-source.d.ts +11 -156
- package/dist/three/volume-source.js +29 -272
- package/dist/three/volume-source.js.map +1 -1
- package/dist/tools/cpu/brick-atlas.d.ts +36 -0
- package/dist/tools/cpu/brick-atlas.js +129 -0
- package/dist/tools/cpu/brick-atlas.js.map +1 -0
- package/dist/tools/cpu/compute.d.ts +23 -4
- package/dist/tools/cpu/compute.js +35 -14
- package/dist/tools/cpu/compute.js.map +1 -1
- package/dist/tools/cpu/lean-reads.d.ts +81 -0
- package/dist/tools/cpu/lean-reads.js +262 -0
- package/dist/tools/cpu/lean-reads.js.map +1 -0
- package/dist/tools/cpu/level-set.d.ts +42 -3
- package/dist/tools/cpu/level-set.js +59 -7
- package/dist/tools/cpu/level-set.js.map +1 -1
- package/dist/tools/cpu/majorant.d.ts +265 -0
- package/dist/tools/cpu/majorant.js +541 -0
- package/dist/tools/cpu/majorant.js.map +1 -0
- package/dist/tools/cpu/march.d.ts +93 -2
- package/dist/tools/cpu/march.js +165 -14
- package/dist/tools/cpu/march.js.map +1 -1
- package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
- package/dist/tools/cpu/mesh-decimate.js +1225 -0
- package/dist/tools/cpu/mesh-decimate.js.map +1 -0
- package/dist/tools/cpu/points.d.ts +29 -0
- package/dist/tools/cpu/points.js +38 -0
- package/dist/tools/cpu/points.js.map +1 -0
- package/dist/tools/cpu/read-value.d.ts +19 -6
- package/dist/tools/cpu/read-value.js +32 -17
- package/dist/tools/cpu/read-value.js.map +1 -1
- package/dist/tools/cpu/sample-trilinear.d.ts +17 -4
- package/dist/tools/cpu/sample-trilinear.js +19 -7
- package/dist/tools/cpu/sample-trilinear.js.map +1 -1
- package/dist/tools/cpu/stride-tables.d.ts +2 -2
- package/dist/tools/cpu/stride-tables.generated.d.ts +6 -5
- package/dist/tools/cpu/stride-tables.generated.js +7 -6
- package/dist/tools/cpu/stride-tables.generated.js.map +1 -1
- package/dist/tools/cpu/stride-tables.js +1 -1
- package/dist/tools/cpu/stride-tables.js.map +1 -1
- package/dist/tools/cpu/surface-nets.d.ts +90 -0
- package/dist/tools/cpu/surface-nets.js +597 -0
- package/dist/tools/cpu/surface-nets.js.map +1 -0
- package/dist/tools/errors.d.ts +9 -0
- package/dist/tools/errors.js +9 -0
- package/dist/tools/errors.js.map +1 -1
- package/dist/tools/frame/ambient.d.ts +98 -0
- package/dist/tools/frame/ambient.js +274 -0
- package/dist/tools/frame/ambient.js.map +1 -0
- package/dist/tools/frame/blackbody.d.ts +15 -0
- package/dist/tools/frame/blackbody.js +35 -0
- package/dist/tools/frame/blackbody.js.map +1 -1
- package/dist/tools/frame/brick-cache.d.ts +165 -0
- package/dist/tools/frame/brick-cache.js +326 -0
- package/dist/tools/frame/brick-cache.js.map +1 -0
- package/dist/tools/frame/emission.d.ts +9 -0
- package/dist/tools/frame/emission.js +9 -1
- package/dist/tools/frame/emission.js.map +1 -1
- package/dist/tools/frame/environment-gpu.d.ts +111 -0
- package/dist/tools/frame/environment-gpu.js +280 -0
- package/dist/tools/frame/environment-gpu.js.map +1 -0
- package/dist/tools/frame/environment.d.ts +3 -2
- package/dist/tools/frame/environment.js +8 -4
- package/dist/tools/frame/environment.js.map +1 -1
- package/dist/tools/frame/froxel.d.ts +58 -0
- package/dist/tools/frame/froxel.js +115 -0
- package/dist/tools/frame/froxel.js.map +1 -0
- package/dist/tools/frame/grid.d.ts +90 -0
- package/dist/tools/frame/grid.js +112 -13
- package/dist/tools/frame/grid.js.map +1 -1
- package/dist/tools/frame/index.d.ts +14 -0
- package/dist/tools/frame/index.js +45 -4
- package/dist/tools/frame/index.js.map +1 -1
- package/dist/tools/frame/medium.d.ts +16 -0
- package/dist/tools/frame/medium.js +3 -1
- package/dist/tools/frame/medium.js.map +1 -1
- package/dist/tools/frame/mie.d.ts +9 -0
- package/dist/tools/frame/mie.js +18 -0
- package/dist/tools/frame/mie.js.map +1 -1
- package/dist/tools/frame/mlp-nn.d.ts +36 -0
- package/dist/tools/frame/mlp-nn.js +159 -0
- package/dist/tools/frame/mlp-nn.js.map +1 -0
- package/dist/tools/frame/mlp-tza.d.ts +29 -0
- package/dist/tools/frame/mlp-tza.js +186 -0
- package/dist/tools/frame/mlp-tza.js.map +1 -0
- package/dist/tools/frame/mlp.d.ts +183 -0
- package/dist/tools/frame/mlp.js +434 -0
- package/dist/tools/frame/mlp.js.map +1 -0
- package/dist/tools/frame/ms-exit.d.ts +42 -0
- package/dist/tools/frame/ms-exit.js +90 -0
- package/dist/tools/frame/ms-exit.js.map +1 -0
- package/dist/tools/frame/multi-scale.d.ts +152 -0
- package/dist/tools/frame/multi-scale.js +302 -0
- package/dist/tools/frame/multi-scale.js.map +1 -0
- package/dist/tools/frame/neural-weights.d.ts +6 -5
- package/dist/tools/frame/neural-weights.js +234 -235
- package/dist/tools/frame/neural-weights.js.map +1 -1
- package/dist/tools/frame/neural.js +1 -1
- package/dist/tools/frame/neural.js.map +1 -1
- package/dist/tools/frame/occluders.d.ts +51 -0
- package/dist/tools/frame/occluders.js +72 -0
- package/dist/tools/frame/occluders.js.map +1 -0
- package/dist/tools/frame/pyramid-layout.d.ts +17 -0
- package/dist/tools/frame/pyramid-layout.js +47 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -1
- package/dist/tools/frame/shadows.d.ts +110 -0
- package/dist/tools/frame/shadows.js +286 -0
- package/dist/tools/frame/shadows.js.map +1 -1
- package/dist/tools/frame/sparse.d.ts +82 -0
- package/dist/tools/frame/sparse.js +242 -1
- package/dist/tools/frame/sparse.js.map +1 -1
- package/dist/tools/frame/spectral-stack.d.ts +159 -0
- package/dist/tools/frame/spectral-stack.js +391 -0
- package/dist/tools/frame/spectral-stack.js.map +1 -0
- package/dist/tools/frame/spectral.d.ts +21 -2
- package/dist/tools/frame/spectral.js +30 -8
- package/dist/tools/frame/spectral.js.map +1 -1
- package/dist/tools/frame/stack.d.ts +115 -0
- package/dist/tools/frame/stack.js +290 -0
- package/dist/tools/frame/stack.js.map +1 -0
- package/dist/tools/frame/view.d.ts +131 -0
- package/dist/tools/frame/view.js +337 -0
- package/dist/tools/frame/view.js.map +1 -0
- package/dist/tools/index.d.ts +66 -15
- package/dist/tools/index.js +55 -11
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/internal.d.ts +58 -17
- package/dist/tools/internal.js +65 -11
- package/dist/tools/internal.js.map +1 -1
- package/dist/tools/nanovdb/build-from-vdb.d.ts +11 -2
- package/dist/tools/nanovdb/build-from-vdb.js +10 -2
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -1
- package/dist/tools/nanovdb/bytes.d.ts +17 -4
- package/dist/tools/nanovdb/bytes.js +46 -3
- package/dist/tools/nanovdb/bytes.js.map +1 -1
- package/dist/tools/nanovdb/coarse-first.d.ts +19 -3
- package/dist/tools/nanovdb/coarse-first.js +7 -1
- package/dist/tools/nanovdb/coarse-first.js.map +1 -1
- package/dist/tools/nanovdb/half.d.ts +22 -0
- package/dist/tools/nanovdb/half.js +73 -0
- package/dist/tools/nanovdb/half.js.map +1 -0
- package/dist/tools/nanovdb/index.d.ts +3 -1
- package/dist/tools/nanovdb/index.js +2 -1
- package/dist/tools/nanovdb/index.js.map +1 -1
- package/dist/tools/nanovdb/inspect.d.ts +10 -1
- package/dist/tools/nanovdb/inspect.js +8 -1
- package/dist/tools/nanovdb/inspect.js.map +1 -1
- package/dist/tools/nanovdb/leaf-codec.d.ts +35 -1
- package/dist/tools/nanovdb/leaf-codec.js +40 -4
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -1
- package/dist/tools/nanovdb/quantize.d.ts +39 -10
- package/dist/tools/nanovdb/quantize.js +96 -44
- package/dist/tools/nanovdb/quantize.js.map +1 -1
- package/dist/tools/nanovdb/resample.d.ts +20 -3
- package/dist/tools/nanovdb/resample.js +20 -7
- package/dist/tools/nanovdb/resample.js.map +1 -1
- package/dist/tools/nanovdb/serialize.d.ts +34 -3
- package/dist/tools/nanovdb/serialize.js +51 -7
- package/dist/tools/nanovdb/serialize.js.map +1 -1
- package/dist/tools/nanovdb/stats.d.ts +34 -5
- package/dist/tools/nanovdb/stats.js +87 -11
- package/dist/tools/nanovdb/stats.js.map +1 -1
- package/dist/tools/nanovdb/transform.d.ts +4 -0
- package/dist/tools/nanovdb/transform.js +3 -0
- package/dist/tools/nanovdb/transform.js.map +1 -1
- package/dist/tools/nanovdb/tree.d.ts +14 -3
- package/dist/tools/nanovdb/tree.js +25 -13
- package/dist/tools/nanovdb/tree.js.map +1 -1
- package/dist/tools/nanovdb/write-nvdb.d.ts +47 -12
- package/dist/tools/nanovdb/write-nvdb.js +108 -28
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -1
- package/dist/tools/nvdb-file.d.ts +77 -7
- package/dist/tools/nvdb-file.js +177 -20
- package/dist/tools/nvdb-file.js.map +1 -1
- package/dist/tools/nvdb-stream.d.ts +23 -7
- package/dist/tools/nvdb-stream.js +78 -34
- package/dist/tools/nvdb-stream.js.map +1 -1
- package/dist/tools/reference/analytic.d.ts +41 -0
- package/dist/tools/reference/analytic.js +95 -0
- package/dist/tools/reference/analytic.js.map +1 -0
- package/dist/tools/reference/environment.d.ts +62 -0
- package/dist/tools/reference/environment.js +154 -0
- package/dist/tools/reference/environment.js.map +1 -0
- package/dist/tools/reference/index.d.ts +12 -0
- package/dist/tools/reference/index.js +13 -0
- package/dist/tools/reference/index.js.map +1 -0
- package/dist/tools/reference/media.d.ts +14 -0
- package/dist/tools/reference/media.js +30 -0
- package/dist/tools/reference/media.js.map +1 -0
- package/dist/tools/reference/rng.d.ts +20 -0
- package/dist/tools/reference/rng.js +30 -0
- package/dist/tools/reference/rng.js.map +1 -0
- package/dist/tools/reference/scene.d.ts +312 -0
- package/dist/tools/reference/scene.js +169 -0
- package/dist/tools/reference/scene.js.map +1 -0
- package/dist/tools/reference/tables.d.ts +98 -0
- package/dist/tools/reference/tables.js +264 -0
- package/dist/tools/reference/tables.js.map +1 -0
- package/dist/tools/reference/trace.d.ts +160 -0
- package/dist/tools/reference/trace.js +497 -0
- package/dist/tools/reference/trace.js.map +1 -0
- package/dist/tools/vdb/blosc-write.d.ts +43 -0
- package/dist/tools/vdb/blosc-write.js +197 -0
- package/dist/tools/vdb/blosc-write.js.map +1 -0
- package/dist/tools/vdb/blosc.d.ts +35 -5
- package/dist/tools/vdb/blosc.js +82 -26
- package/dist/tools/vdb/blosc.js.map +1 -1
- package/dist/tools/vdb/blosclz.d.ts +33 -0
- package/dist/tools/vdb/blosclz.js +112 -0
- package/dist/tools/vdb/blosclz.js.map +1 -0
- package/dist/tools/vdb/byte-reader.d.ts +13 -3
- package/dist/tools/vdb/byte-reader.js +26 -4
- package/dist/tools/vdb/byte-reader.js.map +1 -1
- package/dist/tools/vdb/compression.d.ts +13 -5
- package/dist/tools/vdb/compression.js +13 -2
- package/dist/tools/vdb/compression.js.map +1 -1
- package/dist/tools/vdb/grid.js +8 -2
- package/dist/tools/vdb/grid.js.map +1 -1
- package/dist/tools/vdb/index.d.ts +2 -1
- package/dist/tools/vdb/index.js.map +1 -1
- package/dist/tools/vdb/lz4.d.ts +30 -0
- package/dist/tools/vdb/lz4.js +228 -0
- package/dist/tools/vdb/lz4.js.map +1 -0
- package/dist/tools/vdb/metadata.js +1 -1
- package/dist/tools/vdb/metadata.js.map +1 -1
- package/dist/tools/vdb/parse.d.ts +24 -2
- package/dist/tools/vdb/parse.js +102 -32
- package/dist/tools/vdb/parse.js.map +1 -1
- package/dist/tools/vdb/point-render-data.d.ts +49 -1
- package/dist/tools/vdb/point-render-data.js +91 -11
- package/dist/tools/vdb/point-render-data.js.map +1 -1
- package/dist/tools/vdb/points.d.ts +26 -0
- package/dist/tools/vdb/points.js +46 -5
- package/dist/tools/vdb/points.js.map +1 -1
- package/dist/tools/vdb/types.d.ts +59 -2
- package/dist/tools/vdb/types.js.map +1 -1
- package/dist/tools/wvdb/bake.d.ts +38 -9
- package/dist/tools/wvdb/bake.js +63 -13
- package/dist/tools/wvdb/bake.js.map +1 -1
- package/dist/tools/wvdb/dense.d.ts +80 -1
- package/dist/tools/wvdb/dense.js +67 -8
- package/dist/tools/wvdb/dense.js.map +1 -1
- package/dist/tools/wvdb/format.d.ts +59 -0
- package/dist/tools/wvdb/format.js +3 -0
- package/dist/tools/wvdb/format.js.map +1 -1
- package/dist/tools/wvdb/index.d.ts +1 -0
- package/dist/tools/wvdb/index.js +1 -0
- package/dist/tools/wvdb/index.js.map +1 -1
- package/dist/tools/wvdb/level-set.d.ts +10 -2
- package/dist/tools/wvdb/level-set.js.map +1 -1
- package/dist/tools/wvdb/nanovdb.d.ts +6 -1
- package/dist/tools/wvdb/nanovdb.js +5 -1
- package/dist/tools/wvdb/nanovdb.js.map +1 -1
- package/dist/tools/wvdb/partial.d.ts +74 -0
- package/dist/tools/wvdb/partial.js +233 -0
- package/dist/tools/wvdb/partial.js.map +1 -0
- package/dist/tools/wvdb/read.d.ts +77 -1
- package/dist/tools/wvdb/read.js +30 -7
- package/dist/tools/wvdb/read.js.map +1 -1
- package/dist/tools/wvdb/write.d.ts +23 -1
- package/dist/tools/wvdb/write.js +8 -1
- package/dist/tools/wvdb/write.js.map +1 -1
- package/package.json +2 -1
- package/vendor/VENDOR.md +21 -6
- package/vendor/pnanovdb.wgsl +52 -14
- package/dist/three/frame/blackbody.d.ts +0 -42
- package/dist/three/frame/blackbody.js +0 -74
- package/dist/three/frame/blackbody.js.map +0 -1
- package/dist/three/frame/chunks.d.ts +0 -157
- package/dist/three/frame/chunks.js +0 -559
- package/dist/three/frame/chunks.js.map +0 -1
- package/dist/three/frame/density-material.d.ts +0 -53
- package/dist/three/frame/density-material.js +0 -353
- package/dist/three/frame/density-material.js.map +0 -1
- package/dist/three/frame/environment-grid-material.d.ts +0 -21
- package/dist/three/frame/environment-grid-material.js +0 -184
- package/dist/three/frame/environment-grid-material.js.map +0 -1
- package/dist/three/frame/environment-material.d.ts +0 -22
- package/dist/three/frame/environment-material.js +0 -87
- package/dist/three/frame/environment-material.js.map +0 -1
- package/dist/three/frame/grid-mip-material.d.ts +0 -12
- package/dist/three/frame/grid-mip-material.js +0 -61
- package/dist/three/frame/grid-mip-material.js.map +0 -1
- package/dist/three/frame/inject-material.d.ts +0 -56
- package/dist/three/frame/inject-material.js +0 -424
- package/dist/three/frame/inject-material.js.map +0 -1
- package/dist/three/frame/integrate-material.d.ts +0 -26
- package/dist/three/frame/integrate-material.js +0 -198
- package/dist/three/frame/integrate-material.js.map +0 -1
- package/dist/three/frame/layout.d.ts +0 -34
- package/dist/three/frame/layout.js +0 -48
- package/dist/three/frame/layout.js.map +0 -1
- package/dist/three/frame/lighting-material.d.ts +0 -41
- package/dist/three/frame/lighting-material.js +0 -257
- package/dist/three/frame/lighting-material.js.map +0 -1
- package/dist/three/frame/lights.d.ts +0 -11
- package/dist/three/frame/lights.js +0 -16
- package/dist/three/frame/lights.js.map +0 -1
- package/dist/three/frame/neural.d.ts +0 -14
- package/dist/three/frame/neural.js +0 -105
- package/dist/three/frame/neural.js.map +0 -1
- package/dist/three/frame/phase.d.ts +0 -44
- package/dist/three/frame/phase.js +0 -80
- package/dist/three/frame/phase.js.map +0 -1
- package/dist/three/frame/shadow-density-material.d.ts +0 -30
- package/dist/three/frame/shadow-density-material.js +0 -123
- package/dist/three/frame/shadow-density-material.js.map +0 -1
- package/dist/three/frame/temporal-material.d.ts +0 -29
- package/dist/three/frame/temporal-material.js +0 -152
- package/dist/three/frame/temporal-material.js.map +0 -1
- package/dist/three/frame/transmittance-material.d.ts +0 -31
- package/dist/three/frame/transmittance-material.js +0 -315
- package/dist/three/frame/transmittance-material.js.map +0 -1
- package/dist/three/frame/view.d.ts +0 -103
- package/dist/three/frame/view.js +0 -296
- package/dist/three/frame/view.js.map +0 -1
- package/dist/three/frame/volume-shadow-material.d.ts +0 -36
- package/dist/three/frame/volume-shadow-material.js +0 -128
- package/dist/three/frame/volume-shadow-material.js.map +0 -1
- package/dist/three/sequence.js.map +0 -1
|
@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AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAkB,EAAE,GAAyB,EAAE,UAAkC,EAAE;IACjH,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC;QAAE,MAAM,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAClG,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,MAAM,GAAG,CAAC,qCAAqC,CAAC,CAAC;IAC7F,OAAO,IAAI,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/frameShaderChunks.js L729–763 (createVolumeUniforms, the source\n// half), L834–1028 (createVolumeNodes: getLod, sampleExtinction, sampleAlbedo, sampleEmission and\n// the box helpers, through ./volume-source.ts).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: the density is read from a sparse NanoVDB grid in a VDBGridPool (vdbSample, trilinear)\n// instead of an 8-bit 3D texture; three LOD strategies instead of his box mip atlas; an HDDA\n// empty-space query for marches. Divergences: DIVERGES.md (K3.2 rows), V23–V25.\n\n/**\n * The sparse volume source (K3.2, R1 §4.2–4.3): a `VDBGridPool` grid behind the same seam as the\n * dense `.wvdb` source, so `VDBFrameVolume` renders NanoVDB grids.\n *\n * const grids = new VDBGridNode(renderer, pool, { profile: \"march\", helpers: [\"cellBoundTrilinear\", \"hddaCellEnd\", \"nodeAverage\", \"fastTrilinear\"] });\n * const source = vdbSparseSource(grids, { density: id }, { lod: \"coarse-pyramid\", images: { density: image } });\n * const volume = new VDBFrameVolume(source, { extinction: 100 }); // box: the grid's world box\n *\n * Positions are his local unit box [-0.5, 0.5]³; uvw = local + 0.5 (+ offset, wrapped) maps onto the\n * channel grid's index cell box `[min − ½, max + ½]` (voxel centres at integers), so uvw\n * (i + 0.5) / N lands on voxel min + i as on a dense texel centre. The sample position is clamped to\n * `[min, max]` (his clamp-to-edge). Level 0 is the pool's trilinear `vdbSample`; with the node helper\n * `'fastTrilinear'` (recommended, K3.2d) it is `vdbSampleFast` through one accessor per shader invocation\n * (`cacheAccessor`): the same values, 1.5–2× faster on the hardware GPU (docs/archive/handoffs/K3-2d.md).\n *\n * LOD (`lod`, his `sampleExtinction(localPos, lod)` at lod ≥ 1; R1 §4.3):\n * - `'none'`: level 0 always (no prefilter; aliases when a froxel spans many voxels). lodLevels 0.\n * - `'coarse-pyramid'` (default, the K3.2 A/B pick): a dense r16f pyramid from L₀ = max(1, ⌈log2(maxTexels / pyramidMax)⌉):\n * the base is a box resample of the grid, the levels above it his box mip atlas. lod in (0, L₀)\n * blends level 0 toward L₀; lod ≥ L₀ samples the pyramid as his mip atlas. GPU bytes: ~2 B × (base\n * + atlas) texels. Built on the GPU from the pool grid by default (`pyramidBuild: 'gpu'`, K3.2a: the\n * core's `vdbCreateBoxPyramid`, no CPU image needed) and rebuilt when the grid's image changes\n * (`pool.replace`: a sequence frame), checked once per render that samples it; `'cpu'` keeps the\n * K3.2 path (`@pmndrs/vdb/tools` `vdbBoxPyramid` from `images.density`, static). Both give the same\n * texels to ≤ 1 f16 ulp (e2e/k3-pyramid.spec.ts).\n * - `'node-average'`: no extra memory: trilinear over the node averages (`vdbNodeAverage`) at\n * level 3 (leaves, the exact 8³ box mean for fog leaves) and level 7 (lower nodes, the mean of\n * their active voxels); lod in (0, 3) blends level 0 → 3, (3, 7) blends 3 → 7. Needs stats.\n *\n * HDDA: `skipEmpty` lets a march jump samples that are provably 0 (`VDBFrameVolume` `hdda`, default\n * off since D30 / D31: it slowed the shadow march on Apple GPUs; the image is the same either way).\n *\n * Following the image (`followImage`, G16a): the index boxes, world box and pyramid are fixed when the source is\n * made unless it follows the grids' images. Then a `pool.replace` that changes a channel grid's box (a coarse-first\n * swap: the preview, then the full grid in the same id) is re-read from `pool.info` once the new image is resident:\n * new box uniforms, a new GPU pyramid of the new size (its textures swapped into the same texture nodes), the LOD\n * range as a uniform, and a new `version`, which a `VDBFrameVolume` follows with its box. No shader is rebuilt, and the\n * pyramid kernels of every type the `VDBGridNode` decodes are compiled up front.\n *\n * Mask, albedo and emission grids (optional, scalar; albedo may be three grids for RGB) are read at\n * level 0 only. One VDB module per shader: every grid goes through the one `VDBGridNode`.\n */\n\nimport * as THREE from \"three\";\nimport * as TSL from \"three/tsl\";\nimport { code, wgslFn } from \"three/tsl\";\nimport { VDBError } from \"../core/errors.js\";\nimport type { VDBVolumeChannels } from \"../core/source/types.js\";\nimport { vdbCreateBoxPyramid, warmBoxPyramidPipelines, type VDBBoxPyramidGpu } from \"../core/compute/pyramid.js\";\nimport { vdbBoxPyramid } from \"../tools/frame/sparse.js\";\nimport { vdbBoxPyramidLayout } from \"../tools/frame/pyramid-layout.js\";\nimport { getGPUTexture, webgpuBackendOf } from \"./device.js\";\nimport { leafVoxels, treeNodes } from \"../tools/cpu/march.js\";\nimport { vdbSample, type VDBGridNode, type VDBTslNode } from \"./grid-node.js\";\nimport {\n vdbBoxNodes,\n vdbDensityScaleOf,\n vdbGridUv,\n vdbMaxComponent,\n vdbMipSampler,\n type VDBThreeSourceFactory,\n type VDBVolumeNodes,\n type VDBVolumeNodesOptions,\n type VDBVolumeUniformParameters,\n type VDBVolumeUniforms,\n} from \"./volume-source.js\";\n\nconst { If, clamp, float, int, log2, max, min, mix, pow, select, texture3D, uint, uniform, vec2, vec3 } = TSL as unknown as Record<string, VDBTslNode>;\n\ntype Vec3 = [number, number, number];\n\n/** The LOD strategies of the sparse source (R1 §4.3); see the file comment. */\nexport type VDBSparseLod = \"none\" | \"coarse-pyramid\" | \"node-average\";\n\n/** The pool grid ids of the channels. `albedo`: one grey grid or three (RGB). */\nexport interface VDBSparseSourceGrids {\n density: number;\n mask?: number;\n albedo?: number | readonly [number, number, number];\n emission?: number;\n}\n\n/** Inclusive voxel index box. */\nexport interface VDBIndexBox {\n min: Vec3;\n max: Vec3;\n}\n\n/** Options of {@link vdbSparseSource}. */\nexport interface VDBSparseSourceOptions {\n /**\n * LOD strategy. Default `'coarse-pyramid'`, the K3.2 A/B's pick (closest to his mips, low flicker, cheap to\n * sample; needs `images.density`); see docs/archive/handoffs/K3-2.md.\n */\n lod?: VDBSparseLod;\n /** `'coarse-pyramid'`: base level texels on the longest side at most (default 128). */\n pyramidMax?: number;\n /**\n * `'coarse-pyramid'`: where the pyramid is built. `'gpu'` (default, K3.2a): a compute pass over the\n * pool grid on the renderer's device (the core's `vdbCreateBoxPyramid`), rebuilt when the grid's\n * `imageRevision` changes; needs an initialized WebGPURenderer behind the `VDBGridNode`. `'cpu'`:\n * `vdbBoxPyramid` from `images.density` (the K3.2 path, static; the GPU build's twin).\n */\n pyramidBuild?: \"gpu\" | \"cpu\";\n /** `'none'` (default): raw floats. `'clamp01'`: clamp each density sample to [0, 1] (his 8-bit range; parity A/B). */\n normalize?: \"none\" | \"clamp01\";\n /** CPU copies of the grid images: the density stats (and a `pyramidBuild: 'cpu'` pyramid) read `density`. */\n images?: { density?: Uint32Array };\n /**\n * Density stats (`normalizeDensity` divides by `meanNonZero`). Default: computed from `images.density`.\n * Either way they describe the image at creation; after the density grid's image changes (`pool.replace`,\n * its `imageRevision`) the source reads the new image back from the pool and recomputes them (K3.2e; see\n * `statsUpdates`).\n */\n stats?: { meanNonZero: number; max: number; activeVoxels: number };\n /** Density index box the unit box covers (default: the grid's index bbox). Aux grids use their own. */\n indexBox?: VDBIndexBox;\n /**\n * K3.6: index boxes the unit box covers in the aux grids (default: each grid's own index bbox). Grids converted\n * from one dense `.wvdb` level (`wvdbDenseToNvdb`) share the texture's box (`textureIndexBox`); pass it so a\n * sparse emission or mask channel lines up with the density (its active bbox is usually smaller).\n */\n auxIndexBoxes?: Partial<Record<\"mask\" | \"albedo\" | \"emission\", VDBIndexBox>>;\n /** World box (default: the density cell box through the grid's transform, as an AABB). */\n bbox?: [Vec3, Vec3];\n /**\n * K3.2d: level-0 samples through `vdbSampleFast` (the 8 trilinear taps as lower-node child lookups, no\n * tree walk per tap; bit-identical to `vdbSample`). Needs the `VDBGridNode` helper `'fastTrilinear'`.\n * Default: on when the node has the helper.\n */\n fastTrilinear?: boolean;\n /**\n * K3.2d: keep one accessor per shader invocation (a WGSL `var<private>`) across the samples of a march\n * instead of a fresh one per sample, so consecutive samples reuse its cached leaf/lower/upper nodes. The\n * values are the same either way. Default true (the K3.2d hardware A/B: with `fastTrilinear`, whose taps\n * start from the cached lower node, 10–25% off the source passes; alone it changes little).\n */\n cacheAccessor?: boolean;\n /**\n * G16a: follow the grids' images. When a channel grid's `imageRevision` moves (a `pool.replace`, e.g. a\n * `vdbStreamCoarseFirst` swap from the preview to the full grid) and every channel grid is resident again, the\n * source re-reads its index boxes, world box and transform from `pool.info`, rebuilds the coarse pyramid at the\n * new size and bumps `version` (a `VDBFrameVolume` whose box is the source's follows it). Boxes, sizes and LOD\n * levels are uniforms in this mode, so nothing recompiles; give the `VDBGridNode` every grid type the images will\n * have (`types`, e.g. `VDBCoarseFirstEvent.types`): a new image of a type the node does not compile throws\n * `VDB_TYPE_NOT_COMPILED` when the source re-reads it (it would read 0). Default false: the boxes are fixed when the\n * source is made. Not with `indexBox`, `auxIndexBoxes`, `bbox` or `pyramidBuild: 'cpu'`.\n */\n followImage?: boolean;\n}\n\n/** What the source needs from a pool: `info` and the ids' grids (a `VDBGridPool`). */\ninterface PoolInfoLike {\n info(id: number): { indexBBox: { min: Vec3; max: Vec3 }; indexToWorld: Float64Array; hasStats: boolean; capacity: number; type: string; imageRevision?: number; resident?: boolean };\n}\n\n/** The coarse pyramid of a `'coarse-pyramid'` sparse source. */\nexport interface VDBSparsePyramid {\n /** Where it was built (see `pyramidBuild`). */\n readonly build: \"gpu\" | \"cpu\";\n /** L₀: the base level in level-0 voxels. */\n readonly level: number;\n /** Texels of the base level. */\n readonly dimensions: [number, number, number];\n /** His atlas of the levels above the base (null for a 1³ base); `data` on the CPU path only. */\n readonly atlas: { readonly dimensions: [number, number, number]; readonly levels: number; readonly data?: Float32Array } | null;\n /** L₀ + atlas levels. */\n readonly lodLevels: number;\n /** The base level's f32 texels (CPU path only). */\n readonly data?: Float32Array;\n /** r16f textures: the base level and the atlas. */\n readonly map: THREE.Data3DTexture;\n readonly mip: THREE.Data3DTexture | null;\n /** The core GPU pyramid writing into `map` / `mip` (GPU path), else null. */\n readonly gpu: VDBBoxPyramidGpu | null;\n}\n\n/** The sparse source in three. */\nexport interface VDBThreeSparseSource extends VDBThreeSourceFactory {\n readonly grids: VDBGridNode;\n readonly ids: Readonly<VDBSparseSourceGrids>;\n readonly lod: VDBSparseLod;\n readonly normalize: \"none\" | \"clamp01\";\n /** The density index box the unit box covers. */\n readonly indexBox: VDBIndexBox;\n /** `'coarse-pyramid'` only: the pyramid and its textures. */\n readonly pyramid: VDBSparsePyramid | null;\n /** K3.2d: level 0 through `vdbSampleFast` (see the option). */\n readonly fastTrilinear: boolean;\n /** K3.2d: one accessor per invocation across samples (see the option). */\n readonly cacheAccessor: boolean;\n /** G16a: the boxes follow the grids' images (see the option). */\n readonly followImage: boolean;\n /** G16a: times the boxes (and the pyramid, if its size changed) were re-read after an image change. */\n readonly layoutUpdates: number;\n /**\n * GPU bytes: the grids' pool capacity, the pyramid textures (r16f) and the GPU build's scratch\n * buffers (kept for rebuilds; 0 on the CPU path).\n */\n readonly gpuBytes: { readonly pool: number; readonly pyramid: number; readonly pyramidScratch: number };\n /** GPU pyramid builds recorded so far (the first, then one per image change). */\n readonly pyramidBuilds: number;\n /** Density stats (`normalizeDensity`'s `meanNonZero`): of the density image at creation, then of the latest one read back (K3.2e). */\n readonly stats: { readonly meanNonZero: number; readonly max: number; readonly activeVoxels: number };\n /** Times the stats were recomputed after an image change (K3.2e). */\n readonly statsUpdates: number;\n /**\n * K3.2e: if the density grid's image changed since the stats were computed and it is resident, reads it\n * back from the pool (own encoder, submitted) and recomputes the stats (tools' twin of the CPU path);\n * resolves to whether it did. Renders call it themselves (the density scale uniform's render update) and\n * apply the new mean to the uniforms when the readback lands (K5.9a: a per-draw value, e.g. `VDBFrameVolume.densityScale`, is never overwritten); call it after `pool.update` was\n * submitted, as `grids.update()`.\n */\n refreshStats(): Promise<boolean>;\n /**\n * GPU path: rebuilds the pyramid now (own encoder, submitted) if the density grid's image changed\n * since the last build and it is resident; returns whether it did. Renders that sample the pyramid\n * call it themselves; call it after `pool.update` was submitted, as `grids.update()`.\n */\n refreshPyramid(): boolean;\n /**\n * The source's WGSL helpers as `wgslFn` nodes (including the grid module), for probes and tests:\n * `vdbFrameNodeAverage(g, p, dim) -> f32` (CPU twin `tools` `vdbFrameNodeAverageSample`) and\n * `vdbFrameSkipEmpty(g, o, d, t0, t1, cutoff, dilate) -> vec2f` (twin `vdbFrameSkipEmpty`).\n */\n nodeAverageFn(): VDBTslNode;\n skipEmptyFn(): VDBTslNode;\n dispose(): void;\n}\n\n/** Uniforms of a sparse source: his `VDBVolumeUniforms` plus the channel boxes and pyramid sizes. */\nexport interface VDBSparseVolumeUniforms extends VDBVolumeUniforms {\n /** Per channel: index min and size of the index box (voxels). */\n readonly boxes: Readonly<Record<\"density\" | \"mask\" | \"albedo\" | \"emission\", { min: VDBTslNode; size: VDBTslNode } | null>>;\n readonly pyramidLevel: VDBTslNode;\n readonly pyramidLevels: VDBTslNode;\n readonly pyramidTexels: VDBTslNode;\n readonly pyramidAtlasSize: VDBTslNode;\n}\n\nconst bad = (message: string) => new VDBError(\"VDB_BAD_OPTION\", `vdbSparseSource: ${message}`);\n\n/** G16a: the pyramid texture nodes of a following source's uniforms (their textures change with the layout). */\nconst pyramidTextures = new WeakMap<object, { map: VDBTslNode; mip: VDBTslNode }>();\n\n/** The non-zero density stats of an image (all leaf voxels, active or not, and active tiles). */\nfunction imageStats(image: Uint32Array, clamp01: boolean): { meanNonZero: number; max: number; activeVoxels: number } {\n let sum = 0;\n let count = 0;\n let maxValue = 0;\n const add = (v: number, n: number) => {\n const x = clamp01 ? Math.min(Math.max(v, 0), 1) : v;\n if (x !== 0) {\n sum += x * n;\n count += n;\n maxValue = Math.max(maxValue, x);\n }\n };\n for (const node of treeNodes(image)) {\n for (const t of node.activeTiles) add(t.value, t.dim ** 3);\n if (node.level !== 0) continue;\n const { values } = leafVoxels(image, node.address);\n for (let n = 0; n < 512; n++) add(values[n]!, 1);\n }\n return { meanNonZero: count > 0 ? sum / count : 0, max: maxValue, activeVoxels: count };\n}\n\n/** World AABB of an index cell box through a 3x4 row-major affine. */\nfunction worldBox(box: VDBIndexBox, m: Float64Array): [Vec3, Vec3] {\n const lo: Vec3 = [Infinity, Infinity, Infinity];\n const hi: Vec3 = [-Infinity, -Infinity, -Infinity];\n for (let c = 0; c < 8; c++) {\n const p = [c & 1 ? box.max[0] + 0.5 : box.min[0] - 0.5, c & 2 ? box.max[1] + 0.5 : box.min[1] - 0.5, c & 4 ? box.max[2] + 0.5 : box.min[2] - 0.5];\n for (let r = 0; r < 3; r++) {\n const v = m[r * 4]! * p[0]! + m[r * 4 + 1]! * p[1]! + m[r * 4 + 2]! * p[2]! + m[r * 4 + 3]!;\n lo[r] = Math.min(lo[r]!, v);\n hi[r] = Math.max(hi[r]!, v);\n }\n }\n return [lo, hi];\n}\n\n/** A half-float r16f Data3DTexture (linear, clamp-to-edge, no mipmaps); `data` null: GPU-written (no upload). */\nfunction halfTexture(data: Float32Array | null, dims: readonly number[]): THREE.Data3DTexture {\n let half: Uint16Array | null = null;\n if (data) {\n half = new Uint16Array(data.length);\n for (let i = 0; i < data.length; i++) half[i] = THREE.DataUtils.toHalfFloat(data[i]!);\n }\n const [w, h, d] = dims as Vec3;\n const texture = new THREE.Data3DTexture(half, w, h, d);\n // A GPU-written texture: three allocates it (createTexture) but never uploads (no data to upload).\n if (!half) texture.source.dataReady = false;\n texture.format = THREE.RedFormat;\n texture.type = THREE.HalfFloatType;\n texture.minFilter = THREE.LinearFilter;\n texture.magFilter = THREE.LinearFilter;\n texture.unpackAlignment = 1;\n texture.generateMipmaps = false;\n texture.needsUpdate = true;\n return texture;\n}\n\n// WGSL helpers over the grid module (one module per shader: the VDBGridNode's).\nconst NODE_AVERAGE_WGSL = /* wgsl */ `fn vdbFrameNodeAverage(g: u32, p: vec3f, dim: u32) -> f32 {\n var acc = vdbAccessorInit(g);\n let fd = f32(dim);\n let q = (p - vec3f(0.5 * fd - 0.5)) / fd;\n let base = floor(q);\n let w = q - base;\n let c = vec3i(base) * i32(dim);\n // One call site in a loop: SwiftShader compiles 8 inlined tree walks very slowly.\n var v: array<f32, 8>;\n for (var k = 0u; k < 8u; k++) {\n v[k] = vdbNodeAverage(&acc, c + vec3i(vec3u(k & 1u, (k >> 1u) & 1u, (k >> 2u) & 1u)) * i32(dim), dim);\n }\n let x00 = v[0] + w.x * (v[1] - v[0]);\n let x10 = v[2] + w.x * (v[3] - v[2]);\n let x01 = v[4] + w.x * (v[5] - v[4]);\n let x11 = v[6] + w.x * (v[7] - v[6]);\n let y0 = x00 + w.y * (x10 - x00);\n let y1 = x01 + w.y * (x11 - x01);\n return y0 + w.z * (y1 - y0);\n}`;\n\n// The 'node-average' density at a lod (one call per sample: level 0 → 3 → 7 blends, two taps at most).\nconst nodeLodWgsl = (sample: string) => /* wgsl */ `fn vdbFrameNodeLod(g: u32, p: vec3f, lod: f32) -> f32 {\n var acc = vdbAccessorInit(g);\n if lod <= 0.0 {\n return ${sample}(&acc, p);\n }\n let fine = lod < 3.0;\n var a = 0.0;\n if fine {\n a = ${sample}(&acc, p);\n } else {\n a = vdbFrameNodeAverage(g, p, 8u);\n }\n if lod >= 7.0 {\n return vdbFrameNodeAverage(g, p, 128u);\n }\n let b = vdbFrameNodeAverage(g, p, select(128u, 8u, fine));\n let t = select((lod - 3.0) / 4.0, lod / 3.0, fine);\n return mix(a, b, t);\n}`;\n\n// K3.2d: level-0 density through the source's own sampler: vdbSampleFast (helper 'fastTrilinear') and/or one\n// accessor per invocation kept in a private variable (copied in and out: WGSL can't pass a ptr<private> where\n// the API takes ptr<function>). Same values as vdbSample with a fresh accessor (the accessor cache only skips\n// the descent).\nconst SAMPLE_CACHE_WGSL = /* wgsl */ `var<private> vdbFrameAcc: VdbAccessor;\nvar<private> vdbFrameAccGrid: u32 = 0xffffffffu;`;\nconst sampleWgsl = (fast: boolean, cached: boolean) => {\n const call = fast ? \"vdbSampleFast\" : \"vdbSample\";\n return cached\n ? /* wgsl */ `fn vdbFrameSample(g: u32, xyz: vec3f) -> f32 {\n if vdbFrameAccGrid != g {\n vdbFrameAcc = vdbAccessorInit(g);\n vdbFrameAccGrid = g;\n }\n var a = vdbFrameAcc;\n let v = ${call}(&a, xyz);\n vdbFrameAcc = a;\n return v;\n}`\n : /* wgsl */ `fn vdbFrameSample(g: u32, xyz: vec3f) -> f32 {\n var a = vdbAccessorInit(g);\n return ${call}(&a, xyz);\n}`;\n};\n\n// The HDDA empty-space query; CPU twin tools vdbFrameSkipEmpty (see there for the contract).\nconst SKIP_EMPTY_WGSL = /* wgsl */ `fn vdbFrameSkipEmpty(g: u32, o: vec3f, d: vec3f, t0: f32, t1: f32, cutoff: f32, dilate: u32) -> vec2f {\n var acc = vdbAccessorInit(g);\n var h: VdbHdda;\n vdbHddaInit(&h, o, t0, d, t1, 8u);\n let back = 1e-3 / max(length(d), 1e-6);\n var ts = t0;\n for (var n = 0u; n < 64u; n++) {\n let te = vdbHddaCellEnd(&h);\n var b = 0.0;\n if dilate == 0u {\n b = vdbCellBoundTrilinear(&acc, h.voxel, 8u);\n } else {\n b = -1e30;\n for (var k = 0u; k < 27u; k++) {\n let c = vec3i(i32(k % 3u) - 1, i32((k / 3u) % 3u) - 1, i32(k / 9u) - 1) * 8;\n b = max(b, vdbNodeMax(&acc, h.voxel + c, 8u));\n }\n }\n if b > cutoff {\n return vec2f(max(t0, ts - back), te);\n }\n ts = te;\n if !vdbHddaStep(&h) {\n return vec2f(t1, t1);\n }\n }\n let r = max(t0, ts - back);\n return vec2f(r, r);\n}`;\n\nclass SparseSource implements VDBThreeSparseSource {\n readonly kind = \"sparse\" as const;\n readonly grids: VDBGridNode;\n readonly ids: Readonly<VDBSparseSourceGrids>;\n readonly lod: VDBSparseLod;\n readonly normalize: \"none\" | \"clamp01\";\n readonly channels: VDBVolumeChannels;\n // G16a: the layout fields below are re-read after an image change when `followImage` is on.\n indexBox: VDBIndexBox;\n auxBoxes: Record<\"mask\" | \"albedo\" | \"emission\", VDBIndexBox | null>;\n texels: [number, number, number];\n lodLevels: number;\n stats: { meanNonZero: number; max: number; activeVoxels: number };\n statsUpdates = 0;\n boxToSource: Float32Array;\n bbox: [Vec3, Vec3];\n pyramid: VDBSparsePyramid | null;\n gpuBytes: { pool: number; pyramid: number; pyramidScratch: number };\n readonly fastTrilinear: boolean;\n readonly cacheAccessor: boolean;\n readonly followImage: boolean;\n pyramidBuilds = 0;\n layoutUpdates = 0;\n /** G16a: the newest channel imageRevision the layout describes, the pool revision last checked, the uniforms to re-apply. */\n private layoutRevision = -1;\n private layoutPoolRevision = -1;\n private readonly layoutListeners = new Set<() => void>();\n /** G16a: `pyramidMax` as given (the pyramid is re-laid out with it). */\n private readonly pyramidMaxOption: { pyramidMax?: number };\n /** G16a: the atlas node's texture when the layout has no atlas (a 1³ zero texture of its own). */\n private emptyAtlas: THREE.Data3DTexture | null = null;\n private poolRevisionSeen = -1;\n private readonly poolIds: number[];\n private versionSeen = { poolRevision: -1, value: 0 };\n private nodeAverageCache: ((...a: unknown[]) => VDBTslNode) | null = null;\n private nodeLodCache: ((...a: unknown[]) => VDBTslNode) | null = null;\n private skipCache: ((...a: unknown[]) => VDBTslNode) | null = null;\n private sampleCache: ((...a: unknown[]) => VDBTslNode) | null = null;\n /** K3.2e: the density imageRevision the stats describe, the pool revision last checked, and a readback in flight. */\n private statsRevision = -1;\n private statsPoolRevisionSeen = -1;\n private statsReadback: Promise<boolean> | null = null;\n /** K5.9a: each of this source's uniforms re-applies its density scale with the new mean when a readback lands. */\n private readonly statsListeners = new Set<() => void>();\n\n constructor(grids: VDBGridNode, ids: VDBSparseSourceGrids, o: VDBSparseSourceOptions) {\n const pool = grids.pool as unknown as Partial<PoolInfoLike>;\n if (typeof pool.info !== \"function\") throw bad(\"the VDBGridNode's pool has no info(); pass a VDBGridPool.\");\n const info = (id: number) => (pool as PoolInfoLike).info(id);\n const lod = o.lod ?? \"coarse-pyramid\";\n if (lod !== \"none\" && lod !== \"coarse-pyramid\" && lod !== \"node-average\") throw bad(`unknown lod ${JSON.stringify(lod)}; use 'none', 'coarse-pyramid' or 'node-average'.`);\n const normalize = o.normalize ?? \"none\";\n if (normalize !== \"none\" && normalize !== \"clamp01\") throw bad(`unknown normalize ${JSON.stringify(normalize)}; use 'none' or 'clamp01'.`);\n const helpers = new Set<string>(grids.options.helpers ?? []);\n if (grids.options.profile !== \"march\" || !helpers.has(\"cellBoundTrilinear\") || !helpers.has(\"hddaCellEnd\") || (lod === \"node-average\" && !helpers.has(\"nodeAverage\"))) {\n throw bad(\n `make the VDBGridNode with profile 'march' and helpers ['cellBoundTrilinear', 'hddaCellEnd'${lod === \"node-average\" ? \", 'nodeAverage'\" : \"\"}] ` +\n `(got profile '${grids.options.profile}', helpers [${[...helpers].join(\", \")}]).`,\n );\n }\n const fastTrilinear = o.fastTrilinear ?? helpers.has(\"fastTrilinear\");\n if (fastTrilinear && !helpers.has(\"fastTrilinear\")) throw bad(\"fastTrilinear needs the VDBGridNode helper 'fastTrilinear' (add it to helpers), or pass fastTrilinear: false.\");\n if (fastTrilinear && grids.options.sampler === \"nearest\") throw bad(\"fastTrilinear needs the VDBGridNode's sampler 'trilinear'.\");\n this.fastTrilinear = fastTrilinear;\n this.cacheAccessor = o.cacheAccessor ?? true;\n const followImage = o.followImage ?? false;\n if (typeof followImage !== \"boolean\") throw bad(\"followImage must be a boolean.\");\n if (followImage) {\n const fixed = ([\"indexBox\", \"auxIndexBoxes\", \"bbox\"] as const).filter((k) => o[k] !== undefined);\n if (fixed.length) throw bad(`followImage re-reads every box from the pool; drop ${fixed.join(\", \")} (fixed boxes).`);\n if (lod === \"coarse-pyramid\" && o.pyramidBuild === \"cpu\") throw bad(\"followImage rebuilds the pyramid from the pool on the GPU; use pyramidBuild 'gpu' (the default).\");\n }\n this.followImage = followImage;\n this.pyramidMaxOption = o.pyramidMax !== undefined ? { pyramidMax: o.pyramidMax } : {};\n const density = info(ids.density);\n if (lod === \"node-average\" && !density.hasStats) throw bad(\"lod 'node-average' reads node statistics; this grid has none (rebuild it with stats).\");\n this.grids = grids;\n const channelIds = [ids.density, ids.mask, ids.emission, ...(Array.isArray(ids.albedo) ? ids.albedo : [ids.albedo])].filter((v): v is number => v !== undefined);\n this.checkTypes(\n channelIds.map((id) => ({ id, type: info(id).type })),\n \"a channel grid\",\n );\n this.ids = Object.freeze({ ...ids, ...(Array.isArray(ids.albedo) ? { albedo: [...ids.albedo] as unknown as [number, number, number] } : {}) });\n this.lod = lod;\n this.normalize = normalize;\n this.indexBox = o.indexBox ? { min: [...o.indexBox.min], max: [...o.indexBox.max] } : { min: [...density.indexBBox.min], max: [...density.indexBBox.max] };\n const albedoId = Array.isArray(ids.albedo) ? ids.albedo[0] : (ids.albedo as number | undefined);\n const box = (id: number | undefined, given?: VDBIndexBox) =>\n id === undefined ? null : given ? { min: [...given.min] as Vec3, max: [...given.max] as Vec3 } : { min: [...info(id).indexBBox.min] as Vec3, max: [...info(id).indexBBox.max] as Vec3 };\n const aux = o.auxIndexBoxes ?? {};\n this.auxBoxes = { mask: box(ids.mask, aux.mask), albedo: box(albedoId, aux.albedo), emission: box(ids.emission, aux.emission) };\n this.channels = { mask: ids.mask !== undefined, albedo: ids.albedo !== undefined, emission: ids.emission !== undefined };\n const b = this.indexBox;\n this.texels = [b.max[0] - b.min[0] + 1, b.max[1] - b.min[1] + 1, b.max[2] - b.min[2] + 1];\n if (this.texels.some((t) => !(t > 0))) throw bad(\"the density index box is empty.\");\n const image = o.images?.density;\n if (o.stats) this.stats = { ...o.stats };\n else if (image) this.stats = imageStats(image, normalize === \"clamp01\");\n else throw bad(\"pass images.density (the CPU image, for the density stats) or stats.\");\n this.statsRevision = (density as { imageRevision?: number }).imageRevision ?? -1;\n // Local unit box → sample index space: p = min − ½ + (local + ½)·size (column-major).\n const [sx, sy, sz] = this.texels;\n this.boxToSource = new Float32Array([sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, b.min[0] - 0.5 + 0.5 * sx, b.min[1] - 0.5 + 0.5 * sy, b.min[2] - 0.5 + 0.5 * sz, 1]);\n this.bbox = o.bbox ? [[...o.bbox[0]], [...o.bbox[1]]] : worldBox(b, density.indexToWorld);\n\n let pyramid: VDBSparsePyramid | null = null;\n if (lod === \"coarse-pyramid\") {\n const build = o.pyramidBuild ?? \"gpu\";\n if (build !== \"gpu\" && build !== \"cpu\") throw bad(`unknown pyramidBuild ${JSON.stringify(build)}; use 'gpu' or 'cpu'.`);\n const pyramidMax = o.pyramidMax !== undefined ? { pyramidMax: o.pyramidMax } : {};\n if (build === \"cpu\") {\n if (!image) throw bad(\"pyramidBuild 'cpu' builds the pyramid from images.density; pass it, or use pyramidBuild 'gpu' (the default).\");\n const p = vdbBoxPyramid(image, { indexBox: b, ...pyramidMax });\n pyramid = {\n build,\n level: p.level,\n dimensions: p.dimensions,\n atlas: p.atlas,\n lodLevels: p.lodLevels,\n data: p.data,\n map: halfTexture(p.data, p.dimensions),\n mip: p.atlas ? halfTexture(p.atlas.data, p.atlas.dimensions) : null,\n gpu: null,\n };\n } else {\n const renderer = (grids as { renderer?: unknown }).renderer;\n let device: GPUDevice;\n try {\n device = webgpuBackendOf(renderer, \"vdbSparseSource\").device;\n } catch {\n throw bad(\"pyramidBuild 'gpu' (the default for lod 'coarse-pyramid') needs the VDBGridNode's initialized WebGPURenderer; use pyramidBuild 'cpu' with images.density otherwise.\");\n }\n const initTexture = (renderer as { initTexture?: (t: THREE.Texture) => void }).initTexture;\n if (typeof initTexture !== \"function\") throw bad(\"pyramidBuild 'gpu' needs renderer.initTexture (three r187 WebGPURenderer).\");\n // G16a: a following source compiles the pyramid kernels of every type the node decodes now, so a swap to\n // another grid type creates no pipeline.\n if (followImage) warmBoxPyramidPipelines(device, grids.options.types);\n pyramid = this.gpuPyramid(b, ids.density);\n }\n }\n this.pyramid = pyramid;\n this.lodLevels = lod === \"none\" ? 0 : lod === \"node-average\" ? 7 : pyramid!.lodLevels;\n this.poolIds = [...new Set(channelIds)];\n this.gpuBytes = this.measure();\n this.layoutRevision = this.poolIds.reduce((r, id) => Math.max(r, info(id).imageRevision ?? 0), 0);\n this.refreshPyramid();\n }\n\n /** GPU bytes of the channel grids' pool ranges and the pyramid (see the interface). */\n private measure(): { pool: number; pyramid: number; pyramidScratch: number } {\n const pool = this.grids.pool as unknown as PoolInfoLike;\n const p = this.pyramid;\n const atlasTexels = p?.atlas ? p.atlas.dimensions[0] * p.atlas.dimensions[1] * p.atlas.dimensions[2] : 0;\n const pyramidBytes = p ? 2 * (p.dimensions[0] * p.dimensions[1] * p.dimensions[2] + atlasTexels) : 0;\n return { pool: this.poolIds.reduce((s, id) => s + pool.info(id).capacity, 0), pyramid: pyramidBytes, pyramidScratch: p?.gpu?.gpuBytes.scratch ?? 0 };\n }\n\n /** The GPU pyramid of `box` (K3.2a): three textures the core's `vdbCreateBoxPyramid` writes into. */\n private gpuPyramid(box: VDBIndexBox, densityId: number): VDBSparsePyramid {\n const renderer = this.grids.renderer as unknown as { initTexture(t: THREE.Texture): void };\n const device = webgpuBackendOf(renderer, \"vdbSparseSource\").device;\n const texels = [0, 1, 2].map((a) => box.max[a]! - box.min[a]! + 1);\n const layout = vdbBoxPyramidLayout(texels, this.pyramidMaxOption);\n const map = halfTexture(null, layout.dimensions);\n const mip = layout.atlas ? halfTexture(null, layout.atlas.dimensions) : null;\n map.name = \"vdbSparseSource pyramid base\";\n if (mip) mip.name = \"vdbSparseSource pyramid atlas\";\n for (const t of [map, mip]) if (t) renderer.initTexture(t);\n const gpu = vdbCreateBoxPyramid(device, this.grids.pool as never, densityId, {\n indexBox: box,\n ...this.pyramidMaxOption,\n targets: { base: getGPUTexture(renderer as never, map), atlas: mip ? getGPUTexture(renderer as never, mip) : null },\n label: \"vdbSparseSource pyramid\",\n });\n return {\n build: \"gpu\",\n level: layout.level,\n dimensions: [...layout.dimensions],\n atlas: layout.atlas ? { dimensions: [...layout.atlas.dimensions], levels: layout.atlas.levels.length } : null,\n lodLevels: layout.lodLevels,\n map,\n mip,\n gpu,\n };\n }\n\n /** G16a: the atlas texture a following source's shaders bind: the pyramid's, else a 1³ zero texture (never read). */\n atlasTexture(): THREE.Data3DTexture {\n if (this.pyramid?.mip) return this.pyramid.mip;\n if (!this.emptyAtlas) {\n this.emptyAtlas = halfTexture(new Float32Array(1), [1, 1, 1]);\n this.emptyAtlas.name = \"vdbSparseSource empty atlas\";\n }\n return this.emptyAtlas;\n }\n\n /**\n * G16a (`followImage`): re-reads the layout when a channel grid's image changed and every channel grid is resident\n * again (the update that writes the new image has run: the GPU must not read it through the old boxes, nor the\n * old image through the new ones). Cheap when the pool's revision did not move; called from `version` (a\n * `VDBFrameVolume` asks once per frame, before it places its box) and from the render updates.\n */\n syncLayout(): boolean {\n if (!this.followImage) return false;\n const pool = this.grids.pool as unknown as { revision?: number } & PoolInfoLike;\n if (typeof pool.revision !== \"number\" || pool.revision === this.layoutPoolRevision) return false;\n let revision = 0;\n let resident = true;\n const infos: { id: number; type: string }[] = [];\n for (const id of this.poolIds) {\n let i: ReturnType<PoolInfoLike[\"info\"]>;\n try {\n i = pool.info(id);\n } catch {\n return false; // a removed grid: keep the last layout\n }\n revision = Math.max(revision, i.imageRevision ?? 0);\n if (i.resident === false) resident = false;\n infos.push({ id, type: i.type });\n }\n if (revision === this.layoutRevision) {\n this.layoutPoolRevision = pool.revision;\n return false;\n }\n if (!resident) return false; // look again once the update has written it\n // A new image of a type the module does not decode would read 0 through the new boxes, silently: say so instead\n // (every call until the source is remade over a node that compiles it).\n this.checkTypes(infos, \"a channel grid's new image\");\n this.relayout();\n this.layoutRevision = revision;\n this.layoutPoolRevision = pool.revision;\n return true;\n }\n\n /**\n * Throws `VDB_TYPE_NOT_COMPILED` when a channel grid's type is not among the `VDBGridNode`'s compiled `types` (those\n * grids read 0). A node stand-in without `options.types` is not checked.\n */\n private checkTypes(infos: readonly { id: number; type: string }[], what: string): void {\n const compiled = (this.grids.options as { types?: readonly string[] }).types;\n if (!compiled) return;\n const missing = infos.filter((i) => !compiled.includes(i.type));\n if (missing.length === 0) return;\n throw new VDBError(\n \"VDB_TYPE_NOT_COMPILED\",\n `vdbSparseSource: ${what} is ${missing.map((m) => `grid ${m.id}: ${m.type}`).join(\", \")}, but the VDBGridNode compiles only ` +\n `${compiled.join(\", \")}; it would read 0. Make the VDBGridNode with types that include every type the images will have ` +\n `(a coarse-first stream lists them in VDBCoarseFirstEvent.types: types: event.types), then make the source over it.`,\n );\n }\n\n private relayout(): void {\n const pool = this.grids.pool as unknown as PoolInfoLike;\n const ids = this.ids;\n const density = pool.info(ids.density);\n const b: VDBIndexBox = { min: [...density.indexBBox.min], max: [...density.indexBBox.max] };\n const old = this.indexBox;\n const moved = b.min.some((v, a) => v !== old.min[a]) || b.max.some((v, a) => v !== old.max[a]);\n this.indexBox = b;\n this.texels = [b.max[0] - b.min[0] + 1, b.max[1] - b.min[1] + 1, b.max[2] - b.min[2] + 1];\n const [sx, sy, sz] = this.texels;\n this.boxToSource = new Float32Array([sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, b.min[0] - 0.5 + 0.5 * sx, b.min[1] - 0.5 + 0.5 * sy, b.min[2] - 0.5 + 0.5 * sz, 1]);\n this.bbox = worldBox(b, density.indexToWorld);\n const auxBox = (id: number | undefined): VDBIndexBox | null => (id === undefined ? null : { min: [...pool.info(id).indexBBox.min] as Vec3, max: [...pool.info(id).indexBBox.max] as Vec3 });\n this.auxBoxes = { mask: auxBox(ids.mask), albedo: auxBox(Array.isArray(ids.albedo) ? ids.albedo[0] : (ids.albedo as number | undefined)), emission: auxBox(ids.emission) };\n // A new box needs a pyramid of its size (and box min); the same box rebuilds in place (refreshPyramid).\n const previous = this.pyramid;\n if (moved && previous?.gpu) {\n this.pyramid = this.gpuPyramid(b, ids.density);\n this.lodLevels = this.pyramid.lodLevels;\n this.poolRevisionSeen = -1;\n }\n this.gpuBytes = this.measure();\n this.layoutUpdates++;\n for (const apply of this.layoutListeners) apply();\n // After the uniforms point at the new textures, the old ones go, but not yet: three r187's texture.dispose()\n // destroys the GPUTexture at once, and a pass this render already recorded (not submitted yet) may bind them.\n // Renders submit in the task that records them, so wait past this task, then for the queue's submitted work.\n if (previous !== this.pyramid && previous) {\n const retire = (): void => {\n previous.gpu?.destroy();\n previous.map.dispose();\n previous.mip?.dispose();\n };\n const device = (this.grids.pool as { device?: GPUDevice }).device;\n if (device?.queue) setTimeout(() => void device.queue.onSubmittedWorkDone().then(retire, retire), 0);\n else retire();\n }\n }\n\n /**\n * Content version: the newest `imageRevision` of the channel grids (K3.2a), so a `pool.replace` (a\n * sequence frame) changes it and the 'frame' lighting caster signature (V44) draws the shadow grid\n * again. Read through the pool's `revision` first (cheap when nothing changed).\n */\n get version(): number {\n // G16a: a following source's version is the image revision its layout describes (it moves once the new image is\n // resident and the boxes were re-read), so a VDBFrameVolume re-reads its box and the uniforms then.\n if (this.followImage) {\n this.syncLayout();\n return this.layoutRevision;\n }\n const pool = this.grids.pool as unknown as { revision?: number; info(id: number): { imageRevision?: number } };\n if (typeof pool.revision !== \"number\") return 0;\n if (pool.revision !== this.versionSeen.poolRevision) {\n let value = 0;\n for (const id of this.poolIds) {\n try {\n value = Math.max(value, pool.info(id).imageRevision ?? 0);\n } catch {\n // A removed grid: keep the others' revision.\n }\n }\n this.versionSeen = { poolRevision: pool.revision, value };\n }\n return this.versionSeen.value;\n }\n\n refreshPyramid(): boolean {\n this.syncLayout();\n const gpu = this.pyramid?.gpu;\n if (!gpu) return false;\n // Cheap test first: the pool's revision moves on any change; the grid's imageRevision tells whether this one did.\n const pool = this.grids.pool as unknown as { revision: number; device: GPUDevice };\n if (pool.revision === this.poolRevisionSeen) return false;\n const device = pool.device;\n const encoder = device.createCommandEncoder({ label: \"vdbSparseSource pyramid\" });\n if (!gpu.update(encoder)) {\n // Not resident yet (the update that writes it is still to come): look again next time.\n if (!gpu.stale) this.poolRevisionSeen = pool.revision;\n return false;\n }\n device.queue.submit([encoder.finish()]);\n this.poolRevisionSeen = pool.revision;\n this.pyramidBuilds++;\n return true;\n }\n\n refreshStats(): Promise<boolean> {\n if (this.statsReadback) return this.statsReadback;\n const pool = this.grids.pool as unknown as {\n revision?: number;\n device?: GPUDevice;\n buffer?: GPUBuffer;\n info(id: number): { imageRevision?: number; resident?: boolean; imageOffset?: number | null; imageBytes?: number };\n };\n // Cheap test first (once per render): the pool's revision moves on any change.\n if (typeof pool.revision !== \"number\" || pool.revision === this.statsPoolRevisionSeen || !pool.device || !pool.buffer) return Promise.resolve(false);\n let info: ReturnType<typeof pool.info>;\n try {\n info = pool.info(this.ids.density);\n } catch {\n return Promise.resolve(false); // removed: keep the last stats\n }\n const revision = info.imageRevision ?? -1;\n if (revision === this.statsRevision) {\n this.statsPoolRevisionSeen = pool.revision;\n return Promise.resolve(false);\n }\n // Not written yet (the update that writes it is still to come): look again next time.\n if (!info.resident || info.imageOffset === null || info.imageOffset === undefined || !info.imageBytes) return Promise.resolve(false);\n const { device, buffer } = pool;\n const bytes = info.imageBytes;\n const staging = device.createBuffer({ label: \"vdbSparseSource stats readback\", size: bytes, usage: 0x1 | 0x8 }); // MAP_READ | COPY_DST (no WebGPU globals in Node tests)\n const encoder = device.createCommandEncoder({ label: \"vdbSparseSource stats readback\" });\n encoder.copyBufferToBuffer(buffer, info.imageOffset, staging, 0, bytes);\n device.queue.submit([encoder.finish()]);\n const seen = pool.revision;\n this.statsReadback = staging\n .mapAsync(0x1) // GPUMapMode.READ\n .then(() => {\n const image = new Uint32Array(staging.getMappedRange().slice(0));\n this.stats = imageStats(image, this.normalize === \"clamp01\");\n this.statsRevision = revision;\n this.statsPoolRevisionSeen = seen;\n this.statsUpdates++;\n for (const apply of this.statsListeners) apply();\n return true;\n })\n .catch(() => false)\n .finally(() => {\n staging.destroy();\n this.statsReadback = null;\n });\n return this.statsReadback;\n }\n\n nodeAverageFn(): (...a: unknown[]) => VDBTslNode {\n this.nodeAverageCache ??= wgslFn(NODE_AVERAGE_WGSL, [this.grids.module] as never) as unknown as (...a: unknown[]) => VDBTslNode;\n return this.nodeAverageCache;\n }\n\n private nodeLodFn(): (...a: unknown[]) => VDBTslNode {\n this.nodeLodCache ??= wgslFn(nodeLodWgsl(this.fastTrilinear ? \"vdbSampleFast\" : \"vdbSample\"), [this.grids.module, this.nodeAverageFn()] as never) as unknown as (...a: unknown[]) => VDBTslNode;\n return this.nodeLodCache;\n }\n\n /** `vdbFrameSample(g, xyz) -> f32`: level 0 (index space) as configured (`fastTrilinear`, `cacheAccessor`). */\n sampleFn(): (...a: unknown[]) => VDBTslNode {\n this.sampleCache ??= wgslFn(sampleWgsl(this.fastTrilinear, this.cacheAccessor), (this.cacheAccessor ? [this.grids.module, code(SAMPLE_CACHE_WGSL, [this.grids.module])] : [this.grids.module]) as never) as unknown as (\n ...a: unknown[]\n ) => VDBTslNode;\n return this.sampleCache;\n }\n\n skipEmptyFn(): (...a: unknown[]) => VDBTslNode {\n this.skipCache ??= wgslFn(SKIP_EMPTY_WGSL, [this.grids.module] as never) as unknown as (...a: unknown[]) => VDBTslNode;\n return this.skipCache;\n }\n\n createUniforms(p: VDBVolumeUniformParameters): VDBSparseVolumeUniforms {\n let densityScale = p.densityScale ?? 1.0;\n let normalize = p.normalizeDensity ?? true;\n const boxUniform = (bx: VDBIndexBox | null) =>\n bx ? { min: uniform(new THREE.Vector3(...bx.min)), size: uniform(new THREE.Vector3(bx.max[0] - bx.min[0] + 1, bx.max[1] - bx.min[1] + 1, bx.max[2] - bx.min[2] + 1)) } : null;\n const levels = uniform(this.lodLevels);\n // K3.2e: the mean follows the density image (refreshStats, checked once per render, reads a replaced image\n // back). K5.9a: the new mean is applied once, when the readback lands; the render update never writes the\n // value, so a value set per draw (VDBFrameVolume's densityScale, through setVolumeUniforms) stays as set.\n const densityScaleU = uniform(vdbDensityScaleOf(this, densityScale, normalize)).onRenderUpdate(() => {\n this.syncLayout();\n void this.refreshStats();\n return undefined;\n });\n const applyStats = (): void => {\n densityScaleU.value = vdbDensityScaleOf(this, densityScale, normalize);\n };\n this.statsListeners.add(applyStats);\n const pyr = this.pyramid;\n // G16a: a following source samples its pyramid through texture nodes made here (one pair per uniforms), so a new\n // layout swaps their textures; the atlas node always exists (a 1³ texture when the layout has none).\n const textures = this.followImage && pyr ? { map: texture3D(pyr.map), mip: texture3D(this.atlasTexture()) } : null;\n const u: VDBSparseVolumeUniforms = {\n worldScale: uniform(p.worldScale ?? 1.0),\n gridTexels: uniform(new THREE.Vector3(...this.texels)),\n mipAtlasSize: uniform(new THREE.Vector3(1, 1, 1)),\n maps: { density: null, mask: null, albedo: null, emission: null },\n mipMaps: { density: null, mask: null, albedo: null, emission: null },\n // getSampledLod reads density (and mask) levels; aux channels are level 0 only but report the same.\n mipLevels: { density: levels, mask: levels, albedo: levels, emission: levels },\n baseColor: uniform(new THREE.Color(p.baseColor ?? 0xffffff)),\n extinction: uniform(p.extinction ?? 100.0),\n densityScale: densityScaleU,\n densityCutoff: uniform(p.densityCutoff ?? 0.0),\n emissiveIntensity: uniform(p.emissiveIntensity ?? 1.0),\n temperatureRange: uniform(new THREE.Vector2(...(p.temperatureRange ?? [0.0, 6500.0]))),\n offset3D: uniform(new THREE.Vector3().copy((p.offset3D ?? { x: 0, y: 0, z: 0 }) as THREE.Vector3)),\n wrap3D: uniform(p.wrap3D ?? THREE.ClampToEdgeWrapping, \"int\"),\n boxes: { density: boxUniform(this.indexBox), mask: boxUniform(this.auxBoxes.mask), albedo: boxUniform(this.auxBoxes.albedo), emission: boxUniform(this.auxBoxes.emission) },\n // The GPU pyramid rebuilds (on an image change) from here: once per render that samples it.\n pyramidLevel: pyr?.gpu ? uniform(pyr.level).onRenderUpdate(() => void this.refreshPyramid()) : uniform(pyr?.level ?? 0),\n pyramidLevels: uniform(pyr?.atlas?.levels ?? 0),\n pyramidTexels: uniform(new THREE.Vector3(...(pyr?.dimensions ?? [1, 1, 1]))),\n pyramidAtlasSize: uniform(new THREE.Vector3(...(pyr?.atlas?.dimensions ?? [1, 1, 1]))),\n update: (s, o = {}) => {\n if (s !== this) throw bad(\"these uniforms belong to another source.\");\n if (o.densityScale !== undefined) densityScale = o.densityScale;\n if (o.normalizeDensity !== undefined) normalize = o.normalizeDensity;\n densityScaleU.value = vdbDensityScaleOf(this, densityScale, normalize);\n if (this.followImage) applyLayout();\n },\n dispose: () => {\n this.statsListeners.delete(applyStats);\n this.layoutListeners.delete(applyLayout);\n pyramidTextures.delete(u);\n },\n };\n // G16a: the layout as uniform values (and texture swaps), applied again after every re-read.\n const setBox = (b: { min: VDBTslNode; size: VDBTslNode } | null, bx: VDBIndexBox | null) => {\n if (!b || !bx) return;\n b.min.value.set(...bx.min);\n b.size.value.set(bx.max[0] - bx.min[0] + 1, bx.max[1] - bx.min[1] + 1, bx.max[2] - bx.min[2] + 1);\n };\n const applyLayout = () => {\n u.gridTexels.value.set(...this.texels);\n setBox(u.boxes.density, this.indexBox);\n setBox(u.boxes.mask, this.auxBoxes.mask);\n setBox(u.boxes.albedo, this.auxBoxes.albedo);\n setBox(u.boxes.emission, this.auxBoxes.emission);\n levels.value = this.lodLevels;\n const p = this.pyramid;\n if (!p) return;\n u.pyramidLevel.value = p.level;\n u.pyramidLevels.value = p.atlas?.levels ?? 0;\n u.pyramidTexels.value.set(...p.dimensions);\n u.pyramidAtlasSize.value.set(...(p.atlas?.dimensions ?? [1, 1, 1]));\n if (textures) {\n textures.map.value = p.map;\n textures.mip.value = this.atlasTexture();\n }\n };\n if (this.followImage) {\n this.layoutListeners.add(applyLayout);\n if (textures) pyramidTextures.set(u, textures);\n }\n return u;\n }\n\n createNodes(u0: VDBVolumeUniforms, o: VDBVolumeNodesOptions): VDBVolumeNodes {\n const u = u0 as VDBSparseVolumeUniforms;\n if (!u.boxes) throw bad(\"createNodes needs this source's uniforms (vdbVolumeUniforms(source)).\");\n const { grids, ids, lod } = this;\n const useMipmaps = o.useMipmaps ?? this.lodLevels > 0;\n const gridUv = vdbGridUv(u);\n const clamp01 = this.normalize === \"clamp01\";\n // G16a: a following source's LOD range is a uniform (it changes with the layout); otherwise a constant.\n const lodMax = this.followImage ? u.mipLevels.density : float(this.lodLevels);\n const followTextures = this.followImage ? pyramidTextures.get(u) : undefined;\n\n // uvw → sample index space, clamped to the voxels (his clamp-to-edge).\n const samplePos = (box: { min: VDBTslNode; size: VDBTslNode }, uvw: VDBTslNode) =>\n clamp(box.min.add(uvw.mul(box.size)).sub(0.5), box.min, box.min.add(box.size).sub(1.0));\n const level0 =\n this.fastTrilinear || this.cacheAccessor ? (id: number, p: VDBTslNode) => this.sampleFn()(uint(id), p) : (id: number, p: VDBTslNode) => vdbSample(grids, id, p, { space: \"index\" });\n\n const densityAt = (uvw: VDBTslNode, lodIn: VDBTslNode): VDBTslNode => {\n const p = samplePos(u.boxes.density!, uvw).toVar();\n if (!useMipmaps || lod === \"none\") return level0(ids.density, p);\n const l = clamp(lodIn, 0.0, lodMax).toVar();\n if (lod === \"node-average\") return this.nodeLodFn()(uint(ids.density), p, l);\n const r = float(0.0).toVar();\n // coarse-pyramid\n const pyr = this.pyramid!;\n if (this.followImage && !followTextures) throw bad(\"createNodes needs this source's uniforms (vdbVolumeUniforms(source)).\");\n const pyrMap = followTextures ? followTextures.map : texture3D(pyr.map);\n const pyrMip = followTextures ? followTextures.mip : pyr.mip ? texture3D(pyr.mip) : null;\n const { sampleMipmapped } = vdbMipSampler(u.pyramidTexels, u.pyramidAtlasSize);\n const coarse = (rel: VDBTslNode) => (pyrMip ? sampleMipmapped(pyrMap, pyrMip, u.pyramidLevels, uvw, rel).r : pyrMap.sample(uvw).level(float(0.0)).r);\n // K3.2d: one level-0 call site (each inlines the whole tree walk), shared by the two branches below.\n const fine = float(0.0).toVar();\n If(l.lessThan(u.pyramidLevel), () => {\n fine.assign(level0(ids.density, p));\n });\n If(l.lessThanEqual(0.0), () => {\n r.assign(fine);\n })\n .ElseIf(l.lessThan(u.pyramidLevel), () => {\n r.assign(mix(fine, coarse(float(0.0)), l.div(u.pyramidLevel)));\n })\n .Else(() => {\n r.assign(coarse(l.sub(u.pyramidLevel)));\n });\n return r;\n };\n\n // L892\n const getLod = (localSize: VDBTslNode) => max(0.0, log2(localSize.mul(vdbMaxComponent(u.gridTexels))));\n\n // L914–936: extinction per world unit; the mask at local + 0.5 (no offset or wrap), as his.\n const sampleExtinction = (localPosition: VDBTslNode, lodIn: VDBTslNode) => {\n const mask = this.channels.mask ? level0(ids.mask!, samplePos(u.boxes.mask!, localPosition.add(0.5))) : float(1.0);\n const raw = densityAt(gridUv(localPosition), lodIn);\n const value = (clamp01 ? clamp(raw, 0.0, 1.0) : raw).mul(mask);\n return select(value.greaterThan(u.densityCutoff), value, float(0.0)).mul(u.densityScale).mul(u.extinction).div(u.worldScale);\n };\n\n // L960–971 (level 0)\n const sampleAlbedo = (localPosition: VDBTslNode) => {\n if (!this.channels.albedo) return u.baseColor.mul(vec3(1.0));\n const p = samplePos(u.boxes.albedo!, gridUv(localPosition)).toVar();\n const a = ids.albedo!;\n const rgb = Array.isArray(a) ? vec3(level0(a[0], p), level0(a[1], p), level0(a[2], p)) : vec3(level0(a as number, p));\n return u.baseColor.mul(clamp(rgb, 0.0, 1.0));\n };\n\n // L990–1017 (level 0), colour via the caller's hook (V24).\n const emissionColor = o.emissionColor ?? (() => vec3(1.0));\n const sampleEmission = (localPosition: VDBTslNode) => {\n if (!this.channels.emission) return vec3(0.0);\n const range = u.temperatureRange;\n const value = level0(ids.emission!, samplePos(u.boxes.emission!, gridUv(localPosition)));\n const temperature = mix(range.x, range.y, value);\n const power = pow(temperature.div(max(range.y, 1.0)), 4.0);\n const color = select(temperature.greaterThan(0.0), emissionColor(temperature), vec3(0.0));\n return color.mul(power).mul(u.emissiveIntensity);\n };\n\n // HDDA empty-space query (R1 §4.3 \"HDDA gains\"): exact only where the bound covers every voxel a\n // sample reads: level 0 (the trilinear 2x2x2 cell block), or a coarse level whose taps reach at\n // most 8 voxels past the cell (dilated 3x3x3 block): node averages up to level 3, pyramid bases\n // up to level 2. Wrapping or an offset moves samples off the ray's cells: no skipping then.\n const skipEmpty = (origin: VDBTslNode, direction: VDBTslNode, t0: VDBTslNode, t1: VDBTslNode, lodIn: VDBTslNode) => {\n const box = u.boxes.density!;\n const l = useMipmaps && lod !== \"none\" ? clamp(lodIn, 0.0, lodMax) : float(0.0);\n const dilate = int(0).toVar();\n // Cost rule (K3.2 A/B): a walk visits 8³ cells at 8 node lookups each, so it only pays while samples are at\n // most one cell apart (the march's lod ≤ 3, i.e. steps ≤ 8 voxels); sparser marches sample everything.\n const enabled = u.wrap3D\n .equal(int(THREE.ClampToEdgeWrapping))\n .and(vdbMaxComponent(u.offset3D.abs()).equal(0.0))\n .and(lodIn.lessThanEqual(3.0))\n .toVar();\n if (useMipmaps && lod === \"node-average\") {\n If(l.greaterThan(0.0), () => {\n dilate.assign(1);\n If(l.greaterThan(3.0), () => {\n enabled.assign(false);\n });\n });\n } else if (useMipmaps && lod === \"coarse-pyramid\") {\n If(l.greaterThan(0.0), () => {\n dilate.assign(1);\n If(u.pyramidLevel.greaterThan(2.0).or(l.greaterThan(2.0)), () => {\n enabled.assign(false);\n });\n });\n }\n const result = vec2(t0, 1e30).toVar();\n If(enabled, () => {\n const o2 = box.min.sub(0.5).add(origin.add(0.5).mul(box.size));\n const d2 = direction.mul(box.size);\n // The mask multiplies the density, so with a mask only a zero bound is a safe skip.\n const cutoff = this.channels.mask ? float(0.0) : max(u.densityCutoff, 0.0);\n result.assign(this.skipEmptyFn()(uint(ids.density), o2, d2, t0, t1, cutoff, dilate.toUint()));\n });\n return result;\n };\n\n return { getLod, sampleExtinction, sampleAlbedo, sampleEmission, ...vdbBoxNodes, skipEmpty };\n }\n\n dispose(): void {\n this.pyramid?.gpu?.destroy();\n this.pyramid?.map.dispose();\n this.pyramid?.mip?.dispose();\n this.emptyAtlas?.dispose();\n this.layoutListeners.clear();\n this.statsListeners.clear();\n }\n}\n\n/**\n * A sparse volume source over pool grids (see the file comment). `grids` must be a `VDBGridNode`\n * made with profile `'march'` and helpers `['cellBoundTrilinear', 'hddaCellEnd']` (+ `'nodeAverage'`\n * for that LOD). The source holds no grid buffer of its own (the pool's), only the pyramid textures\n * (and, building on the GPU, the build's scratch buffers).\n */\nexport function vdbSparseSource(grids: VDBGridNode, ids: VDBSparseSourceGrids, options: VDBSparseSourceOptions = {}): VDBThreeSparseSource {\n if (!grids || typeof grids !== \"object\" || !(\"module\" in grids)) throw bad(\"pass a VDBGridNode.\");\n if (!ids || !Number.isInteger(ids.density)) throw bad(\"ids.density must be a pool grid id.\");\n return new SparseSource(grids, ids, options);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sparse-source.js","sourceRoot":"","sources":["../../src/three/sparse-source.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,2HAA2H;AAC3H,wEAAwE;AACxE,4GAA4G;AAC5G,uDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AA6J9D,MAAM,GAAG,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,gBAAgB,EAAE,oBAAoB,OAAO,EAAE,CAAC,CAAC;AAE/F,iGAAiG;AACjG,SAAS,UAAU,CAAC,KAAkB,EAAE,OAAgB;IACtD,IAAI,GAAG,GAAG,CAAC,C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OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC7B,CAAC,CAAC,CAAC;QACL,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,OAAO;IACP,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,KAAkB,EAAE,GAAyB,EAAE,UAAkC,EAAE;IACjH,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC;QAAE,MAAM,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAClG,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,MAAM,GAAG,CAAC,qCAAqC,CAAC,CAAC;IAC7F,OAAO,IAAI,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0): the source half of createVolumeUniforms /\n// createVolumeNodes (frameShaderChunks.js L729–763, L834–1028), whose sparse-grid port (the TSL half) was deleted in K6.11\n// (D35); this file is the handle the core's sparse source is made from.\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Divergences: DIVERGES.md (K3.2 rows), V23–V25, V145.\n\n/**\n * The sparse volume source (K3.2, R1 §4.2–4.3): a `VDBGridPool` grid behind the same seam as the\n * dense `.wvdb` source, so `VDBFrameVolume` renders NanoVDB grids.\n *\n * const grids = new VDBGridNode(renderer, pool, { profile: \"march\", helpers: [\"cellBoundTrilinear\", \"hddaCellEnd\", \"nodeAverage\", \"fastTrilinear\"] });\n * const source = vdbSparseSource(grids, { density: id }, { lod: \"coarse-pyramid\", images: { density: image } });\n * const volume = new VDBFrameVolume(source, { extinction: 100 }); // box: the grid's world box\n *\n * K6.8a / K6.11: the source is a handle (grids, ids, options, boxes, stats, the image-follow state). `VDBFrameRenderer`\n * reads it into the core's sparse source (`vdbSparseSource`), which builds its own pyramids and reads the grids itself.\n * The handle holds no GPU object. (Custom TSL materials sample a pooled grid through `VDBGridNode`; custom WGSL or compute\n * uses the core source's `wgsl()`.)\n *\n * Positions are his local unit box [-0.5, 0.5]³; uvw = local + 0.5 (+ offset, wrapped) maps onto the\n * channel grid's index cell box `[min − ½, max + ½]` (voxel centres at integers), so uvw\n * (i + 0.5) / N lands on voxel min + i as on a dense texel centre. The sample position is clamped to\n * `[min, max]` (his clamp-to-edge). Level 0 is the pool's trilinear sample; with the node helper\n * `'fastTrilinear'` (recommended, K3.2d) it is `vdbSampleFast` through one accessor per shader invocation\n * (`cacheAccessor`): the same values, 1.5–2× faster on the hardware GPU (docs/archive/handoffs/K3-2d.md). (The core's\n * sparse source reads these options.)\n *\n * LOD (`lod`, his `sampleExtinction(localPos, lod)` at lod ≥ 1; R1 §4.3):\n * - `'none'`: level 0 always (no prefilter; aliases when a froxel spans many voxels). lodLevels 0.\n * - `'coarse-pyramid'` (default, the K3.2 A/B pick): a dense r16f pyramid from L₀ = max(1, ⌈log2(maxTexels / pyramidMax)⌉):\n * the base is a box resample of the grid, the levels above it his box mip atlas. lod in (0, L₀)\n * blends level 0 toward L₀; lod ≥ L₀ samples the pyramid as his mip atlas. GPU bytes: ~2 B × (base\n * + atlas) texels. The core's sparse source builds it on the GPU from the pool grid (K3.2a: the core's\n * `vdbCreateBoxPyramid`, no CPU image needed) and rebuilds it when the grid's image changes\n * (`pool.replace`: a sequence frame). K6.11: the CPU build (`pyramidBuild: 'cpu'`, the three textures' static path) is\n * deleted; `@pmndrs/vdb/tools` `vdbBoxPyramid` stays the GPU build's CPU twin.\n * - `'node-average'`: no extra memory: trilinear over the node averages (`vdbNodeAverage`) at\n * level 3 (leaves, the exact 8³ box mean for fog leaves) and level 7 (lower nodes, the mean of\n * their active voxels); lod in (0, 3) blends level 0 → 3, (3, 7) blends 3 → 7. Needs stats.\n *\n * HDDA: `skipEmpty` lets a march jump samples that are provably 0 (`VDBFrameVolume` `hdda`, default\n * off since D30 / D31: it slowed the shadow march on Apple GPUs; the image is the same either way).\n *\n * Following the image (`followImage`, G16a): the index boxes, world box and pyramid are fixed when the source is\n * made unless it follows the grids' images. Then a `pool.replace` that changes a channel grid's box (a coarse-first\n * swap: the preview, then the full grid in the same id) is re-read from `pool.info` once the new image is resident:\n * the new layout, the LOD range and a new `version`, which a `VDBFrameVolume` follows with its box. No shader is rebuilt.\n *\n * Mask, albedo and emission grids (optional, scalar; albedo may be three grids for RGB) are read at\n * level 0 only. One VDB module per shader: every grid goes through the one `VDBGridNode`.\n */\n\nimport { VDBError } from \"../core/errors.js\";\nimport type { VDBVolumeChannels } from \"../core/source/types.js\";\nimport { vdbBoxPyramidLayout } from \"../tools/frame/pyramid-layout.js\";\nimport { leafVoxels, treeNodes } from \"../tools/cpu/march.js\";\nimport type { VDBGridNode } from \"./grid-node.js\";\nimport type { VDBVolumeSourceInfo } from \"../core/source/types.js\";\n\ntype Vec3 = [number, number, number];\n\n/** The LOD strategies of the sparse source (R1 §4.3); see the file comment. */\nexport type VDBSparseLod = \"none\" | \"coarse-pyramid\" | \"node-average\";\n\n/** The pool grid ids of the channels. `albedo`: one grey grid or three (RGB). */\nexport interface VDBSparseSourceGrids {\n /** Pool id of the density grid. */\n density: number;\n /** Pool id of an optional mask grid (multiplies the density). */\n mask?: number;\n /** Pool id of one grey albedo grid, or three ids for RGB. */\n albedo?: number | readonly [number, number, number];\n /** Pool id of an optional emission (temperature) grid. */\n emission?: number;\n}\n\n/** Inclusive voxel index box. */\nexport interface VDBIndexBox {\n /** Smallest voxel index (inclusive). */\n min: Vec3;\n /** Largest voxel index (inclusive). */\n max: Vec3;\n}\n\n/** Options of {@link vdbSparseSource}. */\nexport interface VDBSparseSourceOptions {\n /**\n * LOD strategy. Default `'coarse-pyramid'`, the K3.2 A/B's pick (closest to his mips, low flicker, cheap to\n * sample; needs `images.density`); see docs/archive/handoffs/K3-2.md.\n */\n lod?: VDBSparseLod;\n /** `'coarse-pyramid'`: base level texels on the longest side at most (default 128). */\n pyramidMax?: number;\n /** `'none'` (default): raw floats. `'clamp01'`: clamp each density sample to [0, 1] (his 8-bit range; parity A/B). */\n normalize?: \"none\" | \"clamp01\";\n /** CPU copies of the grid images: the density stats read `density`. */\n images?: { density?: Uint32Array };\n /**\n * Density stats (`normalizeDensity` divides by `meanNonZero`). Default: computed from `images.density`.\n * Either way they describe the image at creation; after the density grid's image changes (`pool.replace`,\n * its `imageRevision`) the source reads the new image back from the pool and recomputes them (K3.2e; see\n * `statsUpdates`).\n */\n stats?: { meanNonZero: number; max: number; activeVoxels: number };\n /** Density index box the unit box covers (default: the grid's index bbox). Aux grids use their own. */\n indexBox?: VDBIndexBox;\n /**\n * K3.6: index boxes the unit box covers in the aux grids (default: each grid's own index bbox). Grids converted\n * from one dense `.wvdb` level (`wvdbDenseToNvdb`) share the texture's box (`textureIndexBox`); pass it so a\n * sparse emission or mask channel lines up with the density (its active bbox is usually smaller).\n */\n auxIndexBoxes?: Partial<Record<\"mask\" | \"albedo\" | \"emission\", VDBIndexBox>>;\n /** World box (default: the density cell box through the grid's transform, as an AABB). */\n bbox?: [Vec3, Vec3];\n /**\n * K3.2d: level-0 samples through `vdbSampleFast` (the 8 trilinear taps as lower-node child lookups, no\n * tree walk per tap; bit-identical to `vdbSample`). Needs the `VDBGridNode` helper `'fastTrilinear'`.\n * Default: on when the node has the helper.\n */\n fastTrilinear?: boolean;\n /**\n * K3.2d: keep one accessor per shader invocation (a WGSL `var<private>`) across the samples of a march\n * instead of a fresh one per sample, so consecutive samples reuse its cached leaf/lower/upper nodes. The\n * values are the same either way. Default true (the K3.2d hardware A/B: with `fastTrilinear`, whose taps\n * start from the cached lower node, 10–25% off the source passes; alone it changes little).\n */\n cacheAccessor?: boolean;\n /**\n * G16a: follow the grids' images. When a channel grid's `imageRevision` moves (a `pool.replace`, e.g. a\n * `vdbStreamCoarseFirst` swap from the preview to the full grid) and every channel grid is resident again, the\n * source re-reads its index boxes, world box and transform from `pool.info`, rebuilds the coarse pyramid at the\n * new size and bumps `version` (a `VDBFrameVolume` whose box is the source's follows it). Boxes, sizes and LOD\n * levels are uniforms in this mode, so nothing recompiles; give the `VDBGridNode` every grid type the images will\n * have (`types`, e.g. `VDBCoarseFirstEvent.types`): a new image of a type the node does not compile throws\n * `VDB_TYPE_NOT_COMPILED` when the source re-reads it (it would read 0). Default false: the boxes are fixed when the\n * source is made. Not with `indexBox`, `auxIndexBoxes` or `bbox`.\n */\n followImage?: boolean;\n}\n\n/**\n * Internal options of {@link vdbSparseSource} (`three/internal.ts`): K3.2f, the core source's brick cache (level-0\n * density from a dense atlas of the touched 8³ blocks; core `VDBSparseSourceInternalOptions`). Opt-in until K6.T times it.\n */\nexport interface VDBThreeSparseSourceInternalOptions extends VDBSparseSourceOptions {\n /** `'off'` (default), `'f32'` (bit-identical to the tree) or `'f16'` (one filtered fetch, bounded). */\n brickCache?: \"off\" | \"f32\" | \"f16\";\n /** K3.2f-e: the core source's `brickKernels`, `brickMarkStats`, `brickCapacity` and `brickBudget` (with `brickCache`). */\n brickKernels?: \"all\" | \"gather-marks\" | \"gather-only\";\n brickMarkStats?: boolean;\n brickCapacity?: number;\n brickBudget?: number;\n}\n\n/** K3.2f-e: the brick cache options a three source passes to its core source (absent ones keep the core defaults). */\nexport interface VDBThreeBrickOptions {\n readonly brickKernels?: \"all\" | \"gather-marks\" | \"gather-only\";\n readonly brickMarkStats?: boolean;\n readonly brickCapacity?: number;\n readonly brickBudget?: number;\n}\n\n/** What the source needs from a pool: `info` and the ids' grids (a `VDBGridPool`). */\ninterface PoolInfoLike {\n info(id: number): { indexBBox: { min: Vec3; max: Vec3 }; indexToWorld: Float64Array; hasStats: boolean; capacity: number; type: string; imageRevision?: number; resident?: boolean };\n}\n\n/** The sparse source in three. */\nexport interface VDBThreeSparseSource extends VDBVolumeSourceInfo {\n /** Always `\"sparse\"`. */\n readonly kind: \"sparse\";\n /** World box of the volume (`[min, max]`), the default `VDBFrameVolume` box. */\n readonly bbox: [[number, number, number], [number, number, number]];\n /** The grid node the source reads through. */\n readonly grids: VDBGridNode;\n /** The pool ids of the channels. */\n readonly ids: Readonly<VDBSparseSourceGrids>;\n /** The LOD strategy in use. */\n readonly lod: VDBSparseLod;\n /** Density normalization: `'clamp01'` clamps to [0, 1], `'none'` leaves it. */\n readonly normalize: \"none\" | \"clamp01\";\n /** The density index box the unit box covers. */\n readonly indexBox: VDBIndexBox;\n /** K3.2d: level 0 through `vdbSampleFast` (see the option). */\n readonly fastTrilinear: boolean;\n /** K3.2d: one accessor per invocation across samples (see the option). */\n readonly cacheAccessor: boolean;\n /** G16a: the boxes follow the grids' images (see the option). */\n readonly followImage: boolean;\n /** G16a: times the boxes (and the pyramid, if its size changed) were re-read after an image change. */\n readonly layoutUpdates: number;\n /**\n * GPU bytes of the channel grids' pool ranges. The LOD pyramid is the core source's (demo 15:\n * `frameRenderer.coreVolumeOf(volume).slot.source.gpuBytes`).\n */\n readonly gpuBytes: { readonly pool: number };\n /** Density stats (`normalizeDensity`'s `meanNonZero`): of the density image at creation, then of the latest one read back (K3.2e). */\n readonly stats: { readonly meanNonZero: number; readonly max: number; readonly activeVoxels: number };\n /** Times the stats were recomputed after an image change (K3.2e). */\n readonly statsUpdates: number;\n /**\n * K3.2e: if the density grid's image changed since the stats were computed and it is resident, reads it\n * back from the pool (own encoder, submitted) and recomputes the stats (tools' twin of the CPU path);\n * resolves to whether it did. K6.11: nothing calls it for you (the TSL uniforms that did are deleted); `VDBFrameRenderer`\n * copies a changed `stats` into its core slot, which otherwise re-reads the mean itself a frame or two later. Call it\n * after `pool.update` was submitted, as `grids.update()`; await it when the first frame needs the new mean.\n */\n refreshStats(): Promise<boolean>;\n /** Drops the listeners. */\n dispose(): void;\n}\n\nconst bad = (message: string) => new VDBError(\"VDB_BAD_OPTION\", `vdbSparseSource: ${message}`);\n\n/** The non-zero density stats of an image (all leaf voxels, active or not, and active tiles). */\nfunction imageStats(image: Uint32Array, clamp01: boolean): { meanNonZero: number; max: number; activeVoxels: number } {\n let sum = 0;\n let count = 0;\n let maxValue = 0;\n const add = (v: number, n: number) => {\n const x = clamp01 ? Math.min(Math.max(v, 0), 1) : v;\n if (x !== 0) {\n sum += x * n;\n count += n;\n maxValue = Math.max(maxValue, x);\n }\n };\n for (const node of treeNodes(image)) {\n for (const t of node.activeTiles) add(t.value, t.dim ** 3);\n if (node.level !== 0) continue;\n const { values } = leafVoxels(image, node.address);\n for (let n = 0; n < 512; n++) add(values[n]!, 1);\n }\n return { meanNonZero: count > 0 ? sum / count : 0, max: maxValue, activeVoxels: count };\n}\n\n/** World AABB of an index cell box through a 3x4 row-major affine. */\nfunction worldBox(box: VDBIndexBox, m: Float64Array): [Vec3, Vec3] {\n const lo: Vec3 = [Infinity, Infinity, Infinity];\n const hi: Vec3 = [-Infinity, -Infinity, -Infinity];\n for (let c = 0; c < 8; c++) {\n const p = [c & 1 ? box.max[0] + 0.5 : box.min[0] - 0.5, c & 2 ? box.max[1] + 0.5 : box.min[1] - 0.5, c & 4 ? box.max[2] + 0.5 : box.min[2] - 0.5];\n for (let r = 0; r < 3; r++) {\n const v = m[r * 4]! * p[0]! + m[r * 4 + 1]! * p[1]! + m[r * 4 + 2]! * p[2]! + m[r * 4 + 3]!;\n lo[r] = Math.min(lo[r]!, v);\n hi[r] = Math.max(hi[r]!, v);\n }\n }\n return [lo, hi];\n}\n\n/** Local unit box → sample index space: p = min − ½ + (local + ½)·size (column-major). */\nfunction boxToSourceOf(b: VDBIndexBox, texels: Vec3): Float32Array {\n const [sx, sy, sz] = texels;\n return new Float32Array([sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, b.min[0] - 0.5 + 0.5 * sx, b.min[1] - 0.5 + 0.5 * sy, b.min[2] - 0.5 + 0.5 * sz, 1]);\n}\n\nconst texelsOf = (b: VDBIndexBox): Vec3 => [b.max[0] - b.min[0] + 1, b.max[1] - b.min[1] + 1, b.max[2] - b.min[2] + 1];\n\n/**\n * The handle (K6.8a): grids, ids, options, boxes, stats and the image-follow state. The frame renderer reads these into\n * the core's sparse source.\n */\nclass SparseSource implements VDBThreeSparseSource {\n readonly kind = \"sparse\" as const;\n readonly grids: VDBGridNode;\n readonly ids: Readonly<VDBSparseSourceGrids>;\n readonly lod: VDBSparseLod;\n readonly normalize: \"none\" | \"clamp01\";\n readonly channels: VDBVolumeChannels;\n // G16a: the layout fields below are re-read after an image change when `followImage` is on.\n indexBox: VDBIndexBox;\n auxBoxes: Record<\"mask\" | \"albedo\" | \"emission\", VDBIndexBox | null>;\n texels: [number, number, number];\n lodLevels: number;\n stats: { meanNonZero: number; max: number; activeVoxels: number };\n statsUpdates = 0;\n boxToSource: Float32Array;\n bbox: [Vec3, Vec3];\n readonly fastTrilinear: boolean;\n readonly cacheAccessor: boolean;\n readonly followImage: boolean;\n readonly pyramidOptions: { readonly pyramidMax?: number };\n /** K3.2f (internal): the core source's brick cache. */\n readonly brickCache: \"off\" | \"f32\" | \"f16\";\n /** K3.2f-e (internal): the core source's other brick options (validated by the core source). */\n readonly brickOptions: VDBThreeBrickOptions;\n layoutUpdates = 0;\n /** G16a: the newest channel imageRevision the layout describes, the pool revision last checked. */\n #layoutRevision = -1;\n #layoutPoolRevision = -1;\n readonly #poolIds: number[];\n #versionSeen = { poolRevision: -1, value: 0 };\n /** K3.2e: the density imageRevision the stats describe, the pool revision last checked, and a readback in flight. */\n #statsRevision = -1;\n #statsPoolRevisionSeen = -1;\n #statsReadback: Promise<boolean> | null = null;\n\n constructor(grids: VDBGridNode, ids: VDBSparseSourceGrids, o: VDBSparseSourceOptions) {\n const pool = grids.pool as unknown as Partial<PoolInfoLike>;\n if (typeof pool.info !== \"function\") throw bad(\"the VDBGridNode's pool has no info(); pass a VDBGridPool.\");\n const info = (id: number) => (pool as PoolInfoLike).info(id);\n const lod = o.lod ?? \"coarse-pyramid\";\n if (lod !== \"none\" && lod !== \"coarse-pyramid\" && lod !== \"node-average\") throw bad(`unknown lod ${JSON.stringify(lod)}; use 'none', 'coarse-pyramid' or 'node-average'.`);\n const normalize = o.normalize ?? \"none\";\n if (normalize !== \"none\" && normalize !== \"clamp01\") throw bad(`unknown normalize ${JSON.stringify(normalize)}; use 'none' or 'clamp01'.`);\n const helpers = new Set<string>(grids.options.helpers ?? []);\n if (grids.options.profile !== \"march\" || !helpers.has(\"cellBoundTrilinear\") || !helpers.has(\"hddaCellEnd\") || (lod === \"node-average\" && !helpers.has(\"nodeAverage\"))) {\n throw bad(\n `make the VDBGridNode with profile 'march' and helpers ['cellBoundTrilinear', 'hddaCellEnd'${lod === \"node-average\" ? \", 'nodeAverage'\" : \"\"}] ` +\n `(got profile '${grids.options.profile}', helpers [${[...helpers].join(\", \")}]).`,\n );\n }\n const fastTrilinear = o.fastTrilinear ?? helpers.has(\"fastTrilinear\");\n if (fastTrilinear && !helpers.has(\"fastTrilinear\")) throw bad(\"fastTrilinear needs the VDBGridNode helper 'fastTrilinear' (add it to helpers), or pass fastTrilinear: false.\");\n if (fastTrilinear && grids.options.sampler === \"nearest\") throw bad(\"fastTrilinear needs the VDBGridNode's sampler 'trilinear'.\");\n this.fastTrilinear = fastTrilinear;\n this.cacheAccessor = o.cacheAccessor ?? true;\n const brickCache = (o as VDBThreeSparseSourceInternalOptions).brickCache ?? \"off\";\n if (brickCache !== \"off\" && brickCache !== \"f32\" && brickCache !== \"f16\") throw bad(`brickCache must be 'off', 'f32' or 'f16', got ${JSON.stringify(brickCache)}.`);\n this.brickCache = brickCache;\n const io = o as VDBThreeSparseSourceInternalOptions;\n this.brickOptions = Object.freeze({\n ...(io.brickKernels !== undefined ? { brickKernels: io.brickKernels } : {}),\n ...(io.brickMarkStats !== undefined ? { brickMarkStats: io.brickMarkStats } : {}),\n ...(io.brickCapacity !== undefined ? { brickCapacity: io.brickCapacity } : {}),\n ...(io.brickBudget !== undefined ? { brickBudget: io.brickBudget } : {}),\n });\n const followImage = o.followImage ?? false;\n if (typeof followImage !== \"boolean\") throw bad(\"followImage must be a boolean.\");\n if (followImage) {\n const fixed = ([\"indexBox\", \"auxIndexBoxes\", \"bbox\"] as const).filter((k) => o[k] !== undefined);\n if (fixed.length) throw bad(`followImage re-reads every box from the pool; drop ${fixed.join(\", \")} (fixed boxes).`);\n }\n this.followImage = followImage;\n const density = info(ids.density);\n if (lod === \"node-average\" && !density.hasStats) throw bad(\"lod 'node-average' reads node statistics; this grid has none (rebuild it with stats).\");\n this.grids = grids;\n const channelIds = [ids.density, ids.mask, ids.emission, ...(Array.isArray(ids.albedo) ? ids.albedo : [ids.albedo])].filter((v): v is number => v !== undefined);\n this.checkTypes(\n channelIds.map((id) => ({ id, type: info(id).type })),\n \"a channel grid\",\n );\n this.ids = Object.freeze({ ...ids, ...(Array.isArray(ids.albedo) ? { albedo: [...ids.albedo] as unknown as [number, number, number] } : {}) });\n this.lod = lod;\n this.normalize = normalize;\n this.indexBox = o.indexBox ? { min: [...o.indexBox.min], max: [...o.indexBox.max] } : { min: [...density.indexBBox.min], max: [...density.indexBBox.max] };\n const albedoId = Array.isArray(ids.albedo) ? ids.albedo[0] : (ids.albedo as number | undefined);\n const box = (id: number | undefined, given?: VDBIndexBox) =>\n id === undefined ? null : given ? { min: [...given.min] as Vec3, max: [...given.max] as Vec3 } : { min: [...info(id).indexBBox.min] as Vec3, max: [...info(id).indexBBox.max] as Vec3 };\n const aux = o.auxIndexBoxes ?? {};\n this.auxBoxes = { mask: box(ids.mask, aux.mask), albedo: box(albedoId, aux.albedo), emission: box(ids.emission, aux.emission) };\n this.channels = { mask: ids.mask !== undefined, albedo: ids.albedo !== undefined, emission: ids.emission !== undefined };\n const b = this.indexBox;\n this.texels = texelsOf(b);\n if (this.texels.some((t) => !(t > 0))) throw bad(\"the density index box is empty.\");\n const image = o.images?.density;\n if (o.stats) this.stats = { ...o.stats };\n else if (image) this.stats = imageStats(image, normalize === \"clamp01\");\n else throw bad(\"pass images.density (the CPU image, for the density stats) or stats.\");\n this.#statsRevision = (density as { imageRevision?: number }).imageRevision ?? -1;\n this.boxToSource = boxToSourceOf(b, this.texels);\n this.bbox = o.bbox ? [[...o.bbox[0]], [...o.bbox[1]]] : worldBox(b, density.indexToWorld);\n\n this.pyramidOptions = o.pyramidMax !== undefined ? { pyramidMax: o.pyramidMax } : {};\n this.lodLevels = this.#lodLevelsOf(this.texels);\n this.#poolIds = [...new Set(channelIds)];\n this.#layoutRevision = this.#poolIds.reduce((r, id) => Math.max(r, info(id).imageRevision ?? 0), 0);\n }\n\n /** The LOD range: 0 (`'none'`), 7 (`'node-average'`), the pyramid layout's levels (`'coarse-pyramid'`). */\n #lodLevelsOf(texels: Vec3): number {\n if (this.lod === \"none\") return 0;\n if (this.lod === \"node-average\") return 7;\n const { pyramidMax } = this.pyramidOptions;\n return vdbBoxPyramidLayout(texels, pyramidMax !== undefined ? { pyramidMax } : {}).lodLevels;\n }\n\n /** GPU bytes of the channel grids' pool ranges. */\n get gpuBytes(): { pool: number } {\n const pool = this.grids.pool as unknown as PoolInfoLike;\n let bytes = 0;\n for (const id of this.#poolIds) {\n try {\n bytes += pool.info(id).capacity;\n } catch {\n // A removed grid holds no pool range.\n }\n }\n return { pool: bytes };\n }\n\n /**\n * G16a (`followImage`): re-reads the layout when a channel grid's image changed and every channel grid is resident\n * again (the update that writes the new image has run: the GPU must not read it through the old boxes, nor the\n * old image through the new ones). Cheap when the pool's revision did not move; called from `version` (a\n * `VDBFrameVolume` asks once per frame, before it places its box) and from the render updates.\n */\n syncLayout(): boolean {\n if (!this.followImage) return false;\n const pool = this.grids.pool as unknown as { revision?: number } & PoolInfoLike;\n if (typeof pool.revision !== \"number\" || pool.revision === this.#layoutPoolRevision) return false;\n let revision = 0;\n let resident = true;\n const infos: { id: number; type: string }[] = [];\n for (const id of this.#poolIds) {\n let i: ReturnType<PoolInfoLike[\"info\"]>;\n try {\n i = pool.info(id);\n } catch {\n return false; // a removed grid: keep the last layout\n }\n revision = Math.max(revision, i.imageRevision ?? 0);\n if (i.resident === false) resident = false;\n infos.push({ id, type: i.type });\n }\n if (revision === this.#layoutRevision) {\n this.#layoutPoolRevision = pool.revision;\n return false;\n }\n if (!resident) return false; // look again once the update has written it\n // A new image of a type the module does not decode would read 0 through the new boxes, silently: say so instead\n // (every call until the source is remade over a node that compiles it).\n this.checkTypes(infos, \"a channel grid's new image\");\n this.#relayout();\n this.#layoutRevision = revision;\n this.#layoutPoolRevision = pool.revision;\n return true;\n }\n\n /**\n * Throws `VDB_TYPE_NOT_COMPILED` when a channel grid's type is not among the `VDBGridNode`'s compiled `types` (those\n * grids read 0). A node stand-in without `options.types` is not checked.\n */\n private checkTypes(infos: readonly { id: number; type: string }[], what: string): void {\n const compiled = (this.grids.options as { types?: readonly string[] }).types;\n if (!compiled) return;\n const missing = infos.filter((i) => !compiled.includes(i.type));\n if (missing.length === 0) return;\n throw new VDBError(\n \"VDB_TYPE_NOT_COMPILED\",\n `vdbSparseSource: ${what} is ${missing.map((m) => `grid ${m.id}: ${m.type}`).join(\", \")}, but the VDBGridNode compiles only ` +\n `${compiled.join(\", \")}; it would read 0. Make the VDBGridNode with types that include every type the images will have ` +\n `(a coarse-first stream lists them in VDBCoarseFirstEvent.types: types: event.types), then make the source over it.`,\n );\n }\n\n #relayout(): void {\n const pool = this.grids.pool as unknown as PoolInfoLike;\n const ids = this.ids;\n const density = pool.info(ids.density);\n const b: VDBIndexBox = { min: [...density.indexBBox.min], max: [...density.indexBBox.max] };\n const old = this.indexBox;\n const moved = b.min.some((v, a) => v !== old.min[a]) || b.max.some((v, a) => v !== old.max[a]);\n this.indexBox = b;\n this.texels = texelsOf(b);\n this.boxToSource = boxToSourceOf(b, this.texels);\n this.bbox = worldBox(b, density.indexToWorld);\n const auxBox = (id: number | undefined): VDBIndexBox | null => (id === undefined ? null : { min: [...pool.info(id).indexBBox.min] as Vec3, max: [...pool.info(id).indexBBox.max] as Vec3 });\n this.auxBoxes = { mask: auxBox(ids.mask), albedo: auxBox(Array.isArray(ids.albedo) ? ids.albedo[0] : (ids.albedo as number | undefined)), emission: auxBox(ids.emission) };\n if (moved) this.lodLevels = this.#lodLevelsOf(this.texels);\n this.layoutUpdates++;\n }\n\n /**\n * Content version: the newest `imageRevision` of the channel grids (K3.2a), so a `pool.replace` (a\n * sequence frame) changes it and the 'frame' lighting caster signature (V44) draws the shadow grid\n * again. Read through the pool's `revision` first (cheap when nothing changed).\n */\n get version(): number {\n // G16a: a following source's version is the image revision its layout describes (it moves once the new image is\n // resident and the boxes were re-read), so a VDBFrameVolume re-reads its box and the uniforms then.\n if (this.followImage) {\n this.syncLayout();\n return this.#layoutRevision;\n }\n const pool = this.grids.pool as unknown as { revision?: number; info(id: number): { imageRevision?: number } };\n if (typeof pool.revision !== \"number\") return 0;\n if (pool.revision !== this.#versionSeen.poolRevision) {\n let value = 0;\n for (const id of this.#poolIds) {\n try {\n value = Math.max(value, pool.info(id).imageRevision ?? 0);\n } catch {\n // A removed grid: keep the others' revision.\n }\n }\n this.#versionSeen = { poolRevision: pool.revision, value };\n }\n return this.#versionSeen.value;\n }\n\n refreshStats(): Promise<boolean> {\n if (this.#statsReadback) return this.#statsReadback;\n const pool = this.grids.pool as unknown as {\n revision?: number;\n device?: GPUDevice;\n buffer?: GPUBuffer;\n info(id: number): { imageRevision?: number; resident?: boolean; imageOffset?: number | null; imageBytes?: number };\n };\n // Cheap test first (once per render): the pool's revision moves on any change.\n if (typeof pool.revision !== \"number\" || pool.revision === this.#statsPoolRevisionSeen || !pool.device || !pool.buffer) return Promise.resolve(false);\n let info: ReturnType<typeof pool.info>;\n try {\n info = pool.info(this.ids.density);\n } catch {\n return Promise.resolve(false); // removed: keep the last stats\n }\n const revision = info.imageRevision ?? -1;\n if (revision === this.#statsRevision) {\n this.#statsPoolRevisionSeen = pool.revision;\n return Promise.resolve(false);\n }\n // Not written yet (the update that writes it is still to come): look again next time.\n if (!info.resident || info.imageOffset === null || info.imageOffset === undefined || !info.imageBytes) return Promise.resolve(false);\n const { device, buffer } = pool;\n const bytes = info.imageBytes;\n const staging = device.createBuffer({ label: \"vdbSparseSource stats readback\", size: bytes, usage: 0x1 | 0x8 }); // MAP_READ | COPY_DST (no WebGPU globals in Node tests)\n const encoder = device.createCommandEncoder({ label: \"vdbSparseSource stats readback\" });\n encoder.copyBufferToBuffer(buffer, info.imageOffset, staging, 0, bytes);\n device.queue.submit([encoder.finish()]);\n const seen = pool.revision;\n this.#statsReadback = staging\n .mapAsync(0x1) // GPUMapMode.READ\n .then(() => {\n const image = new Uint32Array(staging.getMappedRange().slice(0));\n this.stats = imageStats(image, this.normalize === \"clamp01\");\n this.#statsRevision = revision;\n this.#statsPoolRevisionSeen = seen;\n this.statsUpdates++;\n return true;\n })\n .catch(() => false)\n .finally(() => {\n staging.destroy();\n this.#statsReadback = null;\n });\n return this.#statsReadback;\n }\n\n dispose(): void {\n }\n}\n\n/**\n * A sparse volume source over pool grids (see the file comment). `grids` must be a `VDBGridNode`\n * made with profile `'march'` and helpers `['cellBoundTrilinear', 'hddaCellEnd']` (+ `'nodeAverage'`\n * for that LOD). The source holds no GPU object (the pool's grid buffer is the pool's).\n *\n * @param grids A `VDBGridNode` with profile `march` and the helpers the LOD needs.\n * @param ids The pool ids of the density grid and optional channels.\n * @param options LOD, normalization, boxes, pyramid and sampling options.\n */\nexport function vdbSparseSource(grids: VDBGridNode, ids: VDBSparseSourceGrids, options: VDBSparseSourceOptions = {}): VDBThreeSparseSource {\n if (!grids || typeof grids !== \"object\" || !(\"module\" in grids)) throw bad(\"pass a VDBGridNode.\");\n if (!ids || !Number.isInteger(ids.density)) throw bad(\"ids.density must be a pool grid id.\");\n return new SparseSource(grids, ids, options);\n}\n"]}
|
|
@@ -1,167 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The dense `.wvdb` volume source in three (K3.0, R1 §4.2).
|
|
3
|
-
*
|
|
4
|
-
* const file = readWvdb(bytes);
|
|
5
|
-
* const volume = wvdbDenseVolume(file); // @pmndrs/vdb/tools: his 8-bit texels + mip atlas
|
|
6
|
-
* const source = vdbDenseTextures(volume); // three Data3DTextures, set up as his FrameVolume
|
|
7
|
-
* const uniforms = vdbVolumeUniforms(source, { extinction: 100 });
|
|
8
|
-
* const nodes = vdbVolumeNodes(source, uniforms, { useMipmaps: true });
|
|
9
|
-
* // inside a TSL Fn: nodes.sampleExtinction(localPos, lod), nodes.sampleAlbedo(...), nodes.boxSegment(...)
|
|
10
|
-
*
|
|
11
|
-
* `vdbVolumeNodes` returns the shape of his `createVolumeNodes()` (`getLod`,
|
|
12
|
-
* `sampleExtinction`, `sampleAlbedo`, `sampleEmission`, `insideBox`, `boxExit`,
|
|
13
|
-
* `boxSegment`), so the K3 port of his materials changes one import per file.
|
|
14
|
-
* Positions are in the local unit box [-0.5, 0.5]³.
|
|
15
|
-
*/
|
|
16
|
-
import * as THREE from "three";
|
|
17
1
|
import type { VDBVolumeSourceInfo } from "../core/source/types.js";
|
|
18
2
|
import type { WvdbDenseVolume } from "../tools/wvdb/dense.js";
|
|
19
|
-
import type {
|
|
20
|
-
|
|
21
|
-
/** The three textures of one channel. */
|
|
22
|
-
export interface VDBDenseChannelTextures {
|
|
23
|
-
readonly map: THREE.Data3DTexture;
|
|
24
|
-
readonly mip: THREE.Data3DTexture | null;
|
|
25
|
-
}
|
|
26
|
-
/** A dense source as three textures (the descriptive part of `VDBVolumeSource`; no raw bindings). */
|
|
3
|
+
import type { VDBThreeSparseSource } from "./sparse-source.js";
|
|
4
|
+
/** A dense source as a handle (the descriptive part of `VDBVolumeSource`; no raw bindings). */
|
|
27
5
|
export interface VDBThreeDenseSource extends VDBVolumeSourceInfo {
|
|
6
|
+
/** Always `"dense"`. */
|
|
28
7
|
readonly kind: "dense";
|
|
8
|
+
/** The `.wvdb` volume currently set (`VDBFrameVolume`: the core frame renderer uploads it into its own textures). */
|
|
29
9
|
readonly volume: WvdbDenseVolume;
|
|
30
|
-
readonly textures: Readonly<Record<ChannelName, VDBDenseChannelTextures | null>>;
|
|
31
10
|
/**
|
|
32
|
-
* Swap in another LOD or sequence frame. New sizes
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* absent value (mask and albedo 1, emission 0); a channel the source lacks is ignored (warned once). The density's
|
|
36
|
-
* mip atlas must stay if the source has one.
|
|
11
|
+
* Swap in another LOD or sequence frame. New sizes bump `version`, and so does a frame with another `.wvdb` box
|
|
12
|
+
* (a `VDBFrameVolume` follows by itself, its box too unless it was given a `bbox`). A channel the source lacks is
|
|
13
|
+
* ignored (warned once). The density's mip atlas must stay if the source has one.
|
|
37
14
|
*/
|
|
38
15
|
replace(volume: WvdbDenseVolume): void;
|
|
16
|
+
/** Releases the handle (it holds no GPU object). */
|
|
39
17
|
dispose(): void;
|
|
40
18
|
}
|
|
41
|
-
/**
|
|
19
|
+
/** A volume source `VDBFrameVolume` reads: a dense `.wvdb` volume or a pool grid. */
|
|
20
|
+
export type VDBThreeVolumeSource = VDBThreeDenseSource | VDBThreeSparseSource;
|
|
21
|
+
/** A dense `.wvdb` volume (`wvdbDenseVolume`, `@pmndrs/vdb/tools`) as a handle for `VDBFrameVolume`. */
|
|
42
22
|
export declare function vdbDenseTextures(volume: WvdbDenseVolume): VDBThreeDenseSource;
|
|
43
|
-
/**
|
|
44
|
-
* The sparse source (`vdbSparseSource`, `./sparse-source.ts`) as far as this file needs it: it makes
|
|
45
|
-
* its own uniforms and nodes (the K3.1 brief's `nodes(uniforms, options)` factory), so the frame
|
|
46
|
-
* passes take either kind through {@link vdbVolumeUniforms} / {@link vdbVolumeNodes}.
|
|
47
|
-
*/
|
|
48
|
-
export interface VDBThreeSourceFactory extends VDBVolumeSourceInfo {
|
|
49
|
-
readonly kind: "sparse";
|
|
50
|
-
/** World box of the volume (`[min, max]`), the default `VDBFrameVolume` box. */
|
|
51
|
-
readonly bbox: [[number, number, number], [number, number, number]];
|
|
52
|
-
createUniforms(p: VDBVolumeUniformParameters): VDBVolumeUniforms;
|
|
53
|
-
createNodes(u: VDBVolumeUniforms, o: VDBVolumeNodesOptions): VDBVolumeNodes;
|
|
54
|
-
dispose(): void;
|
|
55
|
-
}
|
|
56
|
-
/** A volume source the three frame passes read: dense textures or the sparse pool. */
|
|
57
|
-
export type VDBThreeVolumeSource = VDBThreeDenseSource | VDBThreeSourceFactory;
|
|
58
|
-
/** Initial values of {@link vdbVolumeUniforms} (his `FrameVolume` props of the same names and defaults). */
|
|
59
|
-
export interface VDBVolumeUniformParameters {
|
|
60
|
-
/** Optical depth of the longest box side at the mean density, with `normalizeDensity` (default 100). */
|
|
61
|
-
extinction?: number;
|
|
62
|
-
/** Density multiplier (default 1); with `normalizeDensity` it divides by `stats.meanNonZero`. */
|
|
63
|
-
densityScale?: number;
|
|
64
|
-
normalizeDensity?: boolean;
|
|
65
|
-
densityCutoff?: number;
|
|
66
|
-
baseColor?: THREE.ColorRepresentation;
|
|
67
|
-
emissiveIntensity?: number;
|
|
68
|
-
/** Kelvin at emission values 0 and 1 (default [0, 6500]). */
|
|
69
|
-
temperatureRange?: [number, number];
|
|
70
|
-
offset3D?: THREE.Vector3Like;
|
|
71
|
-
wrap3D?: THREE.Wrapping;
|
|
72
|
-
/** `matrixWorld.getMaxScaleOnAxis()` of the volume (default 1). */
|
|
73
|
-
worldScale?: number;
|
|
74
|
-
}
|
|
75
|
-
/** His `createVolumeUniforms()` subset the source reads (frameShaderChunks.js L729–763), as live TSL uniforms. */
|
|
76
|
-
export interface VDBVolumeUniforms {
|
|
77
|
-
readonly worldScale: VDBTslNode;
|
|
78
|
-
readonly gridTexels: VDBTslNode;
|
|
79
|
-
readonly mipAtlasSize: VDBTslNode;
|
|
80
|
-
readonly maps: Readonly<Record<ChannelName, VDBTslNode | null>>;
|
|
81
|
-
readonly mipMaps: Readonly<Record<ChannelName, VDBTslNode | null>>;
|
|
82
|
-
readonly mipLevels: Readonly<Record<ChannelName, VDBTslNode>>;
|
|
83
|
-
readonly baseColor: VDBTslNode;
|
|
84
|
-
readonly extinction: VDBTslNode;
|
|
85
|
-
readonly densityScale: VDBTslNode;
|
|
86
|
-
readonly densityCutoff: VDBTslNode;
|
|
87
|
-
readonly emissiveIntensity: VDBTslNode;
|
|
88
|
-
readonly temperatureRange: VDBTslNode;
|
|
89
|
-
readonly offset3D: VDBTslNode;
|
|
90
|
-
readonly wrap3D: VDBTslNode;
|
|
91
|
-
/** Re-read textures, sizes and the normalized density scale after `source.replace` (setMipUniforms, L773–798). */
|
|
92
|
-
update(source: VDBThreeVolumeSource, o?: {
|
|
93
|
-
densityScale?: number;
|
|
94
|
-
normalizeDensity?: boolean;
|
|
95
|
-
}): void;
|
|
96
|
-
/**
|
|
97
|
-
* Stops following the source: a sparse source drops the listeners these uniforms registered (its stats and, with
|
|
98
|
-
* `followImage`, its layout), which it otherwise keeps for its lifetime. `VDBFrameVolume.dispose()` calls it; call it
|
|
99
|
-
* yourself for uniforms you made with `vdbVolumeUniforms`. A no-op for a dense source. Idempotent.
|
|
100
|
-
*/
|
|
101
|
-
dispose(): void;
|
|
102
|
-
}
|
|
103
|
-
/** FrameVolume.js L561–568 `getDensityScale`. */
|
|
104
|
-
export declare const vdbDensityScaleOf: (source: VDBVolumeSourceInfo, densityScale: number, normalize: boolean) => number;
|
|
105
|
-
/**
|
|
106
|
-
* Live uniforms for one source (his `createVolumeUniforms` + `setVolumeUniforms` + `setMipUniforms`).
|
|
107
|
-
* A sparse source makes its own (`source.createUniforms`), with the same fields.
|
|
108
|
-
*/
|
|
109
|
-
export declare function vdbVolumeUniforms(source: VDBThreeVolumeSource, p?: VDBVolumeUniformParameters): VDBVolumeUniforms;
|
|
110
|
-
/** Options of {@link vdbVolumeNodes}. */
|
|
111
|
-
export interface VDBVolumeNodesOptions {
|
|
112
|
-
/** Sample the CPU mip atlas at `lod` (his shaders built with `useMipmaps`). Default: the source has mips. */
|
|
113
|
-
useMipmaps?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* Emission colour from temperature (Kelvin node) → vec3 node. Default: white.
|
|
116
|
-
* His `'approximate'` blackbody is from Shadertoy (CC BY-NC-SA unless stated) and is not
|
|
117
|
-
* ported (R1 §7); his `'planck'`/`'soot'` table is the hook `vdbFrameBlackbodyEmission` (K3.6; its CIE 1931
|
|
118
|
-
* colour matching functions are the Wyman–Sloan–Shirley 2013 analytic fit, D33).
|
|
119
|
-
*/
|
|
120
|
-
emissionColor?: (temperature: VDBTslNode) => VDBTslNode;
|
|
121
|
-
}
|
|
122
|
-
/** The node factory of his `createVolumeNodes()` (frameShaderChunks.js L834–1028). */
|
|
123
|
-
export interface VDBVolumeNodes {
|
|
124
|
-
getLod(localSize: VDBTslNode): VDBTslNode;
|
|
125
|
-
sampleExtinction(localPosition: VDBTslNode, lod: VDBTslNode): VDBTslNode;
|
|
126
|
-
sampleAlbedo(localPosition: VDBTslNode, lod: VDBTslNode): VDBTslNode;
|
|
127
|
-
sampleEmission(localPosition: VDBTslNode, lod: VDBTslNode): VDBTslNode;
|
|
128
|
-
insideBox(localPosition: VDBTslNode): VDBTslNode;
|
|
129
|
-
boxExit(origin: VDBTslNode, direction: VDBTslNode): VDBTslNode;
|
|
130
|
-
boxSegment(start: VDBTslNode, end: VDBTslNode): VDBTslNode;
|
|
131
|
-
/**
|
|
132
|
-
* Sparse sources only (K3.2): the empty-space query of a march along `origin + direction·t`
|
|
133
|
-
* (local units) whose samples are read at `lod`. Returns `vec2(ts, te)`: every sample with
|
|
134
|
-
* `t < ts` is exactly 0 (skip it), the samples in `[ts, te)` must be read, ask again from `te`.
|
|
135
|
-
* When no safe bound exists (a coarse level, wrapping, an offset) it returns `(t0, 1e30)`.
|
|
136
|
-
* Call in the Fn body. Absent for dense sources (no skipping).
|
|
137
|
-
*/
|
|
138
|
-
skipEmpty?(origin: VDBTslNode, direction: VDBTslNode, t0: VDBTslNode, t1: VDBTslNode, lod: VDBTslNode): VDBTslNode;
|
|
139
|
-
}
|
|
140
|
-
/** frameShaderChunks.js L65–66. */
|
|
141
|
-
export declare const vdbMinComponent: (v: VDBTslNode) => VDBTslNode;
|
|
142
|
-
export declare const vdbMaxComponent: (v: VDBTslNode) => VDBTslNode;
|
|
143
|
-
/**
|
|
144
|
-
* Sampling of one dense source, in his `createVolumeNodes` shape. Call the
|
|
145
|
-
* sample functions inside a TSL `Fn` body. Absent channels give his fallbacks
|
|
146
|
-
* (mask 1, albedo `baseColor`, emission 0) without sampling.
|
|
147
|
-
*/
|
|
148
|
-
/**
|
|
149
|
-
* His mip sampling (frameShaderChunks.js L838–872) over one texture and its box mip atlas:
|
|
150
|
-
* `sampleMipAtlas` (level 1 and up, frameMipmaps.js layout) and `sampleMipmapped` (linear between
|
|
151
|
-
* two levels). `gridTexels` is the size of `map` (level 0 of this chain), `mipAtlasSize` the atlas's.
|
|
152
|
-
* Shared by the dense source and the sparse source's coarse pyramid. Call in a TSL Fn body.
|
|
153
|
-
*/
|
|
154
|
-
export declare function vdbMipSampler(gridTexels: VDBTslNode, mipAtlasSize: VDBTslNode): {
|
|
155
|
-
sampleMipAtlas(mipMap: VDBTslNode, level: VDBTslNode, uvw: VDBTslNode): VDBTslNode;
|
|
156
|
-
sampleMipmapped(map: VDBTslNode, mipMap: VDBTslNode, levels: VDBTslNode, position: VDBTslNode, lod: VDBTslNode): VDBTslNode;
|
|
157
|
-
};
|
|
158
|
-
/** His `wrapUv` / `gridUv` (frameShaderChunks.js L894–911): the local position as a wrapped, offset uvw. */
|
|
159
|
-
export declare function vdbGridUv(u: Pick<VDBVolumeUniforms, "wrap3D" | "offset3D">): (localPosition: VDBTslNode) => VDBTslNode;
|
|
160
|
-
/** His box geometry (frameShaderChunks.js L938–958): `insideBox`, `boxExit`, `boxSegment` of the local unit box. */
|
|
161
|
-
export declare const vdbBoxNodes: {
|
|
162
|
-
insideBox: (localPosition: VDBTslNode) => any;
|
|
163
|
-
boxExit: (origin: VDBTslNode, direction: VDBTslNode) => import("three/webgpu").Node<"float">;
|
|
164
|
-
boxSegment: (start: VDBTslNode, end: VDBTslNode) => import("three/webgpu").JoinNode<"vec2">;
|
|
165
|
-
};
|
|
166
|
-
export declare function vdbVolumeNodes(source: VDBThreeVolumeSource, u: VDBVolumeUniforms, o?: VDBVolumeNodesOptions): VDBVolumeNodes;
|
|
167
|
-
export {};
|