@pmndrs/vdb 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +727 -0
- package/LICENSE +21 -0
- package/README.md +496 -2
- package/THIRD_PARTY_NOTICES.md +315 -0
- package/dist/core/compute/atlas.d.ts +102 -0
- package/dist/core/compute/atlas.js +103 -0
- package/dist/core/compute/atlas.js.map +1 -0
- package/dist/core/compute/index.d.ts +13 -0
- package/dist/core/compute/index.js +9 -0
- package/dist/core/compute/index.js.map +1 -0
- 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 +120 -0
- package/dist/core/compute/pyramid.js +468 -0
- package/dist/core/compute/pyramid.js.map +1 -0
- package/dist/core/compute/shared.d.ts +116 -0
- package/dist/core/compute/shared.js +211 -0
- package/dist/core/compute/shared.js.map +1 -0
- package/dist/core/compute/stats.d.ts +78 -0
- package/dist/core/compute/stats.js +193 -0
- package/dist/core/compute/stats.js.map +1 -0
- package/dist/core/compute/value-transform.d.ts +30 -0
- package/dist/core/compute/value-transform.js +64 -0
- package/dist/core/compute/value-transform.js.map +1 -0
- package/dist/core/errors.d.ts +21 -0
- package/dist/core/errors.js +17 -0
- package/dist/core/errors.js.map +1 -0
- 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 +52 -0
- package/dist/core/index.js +46 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal.d.ts +31 -0
- package/dist/core/internal.js +32 -0
- package/dist/core/internal.js.map +1 -0
- package/dist/core/pool/affine.d.ts +34 -0
- package/dist/core/pool/affine.js +100 -0
- package/dist/core/pool/affine.js.map +1 -0
- package/dist/core/pool/allocator.d.ts +32 -0
- package/dist/core/pool/allocator.js +81 -0
- package/dist/core/pool/allocator.js.map +1 -0
- package/dist/core/pool/image-header.d.ts +93 -0
- package/dist/core/pool/image-header.js +194 -0
- package/dist/core/pool/image-header.js.map +1 -0
- package/dist/core/pool/layout.d.ts +198 -0
- package/dist/core/pool/layout.js +316 -0
- package/dist/core/pool/layout.js.map +1 -0
- package/dist/core/pool/limits.d.ts +41 -0
- package/dist/core/pool/limits.js +80 -0
- package/dist/core/pool/limits.js.map +1 -0
- package/dist/core/pool/pool.d.ts +384 -0
- package/dist/core/pool/pool.js +1184 -0
- package/dist/core/pool/pool.js.map +1 -0
- 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/core/sequence.d.ts +347 -0
- package/dist/core/sequence.js +548 -0
- 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 +50 -0
- package/dist/core/source/dense.js +384 -0
- package/dist/core/source/dense.js.map +1 -0
- 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 +120 -0
- package/dist/core/source/types.js +9 -0
- package/dist/core/source/types.js.map +1 -0
- 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 +37 -0
- package/dist/core/types.js +32 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/wgsl/api.d.ts +65 -0
- package/dist/core/wgsl/api.js +546 -0
- package/dist/core/wgsl/api.js.map +1 -0
- package/dist/core/wgsl/generate.d.ts +90 -0
- package/dist/core/wgsl/generate.js +678 -0
- package/dist/core/wgsl/generate.js.map +1 -0
- 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 +58 -0
- package/dist/core/wgsl/level-set.js +200 -0
- package/dist/core/wgsl/level-set.js.map +1 -0
- 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 +14 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +333 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -0
- package/dist/core/wgsl/reserved.d.ts +9 -0
- package/dist/core/wgsl/reserved.js +26 -0
- package/dist/core/wgsl/reserved.js.map +1 -0
- package/dist/core/wgsl/types.d.ts +198 -0
- package/dist/core/wgsl/types.js +2 -0
- package/dist/core/wgsl/types.js.map +1 -0
- package/dist/three/coarse-first.d.ts +207 -0
- package/dist/three/coarse-first.js +205 -0
- package/dist/three/coarse-first.js.map +1 -0
- package/dist/three/compute.d.ts +73 -0
- package/dist/three/compute.js +66 -0
- package/dist/three/compute.js.map +1 -0
- package/dist/three/device.d.ts +66 -0
- package/dist/three/device.js +62 -0
- package/dist/three/device.js.map +1 -0
- 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 +117 -0
- package/dist/three/frame/emission-light.js +276 -0
- package/dist/three/frame/emission-light.js.map +1 -0
- package/dist/three/frame/index.d.ts +19 -0
- package/dist/three/frame/index.js +15 -0
- package/dist/three/frame/index.js.map +1 -0
- package/dist/three/frame/medium.d.ts +33 -0
- package/dist/three/frame/medium.js +29 -0
- package/dist/three/frame/medium.js.map +1 -0
- package/dist/three/frame/renderer.d.ts +97 -0
- package/dist/three/frame/renderer.js +480 -0
- package/dist/three/frame/renderer.js.map +1 -0
- package/dist/three/frame/spectrum.d.ts +4 -0
- package/dist/three/frame/spectrum.js +15 -0
- package/dist/three/frame/spectrum.js.map +1 -0
- package/dist/three/frame/three-internals.d.ts +60 -0
- package/dist/three/frame/three-internals.js +152 -0
- package/dist/three/frame/three-internals.js.map +1 -0
- package/dist/three/frame/volume-shadows.d.ts +139 -0
- package/dist/three/frame/volume-shadows.js +403 -0
- package/dist/three/frame/volume-shadows.js.map +1 -0
- package/dist/three/frame/volume.d.ts +230 -0
- package/dist/three/frame/volume.js +268 -0
- package/dist/three/frame/volume.js.map +1 -0
- package/dist/three/grid-node.d.ts +229 -0
- package/dist/three/grid-node.js +545 -0
- package/dist/three/grid-node.js.map +1 -0
- package/dist/three/index.d.ts +52 -0
- package/dist/three/index.js +58 -0
- package/dist/three/index.js.map +1 -0
- package/dist/three/internal.d.ts +20 -0
- package/dist/three/internal.js +18 -0
- package/dist/three/internal.js.map +1 -0
- package/dist/three/level-set-material.d.ts +185 -0
- package/dist/three/level-set-material.js +241 -0
- package/dist/three/level-set-material.js.map +1 -0
- 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 +324 -0
- package/dist/three/material.js +502 -0
- package/dist/three/material.js.map +1 -0
- package/dist/three/points.d.ts +140 -0
- package/dist/three/points.js +261 -0
- package/dist/three/points.js.map +1 -0
- package/dist/three/sparse-source.d.ts +165 -0
- package/dist/three/sparse-source.js +405 -0
- package/dist/three/sparse-source.js.map +1 -0
- package/dist/three/volume-source.d.ts +22 -0
- package/dist/three/volume-source.js +110 -0
- package/dist/three/volume-source.js.map +1 -0
- 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 +116 -0
- package/dist/tools/cpu/compute.js +239 -0
- package/dist/tools/cpu/compute.js.map +1 -0
- 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 +111 -0
- package/dist/tools/cpu/level-set.js +313 -0
- package/dist/tools/cpu/level-set.js.map +1 -0
- 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 +297 -0
- package/dist/tools/cpu/march.js +726 -0
- package/dist/tools/cpu/march.js.map +1 -0
- 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/probe-coords.d.ts +70 -0
- package/dist/tools/cpu/probe-coords.js +116 -0
- package/dist/tools/cpu/probe-coords.js.map +1 -0
- package/dist/tools/cpu/read-value.d.ts +44 -0
- package/dist/tools/cpu/read-value.js +351 -0
- package/dist/tools/cpu/read-value.js.map +1 -0
- package/dist/tools/cpu/sample-trilinear.d.ts +43 -0
- package/dist/tools/cpu/sample-trilinear.js +168 -0
- package/dist/tools/cpu/sample-trilinear.js.map +1 -0
- package/dist/tools/cpu/stride-tables.d.ts +56 -0
- package/dist/tools/cpu/stride-tables.generated.d.ts +1059 -0
- package/dist/tools/cpu/stride-tables.generated.js +1267 -0
- package/dist/tools/cpu/stride-tables.generated.js.map +1 -0
- package/dist/tools/cpu/stride-tables.js +78 -0
- package/dist/tools/cpu/stride-tables.js.map +1 -0
- 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 +66 -0
- package/dist/tools/errors.js +67 -0
- package/dist/tools/errors.js.map +1 -0
- 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 +57 -0
- package/dist/tools/frame/blackbody.js +151 -0
- package/dist/tools/frame/blackbody.js.map +1 -0
- 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 +137 -0
- package/dist/tools/frame/emission.js +290 -0
- package/dist/tools/frame/emission.js.map +1 -0
- 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 +106 -0
- package/dist/tools/frame/environment.js +272 -0
- package/dist/tools/frame/environment.js.map +1 -0
- 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 +392 -0
- package/dist/tools/frame/grid.js +802 -0
- package/dist/tools/frame/grid.js.map +1 -0
- package/dist/tools/frame/index.d.ts +150 -0
- package/dist/tools/frame/index.js +389 -0
- package/dist/tools/frame/index.js.map +1 -0
- package/dist/tools/frame/medium.d.ts +77 -0
- package/dist/tools/frame/medium.js +101 -0
- package/dist/tools/frame/medium.js.map +1 -0
- package/dist/tools/frame/mie-table.d.ts +6 -0
- package/dist/tools/frame/mie-table.js +16 -0
- package/dist/tools/frame/mie-table.js.map +1 -0
- package/dist/tools/frame/mie.d.ts +63 -0
- package/dist/tools/frame/mie.js +194 -0
- package/dist/tools/frame/mie.js.map +1 -0
- 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 +10 -0
- package/dist/tools/frame/neural-weights.js +244 -0
- package/dist/tools/frame/neural-weights.js.map +1 -0
- package/dist/tools/frame/neural.d.ts +80 -0
- package/dist/tools/frame/neural.js +150 -0
- package/dist/tools/frame/neural.js.map +1 -0
- 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 +55 -0
- package/dist/tools/frame/pyramid-layout.js +100 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -0
- package/dist/tools/frame/shadows.d.ts +190 -0
- package/dist/tools/frame/shadows.js +468 -0
- package/dist/tools/frame/shadows.js.map +1 -0
- package/dist/tools/frame/sparse.d.ts +147 -0
- package/dist/tools/frame/sparse.js +432 -0
- package/dist/tools/frame/sparse.js.map +1 -0
- 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 +222 -0
- package/dist/tools/frame/spectral.js +572 -0
- package/dist/tools/frame/spectral.js.map +1 -0
- 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 +157 -0
- package/dist/tools/index.js +132 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/internal.d.ts +87 -0
- package/dist/tools/internal.js +85 -0
- package/dist/tools/internal.js.map +1 -0
- package/dist/tools/nanovdb/build-from-vdb.d.ts +59 -0
- package/dist/tools/nanovdb/build-from-vdb.js +100 -0
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
- package/dist/tools/nanovdb/bytes.d.ts +233 -0
- package/dist/tools/nanovdb/bytes.js +388 -0
- package/dist/tools/nanovdb/bytes.js.map +1 -0
- package/dist/tools/nanovdb/coarse-first.d.ts +78 -0
- package/dist/tools/nanovdb/coarse-first.js +92 -0
- package/dist/tools/nanovdb/coarse-first.js.map +1 -0
- 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 +34 -0
- package/dist/tools/nanovdb/index.js +25 -0
- package/dist/tools/nanovdb/index.js.map +1 -0
- package/dist/tools/nanovdb/inspect.d.ts +33 -0
- package/dist/tools/nanovdb/inspect.js +70 -0
- package/dist/tools/nanovdb/inspect.js.map +1 -0
- package/dist/tools/nanovdb/leaf-codec.d.ts +119 -0
- package/dist/tools/nanovdb/leaf-codec.js +356 -0
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
- package/dist/tools/nanovdb/quantize.d.ts +72 -0
- package/dist/tools/nanovdb/quantize.js +329 -0
- package/dist/tools/nanovdb/quantize.js.map +1 -0
- package/dist/tools/nanovdb/resample.d.ts +177 -0
- package/dist/tools/nanovdb/resample.js +692 -0
- package/dist/tools/nanovdb/resample.js.map +1 -0
- package/dist/tools/nanovdb/serialize.d.ts +176 -0
- package/dist/tools/nanovdb/serialize.js +439 -0
- package/dist/tools/nanovdb/serialize.js.map +1 -0
- package/dist/tools/nanovdb/stats.d.ts +87 -0
- package/dist/tools/nanovdb/stats.js +225 -0
- package/dist/tools/nanovdb/stats.js.map +1 -0
- package/dist/tools/nanovdb/transform.d.ts +30 -0
- package/dist/tools/nanovdb/transform.js +94 -0
- package/dist/tools/nanovdb/transform.js.map +1 -0
- package/dist/tools/nanovdb/tree.d.ts +186 -0
- package/dist/tools/nanovdb/tree.js +530 -0
- package/dist/tools/nanovdb/tree.js.map +1 -0
- package/dist/tools/nanovdb/write-nvdb.d.ts +74 -0
- package/dist/tools/nanovdb/write-nvdb.js +290 -0
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
- package/dist/tools/nvdb-file.d.ts +265 -0
- package/dist/tools/nvdb-file.js +763 -0
- package/dist/tools/nvdb-file.js.map +1 -0
- package/dist/tools/nvdb-stream.d.ts +154 -0
- package/dist/tools/nvdb-stream.js +409 -0
- package/dist/tools/nvdb-stream.js.map +1 -0
- 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/bit-utils.d.ts +20 -0
- package/dist/tools/vdb/bit-utils.js +42 -0
- package/dist/tools/vdb/bit-utils.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 +86 -0
- package/dist/tools/vdb/blosc.js +287 -0
- package/dist/tools/vdb/blosc.js.map +1 -0
- 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 +50 -0
- package/dist/tools/vdb/byte-reader.js +161 -0
- package/dist/tools/vdb/byte-reader.js.map +1 -0
- package/dist/tools/vdb/compression.d.ts +81 -0
- package/dist/tools/vdb/compression.js +260 -0
- package/dist/tools/vdb/compression.js.map +1 -0
- package/dist/tools/vdb/errors.d.ts +10 -0
- package/dist/tools/vdb/errors.js +11 -0
- package/dist/tools/vdb/errors.js.map +1 -0
- package/dist/tools/vdb/grid.d.ts +37 -0
- package/dist/tools/vdb/grid.js +153 -0
- package/dist/tools/vdb/grid.js.map +1 -0
- package/dist/tools/vdb/half-float.d.ts +9 -0
- package/dist/tools/vdb/half-float.js +24 -0
- package/dist/tools/vdb/half-float.js.map +1 -0
- package/dist/tools/vdb/index.d.ts +4 -0
- package/dist/tools/vdb/index.js +3 -0
- package/dist/tools/vdb/index.js.map +1 -0
- package/dist/tools/vdb/inflate.d.ts +24 -0
- package/dist/tools/vdb/inflate.js +334 -0
- package/dist/tools/vdb/inflate.js.map +1 -0
- 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.d.ts +17 -0
- package/dist/tools/vdb/metadata.js +72 -0
- package/dist/tools/vdb/metadata.js.map +1 -0
- package/dist/tools/vdb/parse.d.ts +47 -0
- package/dist/tools/vdb/parse.js +241 -0
- package/dist/tools/vdb/parse.js.map +1 -0
- package/dist/tools/vdb/point-render-data.d.ts +79 -0
- package/dist/tools/vdb/point-render-data.js +137 -0
- package/dist/tools/vdb/point-render-data.js.map +1 -0
- package/dist/tools/vdb/points.d.ts +186 -0
- package/dist/tools/vdb/points.js +835 -0
- package/dist/tools/vdb/points.js.map +1 -0
- package/dist/tools/vdb/transform.d.ts +23 -0
- package/dist/tools/vdb/transform.js +54 -0
- package/dist/tools/vdb/transform.js.map +1 -0
- package/dist/tools/vdb/tree.d.ts +111 -0
- package/dist/tools/vdb/tree.js +228 -0
- package/dist/tools/vdb/tree.js.map +1 -0
- package/dist/tools/vdb/types.d.ts +195 -0
- package/dist/tools/vdb/types.js +3 -0
- package/dist/tools/vdb/types.js.map +1 -0
- package/dist/tools/wvdb/bake.d.ts +145 -0
- package/dist/tools/wvdb/bake.js +361 -0
- package/dist/tools/wvdb/bake.js.map +1 -0
- package/dist/tools/wvdb/dense.d.ts +191 -0
- package/dist/tools/wvdb/dense.js +368 -0
- package/dist/tools/wvdb/dense.js.map +1 -0
- package/dist/tools/wvdb/format.d.ts +220 -0
- package/dist/tools/wvdb/format.js +306 -0
- package/dist/tools/wvdb/format.js.map +1 -0
- package/dist/tools/wvdb/index.d.ts +14 -0
- package/dist/tools/wvdb/index.js +15 -0
- package/dist/tools/wvdb/index.js.map +1 -0
- package/dist/tools/wvdb/level-set.d.ts +56 -0
- package/dist/tools/wvdb/level-set.js +153 -0
- package/dist/tools/wvdb/level-set.js.map +1 -0
- package/dist/tools/wvdb/nanovdb.d.ts +59 -0
- package/dist/tools/wvdb/nanovdb.js +64 -0
- package/dist/tools/wvdb/nanovdb.js.map +1 -0
- 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 +336 -0
- package/dist/tools/wvdb/read.js +766 -0
- package/dist/tools/wvdb/read.js.map +1 -0
- package/dist/tools/wvdb/sha256.d.ts +7 -0
- package/dist/tools/wvdb/sha256.js +76 -0
- package/dist/tools/wvdb/sha256.js.map +1 -0
- package/dist/tools/wvdb/write.d.ts +149 -0
- package/dist/tools/wvdb/write.js +403 -0
- package/dist/tools/wvdb/write.js.map +1 -0
- package/package.json +83 -4
- package/vendor/LICENSE +201 -0
- package/vendor/NOTICE +19 -0
- package/vendor/VENDOR.md +100 -0
- package/vendor/pnanovdb.wgsl +1577 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-nets.js","sourceRoot":"","sources":["../../../src/tools/cpu/surface-nets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,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,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAS,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAC/H,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC1C,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC;YAAE,MAAM,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;IACpE,CAAC;AACH,CAAC","sourcesContent":["/**\n * `vdbLevelSetMesh` (K3.7c): a triangle mesh of a level set's zero surface, for collision, export and\n * picking. The display path is the GPU trace (`VDBLevelSetMaterial`); this is the CPU mesh that replaces\n * mjurczyk/openvdb's `LevelSetMesh`.\n *\n * Method: \"naive surface nets\" after S. F. Gibson, \"Constrained elastic surface nets: generating smooth\n * surfaces from binary segmented data\" (MICCAI 1998). One vertex per cell (the 2x2x2 voxel corners) whose\n * corner values change sign across `isoValue`, placed at the mean of that cell's edge zero crossings\n * (linear interpolation on each sign-changing edge); one quad per sign-changing lattice edge joins the four\n * cells around the edge. There is no 256-case table (DIVERGES V58: Paul Bourke's marching-cubes tables have no\n * stated licence), and no code was ported: the method is the paper's, the code is ours.\n *\n * Sparse walk: the image's leaves are visited and every cell with a corner in a leaf is tested; a level set's\n * tiles and background are +-background, so a cell with no corner in a leaf never straddles `isoValue`\n * (`|isoValue|` must stay inside the band). Corners that fall in a neighbouring leaf, a tile or the background\n * are read from that block, so every grid type the CPU readers decode works (Float, Half, Fp4, Fp8, Fp16, FpN).\n * The mesh is a pure function of the image and the options.\n *\n * K3.7c-a options (each off by default; the default mesh is byte-identical to K3.7c's):\n * - `tiles`: also visit the shell of every tile on the far side of `isoValue` from the background, so grids whose\n * tiles hold other values (fog volumes, unclamped distance grids) mesh where tiles meet tiles or the background.\n * - `relax`: Gibson's constrained relaxation (each vertex to the mean of its linked neighbours, clamped to its own\n * cell), Jacobi iterations with the neighbours summed in a fixed direction order.\n * - `project`: Newton steps on the cell's trilinear field put each vertex on the iso surface (within its cell).\n * - `vdbLevelSetMeshChunks`: the same mesh in index-space chunks (bounded memory); a chunk owns the quads of the\n * lattice edges that start in its box, and a seam vertex is computed from the same eight corner values in both\n * chunks, so seams match bit for bit and the chunks joined are the one-shot mesh.\n */\nimport { VDBToolsError } from \"../errors.js\";\nimport { GRID_OFF_MAP, MAP_OFF_INVMATD, MAP_OFF_MATD, MAP_OFF_VECD } from \"../nanovdb/bytes.js\";\nimport { forEachTreeRegion, indexBBox, leafVoxels, vdbReadValueF32Cpu, type Vec3 } from \"./march.js\";\n\n/** Options of {@link vdbLevelSetMesh}. */\nexport interface VDBLevelSetMeshOptions {\n /**\n * The level to mesh, in the grid's value units. Default 0. Without `tiles` it must lie inside the narrow band\n * (`|isoValue| < background`) of a grid with a positive background.\n */\n isoValue?: number;\n /** `'world'` (default): positions through the grid's affine. `'index'`: index (voxel) coordinates. */\n space?: \"world\" | \"index\";\n /**\n * Also return per-vertex unit normals pointing toward positive values (out of the solid): the gradient of the\n * trilinear field at the vertex, through `W^T` (W = world-to-index) in world space. Default false.\n */\n normals?: boolean;\n /**\n * Clip to an inclusive index-space voxel box. A cell is meshed when all eight of its corner voxels lie inside, so\n * the mesh is open where the box cuts the surface. Default: the whole grid.\n */\n bbox?: { min: readonly [number, number, number]; max: readonly [number, number, number] };\n /**\n * Also mesh cells whose corners lie only in tiles and the background (no leaf), as fog volumes and unclamped\n * distance grids need where a tile meets the background or another tile. The shell of every tile on the far side\n * of `isoValue` from the background is visited (a 4096³ root tile's shell is 1.5 M blocks). Any `isoValue` is\n * then allowed, except on a clamped narrow band (every tile and the background ±background): there is no surface\n * at `|isoValue| >= background` to find. Default false (leaves only).\n */\n tiles?: boolean;\n /**\n * Iterations of Gibson's constrained relaxation: each vertex moves to the mean of the vertices it shares a quad\n * edge with, clamped to its own cell. Smooths the faceting of binary-like data; on a distance field it pulls\n * vertices off the iso surface unless `project` is set. Default 0.\n */\n relax?: number;\n /**\n * Move each vertex onto the trilinear iso surface of its cell (Newton steps along the gradient, clamped to the\n * cell), after any relaxation. Default false (the mean of the cell's edge crossings).\n */\n project?: boolean;\n}\n\n/** Options of {@link vdbLevelSetMeshChunks}. */\nexport interface VDBLevelSetMeshChunkOptions extends VDBLevelSetMeshOptions {\n /** Chunk edge in cells (index voxels), an integer of at least 8; chunks are aligned to multiples of it. Default 256. */\n chunkSize?: number;\n}\n\n/** Result of {@link vdbLevelSetMesh}. */\nexport interface VDBLevelSetMesh {\n /** `vertexCount * 3` floats (x, y, z per vertex), in `space`. */\n positions: Float32Array;\n /** `triangleCount * 3` vertex indices, wound counter-clockwise seen from outside (normals point to positive values). */\n indices: Uint32Array;\n /** `vertexCount * 3` unit normals when `normals` was set. */\n normals?: Float32Array;\n vertexCount: number;\n triangleCount: number;\n /** The space of `positions`. */\n space: \"world\" | \"index\";\n}\n\n/** One chunk of {@link vdbLevelSetMeshChunks}: a mesh with only the vertices its triangles use. */\nexport interface VDBLevelSetMeshChunk extends VDBLevelSetMesh {\n /**\n * The cells this chunk owns: those whose min corner voxel lies in this inclusive index box. A chunk holds the\n * triangles of the lattice edges that start at those voxels, so its vertices reach one cell below `min`.\n */\n bbox: { min: [number, number, number]; max: [number, number, number] };\n}\n\n/** The 12 cell edges as corner pairs (corner bit 0 = +x, 1 = +y, 2 = +z). */\nconst EDGES: readonly (readonly [number, number])[] = [\n [0, 1], [2, 3], [4, 5], [6, 7],\n [0, 2], [1, 3], [4, 6], [5, 7],\n [0, 4], [1, 5], [2, 6], [3, 7],\n];\n\n/** The relaxation's neighbour directions, in summation order: -x, +x, -y, +y, -z, +z. */\nconst DIRS: readonly Vec3[] = [\n [-1, 0, 0], [1, 0, 0], [0, -1, 0], [0, 1, 0], [0, 0, -1], [0, 0, 1],\n];\n\ninterface Block {\n values: Float32Array | null;\n constant: number;\n}\n\ninterface Box {\n min: Vec3;\n max: Vec3;\n}\n\n/** Everything a mesh pass needs, validated once. */\ninterface Prepared {\n image: Uint32Array;\n iso: number;\n space: \"world\" | \"index\";\n wantNormals: boolean;\n clipMin: Vec3;\n clipMax: Vec3;\n relax: number;\n project: boolean;\n mat: number[];\n inv: number[];\n vec: number[];\n mirrored: boolean;\n /** Block (8³) origins to visit: the leaves, then (with `tiles`) the tile shell blocks next to a crossing. */\n blocks: Vec3[];\n cellKey: (x: number, y: number, z: number) => number;\n getBlock: (bx: number, by: number, bz: number) => Block;\n}\n\nconst emptyMesh = (space: \"world\" | \"index\", wantNormals: boolean): VDBLevelSetMesh => ({\n positions: new Float32Array(0),\n indices: new Uint32Array(0),\n ...(wantNormals ? { normals: new Float32Array(0) } : {}),\n vertexCount: 0,\n triangleCount: 0,\n space,\n});\n\n/** Validates the options and indexes the image; `space` and `wantNormals` come back for an empty result. */\nfunction prepare(image: Uint32Array, options: VDBLevelSetMeshOptions, name: string): Prepared | { empty: true; space: \"world\" | \"index\"; wantNormals: boolean } {\n const bad = (message: string): never => {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", `${name}: ${message}`);\n };\n if (!(image instanceof Uint32Array)) throw new VDBToolsError(\"VDB_BAD_IMAGE\", `${name}: image must be a Uint32Array grid image`);\n const iso = options.isoValue ?? 0;\n if (!Number.isFinite(iso)) bad(`isoValue ${iso} is not finite`);\n const space = options.space ?? \"world\";\n if (space !== \"world\" && space !== \"index\") bad(`space must be 'world' or 'index', got ${String(space)}`);\n const wantNormals = options.normals ?? false;\n let clipMin: Vec3 = [-Infinity, -Infinity, -Infinity];\n let clipMax: Vec3 = [Infinity, Infinity, Infinity];\n if (options.bbox) {\n const { min, max } = options.bbox;\n for (let a = 0; a < 3; a++) {\n if (!Number.isInteger(min[a]) || !Number.isInteger(max[a])) bad(\"bbox corners must be integers (index voxels)\");\n if (min[a]! > max[a]!) bad(`bbox min ${min[a]} exceeds max ${max[a]} on axis ${a}`);\n }\n clipMin = [min[0], min[1], min[2]];\n clipMax = [max[0], max[1], max[2]];\n }\n const relax = options.relax ?? 0;\n if (!Number.isInteger(relax) || relax < 0) bad(`relax must be a non-negative integer, got ${String(relax)}`);\n const project = options.project ?? false;\n if (typeof project !== \"boolean\") bad(`project must be a boolean, got ${String(project)}`);\n const tiles = options.tiles ?? false;\n if (typeof tiles !== \"boolean\") bad(`tiles must be a boolean, got ${String(tiles)}`);\n\n indexBBox(image); // validates the image (VDB_BAD_IMAGE / VDB_UNSUPPORTED_GRID_TYPE)\n\n // The grid's affine, f64.\n const view = new DataView(image.buffer, image.byteOffset, image.byteLength);\n const mat = Array.from({ length: 9 }, (_, i) => view.getFloat64(GRID_OFF_MAP + MAP_OFF_MATD + i * 8, true));\n const inv = Array.from({ length: 9 }, (_, i) => view.getFloat64(GRID_OFF_MAP + MAP_OFF_INVMATD + i * 8, true));\n const vec = Array.from({ length: 3 }, (_, i) => view.getFloat64(GRID_OFF_MAP + MAP_OFF_VECD + i * 8, true));\n const det =\n mat[0]! * (mat[4]! * mat[8]! - mat[5]! * mat[7]!) -\n mat[1]! * (mat[3]! * mat[8]! - mat[5]! * mat[6]!) +\n mat[2]! * (mat[3]! * mat[7]! - mat[4]! * mat[6]!);\n const mirrored = space === \"world\" && det < 0;\n\n // The leaves.\n const origins: Vec3[] = [];\n const addresses: number[] = [];\n const { background } = forEachTreeRegion(image, (r) => {\n if (r.level === 0) {\n origins.push(r.origin);\n addresses.push(r.leaf);\n }\n });\n // The tiles on the far side of the iso value from the background (a second walk: the background is known now).\n const farTiles: { origin: Vec3; dim: number }[] = [];\n if (tiles) {\n const bgInside = background < iso;\n let clamped = background !== 0;\n forEachTreeRegion(image, (r) => {\n if (r.level === 0) return;\n if (Math.abs(r.value) !== Math.abs(background)) clamped = false;\n if (r.value < iso !== bgInside) farTiles.push({ origin: r.origin, dim: r.dim });\n });\n if (clamped && !(Math.abs(iso) < Math.abs(background))) {\n bad(\n `isoValue ${iso} is outside the narrow band (|isoValue| < background ${Math.abs(background)}), and every tile and the background hold ±background (a clamped band): there is no surface there to mesh`,\n );\n }\n } else if (background > 0 && !(Math.abs(iso) < background)) {\n bad(\n `isoValue ${iso} is outside the narrow band (|isoValue| < background ${background}): tiles could straddle it, and only leaves are meshed (tiles: true meshes tiles too, for a grid whose tiles hold other values)`,\n );\n }\n if (origins.length === 0 && farTiles.length === 0) return { empty: true, space, wantNormals };\n\n const lo: Vec3 = [Infinity, Infinity, Infinity];\n const hi: Vec3 = [-Infinity, -Infinity, -Infinity];\n const extend = (o: Vec3, d: number) => {\n for (let a = 0; a < 3; a++) {\n lo[a] = Math.min(lo[a]!, o[a]!);\n hi[a] = Math.max(hi[a]!, o[a]! + d - 8);\n }\n };\n for (const o of origins) extend(o, 8);\n for (const t of farTiles) extend(t.origin, t.dim);\n // Block (8^3) keys, relative to the leaf extent, padded by one block each side.\n const bn: Vec3 = [(hi[0] - lo[0]) / 8 + 3, (hi[1] - lo[1]) / 8 + 3, (hi[2] - lo[2]) / 8 + 3];\n const blockKey = (bx: number, by: number, bz: number): number =>\n ((bx - lo[0] / 8 + 1) * bn[1] + (by - lo[1] / 8 + 1)) * bn[2] + (bz - lo[2] / 8 + 1);\n const leafAt = new Map<number, number>();\n for (let i = 0; i < origins.length; i++) {\n const o = origins[i]!;\n leafAt.set(blockKey(o[0] / 8, o[1] / 8, o[2] / 8), addresses[i]!);\n }\n // Cell keys, relative to the leaf extent padded by 2 voxels.\n const cn: Vec3 = [hi[0] - lo[0] + 12, hi[1] - lo[1] + 12, hi[2] - lo[2] + 12];\n const cellKey = (x: number, y: number, z: number): number => ((x - lo[0] + 2) * cn[1] + (y - lo[1] + 2)) * cn[2] + (z - lo[2] + 2);\n if (cn[0] * cn[1] * cn[2] > Number.MAX_SAFE_INTEGER) throw new VDBToolsError(\"VDB_BAD_IMAGE\", `${name}: the grid's extent is too large to key`);\n\n // Decoded leaf blocks (a bounded cache); a block with no leaf is one tile or the background: one value.\n const blocks = new Map<number, Block>();\n const getBlock = (bx: number, by: number, bz: number): Block => {\n const key = blockKey(bx, by, bz);\n let b = blocks.get(key);\n if (b) {\n // Least recently used goes first: a hit moves the block to the back.\n blocks.delete(key);\n blocks.set(key, b);\n return b;\n }\n const addr = leafAt.get(key);\n b = addr !== undefined ? { values: leafVoxels(image, addr).values, constant: 0 } : { values: null, constant: vdbReadValueF32Cpu(image, [bx * 8, by * 8, bz * 8]) };\n if (blocks.size >= 4096) blocks.delete(blocks.keys().next().value as number);\n blocks.set(key, b);\n return b;\n };\n\n // The tile shell blocks with a constant neighbour block (outside the tile) on the other side of the iso value.\n const visit: Vec3[] = origins.slice();\n for (const t of farTiles) {\n const n = t.dim / 8;\n const t0: Vec3 = [t.origin[0] / 8, t.origin[1] / 8, t.origin[2] / 8];\n const tileInside = getBlock(t0[0], t0[1], t0[2]).constant < iso;\n for (let i = 0; i < n; i++) {\n const edgeI = i === 0 || i === n - 1;\n for (let j = 0; j < n; j++) {\n const edgeJ = edgeI || j === 0 || j === n - 1;\n // Interior rows: only the two z faces.\n const step = edgeJ ? 1 : Math.max(1, n - 1);\n for (let k = 0; k < n; k += step) {\n const b: Vec3 = [t0[0] + i, t0[1] + j, t0[2] + k];\n let crossing = false;\n for (let d = 0; d < 27 && !crossing; d++) {\n if (d === 13) continue;\n const nx = b[0] + ((d / 9) | 0) - 1;\n const ny = b[1] + (((d / 3) | 0) % 3) - 1;\n const nz = b[2] + (d % 3) - 1;\n if (nx >= t0[0] && nx < t0[0] + n && ny >= t0[1] && ny < t0[1] + n && nz >= t0[2] && nz < t0[2] + n) continue;\n const nb = getBlock(nx, ny, nz);\n if (nb.values === null && nb.constant < iso !== tileInside) crossing = true;\n }\n if (crossing) visit.push([b[0] * 8, b[1] * 8, b[2] * 8]);\n }\n }\n }\n }\n\n return { image, iso, space, wantNormals, clipMin, clipMax, relax, project, mat, inv, vec, mirrored, blocks: visit, cellKey, getBlock };\n}\n\n/** The gradient of the trilinear field of corners `v` at local `(u, w, s)`, into `out`. */\nfunction cellGradient(v: ArrayLike<number>, u: number, w: number, s: number, out: number[]): void {\n const lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n const dxs = (y: number, z: number) => v[1 + 2 * y + 4 * z]! - v[2 * y + 4 * z]!;\n const dys = (x: number, z: number) => v[x + 2 + 4 * z]! - v[x + 4 * z]!;\n const dzs = (x: number, y: number) => v[x + 2 * y + 4]! - v[x + 2 * y]!;\n out.push(\n lerp(lerp(dxs(0, 0), dxs(1, 0), w), lerp(dxs(0, 1), dxs(1, 1), w), s),\n lerp(lerp(dys(0, 0), dys(1, 0), u), lerp(dys(0, 1), dys(1, 1), u), s),\n lerp(lerp(dzs(0, 0), dzs(1, 0), u), lerp(dzs(0, 1), dzs(1, 1), u), w),\n );\n}\n\n/** The trilinear field of corners `v` at local `(u, w, s)`. */\nfunction cellValue(v: ArrayLike<number>, u: number, w: number, s: number): number {\n const lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n return lerp(lerp(lerp(v[0]!, v[1]!, u), lerp(v[2]!, v[3]!, u), w), lerp(lerp(v[4]!, v[5]!, u), lerp(v[6]!, v[7]!, u), w), s);\n}\n\nconst clamp01 = (x: number): number => (x < 0 ? 0 : x > 1 ? 1 : x);\n\n/**\n * Meshes the cells with a corner in `blockList` (block origins). `region` limits the cells (their min corners,\n * inclusive) that get a vertex; `owned` limits the quads that become triangles to those whose lattice edge starts in\n * it, and drops the vertices no triangle uses (chunk mode). Both null: the one-shot mesh.\n */\nfunction meshBlocks(P: Prepared, blockList: readonly Vec3[], region: Box | null, owned: Box | null): VDBLevelSetMesh {\n const { iso, cellKey, getBlock, space, wantNormals, mat, inv, vec, mirrored } = P;\n const moving = P.relax > 0 || P.project;\n const cellLo: Vec3 = [0, 1, 2].map((a) => Math.max(P.clipMin[a]!, region ? region.min[a]! : -Infinity)) as Vec3;\n const cellHi: Vec3 = [0, 1, 2].map((a) => Math.min(P.clipMax[a]! - 1, region ? region.max[a]! : Infinity)) as Vec3;\n\n // Pass 1: a vertex per crossing cell.\n const vertexOf = new Map<number, number>();\n const cellXYZ: number[] = [];\n const flags: number[] = [];\n const pos: number[] = []; // index space, f64\n const grad: number[] = [];\n const corners: number[] = []; // 8 per vertex when vertices move\n const vals = new Float32Array(1000); // the block's corner block: index -1..8 per axis\n const v = new Float64Array(8);\n const nb: Block[] = new Array<Block>(27);\n for (const o of blockList) {\n // The block's cells have min corners o - 1 .. o + 7: skip a block the clip box or the region leaves no cell of.\n if (o[0] + 7 < cellLo[0] || o[0] - 1 > cellHi[0] || o[1] + 7 < cellLo[1] || o[1] - 1 > cellHi[1] || o[2] + 7 < cellLo[2] || o[2] - 1 > cellHi[2]) continue;\n for (let i = -1; i <= 1; i++) {\n for (let j = -1; j <= 1; j++) {\n for (let k = -1; k <= 1; k++) nb[(i + 1) * 9 + (j + 1) * 3 + (k + 1)] = getBlock(o[0] / 8 + i, o[1] / 8 + j, o[2] / 8 + k);\n }\n }\n for (let i = 0; i < 10; i++) {\n const bi = i === 0 ? 0 : i === 9 ? 2 : 1;\n const lx = (i + 7) & 7;\n for (let j = 0; j < 10; j++) {\n const bj = j === 0 ? 0 : j === 9 ? 2 : 1;\n const ly = (j + 7) & 7;\n for (let k = 0; k < 10; k++) {\n const bk = k === 0 ? 0 : k === 9 ? 2 : 1;\n const b = nb[bi * 9 + bj * 3 + bk]!;\n vals[(i * 10 + j) * 10 + k] = b.values ? b.values[(lx << 6) | (ly << 3) | ((k + 7) & 7)]! : b.constant;\n }\n }\n }\n for (let ci = 0; ci < 9; ci++) {\n const cx = o[0] + ci - 1;\n if (cx < cellLo[0] || cx > cellHi[0]) continue;\n for (let cj = 0; cj < 9; cj++) {\n const cy = o[1] + cj - 1;\n if (cy < cellLo[1] || cy > cellHi[1]) continue;\n for (let ck = 0; ck < 9; ck++) {\n const cz = o[2] + ck - 1;\n if (cz < cellLo[2] || cz > cellHi[2]) continue;\n const base = (ci * 10 + cj) * 10 + ck;\n let mask = 0;\n for (let c = 0; c < 8; c++) {\n const x = vals[base + (c & 1) * 100 + ((c >> 1) & 1) * 10 + ((c >> 2) & 1)]!;\n v[c] = x;\n if (x < iso) mask |= 1 << c;\n }\n if (mask === 0 || mask === 255) continue;\n const key = cellKey(cx, cy, cz);\n if (vertexOf.has(key)) continue;\n let sx = 0;\n let sy = 0;\n let sz = 0;\n let n = 0;\n for (const [a, b] of EDGES) {\n if (((mask >> a) & 1) === ((mask >> b) & 1)) continue;\n const t = (iso - v[a]!) / (v[b]! - v[a]!);\n sx += (a & 1) + t * ((b & 1) - (a & 1));\n sy += ((a >> 1) & 1) + t * (((b >> 1) & 1) - ((a >> 1) & 1));\n sz += ((a >> 2) & 1) + t * (((b >> 2) & 1) - ((a >> 2) & 1));\n n++;\n }\n const u = sx / n;\n const w = sy / n;\n const s = sz / n;\n vertexOf.set(key, cellXYZ.length / 3);\n cellXYZ.push(cx, cy, cz);\n pos.push(cx + u, cy + w, cz + s);\n flags.push(\n (((mask ^ (mask >> 1)) & 1) | (((mask ^ (mask >> 2)) & 1) << 1) | (((mask ^ (mask >> 4)) & 1) << 2)) | ((mask & 1) << 3),\n );\n if (moving) for (let c = 0; c < 8; c++) corners.push(v[c]!);\n else if (wantNormals) cellGradient(v, u, w, s, grad);\n }\n }\n }\n }\n\n // Pass 2: a quad per sign-changing lattice edge starting at a crossing cell's min corner.\n const vertexCount = cellXYZ.length / 3;\n const quads: number[] = []; // 4 per quad, counter-clockwise seen from outside\n const quadOwned: boolean[] = [];\n const at = new Int32Array(3);\n for (let vi = 0; vi < vertexCount; vi++) {\n const f = flags[vi]!;\n at[0] = cellXYZ[3 * vi]!;\n at[1] = cellXYZ[3 * vi + 1]!;\n at[2] = cellXYZ[3 * vi + 2]!;\n const isOwned =\n !owned ||\n (at[0]! >= owned.min[0] && at[0]! <= owned.max[0] && at[1]! >= owned.min[1] && at[1]! <= owned.max[1] && at[2]! >= owned.min[2] && at[2]! <= owned.max[2]);\n // In chunk mode, quads outside the owned box matter only as relaxation links.\n if (!isOwned && P.relax === 0) continue;\n for (let a = 0; a < 3; a++) {\n if (!((f >> a) & 1)) continue;\n const b = (a + 1) % 3;\n const c = (a + 2) % 3;\n // The four cells around the edge, counter-clockwise seen from +a.\n const q = [vi, 0, 0, 0];\n let ok = true;\n for (let m = 1; m < 4; m++) {\n const xyz: Vec3 = [at[0]!, at[1]!, at[2]!];\n if (m === 1 || m === 2) xyz[b]!--;\n if (m === 2 || m === 3) xyz[c]!--;\n const id = vertexOf.get(cellKey(xyz[0], xyz[1], xyz[2]));\n if (id === undefined) {\n ok = false; // cut by the clip box (or the chunk's region)\n break;\n }\n q[m] = id;\n }\n if (!ok) continue;\n // The corner at the edge's start is inside: the outward direction is +a, and q is counter-clockwise seen from it.\n const forward = ((f >> 3) & 1) === 1;\n if (forward !== mirrored) quads.push(q[0]!, q[1]!, q[2]!, q[3]!);\n else quads.push(q[0]!, q[3]!, q[2]!, q[1]!);\n quadOwned.push(isOwned);\n }\n }\n\n if (moving) moveVertices(P, pos, cellXYZ, corners, quads, vertexOf, grad);\n\n // Triangles: each quad split on its shorter diagonal.\n const tri: number[] = [];\n const dist2 = (p: number, q: number): number =>\n (pos[3 * p]! - pos[3 * q]!) ** 2 + (pos[3 * p + 1]! - pos[3 * q + 1]!) ** 2 + (pos[3 * p + 2]! - pos[3 * q + 2]!) ** 2;\n for (let qi = 0; qi < quadOwned.length; qi++) {\n if (!quadOwned[qi]) continue;\n const q0 = quads[4 * qi]!;\n const q1 = quads[4 * qi + 1]!;\n const q2 = quads[4 * qi + 2]!;\n const q3 = quads[4 * qi + 3]!;\n if (dist2(q0, q2) <= dist2(q1, q3)) tri.push(q0, q1, q2, q0, q2, q3);\n else tri.push(q1, q2, q3, q1, q3, q0);\n }\n\n // Chunk mode keeps only the vertices its triangles use (in vertex order).\n let outVertices = vertexCount;\n let source: Int32Array | null = null;\n if (owned) {\n const remap = new Int32Array(vertexCount).fill(-1);\n for (const t of tri) remap[t] = 0;\n source = new Int32Array(vertexCount);\n outVertices = 0;\n for (let i = 0; i < vertexCount; i++) {\n if (remap[i] === -1) continue;\n remap[i] = outVertices;\n source[outVertices++] = i;\n }\n for (let i = 0; i < tri.length; i++) tri[i] = remap[tri[i]!]!;\n }\n\n // Output.\n const positions = new Float32Array(outVertices * 3);\n for (let o = 0; o < outVertices; o++) {\n const i = source ? source[o]! : o;\n const p = [pos[3 * i]!, pos[3 * i + 1]!, pos[3 * i + 2]!];\n if (space === \"world\") {\n for (let r = 0; r < 3; r++) positions[3 * o + r] = mat[r * 3]! * p[0]! + mat[r * 3 + 1]! * p[1]! + mat[r * 3 + 2]! * p[2]! + vec[r]!;\n } else {\n positions[3 * o] = p[0]!;\n positions[3 * o + 1] = p[1]!;\n positions[3 * o + 2] = p[2]!;\n }\n }\n const out: VDBLevelSetMesh = { positions, indices: Uint32Array.from(tri), vertexCount: outVertices, triangleCount: tri.length / 3, space };\n if (wantNormals) {\n const normals = new Float32Array(outVertices * 3);\n for (let o = 0; o < outVertices; o++) {\n const i = source ? source[o]! : o;\n const g = [grad[3 * i]!, grad[3 * i + 1]!, grad[3 * i + 2]!];\n // The gradient is covariant: the world normal is W^T g (W = world-to-index).\n const n = space === \"world\" ? [0, 1, 2].map((cc) => inv[cc]! * g[0]! + inv[3 + cc]! * g[1]! + inv[6 + cc]! * g[2]!) : g;\n const l = Math.hypot(n[0]!, n[1]!, n[2]!);\n if (l > 0) {\n normals[3 * o] = n[0]! / l;\n normals[3 * o + 1] = n[1]! / l;\n normals[3 * o + 2] = n[2]! / l;\n } else normals[3 * o + 1] = 1;\n }\n out.normals = normals;\n }\n return out;\n}\n\n/**\n * `relax` and `project`: moves `pos` (index space) in place and, with normals, fills `grad` at the final positions.\n * Every vertex reads only its own corners and (relaxation) its linked neighbours in the fixed `DIRS` order, so a\n * vertex computed in two chunks comes out bit-identical when both chunks hold its neighbourhood.\n */\nfunction moveVertices(P: Prepared, pos: number[], cellXYZ: number[], corners: number[], quads: number[], vertexOf: Map<number, number>, grad: number[]): void {\n const vertexCount = cellXYZ.length / 3;\n if (P.relax > 0) {\n // Links: the quads' sides join face-adjacent cells.\n const links = new Uint8Array(vertexCount);\n for (let qi = 0; qi < quads.length; qi += 4) {\n for (let e = 0; e < 4; e++) {\n const a = quads[qi + e]!;\n const b = quads[qi + ((e + 1) & 3)]!;\n for (let ax = 0; ax < 3; ax++) {\n const d = cellXYZ[3 * b + ax]! - cellXYZ[3 * a + ax]!;\n if (d === 0) continue;\n links[a]! |= 1 << (2 * ax + (d > 0 ? 1 : 0));\n links[b]! |= 1 << (2 * ax + (d > 0 ? 0 : 1));\n }\n }\n }\n const nbr = new Int32Array(vertexCount * 6).fill(-1);\n for (let i = 0; i < vertexCount; i++) {\n for (let d = 0; d < 6; d++) {\n if (!((links[i]! >> d) & 1)) continue;\n const D = DIRS[d]!;\n nbr[6 * i + d] = vertexOf.get(P.cellKey(cellXYZ[3 * i]! + D[0], cellXYZ[3 * i + 1]! + D[1], cellXYZ[3 * i + 2]! + D[2]))!;\n }\n }\n let cur = Float64Array.from(pos);\n let next = new Float64Array(cur.length);\n for (let it = 0; it < P.relax; it++) {\n for (let i = 0; i < vertexCount; i++) {\n let sx = 0;\n let sy = 0;\n let sz = 0;\n let n = 0;\n for (let d = 0; d < 6; d++) {\n const j = nbr[6 * i + d]!;\n if (j < 0) continue;\n sx += cur[3 * j]!;\n sy += cur[3 * j + 1]!;\n sz += cur[3 * j + 2]!;\n n++;\n }\n if (n === 0) {\n next[3 * i] = cur[3 * i]!;\n next[3 * i + 1] = cur[3 * i + 1]!;\n next[3 * i + 2] = cur[3 * i + 2]!;\n continue;\n }\n // Gibson's constraint: the vertex stays in its cell.\n for (let a = 0; a < 3; a++) {\n const c = cellXYZ[3 * i + a]!;\n const m = [sx, sy, sz][a]! / n;\n next[3 * i + a] = m < c ? c : m > c + 1 ? c + 1 : m;\n }\n }\n [cur, next] = [next, cur];\n }\n for (let i = 0; i < pos.length; i++) pos[i] = cur[i]!;\n }\n const g: number[] = [];\n for (let i = 0; i < vertexCount; i++) {\n const v = corners.slice(8 * i, 8 * i + 8);\n let u = pos[3 * i]! - cellXYZ[3 * i]!;\n let w = pos[3 * i + 1]! - cellXYZ[3 * i + 1]!;\n let s = pos[3 * i + 2]! - cellXYZ[3 * i + 2]!;\n if (P.project) {\n for (let it = 0; it < 8; it++) {\n const f = cellValue(v, u, w, s) - P.iso;\n g.length = 0;\n cellGradient(v, u, w, s, g);\n const gg = g[0]! * g[0]! + g[1]! * g[1]! + g[2]! * g[2]!;\n if (!(gg > 0) || f === 0) break;\n const k = f / gg;\n const nu = clamp01(u - k * g[0]!);\n const nw = clamp01(w - k * g[1]!);\n const ns = clamp01(s - k * g[2]!);\n const moved = Math.max(Math.abs(nu - u), Math.abs(nw - w), Math.abs(ns - s));\n u = nu;\n w = nw;\n s = ns;\n if (moved < 1e-12) break;\n }\n pos[3 * i] = cellXYZ[3 * i]! + u;\n pos[3 * i + 1] = cellXYZ[3 * i + 1]! + w;\n pos[3 * i + 2] = cellXYZ[3 * i + 2]! + s;\n }\n if (P.wantNormals) cellGradient(v, u, w, s, grad);\n }\n}\n\n/**\n * Triangle mesh of a level set's iso surface. See the file header for the method.\n *\n * @param image A level-set grid image (Float, Half, Fp4, Fp8, Fp16 or FpN), the `Uint32Array` the pool takes.\n * @param options See {@link VDBLevelSetMeshOptions}.\n * @throws {VDBToolsError} `VDB_BAD_IMAGE` / `VDB_UNSUPPORTED_GRID_TYPE` for an image the CPU readers can't\n * decode, `VDB_BAD_OPTION` for a bad option or an `isoValue` outside the narrow band.\n */\nexport function vdbLevelSetMesh(image: Uint32Array, options: VDBLevelSetMeshOptions = {}): VDBLevelSetMesh {\n const P = prepare(image, options, \"vdbLevelSetMesh\");\n if (\"empty\" in P) return emptyMesh(P.space, P.wantNormals);\n return meshBlocks(P, P.blocks, null, null);\n}\n\n/**\n * {@link vdbLevelSetMesh} in index-space chunks of `chunkSize`³ cells, for grids whose whole mesh would not fit in\n * memory: each chunk is meshed (and released) as the iterator reaches it, so memory holds one chunk's mesh, the leaf\n * list and a bounded block cache. A chunk owns the quads of the lattice edges that start in its box; a vertex on a\n * seam is computed from the same corner values in both chunks (with `relax`, a chunk meshes `relax + 1` cells around\n * its box so the shared vertices see the same neighbours), so seam positions and normals are bit-identical and the\n * chunks joined (welded on equal positions) are the one-shot mesh. Chunks without triangles are skipped; the order is\n * x, then y, then z of the chunk index. Options are validated when this is called, not when the iteration starts.\n */\nexport function vdbLevelSetMeshChunks(image: Uint32Array, options: VDBLevelSetMeshChunkOptions = {}): IterableIterator<VDBLevelSetMeshChunk> {\n const size = options.chunkSize ?? 256;\n if (!Number.isInteger(size) || size < 8) {\n throw new VDBToolsError(\"VDB_BAD_OPTION\", `vdbLevelSetMeshChunks: chunkSize must be an integer of at least 8, got ${String(size)}`);\n }\n const P = prepare(image, options, \"vdbLevelSetMeshChunks\");\n return chunkIterator(P, size);\n}\n\nfunction* chunkIterator(P: Prepared | { empty: true }, size: number): IterableIterator<VDBLevelSetMeshChunk> {\n if (\"empty\" in P) return;\n const halo = P.relax + 1;\n // Each block's cells (min corners o - 1 .. o + 7), grown by the halo, into the chunks they touch.\n const buckets = new Map<string, { c: Vec3; blocks: Vec3[] }>();\n for (const o of P.blocks) {\n const c0 = [0, 1, 2].map((a) => Math.floor((o[a]! - 1 - halo) / size));\n const c1 = [0, 1, 2].map((a) => Math.floor((o[a]! + 7 + halo) / size));\n for (let x = c0[0]!; x <= c1[0]!; x++) {\n for (let y = c0[1]!; y <= c1[1]!; y++) {\n for (let z = c0[2]!; z <= c1[2]!; z++) {\n const key = `${x},${y},${z}`;\n let b = buckets.get(key);\n if (!b) buckets.set(key, (b = { c: [x, y, z], blocks: [] }));\n b.blocks.push(o);\n }\n }\n }\n }\n const order = [...buckets.values()].sort((a, b) => a.c[0] - b.c[0] || a.c[1] - b.c[1] || a.c[2] - b.c[2]);\n for (const { c, blocks } of order) {\n const min: Vec3 = [c[0] * size, c[1] * size, c[2] * size];\n const max: Vec3 = [min[0] + size - 1, min[1] + size - 1, min[2] + size - 1];\n const region: Box = { min: [min[0] - halo, min[1] - halo, min[2] - halo], max: [max[0] + halo, max[1] + halo, max[2] + halo] };\n const mesh = meshBlocks(P, blocks, region, { min, max });\n buckets.delete(`${c[0]},${c[1]},${c[2]}`);\n if (mesh.triangleCount > 0) yield { ...mesh, bbox: { min, max } };\n }\n}\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* errors.ts — the one error hierarchy of `@pmndrs/vdb/tools` (D32).
|
|
3
|
+
*
|
|
4
|
+
* Every error the tools throw on bad input is a `VDBToolsError` with a `code`, so one
|
|
5
|
+
* `instanceof VDBToolsError` check covers every format:
|
|
6
|
+
*
|
|
7
|
+
* - `VdbFormatError` (`VDB_BAD_VDB`), `NvdbFormatError` (`VDB_BAD_NVDB`) and `WvdbFormatError`
|
|
8
|
+
* (`VDB_BAD_WVDB`): the bytes are not a valid file of that format (bad magic, truncated, corrupt).
|
|
9
|
+
* - `VDBUnsupportedError` (`VDB_UNSUPPORTED`): a real construct of the format that these tools don't
|
|
10
|
+
* handle (BLOSC `.nvdb`, a codec, a tree configuration, a grid type a reader can't decode).
|
|
11
|
+
* - `VDBToolsError` itself: an argument or option is invalid (`VDB_BAD_OPTION`), a grid image is not a
|
|
12
|
+
* NanoVDB grid image (`VDB_BAD_IMAGE`), or an operation doesn't take the image's grid type
|
|
13
|
+
* (`VDB_UNSUPPORTED_GRID_TYPE`).
|
|
14
|
+
*
|
|
15
|
+
* The core (`@pmndrs/vdb`) has its own `VDBError` with the same message shape; tools never import the
|
|
16
|
+
* core (D20), so the two are separate classes. The codes that mean the same thing share a name.
|
|
17
|
+
*/
|
|
18
|
+
/** What went wrong, for `VDBToolsError.code`. */
|
|
19
|
+
export type VDBToolsErrorCode =
|
|
20
|
+
/** Malformed `.vdb` bytes (`VdbFormatError`). */
|
|
21
|
+
"VDB_BAD_VDB"
|
|
22
|
+
/** Malformed `.nvdb` bytes (`NvdbFormatError`). */
|
|
23
|
+
| "VDB_BAD_NVDB"
|
|
24
|
+
/** Malformed `.wvdb` bytes (`WvdbFormatError`). */
|
|
25
|
+
| "VDB_BAD_WVDB"
|
|
26
|
+
/** Valid data the tools don't handle (`VDBUnsupportedError`). */
|
|
27
|
+
| "VDB_UNSUPPORTED"
|
|
28
|
+
/** The operation doesn't take this grid type (e.g. a Float-only CPU reader given a Vec3f grid). */
|
|
29
|
+
| "VDB_UNSUPPORTED_GRID_TYPE"
|
|
30
|
+
/** A `Uint32Array` argument is not a NanoVDB grid image. */
|
|
31
|
+
| "VDB_BAD_IMAGE"
|
|
32
|
+
/** An argument or option is out of range or inconsistent. */
|
|
33
|
+
| "VDB_BAD_OPTION";
|
|
34
|
+
/** Base class of every error `@pmndrs/vdb/tools` throws on bad input. */
|
|
35
|
+
export declare class VDBToolsError extends Error {
|
|
36
|
+
/** The machine-readable reason (see {@link VDBToolsErrorCode}). */
|
|
37
|
+
readonly code: VDBToolsErrorCode;
|
|
38
|
+
/**
|
|
39
|
+
* @param code The machine-readable reason.
|
|
40
|
+
* @param message What went wrong; the message is prefixed with the package and code.
|
|
41
|
+
*/
|
|
42
|
+
constructor(code: VDBToolsErrorCode, message: string);
|
|
43
|
+
}
|
|
44
|
+
/** The bytes are not a valid OpenVDB `.vdb` stream (bad magic, truncated buffer, corrupt masks). */
|
|
45
|
+
export declare class VdbFormatError extends VDBToolsError {
|
|
46
|
+
/** @param message What is malformed; the message is prefixed with the format. */
|
|
47
|
+
constructor(message: string);
|
|
48
|
+
}
|
|
49
|
+
/** A malformed or truncated `.nvdb` (K4.20), from `NvdbFile` and the stream reader alike. */
|
|
50
|
+
export declare class NvdbFormatError extends VDBToolsError {
|
|
51
|
+
/** @param message What is malformed; the message is prefixed with the format. */
|
|
52
|
+
constructor(message: string);
|
|
53
|
+
}
|
|
54
|
+
/** A `.wvdb` file breaks the spec (bad magic, header, offsets, sizes). */
|
|
55
|
+
export declare class WvdbFormatError extends VDBToolsError {
|
|
56
|
+
/** @param message What is malformed; the message is prefixed with the format. */
|
|
57
|
+
constructor(message: string);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A real construct of the format that is out of these tools' scope (BLOSC `.nvdb`, point grids'
|
|
61
|
+
* unsupported codecs, non-5-4-3 trees, rotated transforms, ...), per SPEC's "throw clear errors" contract.
|
|
62
|
+
*/
|
|
63
|
+
export declare class VDBUnsupportedError extends VDBToolsError {
|
|
64
|
+
/** @param message The unsupported construct; the message is prefixed with "not supported". */
|
|
65
|
+
constructor(message: string);
|
|
66
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* errors.ts — the one error hierarchy of `@pmndrs/vdb/tools` (D32).
|
|
3
|
+
*
|
|
4
|
+
* Every error the tools throw on bad input is a `VDBToolsError` with a `code`, so one
|
|
5
|
+
* `instanceof VDBToolsError` check covers every format:
|
|
6
|
+
*
|
|
7
|
+
* - `VdbFormatError` (`VDB_BAD_VDB`), `NvdbFormatError` (`VDB_BAD_NVDB`) and `WvdbFormatError`
|
|
8
|
+
* (`VDB_BAD_WVDB`): the bytes are not a valid file of that format (bad magic, truncated, corrupt).
|
|
9
|
+
* - `VDBUnsupportedError` (`VDB_UNSUPPORTED`): a real construct of the format that these tools don't
|
|
10
|
+
* handle (BLOSC `.nvdb`, a codec, a tree configuration, a grid type a reader can't decode).
|
|
11
|
+
* - `VDBToolsError` itself: an argument or option is invalid (`VDB_BAD_OPTION`), a grid image is not a
|
|
12
|
+
* NanoVDB grid image (`VDB_BAD_IMAGE`), or an operation doesn't take the image's grid type
|
|
13
|
+
* (`VDB_UNSUPPORTED_GRID_TYPE`).
|
|
14
|
+
*
|
|
15
|
+
* The core (`@pmndrs/vdb`) has its own `VDBError` with the same message shape; tools never import the
|
|
16
|
+
* core (D20), so the two are separate classes. The codes that mean the same thing share a name.
|
|
17
|
+
*/
|
|
18
|
+
/** Base class of every error `@pmndrs/vdb/tools` throws on bad input. */
|
|
19
|
+
export class VDBToolsError extends Error {
|
|
20
|
+
/** The machine-readable reason (see {@link VDBToolsErrorCode}). */
|
|
21
|
+
code;
|
|
22
|
+
/**
|
|
23
|
+
* @param code The machine-readable reason.
|
|
24
|
+
* @param message What went wrong; the message is prefixed with the package and code.
|
|
25
|
+
*/
|
|
26
|
+
constructor(code, message) {
|
|
27
|
+
super(`@pmndrs/vdb/tools [${code}]: ${message}`);
|
|
28
|
+
this.name = "VDBToolsError";
|
|
29
|
+
this.code = code;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** The bytes are not a valid OpenVDB `.vdb` stream (bad magic, truncated buffer, corrupt masks). */
|
|
33
|
+
export class VdbFormatError extends VDBToolsError {
|
|
34
|
+
/** @param message What is malformed; the message is prefixed with the format. */
|
|
35
|
+
constructor(message) {
|
|
36
|
+
super("VDB_BAD_VDB", `malformed .vdb: ${message}`);
|
|
37
|
+
this.name = "VdbFormatError";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** A malformed or truncated `.nvdb` (K4.20), from `NvdbFile` and the stream reader alike. */
|
|
41
|
+
export class NvdbFormatError extends VDBToolsError {
|
|
42
|
+
/** @param message What is malformed; the message is prefixed with the format. */
|
|
43
|
+
constructor(message) {
|
|
44
|
+
super("VDB_BAD_NVDB", `malformed .nvdb: ${message}`);
|
|
45
|
+
this.name = "NvdbFormatError";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** A `.wvdb` file breaks the spec (bad magic, header, offsets, sizes). */
|
|
49
|
+
export class WvdbFormatError extends VDBToolsError {
|
|
50
|
+
/** @param message What is malformed; the message is prefixed with the format. */
|
|
51
|
+
constructor(message) {
|
|
52
|
+
super("VDB_BAD_WVDB", `malformed .wvdb: ${message}`);
|
|
53
|
+
this.name = "WvdbFormatError";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A real construct of the format that is out of these tools' scope (BLOSC `.nvdb`, point grids'
|
|
58
|
+
* unsupported codecs, non-5-4-3 trees, rotated transforms, ...), per SPEC's "throw clear errors" contract.
|
|
59
|
+
*/
|
|
60
|
+
export class VDBUnsupportedError extends VDBToolsError {
|
|
61
|
+
/** @param message The unsupported construct; the message is prefixed with "not supported". */
|
|
62
|
+
constructor(message) {
|
|
63
|
+
super("VDB_UNSUPPORTED", `not supported: ${message}`);
|
|
64
|
+
this.name = "VDBUnsupportedError";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/tools/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAmBH,yEAAyE;AACzE,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,mEAAmE;IAC1D,IAAI,CAAoB;IAEjC;;;OAGG;IACH,YAAY,IAAuB,EAAE,OAAe;QAClD,KAAK,CAAC,sBAAsB,IAAI,MAAM,OAAO,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,oGAAoG;AACpG,MAAM,OAAO,cAAe,SAAQ,aAAa;IAC/C,iFAAiF;IACjF,YAAY,OAAe;QACzB,KAAK,CAAC,aAAa,EAAE,mBAAmB,OAAO,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,6FAA6F;AAC7F,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAChD,iFAAiF;IACjF,YAAY,OAAe;QACzB,KAAK,CAAC,cAAc,EAAE,oBAAoB,OAAO,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,0EAA0E;AAC1E,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAChD,iFAAiF;IACjF,YAAY,OAAe;QACzB,KAAK,CAAC,cAAc,EAAE,oBAAoB,OAAO,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IACpD,8FAA8F;IAC9F,YAAY,OAAe;QACzB,KAAK,CAAC,iBAAiB,EAAE,kBAAkB,OAAO,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF","sourcesContent":["/**\n * errors.ts — the one error hierarchy of `@pmndrs/vdb/tools` (D32).\n *\n * Every error the tools throw on bad input is a `VDBToolsError` with a `code`, so one\n * `instanceof VDBToolsError` check covers every format:\n *\n * - `VdbFormatError` (`VDB_BAD_VDB`), `NvdbFormatError` (`VDB_BAD_NVDB`) and `WvdbFormatError`\n * (`VDB_BAD_WVDB`): the bytes are not a valid file of that format (bad magic, truncated, corrupt).\n * - `VDBUnsupportedError` (`VDB_UNSUPPORTED`): a real construct of the format that these tools don't\n * handle (BLOSC `.nvdb`, a codec, a tree configuration, a grid type a reader can't decode).\n * - `VDBToolsError` itself: an argument or option is invalid (`VDB_BAD_OPTION`), a grid image is not a\n * NanoVDB grid image (`VDB_BAD_IMAGE`), or an operation doesn't take the image's grid type\n * (`VDB_UNSUPPORTED_GRID_TYPE`).\n *\n * The core (`@pmndrs/vdb`) has its own `VDBError` with the same message shape; tools never import the\n * core (D20), so the two are separate classes. The codes that mean the same thing share a name.\n */\n\n/** What went wrong, for `VDBToolsError.code`. */\nexport type VDBToolsErrorCode =\n /** Malformed `.vdb` bytes (`VdbFormatError`). */\n | \"VDB_BAD_VDB\"\n /** Malformed `.nvdb` bytes (`NvdbFormatError`). */\n | \"VDB_BAD_NVDB\"\n /** Malformed `.wvdb` bytes (`WvdbFormatError`). */\n | \"VDB_BAD_WVDB\"\n /** Valid data the tools don't handle (`VDBUnsupportedError`). */\n | \"VDB_UNSUPPORTED\"\n /** The operation doesn't take this grid type (e.g. a Float-only CPU reader given a Vec3f grid). */\n | \"VDB_UNSUPPORTED_GRID_TYPE\"\n /** A `Uint32Array` argument is not a NanoVDB grid image. */\n | \"VDB_BAD_IMAGE\"\n /** An argument or option is out of range or inconsistent. */\n | \"VDB_BAD_OPTION\";\n\n/** Base class of every error `@pmndrs/vdb/tools` throws on bad input. */\nexport class VDBToolsError extends Error {\n /** The machine-readable reason (see {@link VDBToolsErrorCode}). */\n readonly code: VDBToolsErrorCode;\n\n /**\n * @param code The machine-readable reason.\n * @param message What went wrong; the message is prefixed with the package and code.\n */\n constructor(code: VDBToolsErrorCode, message: string) {\n super(`@pmndrs/vdb/tools [${code}]: ${message}`);\n this.name = \"VDBToolsError\";\n this.code = code;\n }\n}\n\n/** The bytes are not a valid OpenVDB `.vdb` stream (bad magic, truncated buffer, corrupt masks). */\nexport class VdbFormatError extends VDBToolsError {\n /** @param message What is malformed; the message is prefixed with the format. */\n constructor(message: string) {\n super(\"VDB_BAD_VDB\", `malformed .vdb: ${message}`);\n this.name = \"VdbFormatError\";\n }\n}\n\n/** A malformed or truncated `.nvdb` (K4.20), from `NvdbFile` and the stream reader alike. */\nexport class NvdbFormatError extends VDBToolsError {\n /** @param message What is malformed; the message is prefixed with the format. */\n constructor(message: string) {\n super(\"VDB_BAD_NVDB\", `malformed .nvdb: ${message}`);\n this.name = \"NvdbFormatError\";\n }\n}\n\n/** A `.wvdb` file breaks the spec (bad magic, header, offsets, sizes). */\nexport class WvdbFormatError extends VDBToolsError {\n /** @param message What is malformed; the message is prefixed with the format. */\n constructor(message: string) {\n super(\"VDB_BAD_WVDB\", `malformed .wvdb: ${message}`);\n this.name = \"WvdbFormatError\";\n }\n}\n\n/**\n * A real construct of the format that is out of these tools' scope (BLOSC `.nvdb`, point grids'\n * unsupported codecs, non-5-4-3 trees, rotated transforms, ...), per SPEC's \"throw clear errors\" contract.\n */\nexport class VDBUnsupportedError extends VDBToolsError {\n /** @param message The unsupported construct; the message is prefixed with \"not supported\". */\n constructor(message: string) {\n super(\"VDB_UNSUPPORTED\", `not supported: ${message}`);\n this.name = \"VDBUnsupportedError\";\n }\n}\n"]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K6.Q1 shadowed ambient (V85; DIVERGES V125–V128): the CPU twins of the core renderer's ambient occlusion. Ambient,
|
|
3
|
+
* hemisphere and light-probe light (distant light with no shadow slot) is attenuated by the medium: transmittance is
|
|
4
|
+
* marched along `pairs` opposite direction pairs, (ω_k, −ω_k) with ω_k in the hemisphere around the sky direction, and
|
|
5
|
+
* averaged into two hemispherical visibilities (V_up over the ω_k, V_down over the −ω_k). Each direction's value is the
|
|
6
|
+
* lighting mode's isotropic-light total (as his sky up / down slots): the direct transmittance without multiple
|
|
7
|
+
* scattering, the octave total over an open direction's with octaves, the two-sided isotropic diffusion of the pair (white furnace: V_up + V_down
|
|
8
|
+
* = 2 at albedo 1) with any other mode. The distant light then reads the visibilities as his sky up / down totals:
|
|
9
|
+
* ambient × (V_up + V_down) / 2, hemisphere sky × V_up / 2 + ground × V_down / 2, the probe's SH irradiance along ± the
|
|
10
|
+
* sky × V / 2. Pairs are an equal-area quadrature of each hemisphere: the sky direction, then a ring at the centroid
|
|
11
|
+
* of the rest. 'frame' lighting marches the pairs in the transmittance pass (two spare channels of the fourth target);
|
|
12
|
+
* 'volume' lighting marches them per froxel through the volume's own shadow march (fewer steps).
|
|
13
|
+
*/
|
|
14
|
+
import { type Vec3, type Vec4 } from "./index.js";
|
|
15
|
+
import { type VDBFrameSpectralMarch } from "./spectral.js";
|
|
16
|
+
/** Most direction pairs (the uniform table's length). */
|
|
17
|
+
export declare const VDB_FRAME_AMBIENT_MAX_PAIRS = 8;
|
|
18
|
+
/**
|
|
19
|
+
* The upper direction of each pair (world, unit): [0] the sky direction, then `pairs − 1` at cos θ = (1 − 1/pairs) / 2
|
|
20
|
+
* from it (the ring's area centroid when the sky direction's cap holds 1/pairs of the hemisphere), evenly in azimuth
|
|
21
|
+
* from a tangent of the sky direction. The lower directions are their negatives. The ring is fixed (K6.Q1c, D37 (5):
|
|
22
|
+
* K6.Q1a turned it per frame with `jitter` and `temporal`).
|
|
23
|
+
*/
|
|
24
|
+
export declare function vdbFrameAmbientDirections(sky: readonly number[], pairs: number): Vec3[];
|
|
25
|
+
/**
|
|
26
|
+
* One pair's isotropic-light totals (up, down) from its two marches (direct, total, reduced depth, effective depth):
|
|
27
|
+
* the two-sided isotropic diffusion with `diffusion`, else each march's total through the octave sum (octaves off:
|
|
28
|
+
* the total as given) divided by the octave total of an open direction (a visibility, 1 unoccluded). The 'frame'
|
|
29
|
+
* transmittance's sky up / down rule, but normalised.
|
|
30
|
+
*/
|
|
31
|
+
export declare function vdbFrameAmbientPairTotals(front: Vec4, back: Vec4, diffusion: boolean, octaves?: Vec4): [number, number];
|
|
32
|
+
/**
|
|
33
|
+
* K6.Q1a: one pair's isotropic-light totals of each channel (up, down) from its two spectral marches (direct, total,
|
|
34
|
+
* reduced depth, effective depth of each channel): the two-sided isotropic diffusion of each channel with `diffusion`,
|
|
35
|
+
* else each march's spectral total (octaves: at `albedo`, the spectral octave light) over an open direction's. A grey
|
|
36
|
+
* medium (equal channels; octaves: albedo 1) gives {@link vdbFrameAmbientPairTotals} in every channel.
|
|
37
|
+
*/
|
|
38
|
+
export declare function vdbFrameSpectralAmbientPairTotals(front: VDBFrameSpectralMarch, back: VDBFrameSpectralMarch, diffusion: boolean, octaves?: Vec4, albedo?: Vec3): [Vec3, Vec3];
|
|
39
|
+
/** K6.Q1a: the hemispherical visibilities of each channel (V_up, V_down): the mean of each side's pair totals. */
|
|
40
|
+
export declare function vdbFrameSpectralAmbientVisibility(totals: readonly (readonly [Vec3, Vec3])[]): [Vec3, Vec3];
|
|
41
|
+
/** The hemispherical visibilities (V_up, V_down): the mean of each side's pair totals. */
|
|
42
|
+
export declare function vdbFrameAmbientVisibility(totals: readonly (readonly [number, number])[]): [number, number];
|
|
43
|
+
/**
|
|
44
|
+
* K6.Q1c: M⁺ / 2 of the pairs' upper directions (row-major 3×3, symmetric; M = Σ_k ω_k ω_kᵀ, eigenvalues below 1e-6 of
|
|
45
|
+
* the largest dropped). `b · r = Σ_k (T(ω_k) − T(−ω_k)) ω_k · (M⁺/2 · r)`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function vdbFrameAmbientDipoleMatrix(directions: readonly (readonly number[])[]): number[];
|
|
48
|
+
/** K6.Q1c: a phase's two HG lobes, each one's mean cosine per channel, and the second lobe's weight. */
|
|
49
|
+
export interface VDBFramePhaseLobes {
|
|
50
|
+
g: [Vec3, Vec3];
|
|
51
|
+
weight: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* K6.Q1c: the phase's lobes (the WGSL `vdbFrameAmbientPhaseFactor` reads the same): forward g and back g (spectral: each
|
|
55
|
+
* scaled per channel and clamped ±0.99, as `vdbFramePhaseColor`) with the back weight; both lobes at the Lorenz-Mie table's
|
|
56
|
+
* asymmetry for 'lorenz-mie' and 'lorenz-mie-rgb'.
|
|
57
|
+
*/
|
|
58
|
+
export declare function vdbFramePhaseLobes(phase: Vec4, phaseSpectrum: Vec3): VDBFramePhaseLobes;
|
|
59
|
+
/**
|
|
60
|
+
* K6.Q1c: the scale of the distant light at one position (both visibilities × it): the dipole's phase-weighted visibility
|
|
61
|
+
* mix(clamp(a + g₁ b·r, 0, 1), clamp(a + g₂ b·r, 0, 1), weight) over the isotropic one a (1 where a ≤ 1e-6). `totals` are
|
|
62
|
+
* the pairs' (up, down) totals in `directions` order (grey: numbers; spectral: per channel), `matrix`
|
|
63
|
+
* {@link vdbFrameAmbientDipoleMatrix} of the directions the renderer packed, `ray` the unit view ray (camera → position),
|
|
64
|
+
* `lobes` {@link vdbFramePhaseLobes}.
|
|
65
|
+
*/
|
|
66
|
+
export declare function vdbFrameAmbientPhaseFactor(totals: readonly (readonly [number | Vec3, number | Vec3])[], directions: readonly (readonly number[])[], matrix: readonly number[], ray: readonly number[], lobes: VDBFramePhaseLobes): Vec3;
|
|
67
|
+
/**
|
|
68
|
+
* K6.Q1d: the pairs' dipole b = M⁺/2 Σ_k (T(ω_k) − T(−ω_k)) ω_k of grey totals (`matrix` {@link vdbFrameAmbientDipoleMatrix}
|
|
69
|
+
* of `directions`): what 'frame' lighting's transmittance pass stores per grid voxel (view-independent; b · r is
|
|
70
|
+
* {@link vdbFrameAmbientPhaseFactor}'s dipole sum for a ray r).
|
|
71
|
+
*/
|
|
72
|
+
export declare function vdbFrameAmbientDipole(totals: readonly (readonly [number, number])[], directions: readonly (readonly number[])[], matrix: readonly number[]): Vec3;
|
|
73
|
+
/** K6.Q1d: {@link vdbFrameAmbientDipole} of each channel of spectral totals (b of red, green, blue). */
|
|
74
|
+
export declare function vdbFrameSpectralAmbientDipole(totals: readonly (readonly [Vec3, Vec3])[], directions: readonly (readonly number[])[], matrix: readonly number[]): [Vec3, Vec3, Vec3];
|
|
75
|
+
/**
|
|
76
|
+
* K6.Q1d: the phase weight of the distant light from the hemispherical visibilities (up, down) and the dipole's b · r
|
|
77
|
+
* at one position (the WGSL `vdbFrameAmbientPhaseFactor` with one pair): a = (up + down) / 2,
|
|
78
|
+
* mix(clamp(a + g₁ b·r, 0, 1), clamp(a + g₂ b·r, 0, 1), weight) / a (1 where a ≤ 1e-6); per channel.
|
|
79
|
+
*/
|
|
80
|
+
export declare function vdbFrameAmbientPhaseWeight(up: number | Vec3, down: number | Vec3, dipoleDotRay: number | Vec3, lobes: VDBFramePhaseLobes): Vec3;
|
|
81
|
+
/** The distant light of a frame (renderer units: irradiance on a surface facing it, three colour × intensity). */
|
|
82
|
+
export interface VDBFrameDistantLight {
|
|
83
|
+
ambient: Vec3;
|
|
84
|
+
/** Sums of the hemisphere lights' sky and ground colours (they share the first one's up: the sky direction). */
|
|
85
|
+
hemiSky: Vec3;
|
|
86
|
+
hemiGround: Vec3;
|
|
87
|
+
/** Light probe SH9 (three's order, RGB), or none. */
|
|
88
|
+
probe?: readonly Vec3[] | null;
|
|
89
|
+
/** Unit sky direction (the first hemisphere light's up, else +y). */
|
|
90
|
+
sky: Vec3;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The shadowed distant-light irradiance at visibilities (V_up, V_down) (both lightings): ambient × (V_up + V_down) / 2
|
|
94
|
+
* + hemisphere sky × V_up / 2 + ground × V_down / 2 + the probe's irradiance along ± the sky direction × V / 2.
|
|
95
|
+
* Unoccluded (1, 1) gives the ambient and hemisphere light of the unshadowed renderer. K6.Q1a: a visibility may be per
|
|
96
|
+
* channel (spectral).
|
|
97
|
+
*/
|
|
98
|
+
export declare function vdbFrameAmbientIrradiance(light: VDBFrameDistantLight, visibility: readonly [number | Vec3, number | Vec3]): Vec3;
|