@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,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K3.6: the three r187 internals the mesh shadows and the emission light rely on (his `FrameVolumeShadows` /
|
|
3
|
+
* `FrameEmissionLight` use them; R1 §3 B bucket, §8), each behind a loud check in the style of `VDBGridNode`'s
|
|
4
|
+
* self-test: a check runs before the first use that could leave three in a bad state, and throws
|
|
5
|
+
* `VDB_ENGINE_MISMATCH` (cached, rethrown on every later use) when three r187's behaviour is not there.
|
|
6
|
+
*
|
|
7
|
+
* 1. `new LightsNode().setLights([light]).setupLightsNode(builder)` returns the light node every material shares
|
|
8
|
+
* for that light (three keeps one per light in a module WeakMap), an `AnalyticLightNode` with a `shadowNode`
|
|
9
|
+
* field and `disposeShadow()`, which drops the shadow node and bumps the node's `version` (the lights cache key
|
|
10
|
+
* includes it for a `castShadow` light, so receivers rebuild; checked too). His `resetLightShadow`: a new
|
|
11
|
+
* `shadow.filterNode` only takes effect when the light's shadow node is built again. K6.8b: the emission light's
|
|
12
|
+
* receivers rebuild the same way (the light keeps `castShadow` on and its node bumps `version`).
|
|
13
|
+
* 2. `ShadowNode` / `PointShadowNode` call `shadow.filterNode(inputs)` at build with `{ depthTexture, shadowCoord,
|
|
14
|
+
* shadow, depthLayer }` (point: `{ depthTexture, bd3D, dp, distance, shadow }`); the default filters are the
|
|
15
|
+
* `three/tsl` exports `BasicShadowFilter`, `PCFShadowFilter`, `VSMShadowFilter` (by `shadowMap.type`; the
|
|
16
|
+
* PCF-soft slot is empty in r187) and `BasicPointShadowFilter` / `PointShadowFilter`. Checked at the filter call.
|
|
17
|
+
* 3. `renderer._nodes.nodeFrame.renderId` is a number that changes once per `render()` (his frame identity; the
|
|
18
|
+
* collector already reads it since K3.1). `NodeUpdateType.RENDER` `updateBefore` runs once per render with
|
|
19
|
+
* `frame.renderer / scene / camera / renderId`.
|
|
20
|
+
* 4. `Light.registerNode(nodeClass)` sets the node class lights of a type are shaded with (`prototype._lightNode`).
|
|
21
|
+
* 5. `renderer._precompilationState` exists (null outside `compileAsync`); light passes skip while it is set, as
|
|
22
|
+
* three's own `ShadowNode.updateBefore`.
|
|
23
|
+
*/
|
|
24
|
+
import * as THREE from "three";
|
|
25
|
+
/** The three revision these checks are written against (the package's three peer range is >=0.187.0 <0.188.0). */
|
|
26
|
+
export declare const VDB_FRAME_THREE_REVISION = "187";
|
|
27
|
+
type LightNodeLike = {
|
|
28
|
+
light?: unknown;
|
|
29
|
+
isAnalyticLightNode?: boolean;
|
|
30
|
+
shadowNode?: unknown;
|
|
31
|
+
disposeShadow?: () => void;
|
|
32
|
+
version?: number;
|
|
33
|
+
};
|
|
34
|
+
/** The shared light node of a light, through LightsNode.setupLightsNode (internal 1). */
|
|
35
|
+
export declare function vdbFrameSharedLightNode(light: THREE.Light): LightNodeLike | null;
|
|
36
|
+
/**
|
|
37
|
+
* Internal 1, self-tested once per page on a throwaway `DirectionalLight` that casts shadows: two `LightsNode`s
|
|
38
|
+
* give the same `AnalyticLightNode` for it; `disposeShadow()` drops a shadow node and bumps `version`.
|
|
39
|
+
* @throws VDBError `VDB_ENGINE_MISMATCH`
|
|
40
|
+
*/
|
|
41
|
+
export declare function vdbFrameCheckLightReset(): void;
|
|
42
|
+
/** The shadow filters of internal 2 (three/tsl exports), checked present. */
|
|
43
|
+
export declare function vdbFrameShadowFilters(): {
|
|
44
|
+
maps: (unknown | null)[];
|
|
45
|
+
basicPoint: (inputs: unknown) => unknown;
|
|
46
|
+
point: (inputs: unknown) => unknown;
|
|
47
|
+
};
|
|
48
|
+
/** Internal 2 at the call: the inputs three passes to `shadow.filterNode`. */
|
|
49
|
+
export declare function vdbFrameCheckFilterInputs(inputs: Record<string, unknown>, point: boolean): void;
|
|
50
|
+
/** Internal 3: the render id of the renderer's node frame. @throws VDBError `VDB_ENGINE_MISMATCH` */
|
|
51
|
+
export declare function vdbFrameRenderId(renderer: object): number;
|
|
52
|
+
/** Internal 3: `NodeUpdateType.RENDER`. */
|
|
53
|
+
export declare function vdbFrameRenderUpdateType(): string;
|
|
54
|
+
/** Internal 4: registers a light node class. @throws VDBError `VDB_ENGINE_MISMATCH` */
|
|
55
|
+
export declare function vdbFrameRegisterLightNode(lightClass: typeof THREE.Light, nodeClass: unknown): void;
|
|
56
|
+
/** Internal 5: whether three is precompiling (`compileAsync`). @throws VDBError `VDB_ENGINE_MISMATCH` */
|
|
57
|
+
export declare function vdbFramePrecompiling(renderer: object): boolean;
|
|
58
|
+
/** @internal Tests: forget the cached light-reset result. */
|
|
59
|
+
export declare function vdbFrameResetInternalsCache(): void;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K3.6: the three r187 internals the mesh shadows and the emission light rely on (his `FrameVolumeShadows` /
|
|
3
|
+
* `FrameEmissionLight` use them; R1 §3 B bucket, §8), each behind a loud check in the style of `VDBGridNode`'s
|
|
4
|
+
* self-test: a check runs before the first use that could leave three in a bad state, and throws
|
|
5
|
+
* `VDB_ENGINE_MISMATCH` (cached, rethrown on every later use) when three r187's behaviour is not there.
|
|
6
|
+
*
|
|
7
|
+
* 1. `new LightsNode().setLights([light]).setupLightsNode(builder)` returns the light node every material shares
|
|
8
|
+
* for that light (three keeps one per light in a module WeakMap), an `AnalyticLightNode` with a `shadowNode`
|
|
9
|
+
* field and `disposeShadow()`, which drops the shadow node and bumps the node's `version` (the lights cache key
|
|
10
|
+
* includes it for a `castShadow` light, so receivers rebuild; checked too). His `resetLightShadow`: a new
|
|
11
|
+
* `shadow.filterNode` only takes effect when the light's shadow node is built again. K6.8b: the emission light's
|
|
12
|
+
* receivers rebuild the same way (the light keeps `castShadow` on and its node bumps `version`).
|
|
13
|
+
* 2. `ShadowNode` / `PointShadowNode` call `shadow.filterNode(inputs)` at build with `{ depthTexture, shadowCoord,
|
|
14
|
+
* shadow, depthLayer }` (point: `{ depthTexture, bd3D, dp, distance, shadow }`); the default filters are the
|
|
15
|
+
* `three/tsl` exports `BasicShadowFilter`, `PCFShadowFilter`, `VSMShadowFilter` (by `shadowMap.type`; the
|
|
16
|
+
* PCF-soft slot is empty in r187) and `BasicPointShadowFilter` / `PointShadowFilter`. Checked at the filter call.
|
|
17
|
+
* 3. `renderer._nodes.nodeFrame.renderId` is a number that changes once per `render()` (his frame identity; the
|
|
18
|
+
* collector already reads it since K3.1). `NodeUpdateType.RENDER` `updateBefore` runs once per render with
|
|
19
|
+
* `frame.renderer / scene / camera / renderId`.
|
|
20
|
+
* 4. `Light.registerNode(nodeClass)` sets the node class lights of a type are shaded with (`prototype._lightNode`).
|
|
21
|
+
* 5. `renderer._precompilationState` exists (null outside `compileAsync`); light passes skip while it is set, as
|
|
22
|
+
* three's own `ShadowNode.updateBefore`.
|
|
23
|
+
*/
|
|
24
|
+
import * as THREE from "three";
|
|
25
|
+
import { AnalyticLightNode, LightsNode, NodeUpdateType, REVISION } from "three/webgpu";
|
|
26
|
+
import * as TSL from "three/tsl";
|
|
27
|
+
import { VDBError } from "../../core/errors.js";
|
|
28
|
+
const T = TSL;
|
|
29
|
+
/** The three revision these checks are written against (the package's three peer range is >=0.187.0 <0.188.0). */
|
|
30
|
+
export const VDB_FRAME_THREE_REVISION = "187";
|
|
31
|
+
const mismatch = (what) => new VDBError("VDB_ENGINE_MISMATCH", `three adapter (frame mesh shadows / emission light): three r${REVISION} ${what}. These features use three r187 node-system ` +
|
|
32
|
+
"internals (written against three r187, peer range >=0.187.0 <0.188.0); this three version is unsupported for them.");
|
|
33
|
+
let lightResetResult = null;
|
|
34
|
+
/** The shared light node of a light, through LightsNode.setupLightsNode (internal 1). */
|
|
35
|
+
export function vdbFrameSharedLightNode(light) {
|
|
36
|
+
const nodeData = {};
|
|
37
|
+
const lightsNode = new LightsNode();
|
|
38
|
+
const [node] = lightsNode.setLights([light]).setupLightsNode({ getDataFromNode: () => nodeData, context: { materialLightings: [] } });
|
|
39
|
+
return node ?? null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Internal 1, self-tested once per page on a throwaway `DirectionalLight` that casts shadows: two `LightsNode`s
|
|
43
|
+
* give the same `AnalyticLightNode` for it; `disposeShadow()` drops a shadow node and bumps `version`.
|
|
44
|
+
* @throws VDBError `VDB_ENGINE_MISMATCH`
|
|
45
|
+
*/
|
|
46
|
+
export function vdbFrameCheckLightReset() {
|
|
47
|
+
if (lightResetResult === true)
|
|
48
|
+
return;
|
|
49
|
+
if (lightResetResult)
|
|
50
|
+
throw lightResetResult;
|
|
51
|
+
let error = null;
|
|
52
|
+
const light = new THREE.DirectionalLight();
|
|
53
|
+
light.castShadow = true;
|
|
54
|
+
try {
|
|
55
|
+
if (typeof LightsNode.prototype.setupLightsNode !== "function") {
|
|
56
|
+
error = mismatch("has no LightsNode.setupLightsNode");
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const a = vdbFrameSharedLightNode(light);
|
|
60
|
+
const b = vdbFrameSharedLightNode(light);
|
|
61
|
+
if (!a || !a.isAnalyticLightNode || !(a instanceof AnalyticLightNode) || a.light !== light) {
|
|
62
|
+
error = mismatch("LightsNode.setupLightsNode did not return the light's AnalyticLightNode");
|
|
63
|
+
}
|
|
64
|
+
else if (a !== b) {
|
|
65
|
+
error = mismatch("gave each LightsNode its own node for one light (the shadow reset needs the shared node)");
|
|
66
|
+
}
|
|
67
|
+
else if (!("shadowNode" in a) || a.shadowNode !== null || typeof a.disposeShadow !== "function") {
|
|
68
|
+
error = mismatch("has no AnalyticLightNode.shadowNode / disposeShadow()");
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
let disposed = false;
|
|
72
|
+
const version = a.version ?? 0;
|
|
73
|
+
a.shadowNode = { dispose: () => (disposed = true) };
|
|
74
|
+
a.disposeShadow();
|
|
75
|
+
if (!disposed || a.shadowNode !== null || !((a.version ?? 0) > version)) {
|
|
76
|
+
error = mismatch("AnalyticLightNode.disposeShadow() did not drop the shadow node and bump its version (receivers would keep the old shadow)");
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// K6.8b: the receivers rebuild because the lights cache key holds a castShadow light's node version
|
|
80
|
+
const lights = new LightsNode();
|
|
81
|
+
const keyed = lights.setLights([light]);
|
|
82
|
+
const before = keyed.getCacheKey(true);
|
|
83
|
+
a.needsUpdate = true;
|
|
84
|
+
if (keyed.getCacheKey(true) === before)
|
|
85
|
+
error = mismatch("LightsNode's cache key does not follow a castShadow light's node version (receivers would not rebuild)");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
error = e instanceof VDBError ? e : mismatch(`failed the light-reset self-test (${e instanceof Error ? e.message : String(e)})`);
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
light.dispose();
|
|
95
|
+
}
|
|
96
|
+
lightResetResult = error ?? true;
|
|
97
|
+
if (error)
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
/** The shadow filters of internal 2 (three/tsl exports), checked present. */
|
|
101
|
+
export function vdbFrameShadowFilters() {
|
|
102
|
+
const names = ["BasicShadowFilter", "PCFShadowFilter", "VSMShadowFilter", "BasicPointShadowFilter", "PointShadowFilter"];
|
|
103
|
+
for (const name of names)
|
|
104
|
+
if (typeof T[name] !== "function")
|
|
105
|
+
throw mismatch(`has no three/tsl ${name}`);
|
|
106
|
+
return {
|
|
107
|
+
// NOTE In shadow map type order; PCFSoftShadowMap has no filter (three r187 ShadowNode `_shadowFilterLib`)
|
|
108
|
+
maps: [T.BasicShadowFilter, T.PCFShadowFilter, null, T.VSMShadowFilter],
|
|
109
|
+
basicPoint: T.BasicPointShadowFilter,
|
|
110
|
+
point: T.PointShadowFilter,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/** Internal 2 at the call: the inputs three passes to `shadow.filterNode`. */
|
|
114
|
+
export function vdbFrameCheckFilterInputs(inputs, point) {
|
|
115
|
+
if (!inputs || !inputs.depthTexture || (point ? !inputs.bd3D : !inputs.shadowCoord)) {
|
|
116
|
+
throw mismatch(`called shadow.filterNode without ${point ? "{ depthTexture, bd3D }" : "{ depthTexture, shadowCoord }"}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** Internal 3: the render id of the renderer's node frame. @throws VDBError `VDB_ENGINE_MISMATCH` */
|
|
120
|
+
export function vdbFrameRenderId(renderer) {
|
|
121
|
+
const id = renderer._nodes?.nodeFrame?.renderId;
|
|
122
|
+
if (typeof id !== "number")
|
|
123
|
+
throw mismatch("has no renderer._nodes.nodeFrame.renderId");
|
|
124
|
+
return id;
|
|
125
|
+
}
|
|
126
|
+
/** Internal 3: `NodeUpdateType.RENDER`. */
|
|
127
|
+
export function vdbFrameRenderUpdateType() {
|
|
128
|
+
const type = NodeUpdateType.RENDER;
|
|
129
|
+
if (type !== "render")
|
|
130
|
+
throw mismatch("has no NodeUpdateType.RENDER");
|
|
131
|
+
return type;
|
|
132
|
+
}
|
|
133
|
+
/** Internal 4: registers a light node class. @throws VDBError `VDB_ENGINE_MISMATCH` */
|
|
134
|
+
export function vdbFrameRegisterLightNode(lightClass, nodeClass) {
|
|
135
|
+
const register = lightClass.registerNode;
|
|
136
|
+
if (typeof register !== "function")
|
|
137
|
+
throw mismatch("has no Light.registerNode");
|
|
138
|
+
register.call(lightClass, nodeClass);
|
|
139
|
+
if (lightClass.prototype._lightNode !== nodeClass)
|
|
140
|
+
throw mismatch("Light.registerNode did not set prototype._lightNode");
|
|
141
|
+
}
|
|
142
|
+
/** Internal 5: whether three is precompiling (`compileAsync`). @throws VDBError `VDB_ENGINE_MISMATCH` */
|
|
143
|
+
export function vdbFramePrecompiling(renderer) {
|
|
144
|
+
if (!("_precompilationState" in renderer))
|
|
145
|
+
throw mismatch("has no renderer._precompilationState");
|
|
146
|
+
return renderer._precompilationState != null;
|
|
147
|
+
}
|
|
148
|
+
/** @internal Tests: forget the cached light-reset result. */
|
|
149
|
+
export function vdbFrameResetInternalsCache() {
|
|
150
|
+
lightResetResult = null;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=three-internals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"three-internals.js","sourceRoot":"","sources":["../../../src/three/frame/three-internals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;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,IAAK,UAAU,CAAC,SAAiD,CAAC,UAAU,KAAK,SAAS;QAAE,MAAM,QAAQ,CAAC,qDAAqD,CAAC,CAAC;AACpK,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,IAAI,CAAC,CAAC,sBAAsB,IAAI,QAAQ,CAAC;QAAE,MAAM,QAAQ,CAAC,sCAAsC,CAAC,CAAC;IAClG,OAAQ,QAA8C,CAAC,oBAAoB,IAAI,IAAI,CAAC;AACtF,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,2BAA2B;IACzC,gBAAgB,GAAG,IAAI,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * K3.6: the three r187 internals the mesh shadows and the emission light rely on (his `FrameVolumeShadows` /\n * `FrameEmissionLight` use them; R1 §3 B bucket, §8), each behind a loud check in the style of `VDBGridNode`'s\n * self-test: a check runs before the first use that could leave three in a bad state, and throws\n * `VDB_ENGINE_MISMATCH` (cached, rethrown on every later use) when three r187's behaviour is not there.\n *\n * 1. `new LightsNode().setLights([light]).setupLightsNode(builder)` returns the light node every material shares\n * for that light (three keeps one per light in a module WeakMap), an `AnalyticLightNode` with a `shadowNode`\n * field and `disposeShadow()`, which drops the shadow node and bumps the node's `version` (the lights cache key\n * includes it for a `castShadow` light, so receivers rebuild; checked too). His `resetLightShadow`: a new\n * `shadow.filterNode` only takes effect when the light's shadow node is built again. K6.8b: the emission light's\n * receivers rebuild the same way (the light keeps `castShadow` on and its node bumps `version`).\n * 2. `ShadowNode` / `PointShadowNode` call `shadow.filterNode(inputs)` at build with `{ depthTexture, shadowCoord,\n * shadow, depthLayer }` (point: `{ depthTexture, bd3D, dp, distance, shadow }`); the default filters are the\n * `three/tsl` exports `BasicShadowFilter`, `PCFShadowFilter`, `VSMShadowFilter` (by `shadowMap.type`; the\n * PCF-soft slot is empty in r187) and `BasicPointShadowFilter` / `PointShadowFilter`. Checked at the filter call.\n * 3. `renderer._nodes.nodeFrame.renderId` is a number that changes once per `render()` (his frame identity; the\n * collector already reads it since K3.1). `NodeUpdateType.RENDER` `updateBefore` runs once per render with\n * `frame.renderer / scene / camera / renderId`.\n * 4. `Light.registerNode(nodeClass)` sets the node class lights of a type are shaded with (`prototype._lightNode`).\n * 5. `renderer._precompilationState` exists (null outside `compileAsync`); light passes skip while it is set, as\n * three's own `ShadowNode.updateBefore`.\n */\n\nimport * as THREE from \"three\";\nimport { AnalyticLightNode, LightsNode, NodeUpdateType, REVISION } from \"three/webgpu\";\nimport * as TSL from \"three/tsl\";\nimport { VDBError } from \"../../core/errors.js\";\n\nconst T = TSL as unknown as Record<string, unknown>;\n\n/** The three revision these checks are written against (the package's three peer range is >=0.187.0 <0.188.0). */\nexport const VDB_FRAME_THREE_REVISION = \"187\";\n\nconst mismatch = (what: string): VDBError =>\n new VDBError(\n \"VDB_ENGINE_MISMATCH\",\n `three adapter (frame mesh shadows / emission light): three r${REVISION} ${what}. These features use three r187 node-system ` +\n \"internals (written against three r187, peer range >=0.187.0 <0.188.0); this three version is unsupported for them.\",\n );\n\nlet lightResetResult: true | VDBError | null = null;\n\ntype LightNodeLike = { light?: unknown; isAnalyticLightNode?: boolean; shadowNode?: unknown; disposeShadow?: () => void; version?: number };\n\n/** The shared light node of a light, through LightsNode.setupLightsNode (internal 1). */\nexport function vdbFrameSharedLightNode(light: THREE.Light): LightNodeLike | null {\n const nodeData = {};\n const lightsNode = new LightsNode() as unknown as { setLights(l: THREE.Light[]): { setupLightsNode(b: unknown): LightNodeLike[] } };\n const [node] = lightsNode.setLights([light]).setupLightsNode({ getDataFromNode: () => nodeData, context: { materialLightings: [] } });\n return node ?? null;\n}\n\n/**\n * Internal 1, self-tested once per page on a throwaway `DirectionalLight` that casts shadows: two `LightsNode`s\n * give the same `AnalyticLightNode` for it; `disposeShadow()` drops a shadow node and bumps `version`.\n * @throws VDBError `VDB_ENGINE_MISMATCH`\n */\nexport function vdbFrameCheckLightReset(): void {\n if (lightResetResult === true) return;\n if (lightResetResult) throw lightResetResult;\n let error: VDBError | null = null;\n const light = new THREE.DirectionalLight();\n light.castShadow = true;\n try {\n if (typeof (LightsNode.prototype as unknown as { setupLightsNode?: unknown }).setupLightsNode !== \"function\") {\n error = mismatch(\"has no LightsNode.setupLightsNode\");\n } else {\n const a = vdbFrameSharedLightNode(light);\n const b = vdbFrameSharedLightNode(light);\n if (!a || !a.isAnalyticLightNode || !(a instanceof AnalyticLightNode) || a.light !== light) {\n error = mismatch(\"LightsNode.setupLightsNode did not return the light's AnalyticLightNode\");\n } else if (a !== b) {\n error = mismatch(\"gave each LightsNode its own node for one light (the shadow reset needs the shared node)\");\n } else if (!(\"shadowNode\" in a) || a.shadowNode !== null || typeof a.disposeShadow !== \"function\") {\n error = mismatch(\"has no AnalyticLightNode.shadowNode / disposeShadow()\");\n } else {\n let disposed = false;\n const version = a.version ?? 0;\n a.shadowNode = { dispose: () => (disposed = true) };\n a.disposeShadow();\n if (!disposed || a.shadowNode !== null || !((a.version ?? 0) > version)) {\n error = mismatch(\"AnalyticLightNode.disposeShadow() did not drop the shadow node and bump its version (receivers would keep the old shadow)\");\n } else {\n // K6.8b: the receivers rebuild because the lights cache key holds a castShadow light's node version\n const lights = new LightsNode() as unknown as { setLights(l: THREE.Light[]): { getCacheKey(force: boolean): number } };\n const keyed = lights.setLights([light]);\n const before = keyed.getCacheKey(true);\n (a as { needsUpdate?: boolean }).needsUpdate = true;\n if (keyed.getCacheKey(true) === before) error = mismatch(\"LightsNode's cache key does not follow a castShadow light's node version (receivers would not rebuild)\");\n }\n }\n }\n } catch (e) {\n error = e instanceof VDBError ? e : mismatch(`failed the light-reset self-test (${e instanceof Error ? e.message : String(e)})`);\n } finally {\n light.dispose();\n }\n lightResetResult = error ?? true;\n if (error) throw error;\n}\n\n/** The shadow filters of internal 2 (three/tsl exports), checked present. */\nexport function vdbFrameShadowFilters(): { maps: (unknown | null)[]; basicPoint: (inputs: unknown) => unknown; point: (inputs: unknown) => unknown } {\n const names = [\"BasicShadowFilter\", \"PCFShadowFilter\", \"VSMShadowFilter\", \"BasicPointShadowFilter\", \"PointShadowFilter\"];\n for (const name of names) if (typeof T[name] !== \"function\") throw mismatch(`has no three/tsl ${name}`);\n return {\n // NOTE In shadow map type order; PCFSoftShadowMap has no filter (three r187 ShadowNode `_shadowFilterLib`)\n maps: [T.BasicShadowFilter, T.PCFShadowFilter, null, T.VSMShadowFilter],\n basicPoint: T.BasicPointShadowFilter as (inputs: unknown) => unknown,\n point: T.PointShadowFilter as (inputs: unknown) => unknown,\n };\n}\n\n/** Internal 2 at the call: the inputs three passes to `shadow.filterNode`. */\nexport function vdbFrameCheckFilterInputs(inputs: Record<string, unknown>, point: boolean): void {\n if (!inputs || !inputs.depthTexture || (point ? !inputs.bd3D : !inputs.shadowCoord)) {\n throw mismatch(`called shadow.filterNode without ${point ? \"{ depthTexture, bd3D }\" : \"{ depthTexture, shadowCoord }\"}`);\n }\n}\n\n/** Internal 3: the render id of the renderer's node frame. @throws VDBError `VDB_ENGINE_MISMATCH` */\nexport function vdbFrameRenderId(renderer: object): number {\n const id = (renderer as { _nodes?: { nodeFrame?: { renderId?: unknown } } })._nodes?.nodeFrame?.renderId;\n if (typeof id !== \"number\") throw mismatch(\"has no renderer._nodes.nodeFrame.renderId\");\n return id;\n}\n\n/** Internal 3: `NodeUpdateType.RENDER`. */\nexport function vdbFrameRenderUpdateType(): string {\n const type = (NodeUpdateType as unknown as Record<string, string>).RENDER;\n if (type !== \"render\") throw mismatch(\"has no NodeUpdateType.RENDER\");\n return type;\n}\n\n/** Internal 4: registers a light node class. @throws VDBError `VDB_ENGINE_MISMATCH` */\nexport function vdbFrameRegisterLightNode(lightClass: typeof THREE.Light, nodeClass: unknown): void {\n const register = (lightClass as unknown as { registerNode?: (c: unknown) => void }).registerNode;\n if (typeof register !== \"function\") throw mismatch(\"has no Light.registerNode\");\n register.call(lightClass, nodeClass);\n if ((lightClass.prototype as unknown as { _lightNode?: unknown })._lightNode !== nodeClass) throw mismatch(\"Light.registerNode did not set prototype._lightNode\");\n}\n\n/** Internal 5: whether three is precompiling (`compileAsync`). @throws VDBError `VDB_ENGINE_MISMATCH` */\nexport function vdbFramePrecompiling(renderer: object): boolean {\n if (!(\"_precompilationState\" in renderer)) throw mismatch(\"has no renderer._precompilationState\");\n return (renderer as { _precompilationState: unknown })._precompilationState != null;\n}\n\n/** @internal Tests: forget the cached light-reset result. */\nexport function vdbFrameResetInternalsCache(): void {\n lightResetResult = null;\n}\n"]}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K3.6 / K6.5: shadows of `VDBFrameVolume`s on meshes (`frameRenderer.settings.castShadows`, his `FrameVolumeShadows`).
|
|
3
|
+
* Each shadow-casting directional, spot or point light gets a Beer shadow map from the core frame renderer (its
|
|
4
|
+
* `outputs.volumeShadows`); the light's `shadow.filterNode` multiplies three's shadow by the volume transmittance at
|
|
5
|
+
* the receiver.
|
|
6
|
+
*
|
|
7
|
+
* K6.8a: the receiver is the core's own WGSL (`vdbVolumeShadow`, `…Rgb`, `…Cube`, `…CubeRgb` of `vdbVolumeShadowWgsl()`)
|
|
8
|
+
* through a `wgslFn`. Its inputs are the map texture (a 2d-array: directional cascades or a spot map; a point map through a
|
|
9
|
+
* cube view), the spectral rgb twin, and the map's `view` buffer, the state the map was drawn with (his 62a6e3e), which
|
|
10
|
+
* the core rewrites each update: three binds that buffer itself through a storage stand-in (the `VDBGridNode` pool-buffer
|
|
11
|
+
* pattern), read as `array<vec4u>` and unpacked into `VdbVolumeShadowView`. Each light's texture and storage nodes are
|
|
12
|
+
* made once and only their `value` follows the core (a new stand-in when the core made a new texture or buffer), so a
|
|
13
|
+
* receiver built at any time binds the core's current objects; while a light has no core map they bind a placeholder
|
|
14
|
+
* (a zero view: transmittance 1), never a texture or buffer the core retired (K6.10 finding 8).
|
|
15
|
+
*
|
|
16
|
+
* three: receivers need `receiveShadow`, the light `castShadow`, and `renderer.shadowMap.enabled`. The core update runs
|
|
17
|
+
* before the first receiver of each render (the node's `updateBefore`), so the maps are this render's.
|
|
18
|
+
*/
|
|
19
|
+
import * as THREE from "three";
|
|
20
|
+
import { Node, type WebGPURenderer } from "three/webgpu";
|
|
21
|
+
import { type VDBTslNode } from "../grid-node.js";
|
|
22
|
+
import type { VDBFrameRenderer } from "./renderer.js";
|
|
23
|
+
import { VDBCoreTextureBinding } from "./core-textures.js";
|
|
24
|
+
import { VDBFrameStructLoaderNode, type VDBFrameStorageNode } from "./core-structs.js";
|
|
25
|
+
import type { VDBVolumeShadowMap } from "../../core/frame/types.js";
|
|
26
|
+
type N = VDBTslNode;
|
|
27
|
+
type RendererLike = WebGPURenderer & {
|
|
28
|
+
isWebGPURenderer?: boolean;
|
|
29
|
+
};
|
|
30
|
+
type ShadowLight = THREE.DirectionalLight | THREE.SpotLight | THREE.PointLight;
|
|
31
|
+
type StorageNode = VDBFrameStorageNode;
|
|
32
|
+
/**
|
|
33
|
+
* WGSL that unpacks the view buffer (bound as `array<vec4u>` at `ref`) into the core's `VdbVolumeShadowView`, generated
|
|
34
|
+
* from the struct's layout, so a field the core adds is unpacked too (a type this cannot unpack throws).
|
|
35
|
+
*/
|
|
36
|
+
export declare function vdbFrameShadowViewLoaderWgsl(fnName: string, ref: string): string;
|
|
37
|
+
/** The texture and buffer nodes of one light's receivers; made once, their values follow the core. */
|
|
38
|
+
interface EntryNodes {
|
|
39
|
+
/** Unique per receivers object: names the storage binding and the WGSL functions. */
|
|
40
|
+
k: number;
|
|
41
|
+
map: N;
|
|
42
|
+
rgb: N;
|
|
43
|
+
view: StorageNode;
|
|
44
|
+
loader: VDBFrameStructLoaderNode;
|
|
45
|
+
fns: Map<string, (inputs: Record<string, N>) => N>;
|
|
46
|
+
}
|
|
47
|
+
/** One shadow light's core map, as its receivers bind it. */
|
|
48
|
+
export interface VDBFrameShadowEntry {
|
|
49
|
+
light: ShadowLight;
|
|
50
|
+
isPoint: boolean;
|
|
51
|
+
/** The map's size (texels per side) of the last core map; the settings' size before one. */
|
|
52
|
+
size: number;
|
|
53
|
+
/** The core map the receivers bind now (null: none yet, or the light has none this frame; they bind placeholders). */
|
|
54
|
+
coreMap: VDBVolumeShadowMap | null;
|
|
55
|
+
/** The core update count at the last draw of the map's first piece (his `lastDraw`; tests and the stale harness). */
|
|
56
|
+
lastDraw: number;
|
|
57
|
+
userFilter: ((inputs: unknown) => N) | null;
|
|
58
|
+
/** The map texture bound now (the core's, or the placeholder). */
|
|
59
|
+
texture: GPUTexture | null;
|
|
60
|
+
binding: VDBCoreTextureBinding;
|
|
61
|
+
/** K6.4 spectral: the optical depth rgb twin bound now (null: a grey map; the node binds the placeholder). */
|
|
62
|
+
rgbTexture: GPUTexture | null;
|
|
63
|
+
rgbBinding: VDBCoreTextureBinding;
|
|
64
|
+
/** The view buffer bound now (the core's, or the placeholder). */
|
|
65
|
+
viewBuffer: GPUBuffer | null;
|
|
66
|
+
nodes: EntryNodes | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Volume transmittance at a receiver from the light's core Beer shadow map: the core's `vdbVolumeShadow` /
|
|
70
|
+
* `vdbVolumeShadowCube` (K6.4 spectral maps: `…Rgb` / `…CubeRgb`, the channel mean in a ShadowMaterial, his rule) through
|
|
71
|
+
* a `wgslFn`, with the view the map was drawn with (twin `vdbFrameVolumeShadowLookup`). `updateBefore` runs the core
|
|
72
|
+
* update before the first receiver of each render.
|
|
73
|
+
*/
|
|
74
|
+
export declare class VDBFrameVolumeShadowNode extends Node {
|
|
75
|
+
static get type(): string;
|
|
76
|
+
readonly shadows: VDBFrameVolumeShadowReceivers;
|
|
77
|
+
readonly entry: VDBFrameShadowEntry;
|
|
78
|
+
constructor(shadows: VDBFrameVolumeShadowReceivers, entry: VDBFrameShadowEntry);
|
|
79
|
+
isSpectral(builder: {
|
|
80
|
+
material?: {
|
|
81
|
+
isShadowNodeMaterial?: boolean;
|
|
82
|
+
};
|
|
83
|
+
}): boolean;
|
|
84
|
+
getNodeType(builder: never): string;
|
|
85
|
+
updateBefore(frame: never): boolean | undefined;
|
|
86
|
+
setup(builder: never): N;
|
|
87
|
+
}
|
|
88
|
+
/** The receivers of the core's volume shadow maps, owned by a {@link VDBFrameRenderer} (`frameRenderer.volumeShadows`). */
|
|
89
|
+
export declare class VDBFrameVolumeShadowReceivers {
|
|
90
|
+
#private;
|
|
91
|
+
readonly entries: Map<THREE.Light, VDBFrameShadowEntry>;
|
|
92
|
+
readonly frameRenderer: VDBFrameRenderer;
|
|
93
|
+
retired: {
|
|
94
|
+
dispose(): void;
|
|
95
|
+
}[];
|
|
96
|
+
renderCount: number;
|
|
97
|
+
/** Map pieces drawn in the last update, and how many waited for the budget (not his; tests and timing). */
|
|
98
|
+
readonly lastUpdate: {
|
|
99
|
+
drawn: number;
|
|
100
|
+
waiting: number;
|
|
101
|
+
};
|
|
102
|
+
constructor(frameRenderer: VDBFrameRenderer);
|
|
103
|
+
/**
|
|
104
|
+
* The map size of the settings (`castShadowMapSize`, or his coarse size). The core clamps it to the device's limits
|
|
105
|
+
* (K6.10a); `sync` takes the size of the map the core made.
|
|
106
|
+
*/
|
|
107
|
+
getMapSize(): number;
|
|
108
|
+
/**
|
|
109
|
+
* The light's texture and view nodes (made at its first receiver build, bound to placeholders until the core draws a
|
|
110
|
+
* map). @internal
|
|
111
|
+
*/
|
|
112
|
+
nodesOf(entry: VDBFrameShadowEntry): EntryNodes;
|
|
113
|
+
/** The `wgslFn` of a light's receivers (grey or rgb; the point variants take no view depth). @internal */
|
|
114
|
+
receiverFn(entry: VDBFrameShadowEntry, rgb: boolean): (inputs: Record<string, N>) => N;
|
|
115
|
+
/**
|
|
116
|
+
* Puts the volume filter on each shadow light (new lights and new filters are found each render); frees the entries
|
|
117
|
+
* of lights with no shadow or not in a scene, and all entries when `castShadows` is off.
|
|
118
|
+
*/
|
|
119
|
+
update(renderer: RendererLike, scene: THREE.Object3D): void;
|
|
120
|
+
/** Called by the receivers of every light: the core update of this render (once per render and camera). */
|
|
121
|
+
render(renderer: RendererLike, scene: THREE.Scene, camera: THREE.Camera, renderId: number): void;
|
|
122
|
+
/**
|
|
123
|
+
* After a core update, each entry binds its core map (texture, rgb twin, view buffer) and reads the budget counters.
|
|
124
|
+
* The map size, the cascades and the drawn views live in the view buffer, so only a new core object (the first map, a
|
|
125
|
+
* new size, a spectral switch, a map that went away or came back) touches the receivers: their nodes get the new
|
|
126
|
+
* stand-ins and the light's receivers rebuild. The rebuild is needed: three r187 re-reads the object-group bindings
|
|
127
|
+
* (textures, storage buffers) of a plain material only on a full refresh, which a node `value` swap does not cause, so
|
|
128
|
+
* a receiver drawn with a shared refresh would keep the old bind group, and with it a texture the core retires
|
|
129
|
+
* (K6.10 finding 8). They rebuild at their next draw (the next render: this one may still draw with the old objects,
|
|
130
|
+
* which the core keeps alive for two more updates).
|
|
131
|
+
*/
|
|
132
|
+
sync(maps: ReadonlyMap<number | string, VDBVolumeShadowMap>, stats: {
|
|
133
|
+
drawn: number;
|
|
134
|
+
waiting: number;
|
|
135
|
+
}): void;
|
|
136
|
+
/** Puts back the filter of each light (a later render installs again). */
|
|
137
|
+
dispose(): void;
|
|
138
|
+
}
|
|
139
|
+
export {};
|