@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
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K6.R: the scene of the reference renderer (design K6-core-renderer.md §7.4): plain data shared by the GPU kernel
|
|
3
|
+
* (`core/reference/`) and its CPU twin ({@link vdbReferenceRenderCpu}).
|
|
4
|
+
*
|
|
5
|
+
* The medium is the renderer's (three/frame/inject-material.ts, volume-source.ts `sampleExtinction`): each volume is
|
|
6
|
+
* a local unit box [−0.5, 0.5]³ placed in the world by `localToWorld`, with extinction per world unit
|
|
7
|
+
* σt(x) = `sigma` · value(uvw), value = density × mask, zero at or below `cutoff`, uvw = local + 0.5 (no wrap or
|
|
8
|
+
* offset). The renderer's `sigma` is `densityScale · extinction / worldScale` ({@link vdbReferenceSigma}). Volumes
|
|
9
|
+
* that overlap add their extinction (co-located media): a collision picks volume i with probability σᵢ / σ.
|
|
10
|
+
* Scattering albedo: `albedo` × the source's albedo channel. Emission is the renderer's source term σt · Le with
|
|
11
|
+
* Le = `emission.color` · (T / max(T₁, 1))⁴ · `intensity`, T = mix(T₀, T₁, emission value), 0 when T ≤ 0.
|
|
12
|
+
*
|
|
13
|
+
* Units are radiometric: directional lights carry irradiance, point and spot lights intensity (with no distance
|
|
14
|
+
* falloff unless `inverseSquare`: the renderer's point and spot lights have none), the environment carries radiance.
|
|
15
|
+
* {@link vdbReferenceLightsFromFrame} maps the renderer's light inputs (design §2.3 `VDBFrameLight`, three's
|
|
16
|
+
* `color × intensity`) into these units.
|
|
17
|
+
*/
|
|
18
|
+
export type VDBRefVec3 = [number, number, number];
|
|
19
|
+
/**
|
|
20
|
+
* Henyey-Greenstein (`backWeight` 0) or dual-lobe HG: (1 − w)·HG(g) + w·HG(backG); or, with `table`, a tabulated
|
|
21
|
+
* phase (Lorenz-Mie, Mie RGB: {@link vdbReferenceMiePhaseTable}) that replaces the lobes.
|
|
22
|
+
*/
|
|
23
|
+
export interface VDBReferencePhase {
|
|
24
|
+
/** Forward lobe asymmetry, (−1, 1). */
|
|
25
|
+
g: number;
|
|
26
|
+
/** Back lobe asymmetry (dual-lobe). Default 0. */
|
|
27
|
+
backG?: number;
|
|
28
|
+
/** Weight of the back lobe, [0, 1]. Default 0 (plain HG). */
|
|
29
|
+
backWeight?: number;
|
|
30
|
+
/** K6.R1: a tabulated phase per channel; `g`, `backG`, `backWeight` are then ignored. */
|
|
31
|
+
table?: VDBReferencePhaseTable;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* K6.R1: a phase function per RGB channel tabulated as phase / isotropic (his Lorenz-Mie texel layout): `size`
|
|
35
|
+
* angles θ = π u², u = i / (size − 1), read with linear blending in u (`vdbFrameMieTexel`). `cdf` is the sampling
|
|
36
|
+
* table ({@link vdbReferencePhaseTableCdf}): sampling picks u from the piecewise-constant marginal of the channel
|
|
37
|
+
* mean and weights each channel by its phase over that density, so the estimate is unbiased per channel.
|
|
38
|
+
*/
|
|
39
|
+
export interface VDBReferencePhaseTable {
|
|
40
|
+
size: number;
|
|
41
|
+
/** RGB per angle (`size` × 3). */
|
|
42
|
+
values: Float32Array;
|
|
43
|
+
/** Cumulative distribution of u at the `size` table angles (0 … 1). */
|
|
44
|
+
cdf: Float32Array;
|
|
45
|
+
}
|
|
46
|
+
/** K6.R1: an emission colour table over log temperature (the renderer's blackbody LUT, `vdbReferenceBlackbodyTable`). */
|
|
47
|
+
export interface VDBReferenceColorTable {
|
|
48
|
+
size: number;
|
|
49
|
+
/** RGB per column (`size` × 3); column i at T = minTemperature · (max/min)^(i / (size − 1)). */
|
|
50
|
+
values: Float32Array;
|
|
51
|
+
minTemperature: number;
|
|
52
|
+
maxTemperature: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* K6.R1: a per-cell bound of the density value (density × mask, before σ) over the volume's unit box: cell
|
|
56
|
+
* (i, j, k) covers uvw ∈ [i/nx, (i+1)/nx] × … (x fastest). Tracking uses σ · bound of the cell the ray is in
|
|
57
|
+
* (piecewise-constant majorants: empty and thin cells cost few null collisions). Built from the sparse pool's node
|
|
58
|
+
* stats ({@link vdbReferenceMajorantGridSparse}) or the dense texels ({@link vdbReferenceMajorantGridDense}).
|
|
59
|
+
*/
|
|
60
|
+
export interface VDBReferenceMajorantGrid {
|
|
61
|
+
dims: [number, number, number];
|
|
62
|
+
values: Float32Array;
|
|
63
|
+
}
|
|
64
|
+
/** The renderer's emission model (volume-source.ts `sampleEmission`), white unless `color` is given. */
|
|
65
|
+
export interface VDBReferenceEmission {
|
|
66
|
+
/** Colour of the emission (the renderer's `emissionColor` hook evaluated as a constant). Default white. */
|
|
67
|
+
color?: VDBRefVec3;
|
|
68
|
+
/** `emissiveIntensity`. Default 1. */
|
|
69
|
+
intensity?: number;
|
|
70
|
+
/** `temperatureRange` in kelvin. Default [0, 6500]. */
|
|
71
|
+
temperatureRange?: [number, number];
|
|
72
|
+
/** K6.R1: the colour hook as a table over temperature (blackbody), multiplied with `color`. Default white. */
|
|
73
|
+
colorTable?: VDBReferenceColorTable;
|
|
74
|
+
}
|
|
75
|
+
/** One volume of the reference scene. */
|
|
76
|
+
export interface VDBReferenceVolume {
|
|
77
|
+
/** Column-major 4x4: local unit box [−0.5, 0.5]³ → world. */
|
|
78
|
+
localToWorld: ArrayLike<number>;
|
|
79
|
+
/** Extinction per world unit per unit density value ({@link vdbReferenceSigma}). */
|
|
80
|
+
sigma: number;
|
|
81
|
+
/**
|
|
82
|
+
* Bound of the density value (density × mask) inside the volume: the tracking majorant is `sigma · majorant`.
|
|
83
|
+
* Default 1. A smaller bound than the data's maximum biases delta tracking (the CPU twin counts violations).
|
|
84
|
+
*/
|
|
85
|
+
majorant?: number;
|
|
86
|
+
/** `densityCutoff`: values at or below it read 0. Default 0. */
|
|
87
|
+
cutoff?: number;
|
|
88
|
+
/** Base colour (scattering albedo), multiplied by the source's albedo channel. Default (1, 1, 1). */
|
|
89
|
+
albedo?: VDBRefVec3;
|
|
90
|
+
/** Phase function. Default isotropic (g = 0). */
|
|
91
|
+
phase?: VDBReferencePhase;
|
|
92
|
+
/** Emission (read only when the source has an emission channel: `emits`). */
|
|
93
|
+
emission?: VDBReferenceEmission;
|
|
94
|
+
/** The source has an emission channel (the GPU source compiles `vdbSrcEmission` to 0 without one). Default false. */
|
|
95
|
+
emits?: boolean;
|
|
96
|
+
/** `'box'` (default): the unit box. `'sphere'`: the ball inscribed in it (analytic tests). */
|
|
97
|
+
shape?: "box" | "sphere";
|
|
98
|
+
/** The volume's slot in its source (`VDBVolumeSlot.v`; GPU only). Default 0. */
|
|
99
|
+
v?: number;
|
|
100
|
+
/** K6.R1: per-cell majorants (replace `majorant` inside the box). */
|
|
101
|
+
majorantGrid?: VDBReferenceMajorantGrid;
|
|
102
|
+
}
|
|
103
|
+
/** A directional light: `direction` points toward the light (world, any length); `irradiance` in W/m². */
|
|
104
|
+
export interface VDBReferenceDirectionalLight {
|
|
105
|
+
kind: "directional";
|
|
106
|
+
direction: VDBRefVec3;
|
|
107
|
+
irradiance: VDBRefVec3;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* K6.R1: three's `getDistanceAttenuation` (the renderer's 'frame' lighting): 1 / max(d^decay, 0.01), times
|
|
111
|
+
* (clamp(1 − (d / cutoff)⁴))² when `cutoff` > 0.
|
|
112
|
+
*/
|
|
113
|
+
export interface VDBReferenceFalloff {
|
|
114
|
+
decay: number;
|
|
115
|
+
/** three's `light.distance` (0: no window). */
|
|
116
|
+
cutoff?: number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* A point light. Without `inverseSquare` or `falloff` the irradiance is `intensity` at any distance (the renderer's
|
|
120
|
+
* 'volume' lighting); `inverseSquare` is 1/d², `falloff` three's attenuation ('frame' lighting).
|
|
121
|
+
*/
|
|
122
|
+
export interface VDBReferencePointLight {
|
|
123
|
+
kind: "point";
|
|
124
|
+
position: VDBRefVec3;
|
|
125
|
+
intensity: VDBRefVec3;
|
|
126
|
+
inverseSquare?: boolean;
|
|
127
|
+
falloff?: VDBReferenceFalloff;
|
|
128
|
+
}
|
|
129
|
+
/** A spot light: `direction` from the light toward its target; smoothstep(cosOuter, cosInner, cos) attenuation. */
|
|
130
|
+
export interface VDBReferenceSpotLight {
|
|
131
|
+
kind: "spot";
|
|
132
|
+
position: VDBRefVec3;
|
|
133
|
+
direction: VDBRefVec3;
|
|
134
|
+
intensity: VDBRefVec3;
|
|
135
|
+
cosOuter: number;
|
|
136
|
+
cosInner: number;
|
|
137
|
+
inverseSquare?: boolean;
|
|
138
|
+
falloff?: VDBReferenceFalloff;
|
|
139
|
+
}
|
|
140
|
+
export type VDBReferenceLight = VDBReferenceDirectionalLight | VDBReferencePointLight | VDBReferenceSpotLight;
|
|
141
|
+
/** A hemisphere environment: radiance `sky` above the plane ⟂ `up`, `ground` below. */
|
|
142
|
+
export interface VDBReferenceHemisphere {
|
|
143
|
+
sky: VDBRefVec3;
|
|
144
|
+
ground: VDBRefVec3;
|
|
145
|
+
up: VDBRefVec3;
|
|
146
|
+
}
|
|
147
|
+
/** An equirect radiance map (three's equirect mapping), read nearest (texel lookups, no filtering). */
|
|
148
|
+
export interface VDBReferenceEquirect {
|
|
149
|
+
width: number;
|
|
150
|
+
height: number;
|
|
151
|
+
/** RGBA (alpha ignored) floats, row 0 at the top (v = 1: up), x fastest. */
|
|
152
|
+
data: Float32Array;
|
|
153
|
+
/** Radiance multiplier (`environmentIntensity`). Default 1. */
|
|
154
|
+
intensity?: number;
|
|
155
|
+
/** Row-major 3x3 world → map direction rotation. Default identity. */
|
|
156
|
+
rotation?: ArrayLike<number>;
|
|
157
|
+
}
|
|
158
|
+
/** Radiance arriving from infinity: gathered when a path leaves the media after at least one scattering event. */
|
|
159
|
+
export interface VDBReferenceEnvironment {
|
|
160
|
+
/** Uniform radiance from every direction. */
|
|
161
|
+
uniform?: VDBRefVec3;
|
|
162
|
+
/** Hemisphere radiances (summed). At most 4. */
|
|
163
|
+
hemispheres?: VDBReferenceHemisphere[];
|
|
164
|
+
/** An equirect map (summed). */
|
|
165
|
+
equirect?: VDBReferenceEquirect;
|
|
166
|
+
/**
|
|
167
|
+
* K6.R1: a light probe: radiance as 9 RGB spherical-harmonic coefficients in three's `SphericalHarmonics3` order and
|
|
168
|
+
* basis (27 numbers, coefficient-major), L(d) = Σ cᵢ Yᵢ(d), not clamped (the renderer's irradiance is the cosine
|
|
169
|
+
* convolution of the same function). Summed.
|
|
170
|
+
*/
|
|
171
|
+
sh?: ArrayLike<number>;
|
|
172
|
+
}
|
|
173
|
+
/** The camera: rays from the view origin through each pixel (perspective) or parallel (orthographic). */
|
|
174
|
+
export interface VDBReferenceCamera {
|
|
175
|
+
/** Column-major 4x4 camera → world (three's `camera.matrixWorld`). */
|
|
176
|
+
cameraToWorld: ArrayLike<number>;
|
|
177
|
+
/** Column-major 4x4 inverse projection (three's `projectionMatrixInverse`; WebGL or WebGPU depth range). */
|
|
178
|
+
projectionInverse: ArrayLike<number>;
|
|
179
|
+
/** Orthographic projection: parallel rays from the ndc z = −1 plane. Default false (rays from the view origin). */
|
|
180
|
+
orthographic?: boolean;
|
|
181
|
+
}
|
|
182
|
+
/** The render settings shared by the GPU kernel and the twin. */
|
|
183
|
+
export interface VDBReferenceSettings {
|
|
184
|
+
width: number;
|
|
185
|
+
height: number;
|
|
186
|
+
/**
|
|
187
|
+
* Scattering events per path (1 = single scattering, of the lights and of the environment: the last event still
|
|
188
|
+
* samples a direction and gathers the environment if the path escapes). Default 256; a collision past it ends the
|
|
189
|
+
* path (bias).
|
|
190
|
+
*/
|
|
191
|
+
maxBounces?: number;
|
|
192
|
+
/** Russian roulette on the path throughput from this depth on (survival = min(max(β), 1)). Default 4. */
|
|
193
|
+
rrStart?: number;
|
|
194
|
+
/** Seed of every random stream. Default 1. */
|
|
195
|
+
seed?: number;
|
|
196
|
+
/** Samples per pixel per batch (one dispatch). Default 1. */
|
|
197
|
+
spp?: number;
|
|
198
|
+
/** `'center'` (default): every sample through the pixel centre (as the froxel renderer's lookups); `'box'`: uniform in the pixel. */
|
|
199
|
+
pixelFilter?: "center" | "box";
|
|
200
|
+
/**
|
|
201
|
+
* K6.R2: how the equirect map is gathered. 'mis' (default): next-event estimation of the map at every collision
|
|
202
|
+
* (importance-sampled by luminance × solid angle, `vdbReferenceEnvironmentSampler`) combined with the phase-sampled
|
|
203
|
+
* escape by the power heuristic; 'phase': escapes only (K6.R / K6.R1; a small sun is found by chance). Uniform,
|
|
204
|
+
* hemisphere and probe light are gathered by escapes in both.
|
|
205
|
+
*/
|
|
206
|
+
environmentSampling?: "phase" | "mis";
|
|
207
|
+
}
|
|
208
|
+
/** The whole reference scene. */
|
|
209
|
+
export interface VDBReferenceScene {
|
|
210
|
+
camera: VDBReferenceCamera;
|
|
211
|
+
volumes: VDBReferenceVolume[];
|
|
212
|
+
lights?: VDBReferenceLight[];
|
|
213
|
+
environment?: VDBReferenceEnvironment;
|
|
214
|
+
}
|
|
215
|
+
/** Most volumes and lights one GPU kernel takes (uniform arrays). */
|
|
216
|
+
export declare const VDB_REFERENCE_MAX_VOLUMES = 8;
|
|
217
|
+
export declare const VDB_REFERENCE_MAX_LIGHTS = 16;
|
|
218
|
+
export declare const VDB_REFERENCE_MAX_HEMISPHERES = 4;
|
|
219
|
+
/** Most tracking steps of one ray (a guard: an unbounded loop must never hang a GPU). */
|
|
220
|
+
export declare const VDB_REFERENCE_MAX_STEPS: number;
|
|
221
|
+
/** Ratio tracking plays Russian roulette (survive 1/2, weight × 2) once its transmittance drops below this. */
|
|
222
|
+
export declare const VDB_REFERENCE_RATIO_RR = 0.1;
|
|
223
|
+
/**
|
|
224
|
+
* The renderer's punctual light units → irradiance. 'volume' lighting adds `color · phasê · T` to the irradiance and
|
|
225
|
+
* divides by π (inject-material.ts), with phasê the phase over the isotropic phase 1/(4π): the scattered radiance is
|
|
226
|
+
* albedo · color · 4π·p · T / π = albedo · p · (4·color) · T. A directional light of three colour C is irradiance 4C
|
|
227
|
+
* in the reference (three's Lambert surfaces see C: the renderer's volumes are 4× brighter under punctual lights
|
|
228
|
+
* than its own ambient convention; a convention, not an approximation, so the reference follows it).
|
|
229
|
+
*/
|
|
230
|
+
export declare const VDB_REFERENCE_DIRECT_LIGHT_SCALE = 4;
|
|
231
|
+
/** The resolved settings with defaults. */
|
|
232
|
+
export declare function vdbReferenceSettings(s: VDBReferenceSettings): Required<VDBReferenceSettings>;
|
|
233
|
+
/**
|
|
234
|
+
* The renderer's extinction per world unit per density value: `densityScale` (÷ the mean non-zero density when
|
|
235
|
+
* `normalizeDensity`) × `extinction` ÷ `worldScale`, the largest axis scale of the unit-box → world matrix
|
|
236
|
+
* (three/frame/renderer.ts `setVolumeUniforms`).
|
|
237
|
+
*/
|
|
238
|
+
export declare function vdbReferenceSigma(o: {
|
|
239
|
+
localToWorld: ArrayLike<number>;
|
|
240
|
+
extinction: number;
|
|
241
|
+
densityScale?: number;
|
|
242
|
+
normalizeDensity?: boolean;
|
|
243
|
+
meanNonZero?: number;
|
|
244
|
+
}): number;
|
|
245
|
+
/**
|
|
246
|
+
* A renderer light (design K6-core-renderer.md §2.3 `VDBFrameLight`, without ids, masks or shadow requests). Point and
|
|
247
|
+
* spot lights carry three's `distance` (0: no window) and `decay` (default 2), used by 'frame' lighting only.
|
|
248
|
+
*/
|
|
249
|
+
export type VDBReferenceFrameLight = {
|
|
250
|
+
kind: "ambient";
|
|
251
|
+
color: VDBRefVec3;
|
|
252
|
+
} | {
|
|
253
|
+
kind: "hemisphere";
|
|
254
|
+
sky: VDBRefVec3;
|
|
255
|
+
ground: VDBRefVec3;
|
|
256
|
+
up: VDBRefVec3;
|
|
257
|
+
} | {
|
|
258
|
+
kind: "directional";
|
|
259
|
+
direction: VDBRefVec3;
|
|
260
|
+
color: VDBRefVec3;
|
|
261
|
+
} | {
|
|
262
|
+
kind: "point";
|
|
263
|
+
position: VDBRefVec3;
|
|
264
|
+
color: VDBRefVec3;
|
|
265
|
+
distance?: number;
|
|
266
|
+
decay?: number;
|
|
267
|
+
} | {
|
|
268
|
+
kind: "spot";
|
|
269
|
+
position: VDBRefVec3;
|
|
270
|
+
direction: VDBRefVec3;
|
|
271
|
+
color: VDBRefVec3;
|
|
272
|
+
cosAngle: number;
|
|
273
|
+
cosPenumbra: number;
|
|
274
|
+
distance?: number;
|
|
275
|
+
decay?: number;
|
|
276
|
+
} | {
|
|
277
|
+
kind: "probe";
|
|
278
|
+
sh: ArrayLike<number>;
|
|
279
|
+
};
|
|
280
|
+
/** Options of {@link vdbReferenceLightsFromFrame}. */
|
|
281
|
+
export interface VDBReferenceLightMapping {
|
|
282
|
+
/**
|
|
283
|
+
* The renderer's lighting mode the reference stands for (K6.R1). 'volume' (default): point and spot lights have no
|
|
284
|
+
* distance falloff (inject-material.ts, core gather; V84). 'frame': three's `getDistanceAttenuation` with the
|
|
285
|
+
* light's `distance` and `decay` (lighting-material.ts, core lighting.ts `vdbFrameDistanceAttenuation`).
|
|
286
|
+
*/
|
|
287
|
+
lighting?: "volume" | "frame";
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* The renderer's lights in reference units: punctual lights × {@link VDB_REFERENCE_DIRECT_LIGHT_SCALE}; ambient C is
|
|
291
|
+
* a uniform radiance C/π and a hemisphere light's sky / ground are radiances S/π, G/π (three: an up-facing Lambert
|
|
292
|
+
* surface gets irradiance C, and the renderer's isotropic light gives albedo · C / π); a light probe's SH are radiance
|
|
293
|
+
* coefficients already (three's `shGetIrradianceAt` is their cosine convolution). `direction` of a directional light
|
|
294
|
+
* points toward the light (his `position − target`), of a spot from the light toward its target. Point and spot
|
|
295
|
+
* falloff follows the lighting mode ({@link VDBReferenceLightMapping}).
|
|
296
|
+
*/
|
|
297
|
+
export declare function vdbReferenceLightsFromFrame(lights: readonly VDBReferenceFrameLight[], o?: VDBReferenceLightMapping): {
|
|
298
|
+
lights: VDBReferenceLight[];
|
|
299
|
+
environment: VDBReferenceEnvironment;
|
|
300
|
+
};
|
|
301
|
+
/** three's `getDistanceAttenuation` (Frostbite window; the renderer's 'frame' point and spot lights). */
|
|
302
|
+
export declare function vdbRefDistanceAttenuation(distance: number, falloff: VDBReferenceFalloff): number;
|
|
303
|
+
/** three's `SphericalHarmonics3` basis (Yᵢ, i = 0 … 8) at the unit direction `d`. */
|
|
304
|
+
export declare function vdbRefShBasis(d: readonly number[]): number[];
|
|
305
|
+
/** Inverse of a column-major 4x4 (general). */
|
|
306
|
+
export declare function vdbRefInvert4(m: ArrayLike<number>): Float64Array;
|
|
307
|
+
/** Column-major 4x4 × point (w = 1), divided by w. */
|
|
308
|
+
export declare function vdbRefTransformPoint(m: ArrayLike<number>, p: readonly number[]): VDBRefVec3;
|
|
309
|
+
/** Column-major 4x4 × vector (w = 0). */
|
|
310
|
+
export declare function vdbRefTransformVector(m: ArrayLike<number>, v: readonly number[]): VDBRefVec3;
|
|
311
|
+
/** Column-major 4x4 product a × b. */
|
|
312
|
+
export declare function vdbRefMultiply4(a: ArrayLike<number>, b: ArrayLike<number>): Float64Array;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K6.R: the scene of the reference renderer (design K6-core-renderer.md §7.4): plain data shared by the GPU kernel
|
|
3
|
+
* (`core/reference/`) and its CPU twin ({@link vdbReferenceRenderCpu}).
|
|
4
|
+
*
|
|
5
|
+
* The medium is the renderer's (three/frame/inject-material.ts, volume-source.ts `sampleExtinction`): each volume is
|
|
6
|
+
* a local unit box [−0.5, 0.5]³ placed in the world by `localToWorld`, with extinction per world unit
|
|
7
|
+
* σt(x) = `sigma` · value(uvw), value = density × mask, zero at or below `cutoff`, uvw = local + 0.5 (no wrap or
|
|
8
|
+
* offset). The renderer's `sigma` is `densityScale · extinction / worldScale` ({@link vdbReferenceSigma}). Volumes
|
|
9
|
+
* that overlap add their extinction (co-located media): a collision picks volume i with probability σᵢ / σ.
|
|
10
|
+
* Scattering albedo: `albedo` × the source's albedo channel. Emission is the renderer's source term σt · Le with
|
|
11
|
+
* Le = `emission.color` · (T / max(T₁, 1))⁴ · `intensity`, T = mix(T₀, T₁, emission value), 0 when T ≤ 0.
|
|
12
|
+
*
|
|
13
|
+
* Units are radiometric: directional lights carry irradiance, point and spot lights intensity (with no distance
|
|
14
|
+
* falloff unless `inverseSquare`: the renderer's point and spot lights have none), the environment carries radiance.
|
|
15
|
+
* {@link vdbReferenceLightsFromFrame} maps the renderer's light inputs (design §2.3 `VDBFrameLight`, three's
|
|
16
|
+
* `color × intensity`) into these units.
|
|
17
|
+
*/
|
|
18
|
+
/** Most volumes and lights one GPU kernel takes (uniform arrays). */
|
|
19
|
+
export const VDB_REFERENCE_MAX_VOLUMES = 8;
|
|
20
|
+
export const VDB_REFERENCE_MAX_LIGHTS = 16;
|
|
21
|
+
export const VDB_REFERENCE_MAX_HEMISPHERES = 4;
|
|
22
|
+
/** Most tracking steps of one ray (a guard: an unbounded loop must never hang a GPU). */
|
|
23
|
+
export const VDB_REFERENCE_MAX_STEPS = 1 << 20;
|
|
24
|
+
/** Ratio tracking plays Russian roulette (survive 1/2, weight × 2) once its transmittance drops below this. */
|
|
25
|
+
export const VDB_REFERENCE_RATIO_RR = 0.1;
|
|
26
|
+
/**
|
|
27
|
+
* The renderer's punctual light units → irradiance. 'volume' lighting adds `color · phasê · T` to the irradiance and
|
|
28
|
+
* divides by π (inject-material.ts), with phasê the phase over the isotropic phase 1/(4π): the scattered radiance is
|
|
29
|
+
* albedo · color · 4π·p · T / π = albedo · p · (4·color) · T. A directional light of three colour C is irradiance 4C
|
|
30
|
+
* in the reference (three's Lambert surfaces see C: the renderer's volumes are 4× brighter under punctual lights
|
|
31
|
+
* than its own ambient convention; a convention, not an approximation, so the reference follows it).
|
|
32
|
+
*/
|
|
33
|
+
export const VDB_REFERENCE_DIRECT_LIGHT_SCALE = 4;
|
|
34
|
+
/** The resolved settings with defaults. */
|
|
35
|
+
export function vdbReferenceSettings(s) {
|
|
36
|
+
return {
|
|
37
|
+
width: s.width,
|
|
38
|
+
height: s.height,
|
|
39
|
+
maxBounces: s.maxBounces ?? 256,
|
|
40
|
+
rrStart: s.rrStart ?? 4,
|
|
41
|
+
seed: (s.seed ?? 1) >>> 0,
|
|
42
|
+
spp: Math.max(1, Math.floor(s.spp ?? 1)),
|
|
43
|
+
pixelFilter: s.pixelFilter ?? "center",
|
|
44
|
+
environmentSampling: s.environmentSampling ?? "mis",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The renderer's extinction per world unit per density value: `densityScale` (÷ the mean non-zero density when
|
|
49
|
+
* `normalizeDensity`) × `extinction` ÷ `worldScale`, the largest axis scale of the unit-box → world matrix
|
|
50
|
+
* (three/frame/renderer.ts `setVolumeUniforms`).
|
|
51
|
+
*/
|
|
52
|
+
export function vdbReferenceSigma(o) {
|
|
53
|
+
const m = o.localToWorld;
|
|
54
|
+
const scale = Math.sqrt(Math.max(m[0] ** 2 + m[1] ** 2 + m[2] ** 2, m[4] ** 2 + m[5] ** 2 + m[6] ** 2, m[8] ** 2 + m[9] ** 2 + m[10] ** 2));
|
|
55
|
+
let density = o.densityScale ?? 1;
|
|
56
|
+
if ((o.normalizeDensity ?? true) && (o.meanNonZero ?? 0) > 0)
|
|
57
|
+
density /= o.meanNonZero;
|
|
58
|
+
return (density * o.extinction) / scale;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The renderer's lights in reference units: punctual lights × {@link VDB_REFERENCE_DIRECT_LIGHT_SCALE}; ambient C is
|
|
62
|
+
* a uniform radiance C/π and a hemisphere light's sky / ground are radiances S/π, G/π (three: an up-facing Lambert
|
|
63
|
+
* surface gets irradiance C, and the renderer's isotropic light gives albedo · C / π); a light probe's SH are radiance
|
|
64
|
+
* coefficients already (three's `shGetIrradianceAt` is their cosine convolution). `direction` of a directional light
|
|
65
|
+
* points toward the light (his `position − target`), of a spot from the light toward its target. Point and spot
|
|
66
|
+
* falloff follows the lighting mode ({@link VDBReferenceLightMapping}).
|
|
67
|
+
*/
|
|
68
|
+
export function vdbReferenceLightsFromFrame(lights, o = {}) {
|
|
69
|
+
const k = VDB_REFERENCE_DIRECT_LIGHT_SCALE;
|
|
70
|
+
const frame = (o.lighting ?? "volume") === "frame";
|
|
71
|
+
const scale = (c, s) => c.map((x) => x * s);
|
|
72
|
+
const out = [];
|
|
73
|
+
const environment = {};
|
|
74
|
+
for (const l of lights) {
|
|
75
|
+
if (l.kind === "ambient") {
|
|
76
|
+
const u = environment.uniform ?? [0, 0, 0];
|
|
77
|
+
environment.uniform = u.map((x, i) => x + l.color[i] / Math.PI);
|
|
78
|
+
}
|
|
79
|
+
else if (l.kind === "hemisphere") {
|
|
80
|
+
(environment.hemispheres ??= []).push({ sky: scale(l.sky, 1 / Math.PI), ground: scale(l.ground, 1 / Math.PI), up: l.up });
|
|
81
|
+
}
|
|
82
|
+
else if (l.kind === "probe") {
|
|
83
|
+
if (l.sh.length !== 27)
|
|
84
|
+
throw new RangeError(`vdbReferenceLightsFromFrame: a probe needs 27 SH numbers, got ${l.sh.length}`);
|
|
85
|
+
environment.sh = Array.from({ length: 27 }, (_, i) => (environment.sh?.[i] ?? 0) + l.sh[i]);
|
|
86
|
+
}
|
|
87
|
+
else if (l.kind === "directional") {
|
|
88
|
+
out.push({ kind: "directional", direction: l.direction, irradiance: scale(l.color, k) });
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const falloff = frame ? { falloff: { decay: l.decay ?? 2, cutoff: l.distance ?? 0 } } : {};
|
|
92
|
+
if (l.kind === "point")
|
|
93
|
+
out.push({ kind: "point", position: l.position, intensity: scale(l.color, k), ...falloff });
|
|
94
|
+
else
|
|
95
|
+
out.push({ kind: "spot", position: l.position, direction: l.direction, intensity: scale(l.color, k), cosOuter: l.cosAngle, cosInner: l.cosPenumbra, ...falloff });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { lights: out, environment };
|
|
99
|
+
}
|
|
100
|
+
/** three's `getDistanceAttenuation` (Frostbite window; the renderer's 'frame' point and spot lights). */
|
|
101
|
+
export function vdbRefDistanceAttenuation(distance, falloff) {
|
|
102
|
+
const f = 1 / Math.max(Math.pow(distance, falloff.decay), 0.01);
|
|
103
|
+
const cutoff = falloff.cutoff ?? 0;
|
|
104
|
+
if (cutoff > 0) {
|
|
105
|
+
const x = Math.min(Math.max(1 - Math.pow(distance / cutoff, 4), 0), 1);
|
|
106
|
+
return f * x * x;
|
|
107
|
+
}
|
|
108
|
+
return f;
|
|
109
|
+
}
|
|
110
|
+
/** three's `SphericalHarmonics3` basis (Yᵢ, i = 0 … 8) at the unit direction `d`. */
|
|
111
|
+
export function vdbRefShBasis(d) {
|
|
112
|
+
const x = d[0];
|
|
113
|
+
const y = d[1];
|
|
114
|
+
const z = d[2];
|
|
115
|
+
return [0.282095, 0.488603 * y, 0.488603 * z, 0.488603 * x, 1.092548 * x * y, 1.092548 * y * z, 0.315392 * (3 * z * z - 1), 1.092548 * x * z, 0.546274 * (x * x - y * y)];
|
|
116
|
+
}
|
|
117
|
+
// ── Small maths shared by the twin and the uniform packer ─────────────────────────────────────────────
|
|
118
|
+
/** Inverse of a column-major 4x4 (general). */
|
|
119
|
+
export function vdbRefInvert4(m) {
|
|
120
|
+
const a = Array.from({ length: 16 }, (_, i) => m[i]);
|
|
121
|
+
const inv = new Float64Array(16);
|
|
122
|
+
inv[0] = a[5] * a[10] * a[15] - a[5] * a[11] * a[14] - a[9] * a[6] * a[15] + a[9] * a[7] * a[14] + a[13] * a[6] * a[11] - a[13] * a[7] * a[10];
|
|
123
|
+
inv[4] = -a[4] * a[10] * a[15] + a[4] * a[11] * a[14] + a[8] * a[6] * a[15] - a[8] * a[7] * a[14] - a[12] * a[6] * a[11] + a[12] * a[7] * a[10];
|
|
124
|
+
inv[8] = a[4] * a[9] * a[15] - a[4] * a[11] * a[13] - a[8] * a[5] * a[15] + a[8] * a[7] * a[13] + a[12] * a[5] * a[11] - a[12] * a[7] * a[9];
|
|
125
|
+
inv[12] = -a[4] * a[9] * a[14] + a[4] * a[10] * a[13] + a[8] * a[5] * a[14] - a[8] * a[6] * a[13] - a[12] * a[5] * a[10] + a[12] * a[6] * a[9];
|
|
126
|
+
inv[1] = -a[1] * a[10] * a[15] + a[1] * a[11] * a[14] + a[9] * a[2] * a[15] - a[9] * a[3] * a[14] - a[13] * a[2] * a[11] + a[13] * a[3] * a[10];
|
|
127
|
+
inv[5] = a[0] * a[10] * a[15] - a[0] * a[11] * a[14] - a[8] * a[2] * a[15] + a[8] * a[3] * a[14] + a[12] * a[2] * a[11] - a[12] * a[3] * a[10];
|
|
128
|
+
inv[9] = -a[0] * a[9] * a[15] + a[0] * a[11] * a[13] + a[8] * a[1] * a[15] - a[8] * a[3] * a[13] - a[12] * a[1] * a[11] + a[12] * a[3] * a[9];
|
|
129
|
+
inv[13] = a[0] * a[9] * a[14] - a[0] * a[10] * a[13] - a[8] * a[1] * a[14] + a[8] * a[2] * a[13] + a[12] * a[1] * a[10] - a[12] * a[2] * a[9];
|
|
130
|
+
inv[2] = a[1] * a[6] * a[15] - a[1] * a[7] * a[14] - a[5] * a[2] * a[15] + a[5] * a[3] * a[14] + a[13] * a[2] * a[7] - a[13] * a[3] * a[6];
|
|
131
|
+
inv[6] = -a[0] * a[6] * a[15] + a[0] * a[7] * a[14] + a[4] * a[2] * a[15] - a[4] * a[3] * a[14] - a[12] * a[2] * a[7] + a[12] * a[3] * a[6];
|
|
132
|
+
inv[10] = a[0] * a[5] * a[15] - a[0] * a[7] * a[13] - a[4] * a[1] * a[15] + a[4] * a[3] * a[13] + a[12] * a[1] * a[7] - a[12] * a[3] * a[5];
|
|
133
|
+
inv[14] = -a[0] * a[5] * a[14] + a[0] * a[6] * a[13] + a[4] * a[1] * a[14] - a[4] * a[2] * a[13] - a[12] * a[1] * a[6] + a[12] * a[2] * a[5];
|
|
134
|
+
inv[3] = -a[1] * a[6] * a[11] + a[1] * a[7] * a[10] + a[5] * a[2] * a[11] - a[5] * a[3] * a[10] - a[9] * a[2] * a[7] + a[9] * a[3] * a[6];
|
|
135
|
+
inv[7] = a[0] * a[6] * a[11] - a[0] * a[7] * a[10] - a[4] * a[2] * a[11] + a[4] * a[3] * a[10] + a[8] * a[2] * a[7] - a[8] * a[3] * a[6];
|
|
136
|
+
inv[11] = -a[0] * a[5] * a[11] + a[0] * a[7] * a[9] + a[4] * a[1] * a[11] - a[4] * a[3] * a[9] - a[8] * a[1] * a[7] + a[8] * a[3] * a[5];
|
|
137
|
+
inv[15] = a[0] * a[5] * a[10] - a[0] * a[6] * a[9] - a[4] * a[1] * a[10] + a[4] * a[2] * a[9] + a[8] * a[1] * a[6] - a[8] * a[2] * a[5];
|
|
138
|
+
const det = a[0] * inv[0] + a[1] * inv[4] + a[2] * inv[8] + a[3] * inv[12];
|
|
139
|
+
if (det === 0 || !Number.isFinite(det))
|
|
140
|
+
throw new RangeError("vdbRefInvert4: singular matrix");
|
|
141
|
+
for (let i = 0; i < 16; i++)
|
|
142
|
+
inv[i] = inv[i] / det;
|
|
143
|
+
return inv;
|
|
144
|
+
}
|
|
145
|
+
/** Column-major 4x4 × point (w = 1), divided by w. */
|
|
146
|
+
export function vdbRefTransformPoint(m, p) {
|
|
147
|
+
const x = m[0] * p[0] + m[4] * p[1] + m[8] * p[2] + m[12];
|
|
148
|
+
const y = m[1] * p[0] + m[5] * p[1] + m[9] * p[2] + m[13];
|
|
149
|
+
const z = m[2] * p[0] + m[6] * p[1] + m[10] * p[2] + m[14];
|
|
150
|
+
const w = m[3] * p[0] + m[7] * p[1] + m[11] * p[2] + m[15];
|
|
151
|
+
return [x / w, y / w, z / w];
|
|
152
|
+
}
|
|
153
|
+
/** Column-major 4x4 × vector (w = 0). */
|
|
154
|
+
export function vdbRefTransformVector(m, v) {
|
|
155
|
+
return [m[0] * v[0] + m[4] * v[1] + m[8] * v[2], m[1] * v[0] + m[5] * v[1] + m[9] * v[2], m[2] * v[0] + m[6] * v[1] + m[10] * v[2]];
|
|
156
|
+
}
|
|
157
|
+
/** Column-major 4x4 product a × b. */
|
|
158
|
+
export function vdbRefMultiply4(a, b) {
|
|
159
|
+
const o = new Float64Array(16);
|
|
160
|
+
for (let c = 0; c < 4; c++)
|
|
161
|
+
for (let r = 0; r < 4; r++) {
|
|
162
|
+
let s = 0;
|
|
163
|
+
for (let k = 0; k < 4; k++)
|
|
164
|
+
s += a[k * 4 + r] * b[c * 4 + k];
|
|
165
|
+
o[c * 4 + r] = s;
|
|
166
|
+
}
|
|
167
|
+
return o;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=scene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene.js","sourceRoot":"","sources":["../../../src/tools/reference/scene.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAyNH,qEAAqE;AACrE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAC/C,yFAAyF;AACzF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,CAAC;AAC/C,+GAA+G;AAC/G,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAElD,2CAA2C;AAC3C,MAAM,UAAU,oBAAoB,CAAC,CAAuB;IAC1D,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,UAAU,EAAE,CAAC,CAAC,UAAU,IAAI,GAAG;QAC/B,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC;QACvB,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC;QACzB,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACxC,WAAW,EAAE,CAAC,CAAC,WAAW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,EAAE;gBAAE,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAE,CAAC;YAC/D,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/**\n * K6.R: the scene of the reference renderer (design K6-core-renderer.md §7.4): plain data shared by the GPU kernel\n * (`core/reference/`) and its CPU twin ({@link vdbReferenceRenderCpu}).\n *\n * The medium is the renderer's (three/frame/inject-material.ts, volume-source.ts `sampleExtinction`): each volume is\n * a local unit box [−0.5, 0.5]³ placed in the world by `localToWorld`, with extinction per world unit\n * σt(x) = `sigma` · value(uvw), value = density × mask, zero at or below `cutoff`, uvw = local + 0.5 (no wrap or\n * offset). The renderer's `sigma` is `densityScale · extinction / worldScale` ({@link vdbReferenceSigma}). Volumes\n * that overlap add their extinction (co-located media): a collision picks volume i with probability σᵢ / σ.\n * Scattering albedo: `albedo` × the source's albedo channel. Emission is the renderer's source term σt · Le with\n * Le = `emission.color` · (T / max(T₁, 1))⁴ · `intensity`, T = mix(T₀, T₁, emission value), 0 when T ≤ 0.\n *\n * Units are radiometric: directional lights carry irradiance, point and spot lights intensity (with no distance\n * falloff unless `inverseSquare`: the renderer's point and spot lights have none), the environment carries radiance.\n * {@link vdbReferenceLightsFromFrame} maps the renderer's light inputs (design §2.3 `VDBFrameLight`, three's\n * `color × intensity`) into these units.\n */\n\nexport type VDBRefVec3 = [number, number, number];\n\n/**\n * Henyey-Greenstein (`backWeight` 0) or dual-lobe HG: (1 − w)·HG(g) + w·HG(backG); or, with `table`, a tabulated\n * phase (Lorenz-Mie, Mie RGB: {@link vdbReferenceMiePhaseTable}) that replaces the lobes.\n */\nexport interface VDBReferencePhase {\n /** Forward lobe asymmetry, (−1, 1). */\n g: number;\n /** Back lobe asymmetry (dual-lobe). Default 0. */\n backG?: number;\n /** Weight of the back lobe, [0, 1]. Default 0 (plain HG). */\n backWeight?: number;\n /** K6.R1: a tabulated phase per channel; `g`, `backG`, `backWeight` are then ignored. */\n table?: VDBReferencePhaseTable;\n}\n\n/**\n * K6.R1: a phase function per RGB channel tabulated as phase / isotropic (his Lorenz-Mie texel layout): `size`\n * angles θ = π u², u = i / (size − 1), read with linear blending in u (`vdbFrameMieTexel`). `cdf` is the sampling\n * table ({@link vdbReferencePhaseTableCdf}): sampling picks u from the piecewise-constant marginal of the channel\n * mean and weights each channel by its phase over that density, so the estimate is unbiased per channel.\n */\nexport interface VDBReferencePhaseTable {\n size: number;\n /** RGB per angle (`size` × 3). */\n values: Float32Array;\n /** Cumulative distribution of u at the `size` table angles (0 … 1). */\n cdf: Float32Array;\n}\n\n/** K6.R1: an emission colour table over log temperature (the renderer's blackbody LUT, `vdbReferenceBlackbodyTable`). */\nexport interface VDBReferenceColorTable {\n size: number;\n /** RGB per column (`size` × 3); column i at T = minTemperature · (max/min)^(i / (size − 1)). */\n values: Float32Array;\n minTemperature: number;\n maxTemperature: number;\n}\n\n/**\n * K6.R1: a per-cell bound of the density value (density × mask, before σ) over the volume's unit box: cell\n * (i, j, k) covers uvw ∈ [i/nx, (i+1)/nx] × … (x fastest). Tracking uses σ · bound of the cell the ray is in\n * (piecewise-constant majorants: empty and thin cells cost few null collisions). Built from the sparse pool's node\n * stats ({@link vdbReferenceMajorantGridSparse}) or the dense texels ({@link vdbReferenceMajorantGridDense}).\n */\nexport interface VDBReferenceMajorantGrid {\n dims: [number, number, number];\n values: Float32Array;\n}\n\n/** The renderer's emission model (volume-source.ts `sampleEmission`), white unless `color` is given. */\nexport interface VDBReferenceEmission {\n /** Colour of the emission (the renderer's `emissionColor` hook evaluated as a constant). Default white. */\n color?: VDBRefVec3;\n /** `emissiveIntensity`. Default 1. */\n intensity?: number;\n /** `temperatureRange` in kelvin. Default [0, 6500]. */\n temperatureRange?: [number, number];\n /** K6.R1: the colour hook as a table over temperature (blackbody), multiplied with `color`. Default white. */\n colorTable?: VDBReferenceColorTable;\n}\n\n/** One volume of the reference scene. */\nexport interface VDBReferenceVolume {\n /** Column-major 4x4: local unit box [−0.5, 0.5]³ → world. */\n localToWorld: ArrayLike<number>;\n /** Extinction per world unit per unit density value ({@link vdbReferenceSigma}). */\n sigma: number;\n /**\n * Bound of the density value (density × mask) inside the volume: the tracking majorant is `sigma · majorant`.\n * Default 1. A smaller bound than the data's maximum biases delta tracking (the CPU twin counts violations).\n */\n majorant?: number;\n /** `densityCutoff`: values at or below it read 0. Default 0. */\n cutoff?: number;\n /** Base colour (scattering albedo), multiplied by the source's albedo channel. Default (1, 1, 1). */\n albedo?: VDBRefVec3;\n /** Phase function. Default isotropic (g = 0). */\n phase?: VDBReferencePhase;\n /** Emission (read only when the source has an emission channel: `emits`). */\n emission?: VDBReferenceEmission;\n /** The source has an emission channel (the GPU source compiles `vdbSrcEmission` to 0 without one). Default false. */\n emits?: boolean;\n /** `'box'` (default): the unit box. `'sphere'`: the ball inscribed in it (analytic tests). */\n shape?: \"box\" | \"sphere\";\n /** The volume's slot in its source (`VDBVolumeSlot.v`; GPU only). Default 0. */\n v?: number;\n /** K6.R1: per-cell majorants (replace `majorant` inside the box). */\n majorantGrid?: VDBReferenceMajorantGrid;\n}\n\n/** A directional light: `direction` points toward the light (world, any length); `irradiance` in W/m². */\nexport interface VDBReferenceDirectionalLight {\n kind: \"directional\";\n direction: VDBRefVec3;\n irradiance: VDBRefVec3;\n}\n\n/**\n * K6.R1: three's `getDistanceAttenuation` (the renderer's 'frame' lighting): 1 / max(d^decay, 0.01), times\n * (clamp(1 − (d / cutoff)⁴))² when `cutoff` > 0.\n */\nexport interface VDBReferenceFalloff {\n decay: number;\n /** three's `light.distance` (0: no window). */\n cutoff?: number;\n}\n\n/**\n * A point light. Without `inverseSquare` or `falloff` the irradiance is `intensity` at any distance (the renderer's\n * 'volume' lighting); `inverseSquare` is 1/d², `falloff` three's attenuation ('frame' lighting).\n */\nexport interface VDBReferencePointLight {\n kind: \"point\";\n position: VDBRefVec3;\n intensity: VDBRefVec3;\n inverseSquare?: boolean;\n falloff?: VDBReferenceFalloff;\n}\n\n/** A spot light: `direction` from the light toward its target; smoothstep(cosOuter, cosInner, cos) attenuation. */\nexport interface VDBReferenceSpotLight {\n kind: \"spot\";\n position: VDBRefVec3;\n direction: VDBRefVec3;\n intensity: VDBRefVec3;\n cosOuter: number;\n cosInner: number;\n inverseSquare?: boolean;\n falloff?: VDBReferenceFalloff;\n}\n\nexport type VDBReferenceLight = VDBReferenceDirectionalLight | VDBReferencePointLight | VDBReferenceSpotLight;\n\n/** A hemisphere environment: radiance `sky` above the plane ⟂ `up`, `ground` below. */\nexport interface VDBReferenceHemisphere {\n sky: VDBRefVec3;\n ground: VDBRefVec3;\n up: VDBRefVec3;\n}\n\n/** An equirect radiance map (three's equirect mapping), read nearest (texel lookups, no filtering). */\nexport interface VDBReferenceEquirect {\n width: number;\n height: number;\n /** RGBA (alpha ignored) floats, row 0 at the top (v = 1: up), x fastest. */\n data: Float32Array;\n /** Radiance multiplier (`environmentIntensity`). Default 1. */\n intensity?: number;\n /** Row-major 3x3 world → map direction rotation. Default identity. */\n rotation?: ArrayLike<number>;\n}\n\n/** Radiance arriving from infinity: gathered when a path leaves the media after at least one scattering event. */\nexport interface VDBReferenceEnvironment {\n /** Uniform radiance from every direction. */\n uniform?: VDBRefVec3;\n /** Hemisphere radiances (summed). At most 4. */\n hemispheres?: VDBReferenceHemisphere[];\n /** An equirect map (summed). */\n equirect?: VDBReferenceEquirect;\n /**\n * K6.R1: a light probe: radiance as 9 RGB spherical-harmonic coefficients in three's `SphericalHarmonics3` order and\n * basis (27 numbers, coefficient-major), L(d) = Σ cᵢ Yᵢ(d), not clamped (the renderer's irradiance is the cosine\n * convolution of the same function). Summed.\n */\n sh?: ArrayLike<number>;\n}\n\n/** The camera: rays from the view origin through each pixel (perspective) or parallel (orthographic). */\nexport interface VDBReferenceCamera {\n /** Column-major 4x4 camera → world (three's `camera.matrixWorld`). */\n cameraToWorld: ArrayLike<number>;\n /** Column-major 4x4 inverse projection (three's `projectionMatrixInverse`; WebGL or WebGPU depth range). */\n projectionInverse: ArrayLike<number>;\n /** Orthographic projection: parallel rays from the ndc z = −1 plane. Default false (rays from the view origin). */\n orthographic?: boolean;\n}\n\n/** The render settings shared by the GPU kernel and the twin. */\nexport interface VDBReferenceSettings {\n width: number;\n height: number;\n /**\n * Scattering events per path (1 = single scattering, of the lights and of the environment: the last event still\n * samples a direction and gathers the environment if the path escapes). Default 256; a collision past it ends the\n * path (bias).\n */\n maxBounces?: number;\n /** Russian roulette on the path throughput from this depth on (survival = min(max(β), 1)). Default 4. */\n rrStart?: number;\n /** Seed of every random stream. Default 1. */\n seed?: number;\n /** Samples per pixel per batch (one dispatch). Default 1. */\n spp?: number;\n /** `'center'` (default): every sample through the pixel centre (as the froxel renderer's lookups); `'box'`: uniform in the pixel. */\n pixelFilter?: \"center\" | \"box\";\n /**\n * K6.R2: how the equirect map is gathered. 'mis' (default): next-event estimation of the map at every collision\n * (importance-sampled by luminance × solid angle, `vdbReferenceEnvironmentSampler`) combined with the phase-sampled\n * escape by the power heuristic; 'phase': escapes only (K6.R / K6.R1; a small sun is found by chance). Uniform,\n * hemisphere and probe light are gathered by escapes in both.\n */\n environmentSampling?: \"phase\" | \"mis\";\n}\n\n/** The whole reference scene. */\nexport interface VDBReferenceScene {\n camera: VDBReferenceCamera;\n volumes: VDBReferenceVolume[];\n lights?: VDBReferenceLight[];\n environment?: VDBReferenceEnvironment;\n}\n\n/** Most volumes and lights one GPU kernel takes (uniform arrays). */\nexport const VDB_REFERENCE_MAX_VOLUMES = 8;\nexport const VDB_REFERENCE_MAX_LIGHTS = 16;\nexport const VDB_REFERENCE_MAX_HEMISPHERES = 4;\n/** Most tracking steps of one ray (a guard: an unbounded loop must never hang a GPU). */\nexport const VDB_REFERENCE_MAX_STEPS = 1 << 20;\n/** Ratio tracking plays Russian roulette (survive 1/2, weight × 2) once its transmittance drops below this. */\nexport const VDB_REFERENCE_RATIO_RR = 0.1;\n\n/**\n * The renderer's punctual light units → irradiance. 'volume' lighting adds `color · phasê · T` to the irradiance and\n * divides by π (inject-material.ts), with phasê the phase over the isotropic phase 1/(4π): the scattered radiance is\n * albedo · color · 4π·p · T / π = albedo · p · (4·color) · T. A directional light of three colour C is irradiance 4C\n * in the reference (three's Lambert surfaces see C: the renderer's volumes are 4× brighter under punctual lights\n * than its own ambient convention; a convention, not an approximation, so the reference follows it).\n */\nexport const VDB_REFERENCE_DIRECT_LIGHT_SCALE = 4;\n\n/** The resolved settings with defaults. */\nexport function vdbReferenceSettings(s: VDBReferenceSettings): Required<VDBReferenceSettings> {\n return {\n width: s.width,\n height: s.height,\n maxBounces: s.maxBounces ?? 256,\n rrStart: s.rrStart ?? 4,\n seed: (s.seed ?? 1) >>> 0,\n spp: Math.max(1, Math.floor(s.spp ?? 1)),\n pixelFilter: s.pixelFilter ?? \"center\",\n environmentSampling: s.environmentSampling ?? \"mis\",\n };\n}\n\n/**\n * The renderer's extinction per world unit per density value: `densityScale` (÷ the mean non-zero density when\n * `normalizeDensity`) × `extinction` ÷ `worldScale`, the largest axis scale of the unit-box → world matrix\n * (three/frame/renderer.ts `setVolumeUniforms`).\n */\nexport function vdbReferenceSigma(o: { localToWorld: ArrayLike<number>; extinction: number; densityScale?: number; normalizeDensity?: boolean; meanNonZero?: number }): number {\n const m = o.localToWorld;\n const scale = Math.sqrt(Math.max(m[0]! ** 2 + m[1]! ** 2 + m[2]! ** 2, m[4]! ** 2 + m[5]! ** 2 + m[6]! ** 2, m[8]! ** 2 + m[9]! ** 2 + m[10]! ** 2));\n let density = o.densityScale ?? 1;\n if ((o.normalizeDensity ?? true) && (o.meanNonZero ?? 0) > 0) density /= o.meanNonZero!;\n return (density * o.extinction) / scale;\n}\n\n/**\n * A renderer light (design K6-core-renderer.md §2.3 `VDBFrameLight`, without ids, masks or shadow requests). Point and\n * spot lights carry three's `distance` (0: no window) and `decay` (default 2), used by 'frame' lighting only.\n */\nexport type VDBReferenceFrameLight =\n | { kind: \"ambient\"; color: VDBRefVec3 }\n | { kind: \"hemisphere\"; sky: VDBRefVec3; ground: VDBRefVec3; up: VDBRefVec3 }\n | { kind: \"directional\"; direction: VDBRefVec3; color: VDBRefVec3 }\n | { kind: \"point\"; position: VDBRefVec3; color: VDBRefVec3; distance?: number; decay?: number }\n | { kind: \"spot\"; position: VDBRefVec3; direction: VDBRefVec3; color: VDBRefVec3; cosAngle: number; cosPenumbra: number; distance?: number; decay?: number }\n | { kind: \"probe\"; sh: ArrayLike<number> };\n\n/** Options of {@link vdbReferenceLightsFromFrame}. */\nexport interface VDBReferenceLightMapping {\n /**\n * The renderer's lighting mode the reference stands for (K6.R1). 'volume' (default): point and spot lights have no\n * distance falloff (inject-material.ts, core gather; V84). 'frame': three's `getDistanceAttenuation` with the\n * light's `distance` and `decay` (lighting-material.ts, core lighting.ts `vdbFrameDistanceAttenuation`).\n */\n lighting?: \"volume\" | \"frame\";\n}\n\n/**\n * The renderer's lights in reference units: punctual lights × {@link VDB_REFERENCE_DIRECT_LIGHT_SCALE}; ambient C is\n * a uniform radiance C/π and a hemisphere light's sky / ground are radiances S/π, G/π (three: an up-facing Lambert\n * surface gets irradiance C, and the renderer's isotropic light gives albedo · C / π); a light probe's SH are radiance\n * coefficients already (three's `shGetIrradianceAt` is their cosine convolution). `direction` of a directional light\n * points toward the light (his `position − target`), of a spot from the light toward its target. Point and spot\n * falloff follows the lighting mode ({@link VDBReferenceLightMapping}).\n */\nexport function vdbReferenceLightsFromFrame(lights: readonly VDBReferenceFrameLight[], o: VDBReferenceLightMapping = {}): { lights: VDBReferenceLight[]; environment: VDBReferenceEnvironment } {\n const k = VDB_REFERENCE_DIRECT_LIGHT_SCALE;\n const frame = (o.lighting ?? \"volume\") === \"frame\";\n const scale = (c: VDBRefVec3, s: number) => c.map((x) => x * s) as VDBRefVec3;\n const out: VDBReferenceLight[] = [];\n const environment: VDBReferenceEnvironment = {};\n for (const l of lights) {\n if (l.kind === \"ambient\") {\n const u = environment.uniform ?? [0, 0, 0];\n environment.uniform = u.map((x, i) => x + l.color[i]! / Math.PI) as VDBRefVec3;\n } else if (l.kind === \"hemisphere\") {\n (environment.hemispheres ??= []).push({ sky: scale(l.sky, 1 / Math.PI), ground: scale(l.ground, 1 / Math.PI), up: l.up });\n } else if (l.kind === \"probe\") {\n if (l.sh.length !== 27) throw new RangeError(`vdbReferenceLightsFromFrame: a probe needs 27 SH numbers, got ${l.sh.length}`);\n environment.sh = Array.from({ length: 27 }, (_, i) => (environment.sh?.[i] ?? 0) + l.sh[i]!);\n } else if (l.kind === \"directional\") {\n out.push({ kind: \"directional\", direction: l.direction, irradiance: scale(l.color, k) });\n } else {\n const falloff = frame ? { falloff: { decay: l.decay ?? 2, cutoff: l.distance ?? 0 } } : {};\n if (l.kind === \"point\") out.push({ kind: \"point\", position: l.position, intensity: scale(l.color, k), ...falloff });\n else out.push({ kind: \"spot\", position: l.position, direction: l.direction, intensity: scale(l.color, k), cosOuter: l.cosAngle, cosInner: l.cosPenumbra, ...falloff });\n }\n }\n return { lights: out, environment };\n}\n\n/** three's `getDistanceAttenuation` (Frostbite window; the renderer's 'frame' point and spot lights). */\nexport function vdbRefDistanceAttenuation(distance: number, falloff: VDBReferenceFalloff): number {\n const f = 1 / Math.max(Math.pow(distance, falloff.decay), 0.01);\n const cutoff = falloff.cutoff ?? 0;\n if (cutoff > 0) {\n const x = Math.min(Math.max(1 - Math.pow(distance / cutoff, 4), 0), 1);\n return f * x * x;\n }\n return f;\n}\n\n/** three's `SphericalHarmonics3` basis (Yᵢ, i = 0 … 8) at the unit direction `d`. */\nexport function vdbRefShBasis(d: readonly number[]): number[] {\n const x = d[0]!;\n const y = d[1]!;\n const z = d[2]!;\n return [0.282095, 0.488603 * y, 0.488603 * z, 0.488603 * x, 1.092548 * x * y, 1.092548 * y * z, 0.315392 * (3 * z * z - 1), 1.092548 * x * z, 0.546274 * (x * x - y * y)];\n}\n\n// ── Small maths shared by the twin and the uniform packer ─────────────────────────────────────────────\n\n/** Inverse of a column-major 4x4 (general). */\nexport function vdbRefInvert4(m: ArrayLike<number>): Float64Array {\n const a = Array.from({ length: 16 }, (_, i) => m[i]!);\n const inv = new Float64Array(16);\n inv[0] = a[5]! * a[10]! * a[15]! - a[5]! * a[11]! * a[14]! - a[9]! * a[6]! * a[15]! + a[9]! * a[7]! * a[14]! + a[13]! * a[6]! * a[11]! - a[13]! * a[7]! * a[10]!;\n inv[4] = -a[4]! * a[10]! * a[15]! + a[4]! * a[11]! * a[14]! + a[8]! * a[6]! * a[15]! - a[8]! * a[7]! * a[14]! - a[12]! * a[6]! * a[11]! + a[12]! * a[7]! * a[10]!;\n inv[8] = a[4]! * a[9]! * a[15]! - a[4]! * a[11]! * a[13]! - a[8]! * a[5]! * a[15]! + a[8]! * a[7]! * a[13]! + a[12]! * a[5]! * a[11]! - a[12]! * a[7]! * a[9]!;\n inv[12] = -a[4]! * a[9]! * a[14]! + a[4]! * a[10]! * a[13]! + a[8]! * a[5]! * a[14]! - a[8]! * a[6]! * a[13]! - a[12]! * a[5]! * a[10]! + a[12]! * a[6]! * a[9]!;\n inv[1] = -a[1]! * a[10]! * a[15]! + a[1]! * a[11]! * a[14]! + a[9]! * a[2]! * a[15]! - a[9]! * a[3]! * a[14]! - a[13]! * a[2]! * a[11]! + a[13]! * a[3]! * a[10]!;\n inv[5] = a[0]! * a[10]! * a[15]! - a[0]! * a[11]! * a[14]! - a[8]! * a[2]! * a[15]! + a[8]! * a[3]! * a[14]! + a[12]! * a[2]! * a[11]! - a[12]! * a[3]! * a[10]!;\n inv[9] = -a[0]! * a[9]! * a[15]! + a[0]! * a[11]! * a[13]! + a[8]! * a[1]! * a[15]! - a[8]! * a[3]! * a[13]! - a[12]! * a[1]! * a[11]! + a[12]! * a[3]! * a[9]!;\n inv[13] = a[0]! * a[9]! * a[14]! - a[0]! * a[10]! * a[13]! - a[8]! * a[1]! * a[14]! + a[8]! * a[2]! * a[13]! + a[12]! * a[1]! * a[10]! - a[12]! * a[2]! * a[9]!;\n inv[2] = a[1]! * a[6]! * a[15]! - a[1]! * a[7]! * a[14]! - a[5]! * a[2]! * a[15]! + a[5]! * a[3]! * a[14]! + a[13]! * a[2]! * a[7]! - a[13]! * a[3]! * a[6]!;\n inv[6] = -a[0]! * a[6]! * a[15]! + a[0]! * a[7]! * a[14]! + a[4]! * a[2]! * a[15]! - a[4]! * a[3]! * a[14]! - a[12]! * a[2]! * a[7]! + a[12]! * a[3]! * a[6]!;\n inv[10] = a[0]! * a[5]! * a[15]! - a[0]! * a[7]! * a[13]! - a[4]! * a[1]! * a[15]! + a[4]! * a[3]! * a[13]! + a[12]! * a[1]! * a[7]! - a[12]! * a[3]! * a[5]!;\n inv[14] = -a[0]! * a[5]! * a[14]! + a[0]! * a[6]! * a[13]! + a[4]! * a[1]! * a[14]! - a[4]! * a[2]! * a[13]! - a[12]! * a[1]! * a[6]! + a[12]! * a[2]! * a[5]!;\n inv[3] = -a[1]! * a[6]! * a[11]! + a[1]! * a[7]! * a[10]! + a[5]! * a[2]! * a[11]! - a[5]! * a[3]! * a[10]! - a[9]! * a[2]! * a[7]! + a[9]! * a[3]! * a[6]!;\n inv[7] = a[0]! * a[6]! * a[11]! - a[0]! * a[7]! * a[10]! - a[4]! * a[2]! * a[11]! + a[4]! * a[3]! * a[10]! + a[8]! * a[2]! * a[7]! - a[8]! * a[3]! * a[6]!;\n inv[11] = -a[0]! * a[5]! * a[11]! + a[0]! * a[7]! * a[9]! + a[4]! * a[1]! * a[11]! - a[4]! * a[3]! * a[9]! - a[8]! * a[1]! * a[7]! + a[8]! * a[3]! * a[5]!;\n inv[15] = a[0]! * a[5]! * a[10]! - a[0]! * a[6]! * a[9]! - a[4]! * a[1]! * a[10]! + a[4]! * a[2]! * a[9]! + a[8]! * a[1]! * a[6]! - a[8]! * a[2]! * a[5]!;\n const det = a[0]! * inv[0]! + a[1]! * inv[4]! + a[2]! * inv[8]! + a[3]! * inv[12]!;\n if (det === 0 || !Number.isFinite(det)) throw new RangeError(\"vdbRefInvert4: singular matrix\");\n for (let i = 0; i < 16; i++) inv[i] = inv[i]! / det;\n return inv;\n}\n\n/** Column-major 4x4 × point (w = 1), divided by w. */\nexport function vdbRefTransformPoint(m: ArrayLike<number>, p: readonly number[]): VDBRefVec3 {\n const x = m[0]! * p[0]! + m[4]! * p[1]! + m[8]! * p[2]! + m[12]!;\n const y = m[1]! * p[0]! + m[5]! * p[1]! + m[9]! * p[2]! + m[13]!;\n const z = m[2]! * p[0]! + m[6]! * p[1]! + m[10]! * p[2]! + m[14]!;\n const w = m[3]! * p[0]! + m[7]! * p[1]! + m[11]! * p[2]! + m[15]!;\n return [x / w, y / w, z / w];\n}\n\n/** Column-major 4x4 × vector (w = 0). */\nexport function vdbRefTransformVector(m: ArrayLike<number>, v: readonly number[]): VDBRefVec3 {\n return [m[0]! * v[0]! + m[4]! * v[1]! + m[8]! * v[2]!, m[1]! * v[0]! + m[5]! * v[1]! + m[9]! * v[2]!, m[2]! * v[0]! + m[6]! * v[1]! + m[10]! * v[2]!];\n}\n\n/** Column-major 4x4 product a × b. */\nexport function vdbRefMultiply4(a: ArrayLike<number>, b: ArrayLike<number>): Float64Array {\n const o = new Float64Array(16);\n for (let c = 0; c < 4; c++) for (let r = 0; r < 4; r++) {\n let s = 0;\n for (let k = 0; k < 4; k++) s += a[k * 4 + r]! * b[c * 4 + k]!;\n o[c * 4 + r] = s;\n }\n return o;\n}\n"]}
|