@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,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Point sprites (K6.6, design §3.9): the sprite size and attenuation as core WGSL
|
|
3
|
+
* (`vdbPointSpriteWgsl`), which `VDBPoints` (`./three`) calls from its TSL vertex, and a raw sprite pass
|
|
4
|
+
* (`vdbCreatePointPass`) for engine-free hosts. The disc is the adapters' (three keeps his mipmapped
|
|
5
|
+
* alpha map); the raw pass cuts an analytic disc.
|
|
6
|
+
*
|
|
7
|
+
* Portions derived from mjurczyk/openvdb (MIT), commit 75e7345
|
|
8
|
+
* (`src/three-openvdb/points/webgpu/VDBPoints.js`, `points/pointsCore.js`: one instanced quad per point,
|
|
9
|
+
* the attenuated size in pixels with a 1-pixel minimum, the pixel scale `diameter · maxScale · zoom /
|
|
10
|
+
* tan(fov / 2) · height / 2`) and three.js r187 (MIT) `PointsNodeMaterial.setupVertexSprite` (the clip-space
|
|
11
|
+
* offset). Copyright (c) mjurczyk/openvdb contributors, MIT (see THIRD_PARTY_NOTICES.md). Changes: plain WGSL
|
|
12
|
+
* and data; the raw pass's disc is analytic (DIVERGES.md).
|
|
13
|
+
*
|
|
14
|
+
* CPU twins: `tools` `pointSpriteSize`, `pointSpriteVertex`, `pointSpriteClip` (`tools/cpu/points.ts`).
|
|
15
|
+
*/
|
|
16
|
+
import { VDBError } from "../errors.js";
|
|
17
|
+
import { prepareRender, renderPipeline } from "../frame/pipelines.js";
|
|
18
|
+
import { BUFFER_USAGE, STAGE, VDBRetireQueue } from "../frame/resources.js";
|
|
19
|
+
import { VDBUniformWriter, vdbUniformStruct } from "../frame/uniforms.js";
|
|
20
|
+
import { vdbMat4MaxScale, vdbMat4Multiply } from "../../tools/frame/view.js";
|
|
21
|
+
/**
|
|
22
|
+
* The WGSL text of the sprite functions (no bindings, no module):
|
|
23
|
+
*
|
|
24
|
+
* ```wgsl
|
|
25
|
+
* fn vdbPointSpriteSize(pixelScale: f32, viewDepth: f32, minSize: f32) -> f32;
|
|
26
|
+
* fn vdbPointSpriteVertex(clipCentre: vec4f, corner: vec2f, sizePx: f32, viewportSize: vec2f) -> vec4f;
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* - `vdbPointSpriteSize`: the sprite's width in pixels, `max(pixelScale / viewDepth, minSize)` (his 1-pixel
|
|
30
|
+
* minimum: sprites under a pixel are still drawn); `viewDepth` is the point's distance along the view
|
|
31
|
+
* axis (`−view.z`).
|
|
32
|
+
* - `vdbPointSpriteVertex`: a quad corner's clip position, `clipCentre + (corner · sizePx / (viewportSize / 2)
|
|
33
|
+
* · clipCentre.w, 0, 0)`; `corner` in `[−0.5, 0.5]²`, `viewportSize` in pixels. The quad is `sizePx` wide
|
|
34
|
+
* on screen whatever the depth.
|
|
35
|
+
*/
|
|
36
|
+
export function vdbPointSpriteWgsl() {
|
|
37
|
+
return POINT_SPRITE_WGSL;
|
|
38
|
+
}
|
|
39
|
+
const POINT_SPRITE_WGSL = /* wgsl */ `fn vdbPointSpriteSize(pixelScale: f32, viewDepth: f32, minSize: f32) -> f32 {
|
|
40
|
+
return max(pixelScale / viewDepth, minSize);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fn vdbPointSpriteVertex(clipCentre: vec4f, corner: vec2f, sizePx: f32, viewportSize: vec2f) -> vec4f {
|
|
44
|
+
return clipCentre + vec4f(corner * sizePx / (viewportSize * 0.5) * clipCentre.w, 0.0, 0.0);
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
/**
|
|
48
|
+
* The pixel scale of {@link vdbPointSpriteSize} (pixels at view depth 1) for a point of world diameter
|
|
49
|
+
* `diameter`: `diameter · maxScale(model) · projection[5] · height / 2`. For a perspective projection
|
|
50
|
+
* `projection[5]` is `zoom / tan(fov / 2)`, his `getAttenuatedPointSize` · `height / 2`.
|
|
51
|
+
*
|
|
52
|
+
* @param diameter World diameter of a point (before the model scale).
|
|
53
|
+
* @param projection Column-major view → clip.
|
|
54
|
+
* @param height Viewport height in pixels.
|
|
55
|
+
* @param model Column-major local → world (default identity).
|
|
56
|
+
*/
|
|
57
|
+
export function vdbPointPixelScale(diameter, projection, height, model) {
|
|
58
|
+
return diameter * (model ? vdbMat4MaxScale(model) : 1) * projection[5] * height * 0.5;
|
|
59
|
+
}
|
|
60
|
+
/** Group 0 binding 0. */
|
|
61
|
+
export const VDB_POINT_PASS_FRAME = vdbUniformStruct("VdbPointPassFrame", [
|
|
62
|
+
{ name: "modelView", type: "mat4x4f" },
|
|
63
|
+
{ name: "projection", type: "mat4x4f" },
|
|
64
|
+
{ name: "viewport", type: "vec4f" },
|
|
65
|
+
{ name: "color", type: "vec4f" },
|
|
66
|
+
// pixelScale, minSize
|
|
67
|
+
{ name: "params", type: "vec4f" },
|
|
68
|
+
]);
|
|
69
|
+
/** The quad's 6 corners (two triangles, three's sprite index order 0 1 2, 0 2 3). */
|
|
70
|
+
export const VDB_POINT_SPRITE_CORNERS = Object.freeze([
|
|
71
|
+
[-0.5, -0.5],
|
|
72
|
+
[0.5, -0.5],
|
|
73
|
+
[0.5, 0.5],
|
|
74
|
+
[-0.5, -0.5],
|
|
75
|
+
[0.5, 0.5],
|
|
76
|
+
[-0.5, 0.5],
|
|
77
|
+
]);
|
|
78
|
+
/** The raw pass's WGSL (`colors`: with the per-point colour attribute). */
|
|
79
|
+
export function vdbPointPassWgsl(colors) {
|
|
80
|
+
const corners = VDB_POINT_SPRITE_CORNERS.map(([x, y]) => `vec2f(${x.toFixed(1)}, ${y.toFixed(1)})`).join(", ");
|
|
81
|
+
return /* wgsl */ `${POINT_SPRITE_WGSL}
|
|
82
|
+
${VDB_POINT_PASS_FRAME.wgsl}
|
|
83
|
+
@group(0) @binding(0) var<uniform> vdbPtFrame: VdbPointPassFrame;
|
|
84
|
+
|
|
85
|
+
struct VdbPointPassVaryings {
|
|
86
|
+
@builtin(position) position: vec4f,
|
|
87
|
+
@location(0) corner: vec2f,
|
|
88
|
+
@location(1) color: vec3f,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
@vertex
|
|
92
|
+
fn vdbPointPassVs(@builtin(vertex_index) i: u32, @location(0) local: vec3f${colors ? ", @location(1) rgb: vec3f" : ""}) -> VdbPointPassVaryings {
|
|
93
|
+
var quad = array<vec2f, 6>(${corners});
|
|
94
|
+
let view = vdbPtFrame.modelView * vec4f(local, 1.0);
|
|
95
|
+
let size = vdbPointSpriteSize(vdbPtFrame.params.x, -view.z, vdbPtFrame.params.y);
|
|
96
|
+
var o: VdbPointPassVaryings;
|
|
97
|
+
o.corner = quad[i];
|
|
98
|
+
o.position = vdbPointSpriteVertex(vdbPtFrame.projection * view, o.corner, size, vdbPtFrame.viewport.zw);
|
|
99
|
+
o.color = vdbPtFrame.color.rgb${colors ? " * rgb" : ""};
|
|
100
|
+
return o;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@fragment
|
|
104
|
+
fn vdbPointPassFs(v: VdbPointPassVaryings) -> @location(0) vec4f {
|
|
105
|
+
if dot(v.corner, v.corner) > 0.25 {
|
|
106
|
+
discard;
|
|
107
|
+
}
|
|
108
|
+
return vec4f(v.color, 1.0);
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
function bad(message) {
|
|
113
|
+
return new VDBError("VDB_BAD_OPTION", `vdbCreatePointPass: ${message}`);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Creates a raw point-sprite pass on `device` (see the file comment): one instanced quad per point, an
|
|
117
|
+
* analytic round disc, depth-tested when `depthFormat` is set.
|
|
118
|
+
*
|
|
119
|
+
* @throws VDBError `VDB_BAD_OPTION` for bad options or data.
|
|
120
|
+
*/
|
|
121
|
+
export function vdbCreatePointPass(device, options) {
|
|
122
|
+
if (!options || typeof options.colorFormat !== "string")
|
|
123
|
+
throw bad("colorFormat is required.");
|
|
124
|
+
const label = options.label ?? "vdb point pass";
|
|
125
|
+
const groups = [{ entries: [{ binding: 0, visibility: STAGE.VERTEX | STAGE.FRAGMENT, buffer: { type: "uniform" } }] }];
|
|
126
|
+
const attribute = (location) => ({ arrayStride: 12, stepMode: "instance", attributes: [{ shaderLocation: location, offset: 0, format: "float32x3" }] });
|
|
127
|
+
const spec = (colors) => ({
|
|
128
|
+
label: `${label}${colors ? " (colors)" : ""}`,
|
|
129
|
+
code: vdbPointPassWgsl(colors),
|
|
130
|
+
vertexEntryPoint: "vdbPointPassVs",
|
|
131
|
+
fragmentEntryPoint: "vdbPointPassFs",
|
|
132
|
+
groups,
|
|
133
|
+
targets: [{ format: options.colorFormat }],
|
|
134
|
+
buffers: colors ? [attribute(0), attribute(1)] : [attribute(0)],
|
|
135
|
+
primitive: { topology: "triangle-list", cullMode: "none" },
|
|
136
|
+
...(options.depthFormat ? { depthStencil: { format: options.depthFormat, depthWriteEnabled: true, depthCompare: options.depthCompare ?? "less" } } : {}),
|
|
137
|
+
});
|
|
138
|
+
const specs = [spec(false), spec(true)];
|
|
139
|
+
const retire = new VDBRetireQueue();
|
|
140
|
+
const writer = new VDBUniformWriter(VDB_POINT_PASS_FRAME.size);
|
|
141
|
+
let uniforms = null;
|
|
142
|
+
let group = null;
|
|
143
|
+
let positions = null;
|
|
144
|
+
let colors = null;
|
|
145
|
+
let count = 0;
|
|
146
|
+
let disposed = false;
|
|
147
|
+
const alive = () => {
|
|
148
|
+
if (disposed)
|
|
149
|
+
throw new VDBError("VDB_DISPOSED", `${label}: disposed.`);
|
|
150
|
+
};
|
|
151
|
+
const upload = (data, n, what) => {
|
|
152
|
+
const b = device.createBuffer({ label: `${label} ${what}`, size: Math.max(16, n * 12), usage: 0x20 /* VERTEX */ | BUFFER_USAGE.COPY_DST });
|
|
153
|
+
if (n > 0)
|
|
154
|
+
device.queue.writeBuffer(b, 0, data.buffer, data.byteOffset, n * 12);
|
|
155
|
+
return b;
|
|
156
|
+
};
|
|
157
|
+
return {
|
|
158
|
+
device,
|
|
159
|
+
get count() {
|
|
160
|
+
return count;
|
|
161
|
+
},
|
|
162
|
+
specs,
|
|
163
|
+
setPoints(data) {
|
|
164
|
+
alive();
|
|
165
|
+
if (!data || !(data.positions instanceof Float32Array) || data.positions.length % 3 !== 0)
|
|
166
|
+
throw bad("positions must be a Float32Array of xyz triples.");
|
|
167
|
+
const n = data.count ?? data.positions.length / 3;
|
|
168
|
+
if (!Number.isInteger(n) || n < 0 || n * 3 > data.positions.length)
|
|
169
|
+
throw bad(`count ${n} does not fit ${data.positions.length / 3} positions.`);
|
|
170
|
+
if (data.colors && data.colors.length < n * 3)
|
|
171
|
+
throw bad("colors must hold count * 3 values.");
|
|
172
|
+
retire.retire(positions);
|
|
173
|
+
retire.retire(colors);
|
|
174
|
+
positions = upload(data.positions, n, "positions");
|
|
175
|
+
colors = data.colors ? upload(data.colors, n, "colors") : null;
|
|
176
|
+
count = n;
|
|
177
|
+
},
|
|
178
|
+
async prepare() {
|
|
179
|
+
alive();
|
|
180
|
+
await Promise.all(specs.map((s) => prepareRender(device, s)));
|
|
181
|
+
},
|
|
182
|
+
record(renderPass, frame) {
|
|
183
|
+
alive();
|
|
184
|
+
retire.advance();
|
|
185
|
+
if (!positions || count === 0)
|
|
186
|
+
return;
|
|
187
|
+
if (!frame || !frame.view || !frame.projection || !frame.viewport)
|
|
188
|
+
throw bad("record: frame needs view, projection and viewport.");
|
|
189
|
+
const [, , vw, vh] = frame.viewport;
|
|
190
|
+
if (!(vw > 0 && vh > 0))
|
|
191
|
+
throw bad(`record: viewport width and height must be > 0, got ${JSON.stringify(frame.viewport)}.`);
|
|
192
|
+
const s = VDB_POINT_PASS_FRAME;
|
|
193
|
+
const modelView = frame.model ? vdbMat4Multiply(frame.view, frame.model) : frame.view;
|
|
194
|
+
const pixelScale = frame.pixelScale ?? vdbPointPixelScale(frame.diameter ?? 1, frame.projection, vh, frame.model);
|
|
195
|
+
writer.set(s, 0, "modelView", modelView);
|
|
196
|
+
writer.set(s, 0, "projection", frame.projection);
|
|
197
|
+
writer.set(s, 0, "viewport", frame.viewport);
|
|
198
|
+
writer.set(s, 0, "color", [...(frame.color ?? [1, 1, 1]), 1]);
|
|
199
|
+
writer.set(s, 0, "params", [pixelScale, frame.minSize ?? 1, 0, 0]);
|
|
200
|
+
const built = renderPipeline(device, specs[colors ? 1 : 0]);
|
|
201
|
+
if (!uniforms) {
|
|
202
|
+
uniforms = device.createBuffer({ label: `${label} uniforms`, size: s.size, usage: BUFFER_USAGE.UNIFORM | BUFFER_USAGE.COPY_DST });
|
|
203
|
+
group = device.createBindGroup({ label: `${label} group 0`, layout: built.layouts[0], entries: [{ binding: 0, resource: { buffer: uniforms } }] });
|
|
204
|
+
}
|
|
205
|
+
device.queue.writeBuffer(uniforms, 0, writer.buffer);
|
|
206
|
+
renderPass.setPipeline(built.pipeline);
|
|
207
|
+
renderPass.setBindGroup(0, group);
|
|
208
|
+
renderPass.setVertexBuffer(0, positions);
|
|
209
|
+
if (colors)
|
|
210
|
+
renderPass.setVertexBuffer(1, colors);
|
|
211
|
+
renderPass.draw(6, count);
|
|
212
|
+
},
|
|
213
|
+
dispose() {
|
|
214
|
+
if (disposed)
|
|
215
|
+
return;
|
|
216
|
+
disposed = true;
|
|
217
|
+
retire.drain();
|
|
218
|
+
uniforms?.destroy();
|
|
219
|
+
positions?.destroy();
|
|
220
|
+
colors?.destroy();
|
|
221
|
+
uniforms = positions = colors = null;
|
|
222
|
+
group = null;
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=points.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"points.js","sourceRoot":"","sources":["../../../src/core/surface/points.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAsB,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAgB,MAAM,2BAA2B,CAAC;AAE3F;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,MAAM,iBAAi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AAM,EAAE,OAAO,EAAE,CAAC;YAClB,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;YACrC,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Point sprites (K6.6, design §3.9): the sprite size and attenuation as core WGSL\n * (`vdbPointSpriteWgsl`), which `VDBPoints` (`./three`) calls from its TSL vertex, and a raw sprite pass\n * (`vdbCreatePointPass`) for engine-free hosts. The disc is the adapters' (three keeps his mipmapped\n * alpha map); the raw pass cuts an analytic disc.\n *\n * Portions derived from mjurczyk/openvdb (MIT), commit 75e7345\n * (`src/three-openvdb/points/webgpu/VDBPoints.js`, `points/pointsCore.js`: one instanced quad per point,\n * the attenuated size in pixels with a 1-pixel minimum, the pixel scale `diameter · maxScale · zoom /\n * tan(fov / 2) · height / 2`) and three.js r187 (MIT) `PointsNodeMaterial.setupVertexSprite` (the clip-space\n * offset). Copyright (c) mjurczyk/openvdb contributors, MIT (see THIRD_PARTY_NOTICES.md). Changes: plain WGSL\n * and data; the raw pass's disc is analytic (DIVERGES.md).\n *\n * CPU twins: `tools` `pointSpriteSize`, `pointSpriteVertex`, `pointSpriteClip` (`tools/cpu/points.ts`).\n */\n\nimport { VDBError } from \"../errors.js\";\nimport type { VDBVec3 } from \"../pool/layout.js\";\nimport { prepareRender, renderPipeline, type VDBRenderSpec } from \"../frame/pipelines.js\";\nimport { BUFFER_USAGE, STAGE, VDBRetireQueue } from \"../frame/resources.js\";\nimport { VDBUniformWriter, vdbUniformStruct } from \"../frame/uniforms.js\";\nimport { vdbMat4MaxScale, vdbMat4Multiply, type VDBMat4 } from \"../../tools/frame/view.js\";\n\n/**\n * The WGSL text of the sprite functions (no bindings, no module):\n *\n * ```wgsl\n * fn vdbPointSpriteSize(pixelScale: f32, viewDepth: f32, minSize: f32) -> f32;\n * fn vdbPointSpriteVertex(clipCentre: vec4f, corner: vec2f, sizePx: f32, viewportSize: vec2f) -> vec4f;\n * ```\n *\n * - `vdbPointSpriteSize`: the sprite's width in pixels, `max(pixelScale / viewDepth, minSize)` (his 1-pixel\n * minimum: sprites under a pixel are still drawn); `viewDepth` is the point's distance along the view\n * axis (`−view.z`).\n * - `vdbPointSpriteVertex`: a quad corner's clip position, `clipCentre + (corner · sizePx / (viewportSize / 2)\n * · clipCentre.w, 0, 0)`; `corner` in `[−0.5, 0.5]²`, `viewportSize` in pixels. The quad is `sizePx` wide\n * on screen whatever the depth.\n */\nexport function vdbPointSpriteWgsl(): string {\n return POINT_SPRITE_WGSL;\n}\n\nconst POINT_SPRITE_WGSL = /* wgsl */ `fn vdbPointSpriteSize(pixelScale: f32, viewDepth: f32, minSize: f32) -> f32 {\n return max(pixelScale / viewDepth, minSize);\n}\n\nfn vdbPointSpriteVertex(clipCentre: vec4f, corner: vec2f, sizePx: f32, viewportSize: vec2f) -> vec4f {\n return clipCentre + vec4f(corner * sizePx / (viewportSize * 0.5) * clipCentre.w, 0.0, 0.0);\n}\n`;\n\n/**\n * The pixel scale of {@link vdbPointSpriteSize} (pixels at view depth 1) for a point of world diameter\n * `diameter`: `diameter · maxScale(model) · projection[5] · height / 2`. For a perspective projection\n * `projection[5]` is `zoom / tan(fov / 2)`, his `getAttenuatedPointSize` · `height / 2`.\n *\n * @param diameter World diameter of a point (before the model scale).\n * @param projection Column-major view → clip.\n * @param height Viewport height in pixels.\n * @param model Column-major local → world (default identity).\n */\nexport function vdbPointPixelScale(diameter: number, projection: VDBMat4, height: number, model?: VDBMat4): number {\n return diameter * (model ? vdbMat4MaxScale(model) : 1) * projection[5]! * height * 0.5;\n}\n\n/** Options of {@link vdbCreatePointPass}. */\nexport interface VDBPointPassOptions {\n readonly colorFormat: GPUTextureFormat;\n /** Depth attachment format, or null for none. Default null. */\n readonly depthFormat?: GPUTextureFormat | null;\n /** Depth test when `depthFormat` is set. Default `'less'`. */\n readonly depthCompare?: GPUCompareFunction;\n readonly label?: string;\n}\n\n/** Points to draw (tools `vdbPointRenderData` returns one). */\nexport interface VDBPointPassData {\n /** Local positions, xyz per point. */\n readonly positions: Float32Array;\n /** Linear RGB per point (times the frame colour), or null. */\n readonly colors?: Float32Array | null;\n /** Points to draw. Default `positions.length / 3`. */\n readonly count?: number;\n}\n\n/** The camera of one {@link VDBPointPass.record}. Matrices are column-major. */\nexport interface VDBPointPassFrame {\n readonly view: VDBMat4;\n readonly projection: VDBMat4;\n /** Local → world. Default identity. */\n readonly model?: VDBMat4;\n /** The render pass's viewport in attachment pixels: `[x, y, width, height]`. */\n readonly viewport: readonly [number, number, number, number];\n /** Pixels at view depth 1. Default {@link vdbPointPixelScale}`(diameter, projection, height, model)`. */\n readonly pixelScale?: number;\n /** World diameter for the default pixel scale. Default 1. */\n readonly diameter?: number;\n /** Smallest sprite in pixels. Default 1. */\n readonly minSize?: number;\n /** Colour (times each point's colour). Default white. */\n readonly color?: VDBVec3;\n}\n\n/** A raw point-sprite pass (see the file comment). */\nexport interface VDBPointPass {\n readonly device: GPUDevice;\n /** Points of the last {@link setPoints}. */\n readonly count: number;\n /** The pipeline spec without (`[0]`) and with (`[1]`) the colour attribute. */\n readonly specs: readonly [VDBRenderSpec, VDBRenderSpec];\n /** Uploads the points into buffers the pass owns (the old ones are retired). */\n setPoints(data: VDBPointPassData): void;\n /** Builds both pipelines with the async creators (optional). */\n prepare(): Promise<void>;\n /** Records one instanced draw into the host's render pass (one `record()` per submitted encoder). */\n record(renderPass: GPURenderPassEncoder, frame: VDBPointPassFrame): void;\n /** Destroys the buffers the pass made. Idempotent. */\n dispose(): void;\n}\n\n/** Group 0 binding 0. */\nexport const VDB_POINT_PASS_FRAME = vdbUniformStruct(\"VdbPointPassFrame\", [\n { name: \"modelView\", type: \"mat4x4f\" },\n { name: \"projection\", type: \"mat4x4f\" },\n { name: \"viewport\", type: \"vec4f\" },\n { name: \"color\", type: \"vec4f\" },\n // pixelScale, minSize\n { name: \"params\", type: \"vec4f\" },\n]);\n\n/** The quad's 6 corners (two triangles, three's sprite index order 0 1 2, 0 2 3). */\nexport const VDB_POINT_SPRITE_CORNERS: readonly (readonly [number, number])[] = Object.freeze([\n [-0.5, -0.5],\n [0.5, -0.5],\n [0.5, 0.5],\n [-0.5, -0.5],\n [0.5, 0.5],\n [-0.5, 0.5],\n]);\n\n/** The raw pass's WGSL (`colors`: with the per-point colour attribute). */\nexport function vdbPointPassWgsl(colors: boolean): string {\n const corners = VDB_POINT_SPRITE_CORNERS.map(([x, y]) => `vec2f(${x.toFixed(1)}, ${y.toFixed(1)})`).join(\", \");\n return /* wgsl */ `${POINT_SPRITE_WGSL}\n${VDB_POINT_PASS_FRAME.wgsl}\n@group(0) @binding(0) var<uniform> vdbPtFrame: VdbPointPassFrame;\n\nstruct VdbPointPassVaryings {\n @builtin(position) position: vec4f,\n @location(0) corner: vec2f,\n @location(1) color: vec3f,\n};\n\n@vertex\nfn vdbPointPassVs(@builtin(vertex_index) i: u32, @location(0) local: vec3f${colors ? \", @location(1) rgb: vec3f\" : \"\"}) -> VdbPointPassVaryings {\n var quad = array<vec2f, 6>(${corners});\n let view = vdbPtFrame.modelView * vec4f(local, 1.0);\n let size = vdbPointSpriteSize(vdbPtFrame.params.x, -view.z, vdbPtFrame.params.y);\n var o: VdbPointPassVaryings;\n o.corner = quad[i];\n o.position = vdbPointSpriteVertex(vdbPtFrame.projection * view, o.corner, size, vdbPtFrame.viewport.zw);\n o.color = vdbPtFrame.color.rgb${colors ? \" * rgb\" : \"\"};\n return o;\n}\n\n@fragment\nfn vdbPointPassFs(v: VdbPointPassVaryings) -> @location(0) vec4f {\n if dot(v.corner, v.corner) > 0.25 {\n discard;\n }\n return vec4f(v.color, 1.0);\n}\n`;\n}\n\nfunction bad(message: string): VDBError {\n return new VDBError(\"VDB_BAD_OPTION\", `vdbCreatePointPass: ${message}`);\n}\n\n/**\n * Creates a raw point-sprite pass on `device` (see the file comment): one instanced quad per point, an\n * analytic round disc, depth-tested when `depthFormat` is set.\n *\n * @throws VDBError `VDB_BAD_OPTION` for bad options or data.\n */\nexport function vdbCreatePointPass(device: GPUDevice, options: VDBPointPassOptions): VDBPointPass {\n if (!options || typeof options.colorFormat !== \"string\") throw bad(\"colorFormat is required.\");\n const label = options.label ?? \"vdb point pass\";\n const groups = [{ entries: [{ binding: 0, visibility: STAGE.VERTEX | STAGE.FRAGMENT, buffer: { type: \"uniform\" as const } }] }];\n const attribute = (location: number): GPUVertexBufferLayout => ({ arrayStride: 12, stepMode: \"instance\", attributes: [{ shaderLocation: location, offset: 0, format: \"float32x3\" }] });\n const spec = (colors: boolean): VDBRenderSpec => ({\n label: `${label}${colors ? \" (colors)\" : \"\"}`,\n code: vdbPointPassWgsl(colors),\n vertexEntryPoint: \"vdbPointPassVs\",\n fragmentEntryPoint: \"vdbPointPassFs\",\n groups,\n targets: [{ format: options.colorFormat }],\n buffers: colors ? [attribute(0), attribute(1)] : [attribute(0)],\n primitive: { topology: \"triangle-list\", cullMode: \"none\" },\n ...(options.depthFormat ? { depthStencil: { format: options.depthFormat, depthWriteEnabled: true, depthCompare: options.depthCompare ?? \"less\" } } : {}),\n });\n const specs = [spec(false), spec(true)] as const;\n const retire = new VDBRetireQueue();\n const writer = new VDBUniformWriter(VDB_POINT_PASS_FRAME.size);\n let uniforms: GPUBuffer | null = null;\n let group: GPUBindGroup | null = null;\n let positions: GPUBuffer | null = null;\n let colors: GPUBuffer | null = null;\n let count = 0;\n let disposed = false;\n const alive = () => {\n if (disposed) throw new VDBError(\"VDB_DISPOSED\", `${label}: disposed.`);\n };\n const upload = (data: Float32Array, n: number, what: string): GPUBuffer => {\n const b = device.createBuffer({ label: `${label} ${what}`, size: Math.max(16, n * 12), usage: 0x20 /* VERTEX */ | BUFFER_USAGE.COPY_DST });\n if (n > 0) device.queue.writeBuffer(b, 0, data.buffer, data.byteOffset, n * 12);\n return b;\n };\n\n return {\n device,\n get count() {\n return count;\n },\n specs,\n setPoints(data) {\n alive();\n if (!data || !(data.positions instanceof Float32Array) || data.positions.length % 3 !== 0) throw bad(\"positions must be a Float32Array of xyz triples.\");\n const n = data.count ?? data.positions.length / 3;\n if (!Number.isInteger(n) || n < 0 || n * 3 > data.positions.length) throw bad(`count ${n} does not fit ${data.positions.length / 3} positions.`);\n if (data.colors && data.colors.length < n * 3) throw bad(\"colors must hold count * 3 values.\");\n retire.retire(positions);\n retire.retire(colors);\n positions = upload(data.positions, n, \"positions\");\n colors = data.colors ? upload(data.colors, n, \"colors\") : null;\n count = n;\n },\n async prepare() {\n alive();\n await Promise.all(specs.map((s) => prepareRender(device, s)));\n },\n record(renderPass, frame) {\n alive();\n retire.advance();\n if (!positions || count === 0) return;\n if (!frame || !frame.view || !frame.projection || !frame.viewport) throw bad(\"record: frame needs view, projection and viewport.\");\n const [, , vw, vh] = frame.viewport;\n if (!(vw > 0 && vh > 0)) throw bad(`record: viewport width and height must be > 0, got ${JSON.stringify(frame.viewport)}.`);\n const s = VDB_POINT_PASS_FRAME;\n const modelView = frame.model ? vdbMat4Multiply(frame.view, frame.model) : frame.view;\n const pixelScale = frame.pixelScale ?? vdbPointPixelScale(frame.diameter ?? 1, frame.projection, vh, frame.model);\n writer.set(s, 0, \"modelView\", modelView);\n writer.set(s, 0, \"projection\", frame.projection);\n writer.set(s, 0, \"viewport\", frame.viewport);\n writer.set(s, 0, \"color\", [...(frame.color ?? [1, 1, 1]), 1]);\n writer.set(s, 0, \"params\", [pixelScale, frame.minSize ?? 1, 0, 0]);\n const built = renderPipeline(device, specs[colors ? 1 : 0]);\n if (!uniforms) {\n uniforms = device.createBuffer({ label: `${label} uniforms`, size: s.size, usage: BUFFER_USAGE.UNIFORM | BUFFER_USAGE.COPY_DST });\n group = device.createBindGroup({ label: `${label} group 0`, layout: built.layouts[0]!, entries: [{ binding: 0, resource: { buffer: uniforms } }] });\n }\n device.queue.writeBuffer(uniforms, 0, writer.buffer);\n renderPass.setPipeline(built.pipeline);\n renderPass.setBindGroup(0, group!);\n renderPass.setVertexBuffer(0, positions);\n if (colors) renderPass.setVertexBuffer(1, colors);\n renderPass.draw(6, count);\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n retire.drain();\n uniforms?.destroy();\n positions?.destroy();\n colors?.destroy();\n uniforms = positions = colors = null;\n group = null;\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types and tables shared by the pool (`pool/`) and the WGSL generator
|
|
3
|
+
* (`wgsl/`). One home so the two cannot drift (K1 integration).
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Grid value types the pool can hold and the generated WGSL can decode (NanoVDB
|
|
7
|
+
* `GridType` ids 1, 13-16 and 9). `half` is NanoVDB's `GridType::Half` (raw IEEE
|
|
8
|
+
* binary16 values, implemented in NanoVDB 13.2; K7.H).
|
|
9
|
+
*/
|
|
10
|
+
export type VDBGridTypeName = "float" | "fp4" | "fp8" | "fp16" | "fpn" | "half";
|
|
11
|
+
/**
|
|
12
|
+
* NanoVDB `GridType` id per name (`PNANOVDB_GRID_TYPE_*` in the vendored module).
|
|
13
|
+
* `test/core/types.test.ts` checks it against the vendored stride tables, the
|
|
14
|
+
* vendored WGSL constants and `tools`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const VDB_GRID_TYPE_IDS: Readonly<Record<VDBGridTypeName, number>>;
|
|
17
|
+
/**
|
|
18
|
+
* Canonical order; the generator sorts `types` into it so equal sets give equal
|
|
19
|
+
* bytes. `half` came last (K7.H), so the order of the older types is unchanged.
|
|
20
|
+
*/
|
|
21
|
+
export declare const VDB_GRID_TYPE_NAMES: readonly VDBGridTypeName[];
|
|
22
|
+
/**
|
|
23
|
+
* Every scalar grid type the pool can hold, for
|
|
24
|
+
* `vdbModuleWgsl({ types: VDB_ALL_SCALAR_TYPES, ... })`: a module that reads
|
|
25
|
+
* any grid a host may add later, so it never has to be regenerated and its
|
|
26
|
+
* pipeline rebuilt. The price is the largest module (every decoder); a host
|
|
27
|
+
* that knows its types up front should list just those. Same contents and
|
|
28
|
+
* order as {@link VDB_GRID_TYPE_NAMES}.
|
|
29
|
+
*/
|
|
30
|
+
export declare const VDB_ALL_SCALAR_TYPES: readonly VDBGridTypeName[];
|
|
31
|
+
/** Where a kernel binds the pool: `@group(group) @binding(firstBinding)`. Layout 1 uses one binding (D10). */
|
|
32
|
+
export interface VDBSlot {
|
|
33
|
+
/** The bind group index. */
|
|
34
|
+
readonly group: number;
|
|
35
|
+
/** The binding index of the pool buffer within the group. */
|
|
36
|
+
readonly firstBinding: number;
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types and tables shared by the pool (`pool/`) and the WGSL generator
|
|
3
|
+
* (`wgsl/`). One home so the two cannot drift (K1 integration).
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* NanoVDB `GridType` id per name (`PNANOVDB_GRID_TYPE_*` in the vendored module).
|
|
7
|
+
* `test/core/types.test.ts` checks it against the vendored stride tables, the
|
|
8
|
+
* vendored WGSL constants and `tools`.
|
|
9
|
+
*/
|
|
10
|
+
export const VDB_GRID_TYPE_IDS = {
|
|
11
|
+
float: 1,
|
|
12
|
+
fp4: 13,
|
|
13
|
+
fp8: 14,
|
|
14
|
+
fp16: 15,
|
|
15
|
+
fpn: 16,
|
|
16
|
+
half: 9,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Canonical order; the generator sorts `types` into it so equal sets give equal
|
|
20
|
+
* bytes. `half` came last (K7.H), so the order of the older types is unchanged.
|
|
21
|
+
*/
|
|
22
|
+
export const VDB_GRID_TYPE_NAMES = ["float", "fp4", "fp8", "fp16", "fpn", "half"];
|
|
23
|
+
/**
|
|
24
|
+
* Every scalar grid type the pool can hold, for
|
|
25
|
+
* `vdbModuleWgsl({ types: VDB_ALL_SCALAR_TYPES, ... })`: a module that reads
|
|
26
|
+
* any grid a host may add later, so it never has to be regenerated and its
|
|
27
|
+
* pipeline rebuilt. The price is the largest module (every decoder); a host
|
|
28
|
+
* that knows its types up front should list just those. Same contents and
|
|
29
|
+
* order as {@link VDB_GRID_TYPE_NAMES}.
|
|
30
|
+
*/
|
|
31
|
+
export const VDB_ALL_SCALAR_TYPES = Object.freeze([...VDB_GRID_TYPE_NAMES]);
|
|
32
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA8C;IAC1E,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,IAAI,EAAE,EAAE;IACR,GAAG,EAAE,EAAE;IACP,IAAI,EAAE,CAAC;CACR,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA+B,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAE9G;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA+B,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Types and tables shared by the pool (`pool/`) and the WGSL generator\n * (`wgsl/`). One home so the two cannot drift (K1 integration).\n */\n\n/**\n * Grid value types the pool can hold and the generated WGSL can decode (NanoVDB\n * `GridType` ids 1, 13-16 and 9). `half` is NanoVDB's `GridType::Half` (raw IEEE\n * binary16 values, implemented in NanoVDB 13.2; K7.H).\n */\nexport type VDBGridTypeName = \"float\" | \"fp4\" | \"fp8\" | \"fp16\" | \"fpn\" | \"half\";\n\n/**\n * NanoVDB `GridType` id per name (`PNANOVDB_GRID_TYPE_*` in the vendored module).\n * `test/core/types.test.ts` checks it against the vendored stride tables, the\n * vendored WGSL constants and `tools`.\n */\nexport const VDB_GRID_TYPE_IDS: Readonly<Record<VDBGridTypeName, number>> = {\n float: 1,\n fp4: 13,\n fp8: 14,\n fp16: 15,\n fpn: 16,\n half: 9,\n};\n\n/**\n * Canonical order; the generator sorts `types` into it so equal sets give equal\n * bytes. `half` came last (K7.H), so the order of the older types is unchanged.\n */\nexport const VDB_GRID_TYPE_NAMES: readonly VDBGridTypeName[] = [\"float\", \"fp4\", \"fp8\", \"fp16\", \"fpn\", \"half\"];\n\n/**\n * Every scalar grid type the pool can hold, for\n * `vdbModuleWgsl({ types: VDB_ALL_SCALAR_TYPES, ... })`: a module that reads\n * any grid a host may add later, so it never has to be regenerated and its\n * pipeline rebuilt. The price is the largest module (every decoder); a host\n * that knows its types up front should list just those. Same contents and\n * order as {@link VDB_GRID_TYPE_NAMES}.\n */\nexport const VDB_ALL_SCALAR_TYPES: readonly VDBGridTypeName[] = Object.freeze([...VDB_GRID_TYPE_NAMES]);\n\n/** Where a kernel binds the pool: `@group(group) @binding(firstBinding)`. Layout 1 uses one binding (D10). */\nexport interface VDBSlot {\n /** The bind group index. */\n readonly group: number;\n /** The binding index of the pool buffer within the group. */\n readonly firstBinding: number;\n}\n"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public `vdb*` WGSL API layered over the vendored traversal
|
|
3
|
+
* (docs/dev/design/K1-core.md §3.2). Written in the generated module's final names:
|
|
4
|
+
* vendored declarations appear renamed (`vdb_*`, `VDB_*`), and the generator
|
|
5
|
+
* pulls in exactly the vendored declarations this text references.
|
|
6
|
+
*
|
|
7
|
+
* Every pool read goes through `vdb_load`, the module's one buffer access,
|
|
8
|
+
* which the generator emits for the chosen binding mode.
|
|
9
|
+
*
|
|
10
|
+
* Layers stack: `sample` includes `read`, `march` includes `sample`, and
|
|
11
|
+
* `majorant` (P1.3) includes `sample` and, with `majorant: 'nodeMax'`, `march`
|
|
12
|
+
* (`./majorant.ts`). `reader: 'lean'` (P1.5) swaps the vendored accessor for
|
|
13
|
+
* `./lean.ts`. Each layer is a function of the normalized options and the
|
|
14
|
+
* profile rank.
|
|
15
|
+
*
|
|
16
|
+
* Conventions every layer keeps:
|
|
17
|
+
* - A grid id is usable when it is below `vdbGridCount()` and its record is
|
|
18
|
+
* live. Every per-grid function checks that first: a dead or out-of-range
|
|
19
|
+
* id never reads a zeroed record or image bytes as a record.
|
|
20
|
+
* - Voxel centres sit at integer index coordinates (the vendored trilinear and
|
|
21
|
+
* NanoVDB `SampleFromVoxels`); HDDA cells are floor-based, so voxel `i`
|
|
22
|
+
* occupies `[i, i + 1)` for ray clipping and traversal.
|
|
23
|
+
*/
|
|
24
|
+
import type { VDBGridTypeName } from "../types.js";
|
|
25
|
+
import { type VDBMajorantMode } from "./majorant.js";
|
|
26
|
+
import type { VDBModuleHelper } from "./types.js";
|
|
27
|
+
/** Options the API layer depends on (normalized by the generator). */
|
|
28
|
+
export interface ApiOptions {
|
|
29
|
+
readonly types: readonly VDBGridTypeName[];
|
|
30
|
+
readonly isActive: boolean;
|
|
31
|
+
readonly sampler: "trilinear" | "nearest";
|
|
32
|
+
readonly outside: "background" | "zero";
|
|
33
|
+
/** Opt-in helpers, canonical order; the generator has checked each one's profile. */
|
|
34
|
+
readonly helpers: readonly VDBModuleHelper[];
|
|
35
|
+
/** P1.5: the vendored accessor or the lean reader (`./lean.ts`). */
|
|
36
|
+
readonly reader: "vendored" | "lean";
|
|
37
|
+
/** P1.3/P1.4, `majorant` profile only (else `'brick'`): which walk. `'nodeMax'` includes the march layer. */
|
|
38
|
+
readonly majorant: VDBMajorantMode;
|
|
39
|
+
/** `majorant` profile only (else false): emit `vdbMajorantMinimum`. */
|
|
40
|
+
readonly minima: boolean;
|
|
41
|
+
/** EX1f-b: the host's random function the tracking helpers call (a WGSL identifier), else null. */
|
|
42
|
+
readonly random: string | null;
|
|
43
|
+
/** P1.16: what the lean accessor caches (`'leaf'` for the vendored reader, which has its own cache). */
|
|
44
|
+
readonly cache: "leaf" | "lower" | "lowerLeaf";
|
|
45
|
+
}
|
|
46
|
+
/** Whether the module has the march layer: `march`, or `majorant` with `'nodeMax'`. */
|
|
47
|
+
export declare function hasMarch(profileRank: number, o: Pick<ApiOptions, "majorant">): boolean;
|
|
48
|
+
/** Vendored grid-type constant names (after the rename) per compiled type. */
|
|
49
|
+
export declare const GRID_TYPE_CONSTANT: Readonly<Record<VDBGridTypeName, string>>;
|
|
50
|
+
/**
|
|
51
|
+
* API layers in profile order. A profile's API is every layer up to and
|
|
52
|
+
* including its own, except that `majorant` (rank 3) takes the march layer
|
|
53
|
+
* only with `majorant: 'nodeMax'` (P1.3: `brick` / `global` are `sample` plus
|
|
54
|
+
* the walk, K1-core §3.2).
|
|
55
|
+
*/
|
|
56
|
+
export declare const API_LAYERS: readonly ((o: ApiOptions, profileRank: number) => string)[];
|
|
57
|
+
/** The public API text for the profile at `profileRank` (0 = read, 1 = sample, 2 = march, 3 = majorant), then the requested helpers. */
|
|
58
|
+
export declare function apiWgsl(profileRank: number, o: ApiOptions): string;
|
|
59
|
+
/** The public functions of an API text: what `keep` can name. */
|
|
60
|
+
export declare function apiPublicFunctions(api: string): string[];
|
|
61
|
+
/**
|
|
62
|
+
* P1.16 `keep`: the API text cut to the named public functions and the declarations they reach (by identifier),
|
|
63
|
+
* in the original order. The generator's vendored closure then follows from the cut text.
|
|
64
|
+
*/
|
|
65
|
+
export declare function pruneApiWgsl(api: string, keep: readonly string[]): string;
|