@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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K,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9C,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IAChD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,GAAG,MAAM,EAAE,WAAW,CAAC,CAAC;IAChF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,YAAY,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IACtG,CAAC;AACH,CAAC","sourcesContent":["/**\n * points.ts — OpenVDB point data grids (`points::PointDataGrid`, grid type\n * `Tree_ptdataidx32_5_4_3`): the multi-pass leaf buffers and the attribute\n * arrays they hold.\n *\n * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345\n * (`src/openvdb/core/PointDataBuffers.js`, `src/openvdb/utils/points.js`): the\n * pass walk and the position decode follow the same OpenVDB sources his reader\n * cites. The format authority is OpenVDB itself (pinned a532de55):\n * `Grid::readBuffers` (multi-pass I/O), `points/PointDataGrid.h`\n * (`PointDataLeafNode::readBuffers`, the `PointDataIndex32`\n * `readCompressedValues` specialization), `points/AttributeSet.cc`\n * (`Descriptor::read`, `readMetadata`, `groupIndex`), `points/AttributeArray.h`\n * (`TypedAttributeArray::readMetadata` / `readBuffers` / `readPagedBuffers`,\n * the codecs) and `points/StreamCompression.cc` (`PagedInputStream`, `Page`).\n *\n * ## On-disk layout\n *\n * The tree topology is ordinary (leaves store only their value mask there).\n * The buffers start with a `u16 numPasses`; then the whole tree is walked\n * `numPasses` times, every leaf reading the part of its data that belongs to\n * the pass. With `n = (numPasses - 4) / 2` attributes:\n *\n * pass 0 u16 compressed size of the leaf's voxel buffer\n * pass 1 [u8 header, attribute descriptor, (header & 2) u64 skip]\n * unless a previous leaf shared its descriptor (header & 1);\n * then each attribute array's metadata\n * pass 2..n+1 attribute (pass - 2): page headers of paged arrays\n * pass n+2 the voxel buffer: value mask, then u16 size and a Blosc\n * frame (or 0xFFFF and 512 raw u32 end offsets)\n * pass n+3..2n+2 attribute (pass - n - 3): page bodies of paged arrays, or\n * the whole buffer of a non-paged array\n * pass 2n+3 cleanup (no I/O)\n *\n * Paged arrays (Blosc files) share pages: a page holds the arrays of many\n * consecutive leaves. A page header is an i32 compressed size and, when\n * positive, an i32 uncompressed size; a negative size means the page is\n * stored raw. Page bodies are read only when the next array starts a new\n * page, so the bytes stay views into the file until {@link decodePoints}.\n *\n * Each leaf voxel holds the *end* offset of its points in the leaf's arrays.\n * The position attribute `P` is a voxel-space offset from the voxel centre;\n * world position = `indexToWorld(ijk + P)`.\n *\n * ## Hostile input (K4.2 hardening)\n *\n * Every count, size and offset read from the file is bounded before it drives\n * an allocation or a loop, and every failure is a `VdbFormatError` or\n * `VDBUnsupportedError`:\n *\n * - The pass loops only visit the leaves that own an array for the pass, so\n * their work is bounded by the array metadata actually stored (a large\n * `numPasses` costs nothing). A leaf with more attributes than the passes\n * cover is rejected.\n * - Page headers: a page body must fit in the file, and a Blosc page may claim\n * at most {@link MAX_BLOSC_RATIO} times its compressed size. A page must be\n * filled exactly by the arrays assigned to it.\n * - Point counts: the grid's total point count, times the 12 bytes of its\n * positions, may not exceed {@link MAX_POINT_EXPANSION} times the file size.\n * Uniform arrays store one value for any number of points, so nothing else\n * bounds a count.\n * - Decoding: every output array and every decoded page is charged against a\n * budget of {@link MAX_POINT_EXPANSION} times the file size before it is\n * allocated. Strides and group offsets are range-checked (no int32\n * wrap-around).\n */\n\nimport type { ByteReader } from \"./byte-reader.js\";\nimport { decompressBlosc } from \"./blosc.js\";\nimport { VdbFormatError, VDBUnsupportedError } from \"./errors.js\";\nimport { halfToFloat } from \"./half-float.js\";\nimport { readMetadataMap } from \"./metadata.js\";\nimport type { VdbPointAttributeArray, VdbPointAttributeInfo, VdbPointList } from \"./types.js\";\n\nconst LEAF_NUM_VALUES = 512;\nconst LEAF_LOG2DIM = 3;\n\n/** `PointDataLeafNode::readBuffers` descriptor header bits. */\nconst HEADER_SHARED_DESCRIPTOR = 0x1;\nconst HEADER_SKIP_BYTES = 0x2;\n\n/** `AttributeArray::SerializationFlag`. */\nconst WRITE_STRIDED = 0x1;\nconst WRITE_UNIFORM = 0x2;\nconst WRITE_PAGED = 0x8;\n/** `AttributeArray::Flag::CONSTANTSTRIDE`. */\nconst FLAG_CONSTANT_STRIDE = 0x8;\n\n/** The `u16` voxel-buffer size that marks an uncompressed buffer. */\nconst VOXEL_BUFFER_UNCOMPRESSED = 0xffff;\n\n/**\n * The most a Blosc1 frame from OpenVDB can expand: deflate's worst case is\n * about 1032:1 and LZ4's 255:1 (each length byte adds at most 255 output\n * bytes). A Blosc page header claiming more is not a real page.\n */\nexport const MAX_BLOSC_RATIO = 1032;\n\n/**\n * Decoded point output allowed per byte of the source file. The real samples\n * need under 3 (waterfall_points: 156 MB in, 381 MB of positions and\n * attributes out); 256 matches LZ4's ceiling and leaves room for uniform\n * arrays, which store one value for a whole leaf.\n */\nexport const MAX_POINT_EXPANSION = 256;\n\n/** Bytes of decoded position per point (3 x f32). */\nconst POSITION_BYTES = 12;\n\n/** Descriptor limits: far above any real file, low enough to bound the loops. */\nconst MAX_ATTRIBUTES = 1 << 16;\nconst MAX_GROUPS = 1 << 16;\n\n/** One attribute set descriptor (`AttributeSet::Descriptor`). */\nexport interface PointDescriptor {\n /** In attribute-set order (`index` = position). */\n attributes: VdbPointAttributeInfo[];\n /** Group name -> bit offset across the group attributes. */\n groups: { name: string; offset: number }[];\n}\n\n/** A page of a paged attribute stream (`compression::Page`). */\nexport interface PointPage {\n /** > 0: Blosc frame size; < 0: raw, `-compressedBytes` bytes. */\n compressedBytes: number;\n uncompressedBytes: number;\n /** The page body as stored (a view into the file), once read. */\n data: Uint8Array | null;\n}\n\n/** One leaf's attribute array (`TypedAttributeArray` metadata plus where its bytes are). */\nexport interface PointArrayData {\n flags: number;\n serialization: number;\n /** Points in the array (`mSize`). */\n size: number;\n /** Stride (constant-stride arrays) or total element count. */\n strideOrTotal: number;\n /** Uncompressed array bytes for paged arrays; stored bytes for non-paged ones. */\n bytes: number;\n isUniform: boolean;\n isPaged: boolean;\n /** Non-paged arrays: the stored bytes and whether they are a Blosc frame. */\n raw: Uint8Array | null;\n bloscCompressed: boolean;\n /** Paged arrays: the page and the array's byte offset inside it. */\n page: PointPage | null;\n pageOffset: number;\n}\n\n/** One point data leaf after the buffer passes. */\nexport interface PointLeafData {\n origin: [number, number, number];\n valueMask: Uint32Array;\n /** Per-voxel end offsets into the leaf's arrays. */\n offsets: Uint32Array;\n descriptor: PointDescriptor;\n arrays: PointArrayData[];\n}\n\ninterface PagedStream {\n page: PointPage | null;\n byteIndex: number;\n uncompressedBytes: number;\n}\n\nexport interface ReadPointBuffersOptions {\n fileVersion: number;\n /** Leaves in buffer order, with their topology origins. */\n leaves: readonly { origin: [number, number, number] }[];\n}\n\n/** `AttributeSet::Descriptor::read`. */\nfunction readDescriptor(reader: ByteReader): PointDescriptor {\n const count = reader.u64();\n if (count > BigInt(MAX_ATTRIBUTES)) throw new VdbFormatError(`point attribute descriptor claims ${count} attributes`);\n const n = Number(count);\n const types: { type: string; codec: string }[] = [];\n for (let i = 0; i < n; i++) types.push({ type: reader.string(), codec: reader.string() });\n const names = new Array<string | undefined>(n);\n const seen = new Set<string>();\n for (let i = 0; i < n; i++) {\n const name = reader.string();\n const index = reader.u64();\n if (index >= count) throw new VdbFormatError(`point attribute \"${name}\" has index ${index} of ${n}`);\n // Descriptor::read inserts into a std::map, so a repeated name would leave an attribute unnamed.\n if (seen.has(name)) throw new VdbFormatError(`point attribute name \"${name}\" appears twice`);\n seen.add(name);\n names[Number(index)] = name;\n }\n const attributes = types.map(({ type, codec }, index) => {\n const name = names[index];\n if (name === undefined) throw new VdbFormatError(`point attribute ${index} has no name`);\n return { name, type, codec, index };\n });\n const groupCount = reader.u64();\n if (groupCount > BigInt(MAX_GROUPS)) throw new VdbFormatError(`point attribute descriptor claims ${groupCount} groups`);\n const groups: { name: string; offset: number }[] = [];\n const groupNames = new Set<string>();\n for (let i = 0; i < Number(groupCount); i++) {\n const name = reader.string();\n const offset = reader.u64();\n // The group map is a std::map too: the first entry for a name wins.\n if (groupNames.has(name)) continue;\n groupNames.add(name);\n // Range-checked against the group arrays when decoded (`Descriptor::groupIndex`);\n // anything past 2^32 bits is out of range for any descriptor.\n groups.push({ name, offset: offset > 0xffffffffn ? Number.MAX_SAFE_INTEGER : Number(offset) });\n }\n readMetadataMap(reader); // descriptor metadata (default values, string tables): not needed here\n return { attributes, groups };\n}\n\n/** `TypedAttributeArray::readMetadata`. */\nfunction readArrayMetadata(reader: ByteReader): PointArrayData {\n const total = reader.u64();\n const flags = reader.u8();\n const serialization = reader.u8();\n const size = reader.u32();\n if (serialization >= 0x10) {\n throw new VDBUnsupportedError(`point attribute serialization flags 0x${serialization.toString(16)}`);\n }\n if (total < 6n || total > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new VdbFormatError(`point attribute array byte count ${total} is out of range`);\n }\n const bytes = Number(total) - 2 - 4; // minus the two flag bytes and the u32 size\n const strideOrTotal = serialization & WRITE_STRIDED ? reader.u32() : 1;\n if (serialization & WRITE_STRIDED && flags & FLAG_CONSTANT_STRIDE && strideOrTotal === 0) {\n throw new VdbFormatError(\"point attribute array has a constant stride of 0\");\n }\n return {\n flags,\n serialization,\n size,\n strideOrTotal,\n bytes,\n isUniform: (serialization & WRITE_UNIFORM) !== 0,\n isPaged: (serialization & WRITE_PAGED) !== 0,\n raw: null,\n bloscCompressed: false,\n page: null,\n pageOffset: 0,\n };\n}\n\n/** `PagedInputStream::createHandle`: assign the array its page, reading a page header when one starts. */\nfunction createPageHandle(reader: ByteReader, stream: PagedStream, array: PointArrayData): void {\n if (stream.byteIndex === stream.uncompressedBytes) {\n const compressedBytes = reader.i32();\n const uncompressedBytes = compressedBytes > 0 ? reader.i32() : -compressedBytes;\n if (compressedBytes === 0 || uncompressedBytes <= 0) {\n throw new VdbFormatError(`point attribute page header ${compressedBytes}/${uncompressedBytes} is empty`);\n }\n // The body follows later in the file, so it can be no larger than the file.\n const storedBytes = Math.abs(compressedBytes);\n if (storedBytes > reader.length) {\n throw new VdbFormatError(\n `point attribute page header claims ${storedBytes} stored bytes in a ${reader.length}-byte file`,\n );\n }\n if (compressedBytes > 0 && uncompressedBytes > Math.max(compressedBytes * MAX_BLOSC_RATIO, BLOSC_PAD_BYTES)) {\n throw new VdbFormatError(\n `point attribute page header claims ${uncompressedBytes} bytes from a ${compressedBytes}-byte Blosc frame`,\n );\n }\n stream.page = { compressedBytes, uncompressedBytes, data: null };\n stream.uncompressedBytes = uncompressedBytes;\n stream.byteIndex = 0;\n }\n if (stream.byteIndex + array.bytes > stream.uncompressedBytes) {\n throw new VdbFormatError(\n `point attribute array of ${array.bytes} bytes overruns its ${stream.uncompressedBytes}-byte page`,\n );\n }\n array.page = stream.page;\n array.pageOffset = stream.byteIndex;\n stream.byteIndex += array.bytes;\n}\n\n/** `PagedInputStream::read`: read the array's page body when it starts a new page. */\nfunction readPage(reader: ByteReader, stream: PagedStream, array: PointArrayData): void {\n const page = array.page;\n if (!page) throw new VdbFormatError(\"paged point attribute array has no page\");\n if (stream.byteIndex === stream.uncompressedBytes) {\n stream.uncompressedBytes = page.uncompressedBytes;\n page.data = reader.bytes_(Math.abs(page.compressedBytes));\n stream.byteIndex = 0;\n }\n stream.byteIndex += array.bytes;\n}\n\n/** `LeafNode::readBuffers` with the `PointDataIndex32` `readCompressedValues` specialization. */\nfunction readVoxelBuffer(reader: ByteReader, fileVersion: number): { valueMask: Uint32Array; offsets: Uint32Array } {\n const valueMask = reader.maskWords(LEAF_NUM_VALUES);\n if (fileVersion < 222) {\n reader.vec3i(); // origin\n const numBuffers = reader.u8();\n if (numBuffers !== 1) throw new VdbFormatError(`point leaf numBuffers ${numBuffers} !== 1`);\n }\n const destBytes = LEAF_NUM_VALUES * 4;\n const size = reader.u16();\n const bytes =\n size === VOXEL_BUFFER_UNCOMPRESSED\n ? reader.bytes_(destBytes)\n : decompressBlosc(reader.bytes_(size), { maxBytes: destBytes, expectedCbytes: size });\n if (bytes.length !== destBytes) {\n throw new VdbFormatError(`point leaf voxel buffer decoded to ${bytes.length} bytes, expected ${destBytes}`);\n }\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n const offsets = new Uint32Array(LEAF_NUM_VALUES);\n for (let i = 0; i < LEAF_NUM_VALUES; i++) offsets[i] = view.getUint32(i * 4, true);\n for (let i = 1; i < LEAF_NUM_VALUES; i++) {\n if (offsets[i]! < offsets[i - 1]!) throw new VdbFormatError(\"point leaf end offsets decrease\");\n }\n return { valueMask, offsets };\n}\n\n/**\n * Reads a point data grid's buffers (after its topology): `u16 numPasses`,\n * then every pass over every leaf. Returns one entry per leaf, in order.\n */\nexport function readPointDataBuffers(reader: ByteReader, opts: ReadPointBuffersOptions): PointLeafData[] {\n const numPasses = reader.u16();\n const n = opts.leaves.length;\n if (n === 0) return [];\n if (numPasses < 4) throw new VdbFormatError(`point data grid has ${numPasses} buffer passes (expected >= 4)`);\n const attributeCount = Math.floor((numPasses - 4) / 2);\n\n const leaves: PointLeafData[] = opts.leaves.map((l) => ({\n origin: l.origin,\n valueMask: EMPTY_MASK,\n offsets: EMPTY_OFFSETS,\n descriptor: { attributes: [], groups: [] },\n arrays: [],\n }));\n let sharedDescriptor: PointDescriptor | null = null;\n\n // Pass 0: voxel buffer sizes (only used by OpenVDB for delayed loading).\n for (let i = 0; i < n; i++) reader.u16();\n\n // Pass 1: descriptors and attribute array metadata.\n let maxArrays = 0;\n for (const leaf of leaves) {\n if (sharedDescriptor) {\n leaf.descriptor = sharedDescriptor;\n } else {\n const header = reader.u8();\n leaf.descriptor = readDescriptor(reader);\n if (header & HEADER_SHARED_DESCRIPTOR) sharedDescriptor = leaf.descriptor;\n if (header & HEADER_SKIP_BYTES) {\n const skip = reader.u64();\n if (skip > BigInt(reader.length - reader.pos)) {\n throw new VdbFormatError(`point leaf descriptor asks to skip ${skip} bytes past the end of the file`);\n }\n reader.skip(Number(skip));\n }\n if (header > 3) throw new VDBUnsupportedError(`point leaf descriptor header flags 0x${header.toString(16)}`);\n }\n leaf.arrays = leaf.descriptor.attributes.map(() => readArrayMetadata(reader));\n maxArrays = Math.max(maxArrays, leaf.arrays.length);\n }\n // `PointDataLeafNode::buffers()` is 2 * attributes + 4, and the grid writes the\n // largest leaf's count: arrays past `attributeCount` would never be read.\n if (maxArrays > attributeCount) {\n throw new VdbFormatError(\n `point leaf has ${maxArrays} attribute arrays, but the grid writes ${numPasses} passes (room for ${attributeCount})`,\n );\n }\n // The leaves that own array i, so passes cost no more than the arrays stored.\n const owners: PointLeafData[][] = Array.from({ length: maxArrays }, () => []);\n for (const leaf of leaves) for (let i = 0; i < leaf.arrays.length; i++) owners[i]!.push(leaf);\n const streams: PagedStream[] = Array.from({ length: maxArrays }, () => ({\n page: null,\n byteIndex: 0,\n uncompressedBytes: 0,\n }));\n\n // Passes 2 .. n+1: page headers.\n for (let i = 0; i < maxArrays; i++) {\n for (const leaf of owners[i]!) {\n const array = leaf.arrays[i]!;\n if (array.isPaged) createPageHandle(reader, streams[i]!, array);\n }\n checkStreamComplete(streams[i]!, i, \"page headers\");\n }\n\n // Pass n+2: voxel buffers. Every attribute array holds one entry per point of the leaf.\n let totalPoints = 0;\n for (const leaf of leaves) {\n const { valueMask, offsets } = readVoxelBuffer(reader, opts.fileVersion);\n leaf.valueMask = valueMask;\n leaf.offsets = offsets;\n const points = offsets[LEAF_NUM_VALUES - 1]!;\n const bad = leaf.arrays.find((a) => a.size !== points);\n if (bad) {\n throw new VdbFormatError(`point leaf has ${points} points but an attribute array of size ${bad.size}`);\n }\n totalPoints += points;\n }\n if (totalPoints * POSITION_BYTES > MAX_POINT_EXPANSION * reader.length) {\n throw new VdbFormatError(\n `point data grid claims ${totalPoints} points, more than a ${reader.length}-byte file can hold`,\n );\n }\n\n // Passes n+3 .. 2n+2: page bodies, or the buffers of non-paged arrays.\n for (let i = 0; i < maxArrays; i++) {\n for (const leaf of owners[i]!) {\n const array = leaf.arrays[i]!;\n if (array.isPaged) {\n readPage(reader, streams[i]!, array);\n } else {\n // TypedAttributeArray::readBuffers.\n array.bloscCompressed = array.isUniform ? false : reader.u8() === 1;\n array.raw = reader.bytes_(array.bytes);\n }\n }\n checkStreamComplete(streams[i]!, i, \"page bodies\");\n }\n // Passes past 2n+2 are cleanup only (no I/O), however many the header claims.\n return leaves;\n}\n\nconst EMPTY_MASK = new Uint32Array(LEAF_NUM_VALUES / 32);\nconst EMPTY_OFFSETS = new Uint32Array(LEAF_NUM_VALUES);\n\n/** A paged stream must end on a page boundary, or the next pass reads out of step. */\nfunction checkStreamComplete(stream: PagedStream, index: number, what: string): void {\n if (stream.byteIndex !== stream.uncompressedBytes) {\n throw new VdbFormatError(\n `point attribute ${index} ${what} end mid-page (${stream.byteIndex} of ${stream.uncompressedBytes} bytes)`,\n );\n }\n}\n\n// ---------------------------------------------------------------------------\n// Attribute decoding\n// ---------------------------------------------------------------------------\n\ntype ScalarKind = \"bool\" | \"i8\" | \"u8\" | \"i16\" | \"u16\" | \"i32\" | \"u32\" | \"i64\" | \"u64\" | \"f16\" | \"f32\" | \"f64\";\n\n/** OpenVDB `typeNameAsString` -> element shape. */\nconst VALUE_TYPES: Record<string, { components: number; kind: ScalarKind }> = {\n bool: { components: 1, kind: \"bool\" },\n half: { components: 1, kind: \"f16\" },\n float: { components: 1, kind: \"f32\" },\n double: { components: 1, kind: \"f64\" },\n int8: { components: 1, kind: \"i8\" },\n uint8: { components: 1, kind: \"u8\" },\n int16: { components: 1, kind: \"i16\" },\n uint16: { components: 1, kind: \"u16\" },\n int32: { components: 1, kind: \"i32\" },\n uint32: { components: 1, kind: \"u32\" },\n int64: { components: 1, kind: \"i64\" },\n uint64: { components: 1, kind: \"u64\" },\n vec2i: { components: 2, kind: \"i32\" },\n vec2s: { components: 2, kind: \"f32\" },\n vec2d: { components: 2, kind: \"f64\" },\n vec3u8: { components: 3, kind: \"u8\" },\n vec3u16: { components: 3, kind: \"u16\" },\n vec3i: { components: 3, kind: \"i32\" },\n vec3s: { components: 3, kind: \"f32\" },\n vec3d: { components: 3, kind: \"f64\" },\n vec4i: { components: 4, kind: \"i32\" },\n vec4s: { components: 4, kind: \"f32\" },\n vec4d: { components: 4, kind: \"f64\" },\n quats: { components: 4, kind: \"f32\" },\n quatd: { components: 4, kind: \"f64\" },\n mat3s: { components: 9, kind: \"f32\" },\n mat3d: { components: 9, kind: \"f64\" },\n mat4s: { components: 16, kind: \"f32\" },\n mat4d: { components: 16, kind: \"f64\" },\n};\n\nconst KIND_BYTES: Record<ScalarKind, number> = {\n bool: 1,\n i8: 1,\n u8: 1,\n i16: 2,\n u16: 2,\n i32: 4,\n u32: 4,\n i64: 8,\n u64: 8,\n f16: 2,\n f32: 4,\n f64: 8,\n};\n\ntype ArrayCtor = { new (n: number): VdbPointAttributeArray; readonly BYTES_PER_ELEMENT: number };\n\nconst OUTPUT_CTOR: Record<ScalarKind, ArrayCtor> = {\n bool: Uint8Array,\n i8: Int8Array,\n u8: Uint8Array,\n i16: Int16Array,\n u16: Uint16Array,\n i32: Int32Array,\n u32: Uint32Array,\n i64: BigInt64Array,\n u64: BigUint64Array,\n f16: Float32Array,\n f32: Float32Array,\n f64: Float64Array,\n};\n\nfunction scalarReader(kind: ScalarKind): (view: DataView, at: number) => number | bigint {\n switch (kind) {\n case \"bool\":\n case \"u8\":\n return (v, at) => v.getUint8(at);\n case \"i8\":\n return (v, at) => v.getInt8(at);\n case \"i16\":\n return (v, at) => v.getInt16(at, true);\n case \"u16\":\n return (v, at) => v.getUint16(at, true);\n case \"i32\":\n return (v, at) => v.getInt32(at, true);\n case \"u32\":\n return (v, at) => v.getUint32(at, true);\n case \"i64\":\n return (v, at) => v.getBigInt64(at, true);\n case \"u64\":\n return (v, at) => v.getBigUint64(at, true);\n case \"f16\":\n return (v, at) => halfToFloat(v.getUint16(at, true));\n case \"f32\":\n return (v, at) => v.getFloat32(at, true);\n case \"f64\":\n return (v, at) => v.getFloat64(at, true);\n }\n}\n\nconst fround = Math.fround;\n\nlet unitVecWeights: Float32Array | null = null;\n/**\n * `math::QuantizedUnitVec::sNormalizationWeights`, generated: `1 / |(x, y, 126 - x - y)|`\n * per slot. Exported for the test against OpenVDB's literal table.\n */\nexport function unitVecWeightTable(): Float32Array {\n if (unitVecWeights) return unitVecWeights;\n const table = new Float32Array(8192);\n for (let slot = 0; slot < 8192; slot++) {\n let x = (slot & 0x1f80) >> 7;\n let y = slot & 0x007f;\n if (x + y > 126) {\n x = 127 - x;\n y = 127 - y;\n }\n const z = 126 - x - y;\n table[slot] = 1 / Math.sqrt(x * x + y * y + z * z);\n }\n unitVecWeights = table;\n return table;\n}\n\n/** `math::QuantizedUnitVec::unpack`. */\nexport function unpackUnitVec(data: number, out: Float32Array | Float64Array, at: number): void {\n const w = unitVecWeightTable()[data & 0x1fff]!;\n let x = (data & 0x1f80) >> 7;\n let y = data & 0x007f;\n if (x + y > 126) {\n x = 127 - x;\n y = 127 - y;\n }\n let vx = fround(x * w);\n let vy = fround(y * w);\n let vz = fround((126 - x - y) * w);\n if (data & 0x8000) vx = -vx;\n if (data & 0x4000) vy = -vy;\n if (data & 0x2000) vz = -vz;\n out[at] = vx;\n out[at + 1] = vy;\n out[at + 2] = vz;\n}\n\n/** How one stored element decodes. */\ninterface AttributeCodec {\n components: number;\n /** Bytes of one stored element (all components). */\n storageBytes: number;\n output: ArrayCtor;\n /** Decodes the element at byte `at` into `out[outAt .. outAt + components)`. */\n decode(view: DataView, at: number, out: VdbPointAttributeArray, outAt: number): void;\n}\n\n/** The codec for an attribute's (type, codec) pair, or null when unsupported. */\nfunction attributeCodec(type: string, codec: string): AttributeCodec | null {\n const shape = VALUE_TYPES[type];\n if (!shape) return null;\n const { components, kind } = shape;\n\n const perComponent = (storage: ScalarKind, map: (x: number) => number, output: ArrayCtor): AttributeCodec => {\n const read = scalarReader(storage);\n const step = KIND_BYTES[storage];\n return {\n components,\n storageBytes: step * components,\n output,\n decode(view, at, out, outAt) {\n for (let c = 0; c < components; c++) (out as Float32Array)[outAt + c] = map(read(view, at + c * step) as number);\n },\n };\n };\n\n switch (codec) {\n case \"null\":\n case \"str\": {\n const read = scalarReader(kind);\n const step = KIND_BYTES[kind];\n return {\n components,\n storageBytes: step * components,\n output: OUTPUT_CTOR[kind],\n decode(view, at, out, outAt) {\n for (let c = 0; c < components; c++) (out as unknown as (number | bigint)[])[outAt + c] = read(view, at + c * step);\n },\n };\n }\n case \"trnc\":\n // TruncateTrait: float -> half, int -> short (and their Vec3s).\n if (kind === \"f32\") return perComponent(\"f16\", (x) => x, Float32Array);\n if (kind === \"i32\") return perComponent(\"i16\", (x) => x, Int32Array);\n return null;\n case \"fxpt8\":\n case \"fxpt16\":\n case \"ufxpt8\":\n case \"ufxpt16\": {\n if (kind !== \"f32\") return null;\n const oneByte = codec.endsWith(\"8\");\n const max = oneByte ? 255 : 65535;\n // FixedPointCodec: float(s) / float(max), then PositionRange shifts by -0.5.\n const shift = codec.startsWith(\"u\") ? 0 : 0.5;\n return perComponent(oneByte ? \"u8\" : \"u16\", (s) => fround(fround(s / max) - shift), Float32Array);\n }\n case \"uvec\":\n if (type !== \"vec3s\") return null;\n return {\n components: 3,\n storageBytes: 2,\n output: Float32Array,\n decode(view, at, out, outAt) {\n unpackUnitVec(view.getUint16(at, true), out as Float32Array, outAt);\n },\n };\n default:\n return null;\n }\n}\n\n/** Element stride of an array, or null for a variable-stride array. */\nfunction arrayStride(array: PointArrayData): number | null {\n if (!(array.serialization & WRITE_STRIDED)) return 1;\n return array.flags & FLAG_CONSTANT_STRIDE ? array.strideOrTotal : null;\n}\n\n/** OpenVDB pads Blosc input shorter than this with zeros (`BLOSC_PAD_BYTES`). */\nconst BLOSC_PAD_BYTES = 48;\n\n/**\n * Decompresses a Blosc frame that must hold `expectedBytes` bytes, accepting\n * the zero-padded 48-byte frame OpenVDB writes for shorter input (the rule in\n * `compression::bloscDecompress`).\n */\nfunction decompressExact(frame: Uint8Array, expectedBytes: number, what: string): Uint8Array {\n const bytes = decompressBlosc(frame, {\n maxBytes: Math.max(expectedBytes, BLOSC_PAD_BYTES),\n expectedCbytes: frame.length,\n });\n const padded = bytes.length === BLOSC_PAD_BYTES && expectedBytes <= BLOSC_PAD_BYTES;\n if (bytes.length !== expectedBytes && !padded) {\n throw new VdbFormatError(`${what} decoded to ${bytes.length} bytes, expected ${expectedBytes}`);\n }\n return bytes;\n}\n\n/**\n * The decoded-output budget of one {@link decodePoints} call. Output arrays\n * and decoded pages are charged before they are allocated; a short-lived\n * buffer is only checked against what is left.\n */\nclass DecodeBudget {\n private used = 0;\n\n constructor(private readonly limit: number) {}\n\n private fail(bytes: number, what: string): never {\n throw new VdbFormatError(\n `decoding ${what} needs ${bytes} bytes, past the point grid's ${this.limit}-byte output budget ` +\n `(${MAX_POINT_EXPANSION} x the file size; ${this.used} bytes already used)`,\n );\n }\n\n /** Reserves `bytes` for an allocation that lives until the decode ends. */\n charge(bytes: number, what: string): void {\n if (bytes > this.limit - this.used) this.fail(bytes, what);\n this.used += bytes;\n }\n\n /** Checks a short-lived allocation against the budget left. */\n check(bytes: number, what: string): void {\n if (bytes > this.limit - this.used) this.fail(bytes, what);\n }\n}\n\ninterface DecodeContext {\n budget: DecodeBudget;\n /** Decoded Blosc pages, shared by the arrays they hold; dropped when the decode ends. */\n pages: Map<PointPage, Uint8Array>;\n}\n\n/** The array's stored bytes (decompressed), checked to be exactly `expectedBytes`. */\nfunction arrayBytes(\n array: PointArrayData,\n expectedBytes: number,\n ctx: DecodeContext,\n): { bytes: Uint8Array; offset: number } {\n if (array.isPaged) {\n if (array.bytes !== expectedBytes) {\n throw new VdbFormatError(`paged point attribute holds ${array.bytes} bytes, expected ${expectedBytes}`);\n }\n const page = array.page;\n if (!page?.data) throw new VdbFormatError(\"paged point attribute has no page body\");\n let decoded = page.compressedBytes > 0 ? ctx.pages.get(page) : page.data;\n if (!decoded) {\n ctx.budget.charge(Math.max(page.uncompressedBytes, BLOSC_PAD_BYTES), \"a point attribute page\");\n decoded = decompressExact(page.data, page.uncompressedBytes, \"point attribute page\");\n ctx.pages.set(page, decoded);\n }\n if (array.pageOffset + expectedBytes > decoded.length) {\n throw new VdbFormatError(`paged point attribute runs past its ${decoded.length}-byte page`);\n }\n return { bytes: decoded, offset: array.pageOffset };\n }\n if (!array.raw) throw new VdbFormatError(\"point attribute has no buffer\");\n if (array.bloscCompressed) {\n ctx.budget.check(expectedBytes, \"a point attribute buffer\");\n return { bytes: decompressExact(array.raw, expectedBytes, \"point attribute\"), offset: 0 };\n }\n if (array.raw.length !== expectedBytes) {\n throw new VdbFormatError(`point attribute holds ${array.raw.length} bytes, expected ${expectedBytes}`);\n }\n return { bytes: array.raw, offset: 0 };\n}\n\n/** Sorted attribute indices of the group arrays (`Descriptor::groupIndex`). */\nfunction groupArrayIndices(descriptor: PointDescriptor): number[] {\n return descriptor.attributes\n .filter((a) => a.type === \"uint8\" && a.codec === \"grp\")\n .map((a) => a.index)\n .sort((a, b) => a - b);\n}\n\nexport interface DecodePointsOptions {\n /**\n * Upper bound on the bytes the decode may allocate (outputs plus decoded\n * pages). The parser passes {@link MAX_POINT_EXPANSION} times the file size.\n * Default: unlimited.\n */\n maxOutputBytes?: number;\n}\n\n/**\n * Decodes the points of a parsed point data grid: world-space positions from\n * `P` (through `matrix`, a row-major 4x4 index->world transform) and every\n * other attribute the codec table covers.\n */\nexport function decodePoints(\n leaves: readonly PointLeafData[],\n matrix: readonly number[],\n options: DecodePointsOptions = {},\n): VdbPointList {\n const ctx: DecodeContext = {\n budget: new DecodeBudget(options.maxOutputBytes ?? Number.POSITIVE_INFINITY),\n pages: new Map(),\n };\n let count = 0;\n for (const leaf of leaves) count += leaf.offsets[LEAF_NUM_VALUES - 1]!;\n\n ctx.budget.charge(count * POSITION_BYTES, \"point positions\");\n const positions = new Float32Array(count * 3);\n const attributes: Record<string, VdbPointAttributeArray> = {};\n const attributeShapes: Record<string, { components: number; stride: number }> = {};\n const groups: Record<string, Uint8Array> = {};\n const skipped: VdbPointAttributeInfo[] = [];\n const skippedNames = new Set<string>();\n const skip = (info: VdbPointAttributeInfo): void => {\n if (skippedNames.has(info.name)) return;\n skippedNames.add(info.name);\n skipped.push(info);\n };\n\n const m = matrix;\n let base = 0;\n for (const leaf of leaves) {\n const leafCount = leaf.offsets[LEAF_NUM_VALUES - 1]!;\n const { descriptor, arrays } = leaf;\n\n // Positions: voxel ijk + P offset, then index -> world.\n const pInfo = descriptor.attributes.find((a) => a.name === \"P\");\n // f32 offsets (every OpenVDB P codec but vec3d/null) decode in place into\n // `positions`, then each point is transformed over its own offset.\n let p: ArrayLike<number> | null = null;\n let pAt = 0;\n if (pInfo) {\n const codec = attributeCodec(pInfo.type, pInfo.codec);\n if (!codec || codec.components !== 3) {\n throw new VDBUnsupportedError(`point position attribute P is ${pInfo.type}/${pInfo.codec}`);\n }\n if (codec.output === Float32Array) {\n decodeArrayInto(arrays[pInfo.index]!, codec, leafCount, pInfo, ctx, positions, base * 3);\n p = positions;\n pAt = base * 3;\n } else {\n ctx.budget.check(leafCount * 3 * codec.output.BYTES_PER_ELEMENT, \"a leaf's point offsets\");\n const offsets = new codec.output(leafCount * 3);\n decodeArrayInto(arrays[pInfo.index]!, codec, leafCount, pInfo, ctx, offsets, 0);\n p = offsets as ArrayLike<number>;\n }\n }\n let voxel = 0;\n for (let i = 0; i < leafCount; i++) {\n while (leaf.offsets[voxel]! <= i) voxel++;\n const ix = leaf.origin[0] + (voxel >> (2 * LEAF_LOG2DIM));\n const iy = leaf.origin[1] + ((voxel >> LEAF_LOG2DIM) & 7);\n const iz = leaf.origin[2] + (voxel & 7);\n const x = ix + (p ? p[pAt + i * 3]! : 0);\n const y = iy + (p ? p[pAt + i * 3 + 1]! : 0);\n const z = iz + (p ? p[pAt + i * 3 + 2]! : 0);\n const out = (base + i) * 3;\n positions[out] = m[0]! * x + m[1]! * y + m[2]! * z + m[3]!;\n positions[out + 1] = m[4]! * x + m[5]! * y + m[6]! * z + m[7]!;\n positions[out + 2] = m[8]! * x + m[9]! * y + m[10]! * z + m[11]!;\n }\n\n // Other attributes, decoded straight into the grid-wide output.\n for (const info of descriptor.attributes) {\n if (info.name === \"P\" || (info.type === \"uint8\" && info.codec === \"grp\")) continue;\n const codec = attributeCodec(info.type, info.codec);\n const array = arrays[info.index]!;\n const stride = arrayStride(array);\n if (!codec || stride === null) {\n skip(info);\n continue;\n }\n let target = attributes[info.name];\n const shape = attributeShapes[info.name];\n if (!target) {\n const length = count * stride * codec.components;\n ctx.budget.charge(length * codec.output.BYTES_PER_ELEMENT, `point attribute \"${info.name}\"`);\n target = new codec.output(length);\n attributes[info.name] = target;\n attributeShapes[info.name] = { components: codec.components, stride };\n } else if (\n !shape ||\n shape.components !== codec.components ||\n shape.stride !== stride ||\n target.constructor !== codec.output\n ) {\n throw new VDBUnsupportedError(`point attribute \"${info.name}\" changes type between leaves`);\n }\n decodeArrayInto(array, codec, leafCount * stride, info, ctx, target, base * stride * codec.components);\n }\n\n // Groups: one bit per point in the uint8 group arrays (`Descriptor::groupIndex`).\n if (descriptor.groups.length > 0) {\n const groupArrays = groupArrayIndices(descriptor);\n const decodedGroups = new Map<number, Uint8Array>();\n const uint8 = attributeCodec(\"uint8\", \"null\")!;\n for (const { name, offset } of descriptor.groups) {\n if (offset >= groupArrays.length * 8) {\n throw new VdbFormatError(`point group \"${name}\" offset ${offset} is out of range`);\n }\n const arrayIndex = groupArrays[Math.floor(offset / 8)]!;\n let bits = decodedGroups.get(arrayIndex);\n if (!bits) {\n ctx.budget.check(leafCount, \"a leaf's group bits\");\n bits = new Uint8Array(leafCount);\n decodeArrayInto(arrays[arrayIndex]!, uint8, leafCount, descriptor.attributes[arrayIndex]!, ctx, bits, 0);\n decodedGroups.set(arrayIndex, bits);\n }\n let target = groups[name];\n if (!target) {\n ctx.budget.charge(count, `point group \"${name}\"`);\n target = groups[name] = new Uint8Array(count);\n }\n const bit = offset % 8;\n for (let i = 0; i < leafCount; i++) target[base + i] = (bits[i]! >> bit) & 1;\n }\n }\n\n base += leafCount;\n }\n\n return { count, positions, attributes, attributeShapes, groups, skipped };\n}\n\n/**\n * Decodes `elements` elements of one leaf array into `out` from `outAt` (a\n * uniform array repeats its single value). The array's size and stride are\n * checked before any byte is read.\n */\nfunction decodeArrayInto(\n array: PointArrayData,\n codec: AttributeCodec,\n elements: number,\n info: VdbPointAttributeInfo,\n ctx: DecodeContext,\n out: VdbPointAttributeArray,\n outAt: number,\n): void {\n const stride = arrayStride(array) ?? 1;\n if (array.size * stride !== elements) {\n throw new VdbFormatError(\n `point attribute \"${info.name}\" holds ${array.size} x ${stride} values, but the leaf has ${elements / stride} points`,\n );\n }\n const stored = array.isUniform ? 1 : elements;\n const storedBytes = stored * codec.storageBytes;\n const { bytes, offset } = arrayBytes(array, storedBytes, ctx);\n const view = new DataView(bytes.buffer, bytes.byteOffset + offset, storedBytes);\n for (let i = 0; i < elements; i++) {\n codec.decode(view, array.isUniform ? 0 : i * codec.storageBytes, out, outAt + i * codec.components);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"points.js","sourceRoot":"","sources":["../../../src/tools/vdb/points.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,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;IACtG,CAAC;AACH,CAAC","sourcesContent":["/**\n * points.ts — OpenVDB point data grids (`points::PointDataGrid`, grid type\n * `Tree_ptdataidx32_5_4_3`): the multi-pass leaf buffers and the attribute\n * arrays they hold.\n *\n * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345\n * (`src/openvdb/core/PointDataBuffers.js`, `src/openvdb/utils/points.js`): the\n * pass walk and the position decode follow the same OpenVDB sources his reader\n * cites. The format authority is OpenVDB itself (pinned a532de55):\n * `Grid::readBuffers` (multi-pass I/O), `points/PointDataGrid.h`\n * (`PointDataLeafNode::readBuffers`, the `PointDataIndex32`\n * `readCompressedValues` specialization), `points/AttributeSet.cc`\n * (`Descriptor::read`, `readMetadata`, `groupIndex`), `points/AttributeArray.h`\n * (`TypedAttributeArray::readMetadata` / `readBuffers` / `readPagedBuffers`,\n * the codecs) and `points/StreamCompression.cc` (`PagedInputStream`, `Page`).\n *\n * ## On-disk layout\n *\n * The tree topology is ordinary (leaves store only their value mask there).\n * The buffers start with a `u16 numPasses`; then the whole tree is walked\n * `numPasses` times, every leaf reading the part of its data that belongs to\n * the pass. With `n = (numPasses - 4) / 2` attributes:\n *\n * pass 0 u16 compressed size of the leaf's voxel buffer\n * pass 1 [u8 header, attribute descriptor, (header & 2) u64 skip]\n * unless a previous leaf shared its descriptor (header & 1);\n * then each attribute array's metadata\n * pass 2..n+1 attribute (pass - 2): page headers of paged arrays\n * pass n+2 the voxel buffer: value mask, then u16 size and a Blosc\n * frame (or 0xFFFF and 512 raw u32 end offsets)\n * pass n+3..2n+2 attribute (pass - n - 3): page bodies of paged arrays, or\n * the whole buffer of a non-paged array\n * pass 2n+3 cleanup (no I/O)\n *\n * Paged arrays (Blosc files) share pages: a page holds the arrays of many\n * consecutive leaves. A page header is an i32 compressed size and, when\n * positive, an i32 uncompressed size; a negative size means the page is\n * stored raw. Page bodies are read only when the next array starts a new\n * page, so the bytes stay views into the file until {@link decodePoints}.\n *\n * Each leaf voxel holds the *end* offset of its points in the leaf's arrays.\n * The position attribute `P` is a voxel-space offset from the voxel centre;\n * world position = `indexToWorld(ijk + P)`.\n *\n * ## Hostile input (K4.2 hardening)\n *\n * Every count, size and offset read from the file is bounded before it drives\n * an allocation or a loop, and every failure is a `VdbFormatError` or\n * `VDBUnsupportedError`:\n *\n * - The pass loops only visit the leaves that own an array for the pass, so\n * their work is bounded by the array metadata actually stored (a large\n * `numPasses` costs nothing). A leaf with more attributes than the passes\n * cover is rejected.\n * - Page headers: a page body must fit in the file, and a Blosc page may claim\n * at most {@link MAX_BLOSC_RATIO} times its compressed size. A page must be\n * filled exactly by the arrays assigned to it.\n * - Point counts: the grid's total point count, times the 12 bytes of its\n * positions, may not exceed {@link MAX_POINT_EXPANSION} times the file size.\n * Uniform arrays store one value for any number of points, so nothing else\n * bounds a count.\n * - Decoding: every output array and every decoded page is charged against a\n * budget of {@link MAX_POINT_EXPANSION} times the file size before it is\n * allocated. Strides and group offsets are range-checked (no int32\n * wrap-around).\n *\n * ## OpenVDB v14.0.0 security checks (K7.C)\n *\n * OpenVDB v14 throws `IoError` on four PointDataGrid inconsistencies\n * (CHANGES \"Security Fixes\"; `TypedAttributeArray::readMetadata` /\n * `readBuffers` / `readPagedBuffers`, `PagedInputStream::createHandle` /\n * `read`, `Page::readHeader`, `codecs/PointDataCodec.h`\n * `validateReadOffsets` / `validatePointDataAttributeCount`). Each maps here:\n *\n * 1. Attribute byte count smaller than the array: a byte count below its 6\n * header bytes, a size of 0, a constant stride of 0 or with `size * stride`\n * past u32, and a total size below `size` fail in `readArrayMetadata`;\n * the stored bytes must equal the array's exactly (stricter than v14's\n * \"at least\") when {@link decodePoints} reads them.\n * 2. Page size that does not match its data: page headers of 0, i32 minimum or\n * a non-positive uncompressed size, an array of 0 bytes or past its page\n * (`createPageHandle`), and a page whose arrays don't fill it exactly\n * (`checkStreamComplete`, stricter than v14's unread-page check); a\n * decoded page must be exactly its header's size.\n * 3. Voxel offsets beyond the arrays: end offsets must not decrease, and every\n * array's size must equal the leaf's last offset (v14: offsets at most the\n * last, the last at most each size; ours is exact).\n * 4. Pass count too small: a leaf with more arrays than `(numPasses - 4) / 2`\n * covers fails (and fewer than 4 passes with leaves).\n */\n\nimport type { ByteReader } from \"./byte-reader.js\";\nimport { decompressBlosc } from \"./blosc.js\";\nimport { VdbFormatError, VDBUnsupportedError } from \"./errors.js\";\nimport { halfToFloat } from \"./half-float.js\";\nimport { readMetadataMap } from \"./metadata.js\";\nimport type { VdbPointAttributeArray, VdbPointAttributeInfo, VdbPointList } from \"./types.js\";\n\nconst LEAF_NUM_VALUES = 512;\nconst LEAF_LOG2DIM = 3;\n\n/** `PointDataLeafNode::readBuffers` descriptor header bits. */\nconst HEADER_SHARED_DESCRIPTOR = 0x1;\nconst HEADER_SKIP_BYTES = 0x2;\n\n/** `AttributeArray::SerializationFlag`. */\nconst WRITE_STRIDED = 0x1;\nconst WRITE_UNIFORM = 0x2;\nconst WRITE_PAGED = 0x8;\n/** `AttributeArray::Flag::CONSTANTSTRIDE`. */\nconst FLAG_CONSTANT_STRIDE = 0x8;\n\n/** The `u16` voxel-buffer size that marks an uncompressed buffer. */\nconst VOXEL_BUFFER_UNCOMPRESSED = 0xffff;\n\n/**\n * The most a Blosc1 frame from OpenVDB can expand: deflate's worst case is\n * about 1032:1 and LZ4's 255:1 (each length byte adds at most 255 output\n * bytes). A Blosc page header claiming more is not a real page.\n */\nexport const MAX_BLOSC_RATIO = 1032;\n\n/**\n * Decoded point output allowed per byte of the source file. The real samples\n * need under 3 (waterfall_points: 156 MB in, 381 MB of positions and\n * attributes out); 256 matches LZ4's ceiling and leaves room for uniform\n * arrays, which store one value for a whole leaf.\n */\nexport const MAX_POINT_EXPANSION = 256;\n\n/** Bytes of decoded position per point (3 x f32). */\nconst POSITION_BYTES = 12;\n\n/** Descriptor limits: far above any real file, low enough to bound the loops. */\nconst MAX_ATTRIBUTES = 1 << 16;\nconst MAX_GROUPS = 1 << 16;\n\n/** One attribute set descriptor (`AttributeSet::Descriptor`). */\nexport interface PointDescriptor {\n /** In attribute-set order (`index` = position). */\n attributes: VdbPointAttributeInfo[];\n /** Group name -> bit offset across the group attributes. */\n groups: { name: string; offset: number }[];\n}\n\n/** A page of a paged attribute stream (`compression::Page`). */\nexport interface PointPage {\n /** > 0: Blosc frame size; < 0: raw, `-compressedBytes` bytes. */\n compressedBytes: number;\n uncompressedBytes: number;\n /** The page body as stored (a view into the file), once read. */\n data: Uint8Array | null;\n}\n\n/** One leaf's attribute array (`TypedAttributeArray` metadata plus where its bytes are). */\nexport interface PointArrayData {\n flags: number;\n serialization: number;\n /** Points in the array (`mSize`). */\n size: number;\n /** Stride (constant-stride arrays) or total element count. */\n strideOrTotal: number;\n /** Uncompressed array bytes for paged arrays; stored bytes for non-paged ones. */\n bytes: number;\n isUniform: boolean;\n isPaged: boolean;\n /** Non-paged arrays: the stored bytes and whether they are a Blosc frame. */\n raw: Uint8Array | null;\n bloscCompressed: boolean;\n /** Paged arrays: the page and the array's byte offset inside it. */\n page: PointPage | null;\n pageOffset: number;\n}\n\n/** One point data leaf after the buffer passes. */\nexport interface PointLeafData {\n origin: [number, number, number];\n valueMask: Uint32Array;\n /** Per-voxel end offsets into the leaf's arrays. */\n offsets: Uint32Array;\n descriptor: PointDescriptor;\n arrays: PointArrayData[];\n}\n\ninterface PagedStream {\n page: PointPage | null;\n byteIndex: number;\n uncompressedBytes: number;\n}\n\nexport interface ReadPointBuffersOptions {\n fileVersion: number;\n /** Leaves in buffer order, with their topology origins. */\n leaves: readonly { origin: [number, number, number] }[];\n}\n\n/** `AttributeSet::Descriptor::read`. */\nfunction readDescriptor(reader: ByteReader): PointDescriptor {\n const count = reader.u64();\n if (count > BigInt(MAX_ATTRIBUTES)) throw new VdbFormatError(`point attribute descriptor claims ${count} attributes`);\n const n = Number(count);\n const types: { type: string; codec: string }[] = [];\n for (let i = 0; i < n; i++) types.push({ type: reader.string(), codec: reader.string() });\n const names = new Array<string | undefined>(n);\n const seen = new Set<string>();\n for (let i = 0; i < n; i++) {\n const name = reader.string();\n const index = reader.u64();\n if (index >= count) throw new VdbFormatError(`point attribute \"${name}\" has index ${index} of ${n}`);\n // Descriptor::read inserts into a std::map, so a repeated name would leave an attribute unnamed.\n if (seen.has(name)) throw new VdbFormatError(`point attribute name \"${name}\" appears twice`);\n seen.add(name);\n names[Number(index)] = name;\n }\n const attributes = types.map(({ type, codec }, index) => {\n const name = names[index];\n if (name === undefined) throw new VdbFormatError(`point attribute ${index} has no name`);\n return { name, type, codec, index };\n });\n const groupCount = reader.u64();\n if (groupCount > BigInt(MAX_GROUPS)) throw new VdbFormatError(`point attribute descriptor claims ${groupCount} groups`);\n const groups: { name: string; offset: number }[] = [];\n const groupNames = new Set<string>();\n for (let i = 0; i < Number(groupCount); i++) {\n const name = reader.string();\n const offset = reader.u64();\n // The group map is a std::map too: the first entry for a name wins.\n if (groupNames.has(name)) continue;\n groupNames.add(name);\n // Range-checked against the group arrays when decoded (`Descriptor::groupIndex`);\n // anything past 2^32 bits is out of range for any descriptor.\n groups.push({ name, offset: offset > 0xffffffffn ? Number.MAX_SAFE_INTEGER : Number(offset) });\n }\n readMetadataMap(reader); // descriptor metadata (default values, string tables): not needed here\n return { attributes, groups };\n}\n\n/** `TypedAttributeArray::readMetadata`. */\nfunction readArrayMetadata(reader: ByteReader): PointArrayData {\n const total = reader.u64();\n const flags = reader.u8();\n const serialization = reader.u8();\n const size = reader.u32();\n if (serialization >= 0x10) {\n throw new VDBUnsupportedError(`point attribute serialization flags 0x${serialization.toString(16)}`);\n }\n if (total < 6n || total > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new VdbFormatError(`point attribute array byte count ${total} is out of range`);\n }\n const bytes = Number(total) - 2 - 4; // minus the two flag bytes and the u32 size\n const strideOrTotal = serialization & WRITE_STRIDED ? reader.u32() : 1;\n // OpenVDB v14 (`readMetadata`): size and stride come from the file, so a size of 0, a constant\n // stride of 0 or whose `size * stride` passes u32, or a total below the size is an IoError.\n if (size === 0) throw new VdbFormatError(\"point attribute array has a size of 0\");\n const constantStride = !(serialization & WRITE_STRIDED) || (flags & FLAG_CONSTANT_STRIDE) !== 0;\n if (constantStride) {\n if (strideOrTotal === 0) throw new VdbFormatError(\"point attribute array has a constant stride of 0\");\n if (size * strideOrTotal > 0xffffffff) {\n throw new VdbFormatError(`point attribute array of ${size} x stride ${strideOrTotal} values passes 2^32`);\n }\n } else if (strideOrTotal < size) {\n throw new VdbFormatError(`point attribute array has a total size of ${strideOrTotal}, below its ${size} points`);\n }\n return {\n flags,\n serialization,\n size,\n strideOrTotal,\n bytes,\n isUniform: (serialization & WRITE_UNIFORM) !== 0,\n isPaged: (serialization & WRITE_PAGED) !== 0,\n raw: null,\n bloscCompressed: false,\n page: null,\n pageOffset: 0,\n };\n}\n\n/** `PagedInputStream::createHandle`: assign the array its page, reading a page header when one starts. */\nfunction createPageHandle(reader: ByteReader, stream: PagedStream, array: PointArrayData): void {\n if (stream.byteIndex === stream.uncompressedBytes) {\n const compressedBytes = reader.i32();\n const uncompressedBytes = compressedBytes > 0 ? reader.i32() : -compressedBytes;\n // OpenVDB v14 `Page::readHeader`: 0 and the i32 minimum (whose negation overflows) are invalid.\n if (compressedBytes === 0 || compressedBytes === -0x80000000 || uncompressedBytes <= 0) {\n throw new VdbFormatError(`point attribute page header ${compressedBytes}/${uncompressedBytes} is empty`);\n }\n // The body follows later in the file, so it can be no larger than the file.\n const storedBytes = Math.abs(compressedBytes);\n if (storedBytes > reader.length) {\n throw new VdbFormatError(\n `point attribute page header claims ${storedBytes} stored bytes in a ${reader.length}-byte file`,\n );\n }\n if (compressedBytes > 0 && uncompressedBytes > Math.max(compressedBytes * MAX_BLOSC_RATIO, BLOSC_PAD_BYTES)) {\n throw new VdbFormatError(\n `point attribute page header claims ${uncompressedBytes} bytes from a ${compressedBytes}-byte Blosc frame`,\n );\n }\n stream.page = { compressedBytes, uncompressedBytes, data: null };\n stream.uncompressedBytes = uncompressedBytes;\n stream.byteIndex = 0;\n }\n // OpenVDB v14 `PagedInputStream::createHandle`: a handle of n <= 0 bytes, or past the page, is an IoError.\n if (array.bytes <= 0 || stream.byteIndex + array.bytes > stream.uncompressedBytes) {\n throw new VdbFormatError(\n `point attribute array of ${array.bytes} bytes ${array.bytes <= 0 ? \"is empty in\" : \"overruns\"} its ${stream.uncompressedBytes}-byte page`,\n );\n }\n array.page = stream.page;\n array.pageOffset = stream.byteIndex;\n stream.byteIndex += array.bytes;\n}\n\n/** `PagedInputStream::read`: read the array's page body when it starts a new page. */\nfunction readPage(reader: ByteReader, stream: PagedStream, array: PointArrayData): void {\n const page = array.page;\n if (!page) throw new VdbFormatError(\"paged point attribute array has no page\");\n if (stream.byteIndex === stream.uncompressedBytes) {\n stream.uncompressedBytes = page.uncompressedBytes;\n page.data = reader.bytes_(Math.abs(page.compressedBytes));\n stream.byteIndex = 0;\n }\n stream.byteIndex += array.bytes;\n}\n\n/** `LeafNode::readBuffers` with the `PointDataIndex32` `readCompressedValues` specialization. */\nfunction readVoxelBuffer(reader: ByteReader, fileVersion: number): { valueMask: Uint32Array; offsets: Uint32Array } {\n const valueMask = reader.maskWords(LEAF_NUM_VALUES);\n if (fileVersion < 222) {\n reader.vec3i(); // origin\n const numBuffers = reader.u8();\n if (numBuffers !== 1) throw new VdbFormatError(`point leaf numBuffers ${numBuffers} !== 1`);\n }\n const destBytes = LEAF_NUM_VALUES * 4;\n const size = reader.u16();\n const bytes =\n size === VOXEL_BUFFER_UNCOMPRESSED\n ? reader.bytes_(destBytes)\n : decompressBlosc(reader.bytes_(size), { maxBytes: destBytes, expectedCbytes: size });\n if (bytes.length !== destBytes) {\n throw new VdbFormatError(`point leaf voxel buffer decoded to ${bytes.length} bytes, expected ${destBytes}`);\n }\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n const offsets = new Uint32Array(LEAF_NUM_VALUES);\n for (let i = 0; i < LEAF_NUM_VALUES; i++) offsets[i] = view.getUint32(i * 4, true);\n for (let i = 1; i < LEAF_NUM_VALUES; i++) {\n if (offsets[i]! < offsets[i - 1]!) throw new VdbFormatError(\"point leaf end offsets decrease\");\n }\n return { valueMask, offsets };\n}\n\n/**\n * Reads a point data grid's buffers (after its topology): `u16 numPasses`,\n * then every pass over every leaf. Returns one entry per leaf, in order.\n */\nexport function readPointDataBuffers(reader: ByteReader, opts: ReadPointBuffersOptions): PointLeafData[] {\n const numPasses = reader.u16();\n const n = opts.leaves.length;\n if (n === 0) return [];\n if (numPasses < 4) throw new VdbFormatError(`point data grid has ${numPasses} buffer passes (expected >= 4)`);\n const attributeCount = Math.floor((numPasses - 4) / 2);\n\n const leaves: PointLeafData[] = opts.leaves.map((l) => ({\n origin: l.origin,\n valueMask: EMPTY_MASK,\n offsets: EMPTY_OFFSETS,\n descriptor: { attributes: [], groups: [] },\n arrays: [],\n }));\n let sharedDescriptor: PointDescriptor | null = null;\n\n // Pass 0: voxel buffer sizes (only used by OpenVDB for delayed loading).\n for (let i = 0; i < n; i++) reader.u16();\n\n // Pass 1: descriptors and attribute array metadata.\n let maxArrays = 0;\n for (const leaf of leaves) {\n if (sharedDescriptor) {\n leaf.descriptor = sharedDescriptor;\n } else {\n const header = reader.u8();\n leaf.descriptor = readDescriptor(reader);\n if (header & HEADER_SHARED_DESCRIPTOR) sharedDescriptor = leaf.descriptor;\n if (header & HEADER_SKIP_BYTES) {\n const skip = reader.u64();\n if (skip > BigInt(reader.length - reader.pos)) {\n throw new VdbFormatError(`point leaf descriptor asks to skip ${skip} bytes past the end of the file`);\n }\n reader.skip(Number(skip));\n }\n if (header > 3) throw new VDBUnsupportedError(`point leaf descriptor header flags 0x${header.toString(16)}`);\n }\n leaf.arrays = leaf.descriptor.attributes.map(() => readArrayMetadata(reader));\n maxArrays = Math.max(maxArrays, leaf.arrays.length);\n }\n // `PointDataLeafNode::buffers()` is 2 * attributes + 4, and the grid writes the\n // largest leaf's count: arrays past `attributeCount` would never be read.\n if (maxArrays > attributeCount) {\n throw new VdbFormatError(\n `point leaf has ${maxArrays} attribute arrays, but the grid writes ${numPasses} passes (room for ${attributeCount})`,\n );\n }\n // The leaves that own array i, so passes cost no more than the arrays stored.\n const owners: PointLeafData[][] = Array.from({ length: maxArrays }, () => []);\n for (const leaf of leaves) for (let i = 0; i < leaf.arrays.length; i++) owners[i]!.push(leaf);\n const streams: PagedStream[] = Array.from({ length: maxArrays }, () => ({\n page: null,\n byteIndex: 0,\n uncompressedBytes: 0,\n }));\n\n // Passes 2 .. n+1: page headers.\n for (let i = 0; i < maxArrays; i++) {\n for (const leaf of owners[i]!) {\n const array = leaf.arrays[i]!;\n if (array.isPaged) createPageHandle(reader, streams[i]!, array);\n }\n checkStreamComplete(streams[i]!, i, \"page headers\");\n }\n\n // Pass n+2: voxel buffers. Every attribute array holds one entry per point of the leaf.\n let totalPoints = 0;\n for (const leaf of leaves) {\n const { valueMask, offsets } = readVoxelBuffer(reader, opts.fileVersion);\n leaf.valueMask = valueMask;\n leaf.offsets = offsets;\n const points = offsets[LEAF_NUM_VALUES - 1]!;\n const bad = leaf.arrays.find((a) => a.size !== points);\n if (bad) {\n throw new VdbFormatError(`point leaf has ${points} points but an attribute array of size ${bad.size}`);\n }\n totalPoints += points;\n }\n if (totalPoints * POSITION_BYTES > MAX_POINT_EXPANSION * reader.length) {\n throw new VdbFormatError(\n `point data grid claims ${totalPoints} points, more than a ${reader.length}-byte file can hold`,\n );\n }\n\n // Passes n+3 .. 2n+2: page bodies, or the buffers of non-paged arrays.\n for (let i = 0; i < maxArrays; i++) {\n for (const leaf of owners[i]!) {\n const array = leaf.arrays[i]!;\n if (array.isPaged) {\n readPage(reader, streams[i]!, array);\n } else {\n // TypedAttributeArray::readBuffers.\n array.bloscCompressed = array.isUniform ? false : reader.u8() === 1;\n array.raw = reader.bytes_(array.bytes);\n }\n }\n checkStreamComplete(streams[i]!, i, \"page bodies\");\n }\n // Passes past 2n+2 are cleanup only (no I/O), however many the header claims.\n return leaves;\n}\n\nconst EMPTY_MASK = new Uint32Array(LEAF_NUM_VALUES / 32);\nconst EMPTY_OFFSETS = new Uint32Array(LEAF_NUM_VALUES);\n\n/** A paged stream must end on a page boundary, or the next pass reads out of step. */\nfunction checkStreamComplete(stream: PagedStream, index: number, what: string): void {\n if (stream.byteIndex !== stream.uncompressedBytes) {\n throw new VdbFormatError(\n `point attribute ${index} ${what} end mid-page (${stream.byteIndex} of ${stream.uncompressedBytes} bytes)`,\n );\n }\n}\n\n// ---------------------------------------------------------------------------\n// Attribute decoding\n// ---------------------------------------------------------------------------\n\ntype ScalarKind = \"bool\" | \"i8\" | \"u8\" | \"i16\" | \"u16\" | \"i32\" | \"u32\" | \"i64\" | \"u64\" | \"f16\" | \"f32\" | \"f64\";\n\n/** OpenVDB `typeNameAsString` -> element shape. */\nconst VALUE_TYPES: Record<string, { components: number; kind: ScalarKind }> = {\n bool: { components: 1, kind: \"bool\" },\n half: { components: 1, kind: \"f16\" },\n float: { components: 1, kind: \"f32\" },\n double: { components: 1, kind: \"f64\" },\n int8: { components: 1, kind: \"i8\" },\n uint8: { components: 1, kind: \"u8\" },\n int16: { components: 1, kind: \"i16\" },\n uint16: { components: 1, kind: \"u16\" },\n int32: { components: 1, kind: \"i32\" },\n uint32: { components: 1, kind: \"u32\" },\n int64: { components: 1, kind: \"i64\" },\n uint64: { components: 1, kind: \"u64\" },\n vec2i: { components: 2, kind: \"i32\" },\n vec2s: { components: 2, kind: \"f32\" },\n vec2d: { components: 2, kind: \"f64\" },\n vec3u8: { components: 3, kind: \"u8\" },\n vec3u16: { components: 3, kind: \"u16\" },\n vec3i: { components: 3, kind: \"i32\" },\n vec3s: { components: 3, kind: \"f32\" },\n vec3d: { components: 3, kind: \"f64\" },\n vec4i: { components: 4, kind: \"i32\" },\n vec4s: { components: 4, kind: \"f32\" },\n vec4d: { components: 4, kind: \"f64\" },\n quats: { components: 4, kind: \"f32\" },\n quatd: { components: 4, kind: \"f64\" },\n mat3s: { components: 9, kind: \"f32\" },\n mat3d: { components: 9, kind: \"f64\" },\n mat4s: { components: 16, kind: \"f32\" },\n mat4d: { components: 16, kind: \"f64\" },\n};\n\nconst KIND_BYTES: Record<ScalarKind, number> = {\n bool: 1,\n i8: 1,\n u8: 1,\n i16: 2,\n u16: 2,\n i32: 4,\n u32: 4,\n i64: 8,\n u64: 8,\n f16: 2,\n f32: 4,\n f64: 8,\n};\n\ntype ArrayCtor = { new (n: number): VdbPointAttributeArray; readonly BYTES_PER_ELEMENT: number };\n\nconst OUTPUT_CTOR: Record<ScalarKind, ArrayCtor> = {\n bool: Uint8Array,\n i8: Int8Array,\n u8: Uint8Array,\n i16: Int16Array,\n u16: Uint16Array,\n i32: Int32Array,\n u32: Uint32Array,\n i64: BigInt64Array,\n u64: BigUint64Array,\n f16: Float32Array,\n f32: Float32Array,\n f64: Float64Array,\n};\n\nfunction scalarReader(kind: ScalarKind): (view: DataView, at: number) => number | bigint {\n switch (kind) {\n case \"bool\":\n case \"u8\":\n return (v, at) => v.getUint8(at);\n case \"i8\":\n return (v, at) => v.getInt8(at);\n case \"i16\":\n return (v, at) => v.getInt16(at, true);\n case \"u16\":\n return (v, at) => v.getUint16(at, true);\n case \"i32\":\n return (v, at) => v.getInt32(at, true);\n case \"u32\":\n return (v, at) => v.getUint32(at, true);\n case \"i64\":\n return (v, at) => v.getBigInt64(at, true);\n case \"u64\":\n return (v, at) => v.getBigUint64(at, true);\n case \"f16\":\n return (v, at) => halfToFloat(v.getUint16(at, true));\n case \"f32\":\n return (v, at) => v.getFloat32(at, true);\n case \"f64\":\n return (v, at) => v.getFloat64(at, true);\n }\n}\n\nconst fround = Math.fround;\n\nlet unitVecWeights: Float32Array | null = null;\n/**\n * `math::QuantizedUnitVec::sNormalizationWeights`, generated: `1 / |(x, y, 126 - x - y)|`\n * per slot. Exported for the test against OpenVDB's literal table.\n */\nexport function unitVecWeightTable(): Float32Array {\n if (unitVecWeights) return unitVecWeights;\n const table = new Float32Array(8192);\n for (let slot = 0; slot < 8192; slot++) {\n let x = (slot & 0x1f80) >> 7;\n let y = slot & 0x007f;\n if (x + y > 126) {\n x = 127 - x;\n y = 127 - y;\n }\n const z = 126 - x - y;\n table[slot] = 1 / Math.sqrt(x * x + y * y + z * z);\n }\n unitVecWeights = table;\n return table;\n}\n\n/** `math::QuantizedUnitVec::unpack`. */\nexport function unpackUnitVec(data: number, out: Float32Array | Float64Array, at: number): void {\n const w = unitVecWeightTable()[data & 0x1fff]!;\n let x = (data & 0x1f80) >> 7;\n let y = data & 0x007f;\n if (x + y > 126) {\n x = 127 - x;\n y = 127 - y;\n }\n let vx = fround(x * w);\n let vy = fround(y * w);\n let vz = fround((126 - x - y) * w);\n if (data & 0x8000) vx = -vx;\n if (data & 0x4000) vy = -vy;\n if (data & 0x2000) vz = -vz;\n out[at] = vx;\n out[at + 1] = vy;\n out[at + 2] = vz;\n}\n\n/** How one stored element decodes. */\ninterface AttributeCodec {\n components: number;\n /** Bytes of one stored element (all components). */\n storageBytes: number;\n output: ArrayCtor;\n /** Decodes the element at byte `at` into `out[outAt .. outAt + components)`. */\n decode(view: DataView, at: number, out: VdbPointAttributeArray, outAt: number): void;\n}\n\n/** The codec for an attribute's (type, codec) pair, or null when unsupported. */\nfunction attributeCodec(type: string, codec: string): AttributeCodec | null {\n const shape = VALUE_TYPES[type];\n if (!shape) return null;\n const { components, kind } = shape;\n\n const perComponent = (storage: ScalarKind, map: (x: number) => number, output: ArrayCtor): AttributeCodec => {\n const read = scalarReader(storage);\n const step = KIND_BYTES[storage];\n return {\n components,\n storageBytes: step * components,\n output,\n decode(view, at, out, outAt) {\n for (let c = 0; c < components; c++) (out as Float32Array)[outAt + c] = map(read(view, at + c * step) as number);\n },\n };\n };\n\n switch (codec) {\n case \"null\":\n case \"str\": {\n const read = scalarReader(kind);\n const step = KIND_BYTES[kind];\n return {\n components,\n storageBytes: step * components,\n output: OUTPUT_CTOR[kind],\n decode(view, at, out, outAt) {\n for (let c = 0; c < components; c++) (out as unknown as (number | bigint)[])[outAt + c] = read(view, at + c * step);\n },\n };\n }\n case \"trnc\":\n // TruncateTrait: float -> half, int -> short (and their Vec3s).\n if (kind === \"f32\") return perComponent(\"f16\", (x) => x, Float32Array);\n if (kind === \"i32\") return perComponent(\"i16\", (x) => x, Int32Array);\n return null;\n case \"fxpt8\":\n case \"fxpt16\":\n case \"ufxpt8\":\n case \"ufxpt16\": {\n if (kind !== \"f32\") return null;\n const oneByte = codec.endsWith(\"8\");\n const max = oneByte ? 255 : 65535;\n // FixedPointCodec: float(s) / float(max), then PositionRange shifts by -0.5.\n const shift = codec.startsWith(\"u\") ? 0 : 0.5;\n return perComponent(oneByte ? \"u8\" : \"u16\", (s) => fround(fround(s / max) - shift), Float32Array);\n }\n case \"uvec\":\n if (type !== \"vec3s\") return null;\n return {\n components: 3,\n storageBytes: 2,\n output: Float32Array,\n decode(view, at, out, outAt) {\n unpackUnitVec(view.getUint16(at, true), out as Float32Array, outAt);\n },\n };\n default:\n return null;\n }\n}\n\n/** Element stride of an array, or null for a variable-stride array. */\nfunction arrayStride(array: PointArrayData): number | null {\n if (!(array.serialization & WRITE_STRIDED)) return 1;\n return array.flags & FLAG_CONSTANT_STRIDE ? array.strideOrTotal : null;\n}\n\n/** OpenVDB pads Blosc input shorter than this with zeros (`BLOSC_PAD_BYTES`). */\nconst BLOSC_PAD_BYTES = 48;\n\n/**\n * Decompresses a Blosc frame that must hold `expectedBytes` bytes, accepting\n * the zero-padded 48-byte frame OpenVDB writes for shorter input (the rule in\n * `compression::bloscDecompress`).\n */\nfunction decompressExact(frame: Uint8Array, expectedBytes: number, what: string): Uint8Array {\n const bytes = decompressBlosc(frame, {\n maxBytes: Math.max(expectedBytes, BLOSC_PAD_BYTES),\n expectedCbytes: frame.length,\n });\n const padded = bytes.length === BLOSC_PAD_BYTES && expectedBytes <= BLOSC_PAD_BYTES;\n if (bytes.length !== expectedBytes && !padded) {\n throw new VdbFormatError(`${what} decoded to ${bytes.length} bytes, expected ${expectedBytes}`);\n }\n return bytes;\n}\n\n/**\n * The decoded-output budget of one {@link decodePoints} call. Output arrays\n * and decoded pages are charged before they are allocated; a short-lived\n * buffer is only checked against what is left.\n */\nclass DecodeBudget {\n private used = 0;\n\n constructor(private readonly limit: number) {}\n\n private fail(bytes: number, what: string): never {\n throw new VdbFormatError(\n `decoding ${what} needs ${bytes} bytes, past the point grid's ${this.limit}-byte output budget ` +\n `(${MAX_POINT_EXPANSION} x the file size; ${this.used} bytes already used)`,\n );\n }\n\n /** Reserves `bytes` for an allocation that lives until the decode ends. */\n charge(bytes: number, what: string): void {\n if (bytes > this.limit - this.used) this.fail(bytes, what);\n this.used += bytes;\n }\n\n /** Checks a short-lived allocation against the budget left. */\n check(bytes: number, what: string): void {\n if (bytes > this.limit - this.used) this.fail(bytes, what);\n }\n}\n\ninterface DecodeContext {\n budget: DecodeBudget;\n /** Decoded Blosc pages, shared by the arrays they hold; dropped when the decode ends. */\n pages: Map<PointPage, Uint8Array>;\n}\n\n/** The array's stored bytes (decompressed), checked to be exactly `expectedBytes`. */\nfunction arrayBytes(\n array: PointArrayData,\n expectedBytes: number,\n ctx: DecodeContext,\n): { bytes: Uint8Array; offset: number } {\n if (array.isPaged) {\n if (array.bytes !== expectedBytes) {\n throw new VdbFormatError(`paged point attribute holds ${array.bytes} bytes, expected ${expectedBytes}`);\n }\n const page = array.page;\n if (!page?.data) throw new VdbFormatError(\"paged point attribute has no page body\");\n let decoded = page.compressedBytes > 0 ? ctx.pages.get(page) : page.data;\n if (!decoded) {\n ctx.budget.charge(Math.max(page.uncompressedBytes, BLOSC_PAD_BYTES), \"a point attribute page\");\n decoded = decompressExact(page.data, page.uncompressedBytes, \"point attribute page\");\n ctx.pages.set(page, decoded);\n }\n if (array.pageOffset + expectedBytes > decoded.length) {\n throw new VdbFormatError(`paged point attribute runs past its ${decoded.length}-byte page`);\n }\n return { bytes: decoded, offset: array.pageOffset };\n }\n if (!array.raw) throw new VdbFormatError(\"point attribute has no buffer\");\n if (array.bloscCompressed) {\n ctx.budget.check(expectedBytes, \"a point attribute buffer\");\n return { bytes: decompressExact(array.raw, expectedBytes, \"point attribute\"), offset: 0 };\n }\n if (array.raw.length !== expectedBytes) {\n throw new VdbFormatError(`point attribute holds ${array.raw.length} bytes, expected ${expectedBytes}`);\n }\n return { bytes: array.raw, offset: 0 };\n}\n\n/** Sorted attribute indices of the group arrays (`Descriptor::groupIndex`). */\nfunction groupArrayIndices(descriptor: PointDescriptor): number[] {\n return descriptor.attributes\n .filter((a) => a.type === \"uint8\" && a.codec === \"grp\")\n .map((a) => a.index)\n .sort((a, b) => a - b);\n}\n\nexport interface DecodePointsOptions {\n /**\n * Upper bound on the bytes the decode may allocate (outputs plus decoded\n * pages). The parser passes {@link MAX_POINT_EXPANSION} times the file size.\n * Default: unlimited.\n */\n maxOutputBytes?: number;\n /** Called after each leaf with the points decoded so far and the total (G14a). */\n onProgress?: (decoded: number, total: number) => void;\n}\n\n/**\n * Decodes the points of a parsed point data grid: world-space positions from\n * `P` (through `matrix`, a row-major 4x4 index->world transform) and every\n * other attribute the codec table covers.\n */\nexport function decodePoints(\n leaves: readonly PointLeafData[],\n matrix: readonly number[],\n options: DecodePointsOptions = {},\n): VdbPointList {\n const ctx: DecodeContext = {\n budget: new DecodeBudget(options.maxOutputBytes ?? Number.POSITIVE_INFINITY),\n pages: new Map(),\n };\n let count = 0;\n for (const leaf of leaves) count += leaf.offsets[LEAF_NUM_VALUES - 1]!;\n\n ctx.budget.charge(count * POSITION_BYTES, \"point positions\");\n const positions = new Float32Array(count * 3);\n const attributes: Record<string, VdbPointAttributeArray> = {};\n const attributeShapes: Record<string, { components: number; stride: number }> = {};\n const groups: Record<string, Uint8Array> = {};\n const skipped: VdbPointAttributeInfo[] = [];\n const skippedNames = new Set<string>();\n const skip = (info: VdbPointAttributeInfo): void => {\n if (skippedNames.has(info.name)) return;\n skippedNames.add(info.name);\n skipped.push(info);\n };\n\n const m = matrix;\n let base = 0;\n for (const leaf of leaves) {\n const leafCount = leaf.offsets[LEAF_NUM_VALUES - 1]!;\n const { descriptor, arrays } = leaf;\n\n // Positions: voxel ijk + P offset, then index -> world.\n const pInfo = descriptor.attributes.find((a) => a.name === \"P\");\n // f32 offsets (every OpenVDB P codec but vec3d/null) decode in place into\n // `positions`, then each point is transformed over its own offset.\n let p: ArrayLike<number> | null = null;\n let pAt = 0;\n if (pInfo) {\n const codec = attributeCodec(pInfo.type, pInfo.codec);\n if (!codec || codec.components !== 3) {\n throw new VDBUnsupportedError(`point position attribute P is ${pInfo.type}/${pInfo.codec}`);\n }\n if (codec.output === Float32Array) {\n decodeArrayInto(arrays[pInfo.index]!, codec, leafCount, pInfo, ctx, positions, base * 3);\n p = positions;\n pAt = base * 3;\n } else {\n ctx.budget.check(leafCount * 3 * codec.output.BYTES_PER_ELEMENT, \"a leaf's point offsets\");\n const offsets = new codec.output(leafCount * 3);\n decodeArrayInto(arrays[pInfo.index]!, codec, leafCount, pInfo, ctx, offsets, 0);\n p = offsets as ArrayLike<number>;\n }\n }\n let voxel = 0;\n for (let i = 0; i < leafCount; i++) {\n while (leaf.offsets[voxel]! <= i) voxel++;\n const ix = leaf.origin[0] + (voxel >> (2 * LEAF_LOG2DIM));\n const iy = leaf.origin[1] + ((voxel >> LEAF_LOG2DIM) & 7);\n const iz = leaf.origin[2] + (voxel & 7);\n const x = ix + (p ? p[pAt + i * 3]! : 0);\n const y = iy + (p ? p[pAt + i * 3 + 1]! : 0);\n const z = iz + (p ? p[pAt + i * 3 + 2]! : 0);\n const out = (base + i) * 3;\n positions[out] = m[0]! * x + m[1]! * y + m[2]! * z + m[3]!;\n positions[out + 1] = m[4]! * x + m[5]! * y + m[6]! * z + m[7]!;\n positions[out + 2] = m[8]! * x + m[9]! * y + m[10]! * z + m[11]!;\n }\n\n // Other attributes, decoded straight into the grid-wide output.\n for (const info of descriptor.attributes) {\n if (info.name === \"P\" || (info.type === \"uint8\" && info.codec === \"grp\")) continue;\n const codec = attributeCodec(info.type, info.codec);\n const array = arrays[info.index]!;\n const stride = arrayStride(array);\n if (!codec || stride === null) {\n skip(info);\n continue;\n }\n let target = attributes[info.name];\n const shape = attributeShapes[info.name];\n if (!target) {\n const length = count * stride * codec.components;\n ctx.budget.charge(length * codec.output.BYTES_PER_ELEMENT, `point attribute \"${info.name}\"`);\n target = new codec.output(length);\n attributes[info.name] = target;\n attributeShapes[info.name] = { components: codec.components, stride };\n } else if (\n !shape ||\n shape.components !== codec.components ||\n shape.stride !== stride ||\n target.constructor !== codec.output\n ) {\n throw new VDBUnsupportedError(`point attribute \"${info.name}\" changes type between leaves`);\n }\n decodeArrayInto(array, codec, leafCount * stride, info, ctx, target, base * stride * codec.components);\n }\n\n // Groups: one bit per point in the uint8 group arrays (`Descriptor::groupIndex`).\n if (descriptor.groups.length > 0) {\n const groupArrays = groupArrayIndices(descriptor);\n const decodedGroups = new Map<number, Uint8Array>();\n const uint8 = attributeCodec(\"uint8\", \"null\")!;\n for (const { name, offset } of descriptor.groups) {\n if (offset >= groupArrays.length * 8) {\n throw new VdbFormatError(`point group \"${name}\" offset ${offset} is out of range`);\n }\n const arrayIndex = groupArrays[Math.floor(offset / 8)]!;\n let bits = decodedGroups.get(arrayIndex);\n if (!bits) {\n ctx.budget.check(leafCount, \"a leaf's group bits\");\n bits = new Uint8Array(leafCount);\n decodeArrayInto(arrays[arrayIndex]!, uint8, leafCount, descriptor.attributes[arrayIndex]!, ctx, bits, 0);\n decodedGroups.set(arrayIndex, bits);\n }\n let target = groups[name];\n if (!target) {\n ctx.budget.charge(count, `point group \"${name}\"`);\n target = groups[name] = new Uint8Array(count);\n }\n const bit = offset % 8;\n for (let i = 0; i < leafCount; i++) target[base + i] = (bits[i]! >> bit) & 1;\n }\n }\n\n base += leafCount;\n options.onProgress?.(base, count);\n }\n if (leaves.length === 0) options.onProgress?.(0, 0);\n\n return { count, positions, attributes, attributeShapes, groups, skipped };\n}\n\n/**\n * Decodes `elements` elements of one leaf array into `out` from `outAt` (a\n * uniform array repeats its single value). The array's size and stride are\n * checked before any byte is read.\n */\nfunction decodeArrayInto(\n array: PointArrayData,\n codec: AttributeCodec,\n elements: number,\n info: VdbPointAttributeInfo,\n ctx: DecodeContext,\n out: VdbPointAttributeArray,\n outAt: number,\n): void {\n const stride = arrayStride(array) ?? 1;\n if (array.size * stride !== elements) {\n throw new VdbFormatError(\n `point attribute \"${info.name}\" holds ${array.size} x ${stride} values, but the leaf has ${elements / stride} points`,\n );\n }\n const stored = array.isUniform ? 1 : elements;\n const storedBytes = stored * codec.storageBytes;\n const { bytes, offset } = arrayBytes(array, storedBytes, ctx);\n const view = new DataView(bytes.buffer, bytes.byteOffset + offset, storedBytes);\n for (let i = 0; i < elements; i++) {\n codec.decode(view, array.isUniform ? 0 : i * codec.storageBytes, out, outAt + i * codec.components);\n }\n}\n"]}
|
|
@@ -1,16 +1,55 @@
|
|
|
1
1
|
/** Public `.vdb` parser types (docs/archive/v1/SPEC.md §4, docs/archive/v1/PLAN.md Phase 5). */
|
|
2
|
+
/**
|
|
3
|
+
* Cheap description of one grid in a `.vdb`, read from the grid's header (name, type string, metadata and
|
|
4
|
+
* transform) without decoding its tree. `VdbFile.descriptors` lists every grid in file order.
|
|
5
|
+
*/
|
|
6
|
+
export interface VdbGridDescriptor {
|
|
7
|
+
name: string;
|
|
8
|
+
/** The grid type without the `_HalfFloat` suffix, e.g. `Tree_float_5_4_3`. */
|
|
9
|
+
gridType: string;
|
|
10
|
+
/**
|
|
11
|
+
* The on-disk `<valueType>` parsed from `gridType` (`float`, `vec3s`, `half`, ...), or `""` when the type string is
|
|
12
|
+
* unrecognised. A `half` grid decodes as a float grid (`VdbGrid.valueType` is `float`; DIVERGES V70).
|
|
13
|
+
*/
|
|
14
|
+
valueType: string;
|
|
15
|
+
/** The grid's `class` metadata (`level set`, `fog volume`, `staggered`, `unknown`), or `""` when absent. */
|
|
16
|
+
gridClass: string;
|
|
17
|
+
/** `null` when the grid was not read far enough to know it (an unsupported type or instanced grid) or its transform is unsupported. */
|
|
18
|
+
transform: VdbTransformInfo | null;
|
|
19
|
+
/** From the grid's `file_bbox_min` / `file_bbox_max` metadata, or `null`. */
|
|
20
|
+
indexBBox: VdbBBox | null;
|
|
21
|
+
/** The grid's compression flags (`zip`: zlib, `blosc`: Blosc, `activeMask`: node masks are compressed). */
|
|
22
|
+
compression: {
|
|
23
|
+
zip: boolean;
|
|
24
|
+
activeMask: boolean;
|
|
25
|
+
blosc: boolean;
|
|
26
|
+
};
|
|
27
|
+
/** Why this parser cannot decode the grid (value type, tree layout, transform or instancing), or `null` when it can. */
|
|
28
|
+
unsupported: string | null;
|
|
29
|
+
}
|
|
30
|
+
/** A parsed `.vdb` file. */
|
|
2
31
|
export interface VdbFile {
|
|
32
|
+
/** The OpenVDB file format version. */
|
|
3
33
|
fileVersion: number;
|
|
34
|
+
/** The decoded grids (every supported grid, or the ones `ParseVdbOptions.select` accepted), in file order. */
|
|
4
35
|
grids: VdbGrid[];
|
|
36
|
+
/** Every grid in the file, decoded or not, in file order. */
|
|
37
|
+
descriptors: VdbGridDescriptor[];
|
|
5
38
|
}
|
|
39
|
+
/** A grid's index-to-world transform. */
|
|
6
40
|
export interface VdbTransformInfo {
|
|
41
|
+
/** OpenVDB map type name (e.g. a uniform or scale-translate map). */
|
|
7
42
|
type: string;
|
|
8
43
|
/** 4x4 row-major index->world affine matrix. */
|
|
9
44
|
matrix: number[];
|
|
45
|
+
/** Voxel size per axis, in world units. */
|
|
10
46
|
voxelSize: [number, number, number];
|
|
11
47
|
}
|
|
48
|
+
/** An inclusive index-space box. */
|
|
12
49
|
export interface VdbBBox {
|
|
50
|
+
/** Smallest index corner. */
|
|
13
51
|
min: [number, number, number];
|
|
52
|
+
/** Largest index corner. */
|
|
14
53
|
max: [number, number, number];
|
|
15
54
|
}
|
|
16
55
|
/** A 3-vector of numbers (also exported by the core as `VDBVec3`). */
|
|
@@ -22,7 +61,9 @@ export type VDBVec3 = [number, number, number];
|
|
|
22
61
|
* point data grid (`points::PointDataGrid`).
|
|
23
62
|
*/
|
|
24
63
|
export type VdbValueType = "float" | "vec3s" | "vec3d" | "vec3i" | "ptdataidx32";
|
|
64
|
+
/** One 8x8x8 leaf node of a parsed grid. */
|
|
25
65
|
export interface VdbLeaf {
|
|
66
|
+
/** Index-space min corner (a multiple of 8). */
|
|
26
67
|
origin: [number, number, number];
|
|
27
68
|
/**
|
|
28
69
|
* All 512 voxel values in leaf-offset order, `components` scalars each
|
|
@@ -41,7 +82,9 @@ export interface VdbLeaf {
|
|
|
41
82
|
export interface VdbTile<V = number> {
|
|
42
83
|
/** Index-space min corner, a multiple of `dim`. */
|
|
43
84
|
origin: [number, number, number];
|
|
85
|
+
/** Edge length of the tile in voxels. */
|
|
44
86
|
dim: 8 | 128 | 4096;
|
|
87
|
+
/** The value of every voxel in the tile. */
|
|
45
88
|
value: V;
|
|
46
89
|
}
|
|
47
90
|
interface VdbGridBase<V> {
|
|
@@ -73,18 +116,23 @@ interface VdbGridBase<V> {
|
|
|
73
116
|
}
|
|
74
117
|
/** A scalar `FloatGrid`. */
|
|
75
118
|
export interface VdbFloatGrid extends VdbGridBase<number> {
|
|
119
|
+
/** Discriminant: a float grid. */
|
|
76
120
|
valueType: "float";
|
|
121
|
+
/** Scalars per value. */
|
|
77
122
|
components: 1;
|
|
78
123
|
}
|
|
79
124
|
/** A `Vec3SGrid` / `Vec3DGrid` / `Vec3IGrid`. Values are `[x, y, z]`. */
|
|
80
125
|
export interface VdbVec3Grid extends VdbGridBase<VDBVec3> {
|
|
126
|
+
/** Discriminant: which vector type the file stored. */
|
|
81
127
|
valueType: "vec3s" | "vec3d" | "vec3i";
|
|
128
|
+
/** Scalars per value. */
|
|
82
129
|
components: 3;
|
|
83
130
|
}
|
|
84
131
|
/** Element type of a decoded point attribute. */
|
|
85
132
|
export type VdbPointAttributeArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Uint8Array | Uint16Array | Uint32Array | BigUint64Array;
|
|
86
133
|
/** One attribute in a point data grid's descriptor. */
|
|
87
134
|
export interface VdbPointAttributeInfo {
|
|
135
|
+
/** Attribute name (e.g. `P`, `Cd`, `v`). */
|
|
88
136
|
name: string;
|
|
89
137
|
/** OpenVDB value type name, e.g. `vec3s`, `float`, `int32`, `uint8`. */
|
|
90
138
|
type: string;
|
|
@@ -95,6 +143,7 @@ export interface VdbPointAttributeInfo {
|
|
|
95
143
|
}
|
|
96
144
|
/** Points decoded from a point data grid, in OpenVDB leaf and voxel order. */
|
|
97
145
|
export interface VdbPointList {
|
|
146
|
+
/** Number of points. */
|
|
98
147
|
count: number;
|
|
99
148
|
/** World-space positions, xyz per point: `vdbTransform(voxel ijk + P)`. */
|
|
100
149
|
positions: Float32Array;
|
|
@@ -123,7 +172,9 @@ export interface VdbPointList {
|
|
|
123
172
|
* attribute arrays.
|
|
124
173
|
*/
|
|
125
174
|
export interface VdbPointDataGrid extends VdbGridBase<number> {
|
|
175
|
+
/** Discriminant: a point data grid. */
|
|
126
176
|
valueType: "ptdataidx32";
|
|
177
|
+
/** Scalars per voxel value (the point end offset). */
|
|
127
178
|
components: 1;
|
|
128
179
|
/** Total points (the sum of every leaf's last end offset). */
|
|
129
180
|
pointCount: number;
|
|
@@ -131,8 +182,14 @@ export interface VdbPointDataGrid extends VdbGridBase<number> {
|
|
|
131
182
|
attributes: VdbPointAttributeInfo[];
|
|
132
183
|
/** Group names, from the descriptor. */
|
|
133
184
|
groupNames: string[];
|
|
134
|
-
/**
|
|
135
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Decodes every leaf's attribute arrays (cached after the first call).
|
|
187
|
+
* @param options `onProgress(decoded, total)` after each leaf (G14a); once with `(total, total)` when cached.
|
|
188
|
+
*/
|
|
189
|
+
points(options?: {
|
|
190
|
+
onProgress?: (decoded: number, total: number) => void;
|
|
191
|
+
}): VdbPointList;
|
|
136
192
|
}
|
|
193
|
+
/** Any grid {@link parseVdb} returns, discriminated by `valueType`. */
|
|
137
194
|
export type VdbGrid = VdbFloatGrid | VdbVec3Grid | VdbPointDataGrid;
|
|
138
195
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tools/vdb/types.ts"],"names":[],"mappings":"AAAA,gGAAgG","sourcesContent":["/** Public `.vdb` parser types (docs/archive/v1/SPEC.md §4, docs/archive/v1/PLAN.md Phase 5). */\n\nexport interface VdbFile {\n fileVersion: number;\n grids: VdbGrid[];\n}\n\nexport interface VdbTransformInfo {\n type: string;\n /** 4x4 row-major index->world affine matrix. */\n matrix: number[];\n voxelSize: [number, number, number];\n}\n\nexport interface VdbBBox {\n min: [number, number, number];\n max: [number, number, number];\n}\n\n/** A 3-vector of numbers (also exported by the core as `VDBVec3`). */\nexport type VDBVec3 = [number, number, number];\n\n/**\n * The OpenVDB value types this parser reads (the `<valueType>` of a\n * `Tree_<valueType>_5_4_3` grid type): `float`; the vectors `vec3s`, `vec3d`\n * (narrowed to f32) and `vec3i` (exact below 2^24); and `ptdataidx32`, the\n * point data grid (`points::PointDataGrid`).\n */\nexport type VdbValueType = \"float\" | \"vec3s\" | \"vec3d\" | \"vec3i\" | \"ptdataidx32\";\n\nexport interface VdbLeaf {\n origin: [number, number, number];\n /**\n * All 512 voxel values in leaf-offset order, `components` scalars each\n * (xyz interleaved for vector grids, so 1536 entries). For a point data\n * grid these are the voxels' point end offsets, see {@link VdbPointDataGrid}.\n */\n values: Float32Array;\n /** 512-bit active mask as 16 little-endian u32 words. */\n valueMask: Uint32Array;\n}\n\n/**\n * An active tile above leaf level: a `dim^3` block of voxels that are all\n * active and all equal to `value`. `dim` is 8 for a lower-node (16^3) tile,\n * 128 for an upper-node (32^3) tile and 4096 for a root tile.\n */\nexport interface VdbTile<V = number> {\n /** Index-space min corner, a multiple of `dim`. */\n origin: [number, number, number];\n dim: 8 | 128 | 4096;\n value: V;\n}\n\ninterface VdbGridBase<V> {\n name: string;\n /** The grid type without the `_HalfFloat` suffix, e.g. `Tree_vec3s_5_4_3`. */\n gridType: string;\n transform: VdbTransformInfo;\n metadata: Record<string, unknown>;\n indexBBox: VdbBBox | null;\n /** Active voxels in leaves plus `dim^3` for every active tile. */\n activeVoxelCount: bigint;\n background: V;\n /**\n * Value and active state at an index coordinate: a leaf voxel, else the value\n * of an enclosing active tile, else the background (inactive).\n */\n readValue(ijk: [number, number, number]): { value: V; active: boolean };\n iterLeaves(): Iterable<VdbLeaf>;\n /** Active tiles at root, upper and lower level. Empty for fully leaf-resolved grids. */\n iterTiles(): Iterable<VdbTile<V>>;\n /**\n * Inactive tiles with a stored value (K4.9), e.g. a level set's interior\n * `-background`. Internal-node inactive tiles equal to the background are omitted.\n */\n iterInactiveTiles(): Iterable<VdbTile<V>>;\n}\n\n/** A scalar `FloatGrid`. */\nexport interface VdbFloatGrid extends VdbGridBase<number> {\n valueType: \"float\";\n components: 1;\n}\n\n/** A `Vec3SGrid` / `Vec3DGrid` / `Vec3IGrid`. Values are `[x, y, z]`. */\nexport interface VdbVec3Grid extends VdbGridBase<VDBVec3> {\n valueType: \"vec3s\" | \"vec3d\" | \"vec3i\";\n components: 3;\n}\n\n/** Element type of a decoded point attribute. */\nexport type VdbPointAttributeArray =\n | Float32Array\n | Float64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Uint8Array\n | Uint16Array\n | Uint32Array\n | BigUint64Array;\n\n/** One attribute in a point data grid's descriptor. */\nexport interface VdbPointAttributeInfo {\n name: string;\n /** OpenVDB value type name, e.g. `vec3s`, `float`, `int32`, `uint8`. */\n type: string;\n /** OpenVDB codec name, e.g. `null`, `trnc`, `fxpt16`, `uvec`, `grp`, `str`. */\n codec: string;\n /** Position in the attribute set. */\n index: number;\n}\n\n/** Points decoded from a point data grid, in OpenVDB leaf and voxel order. */\nexport interface VdbPointList {\n count: number;\n /** World-space positions, xyz per point: `vdbTransform(voxel ijk + P)`. */\n positions: Float32Array;\n /**\n * Every other decodable attribute, `count * stride * components` values\n * (vectors interleaved). Real types decode to `Float32Array` (`double` to\n * `Float64Array`), whatever their codec; integer types keep their width.\n * Group attributes (codec `grp`) are not listed here; see `groups`.\n */\n attributes: Record<string, VdbPointAttributeArray>;\n /** Shape of each entry in `attributes`. */\n attributeShapes: Record<string, { components: number; stride: number }>;\n /** Group membership per point (0 or 1), by group name. */\n groups: Record<string, Uint8Array>;\n /** Attributes whose type/codec pair this decoder does not handle. */\n skipped: VdbPointAttributeInfo[];\n}\n\n/**\n * A `points::PointDataGrid` (`ptdataidx32`). The tree is parsed like any\n * other: each leaf voxel holds the *end* offset of its points within the\n * leaf's attribute arrays (so a voxel's points are `[prev end, end)`).\n * `readValue` returns that offset. {@link VdbPointDataGrid.points} decodes the\n * attribute arrays.\n */\nexport interface VdbPointDataGrid extends VdbGridBase<number> {\n valueType: \"ptdataidx32\";\n components: 1;\n /** Total points (the sum of every leaf's last end offset). */\n pointCount: number;\n /** The attribute descriptor of the first leaf (OpenVDB shares one per grid when it can). */\n attributes: VdbPointAttributeInfo[];\n /** Group names, from the descriptor. */\n groupNames: string[];\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tools/vdb/types.ts"],"names":[],"mappings":"AAAA,gGAAgG","sourcesContent":["/** Public `.vdb` parser types (docs/archive/v1/SPEC.md §4, docs/archive/v1/PLAN.md Phase 5). */\n\n/**\n * Cheap description of one grid in a `.vdb`, read from the grid's header (name, type string, metadata and\n * transform) without decoding its tree. `VdbFile.descriptors` lists every grid in file order.\n */\nexport interface VdbGridDescriptor {\n name: string;\n /** The grid type without the `_HalfFloat` suffix, e.g. `Tree_float_5_4_3`. */\n gridType: string;\n /**\n * The on-disk `<valueType>` parsed from `gridType` (`float`, `vec3s`, `half`, ...), or `\"\"` when the type string is\n * unrecognised. A `half` grid decodes as a float grid (`VdbGrid.valueType` is `float`; DIVERGES V70).\n */\n valueType: string;\n /** The grid's `class` metadata (`level set`, `fog volume`, `staggered`, `unknown`), or `\"\"` when absent. */\n gridClass: string;\n /** `null` when the grid was not read far enough to know it (an unsupported type or instanced grid) or its transform is unsupported. */\n transform: VdbTransformInfo | null;\n /** From the grid's `file_bbox_min` / `file_bbox_max` metadata, or `null`. */\n indexBBox: VdbBBox | null;\n /** The grid's compression flags (`zip`: zlib, `blosc`: Blosc, `activeMask`: node masks are compressed). */\n compression: { zip: boolean; activeMask: boolean; blosc: boolean };\n /** Why this parser cannot decode the grid (value type, tree layout, transform or instancing), or `null` when it can. */\n unsupported: string | null;\n}\n\n/** A parsed `.vdb` file. */\nexport interface VdbFile {\n /** The OpenVDB file format version. */\n fileVersion: number;\n /** The decoded grids (every supported grid, or the ones `ParseVdbOptions.select` accepted), in file order. */\n grids: VdbGrid[];\n /** Every grid in the file, decoded or not, in file order. */\n descriptors: VdbGridDescriptor[];\n}\n\n/** A grid's index-to-world transform. */\nexport interface VdbTransformInfo {\n /** OpenVDB map type name (e.g. a uniform or scale-translate map). */\n type: string;\n /** 4x4 row-major index->world affine matrix. */\n matrix: number[];\n /** Voxel size per axis, in world units. */\n voxelSize: [number, number, number];\n}\n\n/** An inclusive index-space box. */\nexport interface VdbBBox {\n /** Smallest index corner. */\n min: [number, number, number];\n /** Largest index corner. */\n max: [number, number, number];\n}\n\n/** A 3-vector of numbers (also exported by the core as `VDBVec3`). */\nexport type VDBVec3 = [number, number, number];\n\n/**\n * The OpenVDB value types this parser reads (the `<valueType>` of a\n * `Tree_<valueType>_5_4_3` grid type): `float`; the vectors `vec3s`, `vec3d`\n * (narrowed to f32) and `vec3i` (exact below 2^24); and `ptdataidx32`, the\n * point data grid (`points::PointDataGrid`).\n */\nexport type VdbValueType = \"float\" | \"vec3s\" | \"vec3d\" | \"vec3i\" | \"ptdataidx32\";\n\n/** One 8x8x8 leaf node of a parsed grid. */\nexport interface VdbLeaf {\n /** Index-space min corner (a multiple of 8). */\n origin: [number, number, number];\n /**\n * All 512 voxel values in leaf-offset order, `components` scalars each\n * (xyz interleaved for vector grids, so 1536 entries). For a point data\n * grid these are the voxels' point end offsets, see {@link VdbPointDataGrid}.\n */\n values: Float32Array;\n /** 512-bit active mask as 16 little-endian u32 words. */\n valueMask: Uint32Array;\n}\n\n/**\n * An active tile above leaf level: a `dim^3` block of voxels that are all\n * active and all equal to `value`. `dim` is 8 for a lower-node (16^3) tile,\n * 128 for an upper-node (32^3) tile and 4096 for a root tile.\n */\nexport interface VdbTile<V = number> {\n /** Index-space min corner, a multiple of `dim`. */\n origin: [number, number, number];\n /** Edge length of the tile in voxels. */\n dim: 8 | 128 | 4096;\n /** The value of every voxel in the tile. */\n value: V;\n}\n\ninterface VdbGridBase<V> {\n name: string;\n /** The grid type without the `_HalfFloat` suffix, e.g. `Tree_vec3s_5_4_3`. */\n gridType: string;\n transform: VdbTransformInfo;\n metadata: Record<string, unknown>;\n indexBBox: VdbBBox | null;\n /** Active voxels in leaves plus `dim^3` for every active tile. */\n activeVoxelCount: bigint;\n background: V;\n /**\n * Value and active state at an index coordinate: a leaf voxel, else the value\n * of an enclosing active tile, else the background (inactive).\n */\n readValue(ijk: [number, number, number]): { value: V; active: boolean };\n iterLeaves(): Iterable<VdbLeaf>;\n /** Active tiles at root, upper and lower level. Empty for fully leaf-resolved grids. */\n iterTiles(): Iterable<VdbTile<V>>;\n /**\n * Inactive tiles with a stored value (K4.9), e.g. a level set's interior\n * `-background`. Internal-node inactive tiles equal to the background are omitted.\n */\n iterInactiveTiles(): Iterable<VdbTile<V>>;\n}\n\n/** A scalar `FloatGrid`. */\nexport interface VdbFloatGrid extends VdbGridBase<number> {\n /** Discriminant: a float grid. */\n valueType: \"float\";\n /** Scalars per value. */\n components: 1;\n}\n\n/** A `Vec3SGrid` / `Vec3DGrid` / `Vec3IGrid`. Values are `[x, y, z]`. */\nexport interface VdbVec3Grid extends VdbGridBase<VDBVec3> {\n /** Discriminant: which vector type the file stored. */\n valueType: \"vec3s\" | \"vec3d\" | \"vec3i\";\n /** Scalars per value. */\n components: 3;\n}\n\n/** Element type of a decoded point attribute. */\nexport type VdbPointAttributeArray =\n | Float32Array\n | Float64Array\n | Int8Array\n | Int16Array\n | Int32Array\n | BigInt64Array\n | Uint8Array\n | Uint16Array\n | Uint32Array\n | BigUint64Array;\n\n/** One attribute in a point data grid's descriptor. */\nexport interface VdbPointAttributeInfo {\n /** Attribute name (e.g. `P`, `Cd`, `v`). */\n name: string;\n /** OpenVDB value type name, e.g. `vec3s`, `float`, `int32`, `uint8`. */\n type: string;\n /** OpenVDB codec name, e.g. `null`, `trnc`, `fxpt16`, `uvec`, `grp`, `str`. */\n codec: string;\n /** Position in the attribute set. */\n index: number;\n}\n\n/** Points decoded from a point data grid, in OpenVDB leaf and voxel order. */\nexport interface VdbPointList {\n /** Number of points. */\n count: number;\n /** World-space positions, xyz per point: `vdbTransform(voxel ijk + P)`. */\n positions: Float32Array;\n /**\n * Every other decodable attribute, `count * stride * components` values\n * (vectors interleaved). Real types decode to `Float32Array` (`double` to\n * `Float64Array`), whatever their codec; integer types keep their width.\n * Group attributes (codec `grp`) are not listed here; see `groups`.\n */\n attributes: Record<string, VdbPointAttributeArray>;\n /** Shape of each entry in `attributes`. */\n attributeShapes: Record<string, { components: number; stride: number }>;\n /** Group membership per point (0 or 1), by group name. */\n groups: Record<string, Uint8Array>;\n /** Attributes whose type/codec pair this decoder does not handle. */\n skipped: VdbPointAttributeInfo[];\n}\n\n/**\n * A `points::PointDataGrid` (`ptdataidx32`). The tree is parsed like any\n * other: each leaf voxel holds the *end* offset of its points within the\n * leaf's attribute arrays (so a voxel's points are `[prev end, end)`).\n * `readValue` returns that offset. {@link VdbPointDataGrid.points} decodes the\n * attribute arrays.\n */\nexport interface VdbPointDataGrid extends VdbGridBase<number> {\n /** Discriminant: a point data grid. */\n valueType: \"ptdataidx32\";\n /** Scalars per voxel value (the point end offset). */\n components: 1;\n /** Total points (the sum of every leaf's last end offset). */\n pointCount: number;\n /** The attribute descriptor of the first leaf (OpenVDB shares one per grid when it can). */\n attributes: VdbPointAttributeInfo[];\n /** Group names, from the descriptor. */\n groupNames: string[];\n /**\n * Decodes every leaf's attribute arrays (cached after the first call).\n * @param options `onProgress(decoded, total)` after each leaf (G14a); once with `(total, total)` when cached.\n */\n points(options?: { onProgress?: (decoded: number, total: number) => void }): VdbPointList;\n}\n\n/** Any grid {@link parseVdb} returns, discriminated by `valueType`. */\nexport type VdbGrid = VdbFloatGrid | VdbVec3Grid | VdbPointDataGrid;\n"]}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Portions derived from mjurczyk/openvdb (MIT), commit 75e7345:
|
|
6
6
|
* `src/wvdb/bake.js` (getWVDBBox, getFinestDimensions, forEachTexel,
|
|
7
|
-
* sampleScalarGrid, the level-set band limit
|
|
8
|
-
*
|
|
7
|
+
* sampleScalarGrid, the level-set band limit, getBakedGrids and
|
|
8
|
+
* encodePointGrid: point data grids become points grids in file order, G14b)
|
|
9
|
+
* and `src/wvdb/cli.js` (the `source` member). His sampling is reproduced, including its arithmetic order:
|
|
9
10
|
* - one shared world box for all grids: the union of the grids' active-voxel
|
|
10
11
|
* index boxes (voxel centres, so `max` is the last voxel, not one past it)
|
|
11
12
|
* mapped to world space, unless `bbox` is given;
|
|
@@ -35,15 +36,17 @@
|
|
|
35
36
|
* `resolution`³ for every box, e.g. the committed `smoke.wvdb` and
|
|
36
37
|
* `bunny_cloud.wvdb`; this reproduces them).
|
|
37
38
|
*/
|
|
38
|
-
import type { VdbFile, VdbGrid } from "../vdb/types.js";
|
|
39
|
+
import type { VdbFile, VdbGrid, VdbPointDataGrid } from "../vdb/types.js";
|
|
39
40
|
import type { WvdbBits, WvdbBox, WvdbVec3 } from "./format.js";
|
|
40
41
|
import { type WvdbIndexAccess } from "./level-set.js";
|
|
41
|
-
import { type WriteWvdbOptions, type WriteWvdbResult } from "./write.js";
|
|
42
|
+
import { type WriteWvdbOptions, type WriteWvdbResult, type WvdbPointsGridInput } from "./write.js";
|
|
42
43
|
/** A grid the baker can point-sample in world space. */
|
|
43
44
|
export interface WvdbSampleSource {
|
|
45
|
+
/** The grid name (matched by `gridNames`). */
|
|
44
46
|
name: string;
|
|
45
47
|
/** `.wvdb` class string: "fog volume", "level set", "staggered" or "unknown". */
|
|
46
48
|
class: string;
|
|
49
|
+
/** The value outside the grid's active voxels. */
|
|
47
50
|
background: number;
|
|
48
51
|
/** World box of the active voxels (voxel centres), or null when the grid has none. */
|
|
49
52
|
bbox: WvdbBox | null;
|
|
@@ -57,6 +60,7 @@ export interface WvdbSampleSource {
|
|
|
57
60
|
/** The sparse grid behind the source, for `sampling: 'box'`. The built-in sources have it. */
|
|
58
61
|
grid?: Uint32Array | VdbGrid;
|
|
59
62
|
}
|
|
63
|
+
/** Options of {@link bakeWvdb}: the writer's options plus the box, resolution and sampling choices. */
|
|
60
64
|
export interface BakeWvdbOptions extends Omit<WriteWvdbOptions, "resolution" | "bakeBBox"> {
|
|
61
65
|
/** Voxels on the longest box side of the finest LOD. Default 128. */
|
|
62
66
|
resolution?: number;
|
|
@@ -83,7 +87,9 @@ export interface BakeWvdbOptions extends Omit<WriteWvdbOptions, "resolution" | "
|
|
|
83
87
|
*/
|
|
84
88
|
levelSetSampler?: WvdbLevelSetSampler;
|
|
85
89
|
}
|
|
90
|
+
/** Resampling filter of the baker: point sampling (`nearest`) or the area-weighted mean of each texel cell (`box`). */
|
|
86
91
|
export type WvdbSampling = "nearest" | "box";
|
|
92
|
+
/** How the baker samples level sets: the spec rule (`spec`) or his CLI sampler (`surface-mean`). */
|
|
87
93
|
export type WvdbLevelSetSampler = "spec" | "surface-mean";
|
|
88
94
|
/** §3.2.1, his `getFinestDimensions`. */
|
|
89
95
|
export declare function wvdbFinestDimensions(bbox: WvdbBox | null, resolution: number): WvdbVec3;
|
|
@@ -95,22 +101,45 @@ export declare function sampleWvdbDense(source: WvdbSampleSource, bbox: WvdbBox
|
|
|
95
101
|
* filtered active state.
|
|
96
102
|
*/
|
|
97
103
|
export declare function sampleWvdbDenseBox(source: WvdbSampleSource, bbox: WvdbBox | null, dimensions: WvdbVec3, bits?: WvdbBits): Float32Array;
|
|
98
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Bakes sources to a `.wvdb` with his CLI defaults (128, 3 LODs, 8 bits, sparse, 1024 bricks per page).
|
|
106
|
+
* @param sources The grids to bake, point-sampled in world space.
|
|
107
|
+
* @param options Resolution, box, grid names, sampling and the writer's options ({@link BakeWvdbOptions}).
|
|
108
|
+
*/
|
|
99
109
|
export declare function bakeWvdb(sources: readonly WvdbSampleSource[], options?: BakeWvdbOptions): WriteWvdbResult;
|
|
100
110
|
/** A parsed `.vdb` grid (axis-aligned map) as a sample source. */
|
|
101
111
|
export declare function wvdbSourceFromVdbGrid(grid: VdbGrid): WvdbSampleSource;
|
|
102
112
|
/** A NanoVDB FLOAT/Fp8/FpN grid image as a sample source, read through the CPU oracle (`readValue`). */
|
|
103
113
|
export declare function wvdbSourceFromNvdb(gridWords: Uint32Array): WvdbSampleSource;
|
|
114
|
+
/** Options of {@link vdbToWvdb}: the baker's options plus the source file name. */
|
|
104
115
|
export interface VdbToWvdbOptions extends BakeWvdbOptions {
|
|
105
116
|
/** `source.file` (the name without directories). Default "". */
|
|
106
117
|
fileName?: string;
|
|
107
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* A parsed point data grid as a `.wvdb` points grid (G14b, his `encodePointGrid`): world positions and `Cd` in
|
|
121
|
+
* the grid's point order, every n-th point above `maxPoints` (`vdbPointRenderData`'s stride rule, his
|
|
122
|
+
* `createPointData`), the source count and his spacing. `writeWvdb` then splits it into LODs (§3.5).
|
|
123
|
+
*
|
|
124
|
+
* @param grid A point data grid from `parseVdb`.
|
|
125
|
+
* @param maxPoints Keep every `ceil(total / maxPoints)`-th point above this many (default 4,000,000).
|
|
126
|
+
*/
|
|
127
|
+
export declare function wvdbPointsFromVdbGrid(grid: VdbPointDataGrid, maxPoints?: number): WvdbPointsGridInput;
|
|
108
128
|
/**
|
|
109
129
|
* `.vdb` → `.wvdb`, like his `wvdb` CLI with the same options. Given the file
|
|
110
|
-
* bytes, `source.sha256` is their digest.
|
|
111
|
-
*
|
|
112
|
-
*
|
|
130
|
+
* bytes, `source.sha256` is their digest. Float grids are baked as volumes and
|
|
131
|
+
* point data grids as points grids (G14b: positions and `Cd`, every n-th point
|
|
132
|
+
* above `maxPoints`, the §3.5 LOD order), in file order; the volume box ignores
|
|
133
|
+
* the points (his `getWVDBBox`). Vector grids are skipped (his CLI bakes them as
|
|
134
|
+
* 3 channels; not ported).
|
|
135
|
+
* @param input The `.vdb` file's bytes, or an already parsed {@link VdbFile}.
|
|
136
|
+
* @param options Baker options and the `source.file` name.
|
|
137
|
+
* @throws VDBToolsError `VDB_UNSUPPORTED_GRID_TYPE` when the file has no float or point data grids.
|
|
113
138
|
*/
|
|
114
139
|
export declare function vdbToWvdb(input: ArrayBuffer | Uint8Array | VdbFile, options?: VdbToWvdbOptions): WriteWvdbResult;
|
|
115
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* NanoVDB grid image(s) → `.wvdb`, sampled through the CPU oracle.
|
|
142
|
+
* @param images One grid image or several.
|
|
143
|
+
* @param options Baker options.
|
|
144
|
+
*/
|
|
116
145
|
export declare function nvdbToWvdb(images: Uint32Array | readonly Uint32Array[], options?: BakeWvdbOptions): WriteWvdbResult;
|