@pmndrs/vdb 0.0.0-stage → 0.1.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 +137 -0
- package/LICENSE +21 -0
- package/README.md +448 -2
- package/THIRD_PARTY_NOTICES.md +147 -0
- package/dist/core/compute/atlas.d.ts +94 -0
- package/dist/core/compute/atlas.js +98 -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/pyramid.d.ts +105 -0
- package/dist/core/compute/pyramid.js +455 -0
- package/dist/core/compute/pyramid.js.map +1 -0
- package/dist/core/compute/shared.d.ts +115 -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 +71 -0
- package/dist/core/compute/stats.js +188 -0
- package/dist/core/compute/stats.js.map +1 -0
- package/dist/core/compute/value-transform.d.ts +23 -0
- package/dist/core/compute/value-transform.js +58 -0
- package/dist/core/compute/value-transform.js.map +1 -0
- package/dist/core/errors.d.ts +11 -0
- package/dist/core/errors.js +9 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/index.d.ts +30 -0
- package/dist/core/index.js +27 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal.d.ts +15 -0
- package/dist/core/internal.js +15 -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 +82 -0
- package/dist/core/pool/image-header.js +175 -0
- package/dist/core/pool/image-header.js.map +1 -0
- package/dist/core/pool/layout.d.ts +164 -0
- package/dist/core/pool/layout.js +267 -0
- package/dist/core/pool/layout.js.map +1 -0
- package/dist/core/pool/limits.d.ts +40 -0
- package/dist/core/pool/limits.js +79 -0
- package/dist/core/pool/limits.js.map +1 -0
- package/dist/core/pool/pool.d.ts +279 -0
- package/dist/core/pool/pool.js +953 -0
- package/dist/core/pool/pool.js.map +1 -0
- package/dist/core/source/dense.d.ts +19 -0
- package/dist/core/source/dense.js +287 -0
- package/dist/core/source/dense.js.map +1 -0
- package/dist/core/source/types.d.ts +63 -0
- package/dist/core/source/types.js +9 -0
- package/dist/core/source/types.js.map +1 -0
- package/dist/core/types.d.ts +28 -0
- package/dist/core/types.js +28 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/wgsl/api.d.ts +41 -0
- package/dist/core/wgsl/api.js +463 -0
- package/dist/core/wgsl/api.js.map +1 -0
- package/dist/core/wgsl/generate.d.ts +82 -0
- package/dist/core/wgsl/generate.js +505 -0
- package/dist/core/wgsl/generate.js.map +1 -0
- package/dist/core/wgsl/level-set.d.ts +54 -0
- package/dist/core/wgsl/level-set.js +194 -0
- package/dist/core/wgsl/level-set.js.map +1 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +14 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +330 -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 +104 -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 +162 -0
- package/dist/three/coarse-first.js +187 -0
- package/dist/three/coarse-first.js.map +1 -0
- package/dist/three/compute.d.ts +63 -0
- package/dist/three/compute.js +56 -0
- package/dist/three/compute.js.map +1 -0
- package/dist/three/device.d.ts +59 -0
- package/dist/three/device.js +59 -0
- package/dist/three/device.js.map +1 -0
- package/dist/three/frame/blackbody.d.ts +42 -0
- package/dist/three/frame/blackbody.js +74 -0
- package/dist/three/frame/blackbody.js.map +1 -0
- package/dist/three/frame/chunks.d.ts +157 -0
- package/dist/three/frame/chunks.js +559 -0
- package/dist/three/frame/chunks.js.map +1 -0
- package/dist/three/frame/density-material.d.ts +53 -0
- package/dist/three/frame/density-material.js +353 -0
- package/dist/three/frame/density-material.js.map +1 -0
- package/dist/three/frame/emission-light.d.ts +167 -0
- package/dist/three/frame/emission-light.js +655 -0
- package/dist/three/frame/emission-light.js.map +1 -0
- package/dist/three/frame/environment-grid-material.d.ts +21 -0
- package/dist/three/frame/environment-grid-material.js +184 -0
- package/dist/three/frame/environment-grid-material.js.map +1 -0
- package/dist/three/frame/environment-material.d.ts +22 -0
- package/dist/three/frame/environment-material.js +87 -0
- package/dist/three/frame/environment-material.js.map +1 -0
- package/dist/three/frame/grid-mip-material.d.ts +12 -0
- package/dist/three/frame/grid-mip-material.js +61 -0
- package/dist/three/frame/grid-mip-material.js.map +1 -0
- package/dist/three/frame/index.d.ts +39 -0
- package/dist/three/frame/index.js +35 -0
- package/dist/three/frame/index.js.map +1 -0
- package/dist/three/frame/inject-material.d.ts +56 -0
- package/dist/three/frame/inject-material.js +424 -0
- package/dist/three/frame/inject-material.js.map +1 -0
- package/dist/three/frame/integrate-material.d.ts +26 -0
- package/dist/three/frame/integrate-material.js +198 -0
- package/dist/three/frame/integrate-material.js.map +1 -0
- package/dist/three/frame/layout.d.ts +34 -0
- package/dist/three/frame/layout.js +48 -0
- package/dist/three/frame/layout.js.map +1 -0
- package/dist/three/frame/lighting-material.d.ts +41 -0
- package/dist/three/frame/lighting-material.js +257 -0
- package/dist/three/frame/lighting-material.js.map +1 -0
- package/dist/three/frame/lights.d.ts +11 -0
- package/dist/three/frame/lights.js +16 -0
- package/dist/three/frame/lights.js.map +1 -0
- package/dist/three/frame/medium.d.ts +21 -0
- package/dist/three/frame/medium.js +29 -0
- package/dist/three/frame/medium.js.map +1 -0
- package/dist/three/frame/neural.d.ts +14 -0
- package/dist/three/frame/neural.js +105 -0
- package/dist/three/frame/neural.js.map +1 -0
- package/dist/three/frame/phase.d.ts +44 -0
- package/dist/three/frame/phase.js +80 -0
- package/dist/three/frame/phase.js.map +1 -0
- package/dist/three/frame/renderer.d.ts +493 -0
- package/dist/three/frame/renderer.js +1498 -0
- package/dist/three/frame/renderer.js.map +1 -0
- package/dist/three/frame/shadow-density-material.d.ts +30 -0
- package/dist/three/frame/shadow-density-material.js +123 -0
- package/dist/three/frame/shadow-density-material.js.map +1 -0
- package/dist/three/frame/spectrum.d.ts +18 -0
- package/dist/three/frame/spectrum.js +36 -0
- package/dist/three/frame/spectrum.js.map +1 -0
- package/dist/three/frame/temporal-material.d.ts +29 -0
- package/dist/three/frame/temporal-material.js +152 -0
- package/dist/three/frame/temporal-material.js.map +1 -0
- package/dist/three/frame/three-internals.d.ts +65 -0
- package/dist/three/frame/three-internals.js +150 -0
- package/dist/three/frame/three-internals.js.map +1 -0
- package/dist/three/frame/transmittance-material.d.ts +31 -0
- package/dist/three/frame/transmittance-material.js +315 -0
- package/dist/three/frame/transmittance-material.js.map +1 -0
- package/dist/three/frame/view.d.ts +103 -0
- package/dist/three/frame/view.js +296 -0
- package/dist/three/frame/view.js.map +1 -0
- package/dist/three/frame/volume-shadow-material.d.ts +36 -0
- package/dist/three/frame/volume-shadow-material.js +128 -0
- package/dist/three/frame/volume-shadow-material.js.map +1 -0
- package/dist/three/frame/volume-shadows.d.ts +153 -0
- package/dist/three/frame/volume-shadows.js +756 -0
- package/dist/three/frame/volume-shadows.js.map +1 -0
- package/dist/three/frame/volume.d.ts +172 -0
- package/dist/three/frame/volume.js +256 -0
- package/dist/three/frame/volume.js.map +1 -0
- package/dist/three/grid-node.d.ts +196 -0
- package/dist/three/grid-node.js +510 -0
- package/dist/three/grid-node.js.map +1 -0
- package/dist/three/index.d.ts +43 -0
- package/dist/three/index.js +49 -0
- package/dist/three/index.js.map +1 -0
- package/dist/three/internal.d.ts +14 -0
- package/dist/three/internal.js +14 -0
- package/dist/three/internal.js.map +1 -0
- package/dist/three/level-set-material.d.ts +112 -0
- package/dist/three/level-set-material.js +204 -0
- package/dist/three/level-set-material.js.map +1 -0
- package/dist/three/material.d.ts +194 -0
- package/dist/three/material.js +359 -0
- package/dist/three/material.js.map +1 -0
- package/dist/three/points.d.ts +84 -0
- package/dist/three/points.js +130 -0
- package/dist/three/points.js.map +1 -0
- package/dist/three/sequence.d.ts +317 -0
- package/dist/three/sequence.js +526 -0
- package/dist/three/sequence.js.map +1 -0
- package/dist/three/sparse-source.d.ts +233 -0
- package/dist/three/sparse-source.js +876 -0
- package/dist/three/sparse-source.js.map +1 -0
- package/dist/three/volume-source.d.ts +167 -0
- package/dist/three/volume-source.js +353 -0
- package/dist/three/volume-source.js.map +1 -0
- package/dist/tools/cpu/compute.d.ts +97 -0
- package/dist/tools/cpu/compute.js +218 -0
- package/dist/tools/cpu/compute.js.map +1 -0
- package/dist/tools/cpu/level-set.d.ts +72 -0
- package/dist/tools/cpu/level-set.js +261 -0
- package/dist/tools/cpu/level-set.js.map +1 -0
- package/dist/tools/cpu/march.d.ts +206 -0
- package/dist/tools/cpu/march.js +575 -0
- package/dist/tools/cpu/march.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 +31 -0
- package/dist/tools/cpu/read-value.js +336 -0
- package/dist/tools/cpu/read-value.js.map +1 -0
- package/dist/tools/cpu/sample-trilinear.d.ts +30 -0
- package/dist/tools/cpu/sample-trilinear.js +156 -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 +1058 -0
- package/dist/tools/cpu/stride-tables.generated.js +1266 -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/errors.d.ts +57 -0
- package/dist/tools/errors.js +58 -0
- package/dist/tools/errors.js.map +1 -0
- package/dist/tools/frame/blackbody.d.ts +42 -0
- package/dist/tools/frame/blackbody.js +116 -0
- package/dist/tools/frame/blackbody.js.map +1 -0
- package/dist/tools/frame/emission.d.ts +128 -0
- package/dist/tools/frame/emission.js +282 -0
- package/dist/tools/frame/emission.js.map +1 -0
- package/dist/tools/frame/environment.d.ts +105 -0
- package/dist/tools/frame/environment.js +268 -0
- package/dist/tools/frame/environment.js.map +1 -0
- package/dist/tools/frame/grid.d.ts +302 -0
- package/dist/tools/frame/grid.js +703 -0
- package/dist/tools/frame/grid.js.map +1 -0
- package/dist/tools/frame/index.d.ts +136 -0
- package/dist/tools/frame/index.js +348 -0
- package/dist/tools/frame/index.js.map +1 -0
- package/dist/tools/frame/medium.d.ts +61 -0
- package/dist/tools/frame/medium.js +99 -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 +54 -0
- package/dist/tools/frame/mie.js +176 -0
- package/dist/tools/frame/mie.js.map +1 -0
- package/dist/tools/frame/neural-weights.d.ts +9 -0
- package/dist/tools/frame/neural-weights.js +245 -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/pyramid-layout.d.ts +38 -0
- package/dist/tools/frame/pyramid-layout.js +53 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -0
- package/dist/tools/frame/shadows.d.ts +80 -0
- package/dist/tools/frame/shadows.js +182 -0
- package/dist/tools/frame/shadows.js.map +1 -0
- package/dist/tools/frame/sparse.d.ts +65 -0
- package/dist/tools/frame/sparse.js +191 -0
- package/dist/tools/frame/sparse.js.map +1 -0
- package/dist/tools/frame/spectral.d.ts +203 -0
- package/dist/tools/frame/spectral.js +550 -0
- package/dist/tools/frame/spectral.js.map +1 -0
- package/dist/tools/index.d.ts +106 -0
- package/dist/tools/index.js +88 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/internal.d.ts +46 -0
- package/dist/tools/internal.js +31 -0
- package/dist/tools/internal.js.map +1 -0
- package/dist/tools/nanovdb/build-from-vdb.d.ts +50 -0
- package/dist/tools/nanovdb/build-from-vdb.js +92 -0
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
- package/dist/tools/nanovdb/bytes.d.ts +220 -0
- package/dist/tools/nanovdb/bytes.js +345 -0
- package/dist/tools/nanovdb/bytes.js.map +1 -0
- package/dist/tools/nanovdb/coarse-first.d.ts +62 -0
- package/dist/tools/nanovdb/coarse-first.js +86 -0
- package/dist/tools/nanovdb/coarse-first.js.map +1 -0
- package/dist/tools/nanovdb/index.d.ts +32 -0
- package/dist/tools/nanovdb/index.js +24 -0
- package/dist/tools/nanovdb/index.js.map +1 -0
- package/dist/tools/nanovdb/inspect.d.ts +24 -0
- package/dist/tools/nanovdb/inspect.js +63 -0
- package/dist/tools/nanovdb/inspect.js.map +1 -0
- package/dist/tools/nanovdb/leaf-codec.d.ts +85 -0
- package/dist/tools/nanovdb/leaf-codec.js +320 -0
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
- package/dist/tools/nanovdb/quantize.d.ts +43 -0
- package/dist/tools/nanovdb/quantize.js +277 -0
- package/dist/tools/nanovdb/quantize.js.map +1 -0
- package/dist/tools/nanovdb/resample.d.ts +160 -0
- package/dist/tools/nanovdb/resample.js +679 -0
- package/dist/tools/nanovdb/resample.js.map +1 -0
- package/dist/tools/nanovdb/serialize.d.ts +145 -0
- package/dist/tools/nanovdb/serialize.js +395 -0
- package/dist/tools/nanovdb/serialize.js.map +1 -0
- package/dist/tools/nanovdb/stats.d.ts +58 -0
- package/dist/tools/nanovdb/stats.js +149 -0
- package/dist/tools/nanovdb/stats.js.map +1 -0
- package/dist/tools/nanovdb/transform.d.ts +26 -0
- package/dist/tools/nanovdb/transform.js +91 -0
- package/dist/tools/nanovdb/transform.js.map +1 -0
- package/dist/tools/nanovdb/tree.d.ts +175 -0
- package/dist/tools/nanovdb/tree.js +518 -0
- package/dist/tools/nanovdb/tree.js.map +1 -0
- package/dist/tools/nanovdb/write-nvdb.d.ts +39 -0
- package/dist/tools/nanovdb/write-nvdb.js +210 -0
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
- package/dist/tools/nvdb-file.d.ts +195 -0
- package/dist/tools/nvdb-file.js +606 -0
- package/dist/tools/nvdb-file.js.map +1 -0
- package/dist/tools/nvdb-stream.d.ts +138 -0
- package/dist/tools/nvdb-stream.js +365 -0
- package/dist/tools/nvdb-stream.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.d.ts +56 -0
- package/dist/tools/vdb/blosc.js +231 -0
- package/dist/tools/vdb/blosc.js.map +1 -0
- package/dist/tools/vdb/byte-reader.d.ts +40 -0
- package/dist/tools/vdb/byte-reader.js +139 -0
- package/dist/tools/vdb/byte-reader.js.map +1 -0
- package/dist/tools/vdb/compression.d.ts +73 -0
- package/dist/tools/vdb/compression.js +249 -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 +147 -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 +3 -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/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 +25 -0
- package/dist/tools/vdb/parse.js +171 -0
- package/dist/tools/vdb/parse.js.map +1 -0
- package/dist/tools/vdb/point-render-data.d.ts +31 -0
- package/dist/tools/vdb/point-render-data.js +57 -0
- package/dist/tools/vdb/point-render-data.js.map +1 -0
- package/dist/tools/vdb/points.d.ts +160 -0
- package/dist/tools/vdb/points.js +794 -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 +138 -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 +116 -0
- package/dist/tools/wvdb/bake.js +311 -0
- package/dist/tools/wvdb/bake.js.map +1 -0
- package/dist/tools/wvdb/dense.d.ts +112 -0
- package/dist/tools/wvdb/dense.js +309 -0
- package/dist/tools/wvdb/dense.js.map +1 -0
- package/dist/tools/wvdb/format.d.ts +161 -0
- package/dist/tools/wvdb/format.js +303 -0
- package/dist/tools/wvdb/format.js.map +1 -0
- package/dist/tools/wvdb/index.d.ts +13 -0
- package/dist/tools/wvdb/index.js +14 -0
- package/dist/tools/wvdb/index.js.map +1 -0
- package/dist/tools/wvdb/level-set.d.ts +48 -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 +54 -0
- package/dist/tools/wvdb/nanovdb.js +60 -0
- package/dist/tools/wvdb/nanovdb.js.map +1 -0
- package/dist/tools/wvdb/read.d.ts +260 -0
- package/dist/tools/wvdb/read.js +743 -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 +127 -0
- package/dist/tools/wvdb/write.js +396 -0
- package/dist/tools/wvdb/write.js.map +1 -0
- package/package.json +82 -4
- package/vendor/LICENSE +201 -0
- package/vendor/NOTICE +19 -0
- package/vendor/VENDOR.md +85 -0
- package/vendor/pnanovdb.wgsl +1539 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/three/device.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAmB7C,+GAA+G;AAC/G,MAAM,UAAU,eAAe,CAAC,QAAiB,EAAE,IAAI,GAAG,WAAW;IACnE,MAAM,OAAO,GAAI,QAAiE,EAAE,OAAO,CAAC;IAC5F,IAAI,OAAO,EAAE,eAAe,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,OAAO,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;QAC9F,MAAM,IAAI,QAAQ,CAChB,wBAAwB,EACxB,kBAAkB,IAAI,yFAAyF;YAC7G,8CAA8C,CACjD,CAAC;IACJ,CAAC;IACD,OAAO,OAA+D,CAAC;AACzE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,QAA8B;IACtD,OAAO,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC;AACvD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,QAA8B,EAAE,OAAe;IAC3E,MAAM,OAAO,GAAG,eAAe,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,OAA2C,CAAC;QAC1D,MAAM,IAAI,QAAQ,CAChB,gBAAgB,EAChB,wCAAwC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,SAAS,SAAS;YACpF,gEAAgE,CACnE,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/**\n * The raw WebGPU handles behind a three.js `WebGPURenderer` (task K2.1).\n *\n * Same helpers and semantics as `@pmndrs/upscaler` and `@pmndrs/denoiser`\n * (`getDevice`, `getGPUTexture`), so every pmndrs tool in a frame shares the\n * renderer's one `GPUDevice`: create the pool with\n * `VDBGridPool.create(getDevice(renderer))`.\n *\n * Typed structurally (`VDBThreeRendererLike`, the downsampler's pattern), so this\n * file needs nothing from three at runtime. It reads two backend internals,\n * checked against three r187 (the peer range):\n * - `renderer.backend.device`: the `GPUDevice` (null until `renderer.init()`\n * resolves; absent on the WebGL fallback backend);\n * - `renderer.backend.get(texture).texture`: the `GPUTexture` behind a three\n * texture once it is allocated.\n *\n * A renderer built without a `device` parameter owns its device and destroys\n * it in `renderer.dispose()`, and with it every buffer on it (the pool's\n * too). To keep a pool alive past the renderer, create the device yourself and\n * pass it: `new WebGPURenderer({ device })`.\n */\n\nimport { VDBError } from \"../core/errors.js\";\n\n/** The parts of three's WebGPU backend the adapter reads (structural, three r187). */\nexport interface VDBThreeBackendLike {\n readonly isWebGPUBackend?: boolean;\n readonly device?: GPUDevice | null;\n get(object: object): { texture?: GPUTexture; buffer?: GPUBuffer } & Record<string, unknown>;\n}\n\n/**\n * The part of a three.js `WebGPURenderer` the adapter uses (structural, so\n * `three` stays an optional peer). `backend` is typed loosely because\n * `@types/three` does not declare the internals read here (`get`); they are\n * checked at runtime instead.\n */\nexport interface VDBThreeRendererLike {\n readonly backend: object;\n}\n\n/** Throws unless `renderer` is an initialized `WebGPURenderer` on its WebGPU backend; returns that backend. */\nexport function webgpuBackendOf(renderer: unknown, what = \"getDevice\"): VDBThreeBackendLike & { readonly device: GPUDevice } {\n const backend = (renderer as { backend?: VDBThreeBackendLike } | null | undefined)?.backend;\n if (backend?.isWebGPUBackend !== true || !backend.device || typeof backend.get !== \"function\") {\n throw new VDBError(\n \"VDB_UNSUPPORTED_DEVICE\",\n `three adapter: ${what} requires an initialized WebGPURenderer (await renderer.init()) on its WebGPU backend; ` +\n \"the WebGL fallback backend has no GPUDevice.\",\n );\n }\n return backend as VDBThreeBackendLike & { readonly device: GPUDevice };\n}\n\n/**\n * The `GPUDevice` an initialized `WebGPURenderer` renders with. Create the\n * pool (and the other pmndrs tools) on it so they share one device.\n *\n * @throws VDBError `VDB_UNSUPPORTED_DEVICE` before `await renderer.init()`, or on the WebGL fallback backend.\n */\nexport function getDevice(renderer: VDBThreeRendererLike): GPUDevice {\n return webgpuBackendOf(renderer, \"getDevice\").device;\n}\n\n/**\n * The raw `GPUTexture` behind a three texture (render-target attachment,\n * `DepthTexture`, `StorageTexture`...). It must already be allocated: render to\n * it once or call `renderer.initTexture(texture)`.\n *\n * @throws VDBError `VDB_UNSUPPORTED_DEVICE` for an uninitialized or non-WebGPU\n * renderer; `VDB_BAD_OPTION` if the texture has no GPU allocation yet.\n */\nexport function getGPUTexture(renderer: VDBThreeRendererLike, texture: object): GPUTexture {\n const backend = webgpuBackendOf(renderer, \"getGPUTexture\");\n const gpuTexture = backend.get(texture)?.texture;\n if (!gpuTexture) {\n const named = texture as { name?: string; uuid?: string };\n throw new VDBError(\n \"VDB_BAD_OPTION\",\n `three adapter: no GPUTexture behind \"${named.name || named.uuid || \"texture\"}\" yet. ` +\n \"Render to it once or call renderer.initTexture(texture) first.\",\n );\n }\n return gpuTexture;\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K3.6: his physical emission spectra as an emission colour hook:
|
|
3
|
+
*
|
|
4
|
+
* const flames = vdbFrameBlackbodyEmission("soot", 1.39);
|
|
5
|
+
* new VDBFrameVolume(source, { emissionColor: flames, temperatureRange: [0, 3000], emissiveIntensity: 13 });
|
|
6
|
+
* flames.sootExponent.value = 2.0; // a uniform: no rebuild
|
|
7
|
+
*
|
|
8
|
+
* `'planck'`: blackbody colour; `'soot'`: × λ^−exponent (0–3). The colour is normalized (largest channel 1); the
|
|
9
|
+
* volume's power still grows with temperature⁴ (`sampleEmission`). The CIE 1931 colour matching functions are the
|
|
10
|
+
* analytic fit of Wyman, Sloan & Shirley (2013; D33): against the CIE table the normalized colour moves by ≤ 0.021
|
|
11
|
+
* per channel over 1,000–40,000 K (chromaticity Δxy ≤ 0.0016 from 3,000 K up, 0.015 at 1,000 K where the fit's red
|
|
12
|
+
* tail past ~680 nm is short).
|
|
13
|
+
*/
|
|
14
|
+
import * as THREE from "three";
|
|
15
|
+
import type { VDBTslNode } from "../grid-node.js";
|
|
16
|
+
import { type VDBColorMatchingFunctions } from "../../tools/frame/blackbody.js";
|
|
17
|
+
type N = VDBTslNode;
|
|
18
|
+
/** The 256 × 16 RGBA float table as a texture (made once per `cmf`; read with `load`, no filtering). */
|
|
19
|
+
export declare function getFrameBlackbodyMap(cmf?: VDBColorMatchingFunctions): THREE.DataTexture;
|
|
20
|
+
/** frameBlackbodyColor: the table at a temperature (K) and soot exponent, linear in log temperature and exponent. */
|
|
21
|
+
export declare const frameBlackbodyColor: (map: N, temperature: N, exponent: N) => N;
|
|
22
|
+
/** An emission colour hook with its soot exponent uniform. */
|
|
23
|
+
export interface VDBFrameBlackbodyHook {
|
|
24
|
+
(temperature: N): N;
|
|
25
|
+
/** The soot exponent (0–3; 'planck': 0). Set `.value` at runtime. */
|
|
26
|
+
readonly sootExponent: {
|
|
27
|
+
value: number;
|
|
28
|
+
};
|
|
29
|
+
readonly spectrum: "planck" | "soot";
|
|
30
|
+
/** The table texture this hook reads (one per colour matching functions; D33). */
|
|
31
|
+
readonly table: THREE.DataTexture;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The `emissionColor` hook of his `'planck'` / `'soot'` emission spectra (`VDBFrameVolume` / `vdbVolumeNodes`
|
|
35
|
+
* `emissionColor`). Temperatures ≤ 0 give black (the source's `sampleEmission` already selects them out).
|
|
36
|
+
* `options.cmf`: the CIE 1931 colour matching functions (x̄, ȳ, z̄ at a wavelength in nm, read at 380–780 nm in 5 nm
|
|
37
|
+
* steps); default the analytic fit `vdbCie1931Fit` (D33). Pass the exact CIE table here to match his colours exactly.
|
|
38
|
+
*/
|
|
39
|
+
export declare function vdbFrameBlackbodyEmission(spectrum?: "planck" | "soot", sootExponent?: number, options?: {
|
|
40
|
+
cmf?: VDBColorMatchingFunctions;
|
|
41
|
+
}): VDBFrameBlackbodyHook;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/frame/webgpu/frameShaderChunks.js L222–256 (the blackbody table texture and
|
|
3
|
+
// frameBlackbodyColor), L1003–1010 (the 'planck' / 'soot' branch of sampleEmission).
|
|
4
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
5
|
+
// Changes: TypeScript; an `emissionColor` hook of `VDBFrameVolume` (the volume-source seam) instead of a built-in
|
|
6
|
+
// spectrum switch; his 'approximate' (Shadertoy) spectrum is not ported (R1 §7, DIVERGES V24). The table is engine-free
|
|
7
|
+
// (`@pmndrs/vdb/tools` `vdbFrameBlackbodyTable`, with a CPU twin of the read). D33: the colour matching functions are
|
|
8
|
+
// the analytic fit of Wyman, Sloan & Shirley (JCGT 2(2), 2013), not his CIE 1931 table (CC BY-SA 4.0); `options.cmf`
|
|
9
|
+
// takes others (e.g. the exact table, supplied by the caller under its own licence).
|
|
10
|
+
/**
|
|
11
|
+
* K3.6: his physical emission spectra as an emission colour hook:
|
|
12
|
+
*
|
|
13
|
+
* const flames = vdbFrameBlackbodyEmission("soot", 1.39);
|
|
14
|
+
* new VDBFrameVolume(source, { emissionColor: flames, temperatureRange: [0, 3000], emissiveIntensity: 13 });
|
|
15
|
+
* flames.sootExponent.value = 2.0; // a uniform: no rebuild
|
|
16
|
+
*
|
|
17
|
+
* `'planck'`: blackbody colour; `'soot'`: × λ^−exponent (0–3). The colour is normalized (largest channel 1); the
|
|
18
|
+
* volume's power still grows with temperature⁴ (`sampleEmission`). The CIE 1931 colour matching functions are the
|
|
19
|
+
* analytic fit of Wyman, Sloan & Shirley (2013; D33): against the CIE table the normalized colour moves by ≤ 0.021
|
|
20
|
+
* per channel over 1,000–40,000 K (chromaticity Δxy ≤ 0.0016 from 3,000 K up, 0.015 at 1,000 K where the fit's red
|
|
21
|
+
* tail past ~680 nm is short).
|
|
22
|
+
*/
|
|
23
|
+
import * as THREE from "three";
|
|
24
|
+
import * as TSL from "three/tsl";
|
|
25
|
+
import { frameBlackbodyMaxTemperature, frameBlackbodyMinTemperature, frameBlackbodyTableRows, frameBlackbodyTableSize, frameMaxSootExponent, vdbCie1931Fit, vdbFrameBlackbodyTable, vdbFrameEmissionSpectrum, } from "../../tools/frame/blackbody.js";
|
|
26
|
+
const { clamp, float, int, ivec2, log, max, min, mix, texture, uniform } = TSL;
|
|
27
|
+
const tableTextures = new WeakMap();
|
|
28
|
+
/** The 256 × 16 RGBA float table as a texture (made once per `cmf`; read with `load`, no filtering). */
|
|
29
|
+
export function getFrameBlackbodyMap(cmf = vdbCie1931Fit) {
|
|
30
|
+
let tableTexture = tableTextures.get(cmf);
|
|
31
|
+
if (!tableTexture) {
|
|
32
|
+
tableTexture = new THREE.DataTexture(vdbFrameBlackbodyTable(cmf), frameBlackbodyTableSize, frameBlackbodyTableRows, THREE.RGBAFormat, THREE.FloatType);
|
|
33
|
+
tableTexture.minFilter = THREE.NearestFilter;
|
|
34
|
+
tableTexture.magFilter = THREE.NearestFilter;
|
|
35
|
+
tableTexture.generateMipmaps = false;
|
|
36
|
+
tableTexture.needsUpdate = true;
|
|
37
|
+
tableTextures.set(cmf, tableTexture);
|
|
38
|
+
}
|
|
39
|
+
return tableTexture;
|
|
40
|
+
}
|
|
41
|
+
/** frameBlackbodyColor: the table at a temperature (K) and soot exponent, linear in log temperature and exponent. */
|
|
42
|
+
export const frameBlackbodyColor = (map, temperature, exponent) => {
|
|
43
|
+
const temperatureScale = Math.log(frameBlackbodyMaxTemperature / frameBlackbodyMinTemperature);
|
|
44
|
+
const logTemperature = log(max(temperature, 1e-3).div(frameBlackbodyMinTemperature));
|
|
45
|
+
const x = clamp(logTemperature.div(temperatureScale), 0.0, 1.0)
|
|
46
|
+
.mul(frameBlackbodyTableSize - 1)
|
|
47
|
+
.toVar();
|
|
48
|
+
const y = clamp(exponent.div(frameMaxSootExponent), 0.0, 1.0)
|
|
49
|
+
.mul(frameBlackbodyTableRows - 1)
|
|
50
|
+
.toVar();
|
|
51
|
+
const column = min(int(x), int(frameBlackbodyTableSize - 2)).toVar();
|
|
52
|
+
const row = min(int(y), int(frameBlackbodyTableRows - 2)).toVar();
|
|
53
|
+
const blendX = x.sub(float(column)).toVar();
|
|
54
|
+
const texel = (offsetX, offsetY) => map.load(ivec2(column.add(offsetX), row.add(offsetY))).rgb;
|
|
55
|
+
return mix(mix(texel(0, 0), texel(1, 0), blendX), mix(texel(0, 1), texel(1, 1), blendX), y.sub(float(row)));
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* The `emissionColor` hook of his `'planck'` / `'soot'` emission spectra (`VDBFrameVolume` / `vdbVolumeNodes`
|
|
59
|
+
* `emissionColor`). Temperatures ≤ 0 give black (the source's `sampleEmission` already selects them out).
|
|
60
|
+
* `options.cmf`: the CIE 1931 colour matching functions (x̄, ȳ, z̄ at a wavelength in nm, read at 380–780 nm in 5 nm
|
|
61
|
+
* steps); default the analytic fit `vdbCie1931Fit` (D33). Pass the exact CIE table here to match his colours exactly.
|
|
62
|
+
*/
|
|
63
|
+
export function vdbFrameBlackbodyEmission(spectrum = "planck", sootExponent = 1.39, options = {}) {
|
|
64
|
+
const [, exponent] = vdbFrameEmissionSpectrum(spectrum, sootExponent);
|
|
65
|
+
const exponentNode = uniform(exponent);
|
|
66
|
+
const table = getFrameBlackbodyMap(options.cmf);
|
|
67
|
+
const map = texture(table);
|
|
68
|
+
const hook = ((temperature) => frameBlackbodyColor(map, temperature, exponentNode));
|
|
69
|
+
Object.defineProperty(hook, "sootExponent", { value: exponentNode });
|
|
70
|
+
Object.defineProperty(hook, "spectrum", { value: spectrum });
|
|
71
|
+
Object.defineProperty(hook, "table", { value: table });
|
|
72
|
+
return hook;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=blackbody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blackbody.js","sourceRoot":"","sources":["../../../src/three/frame/blackbody.ts"],"names":[],"mappings":"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","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/frameShaderChunks.js L222–256 (the blackbody table texture and\n// frameBlackbodyColor), L1003–1010 (the 'planck' / 'soot' branch of sampleEmission).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TypeScript; an `emissionColor` hook of `VDBFrameVolume` (the volume-source seam) instead of a built-in\n// spectrum switch; his 'approximate' (Shadertoy) spectrum is not ported (R1 §7, DIVERGES V24). The table is engine-free\n// (`@pmndrs/vdb/tools` `vdbFrameBlackbodyTable`, with a CPU twin of the read). D33: the colour matching functions are\n// the analytic fit of Wyman, Sloan & Shirley (JCGT 2(2), 2013), not his CIE 1931 table (CC BY-SA 4.0); `options.cmf`\n// takes others (e.g. the exact table, supplied by the caller under its own licence).\n\n/**\n * K3.6: his physical emission spectra as an emission colour hook:\n *\n * const flames = vdbFrameBlackbodyEmission(\"soot\", 1.39);\n * new VDBFrameVolume(source, { emissionColor: flames, temperatureRange: [0, 3000], emissiveIntensity: 13 });\n * flames.sootExponent.value = 2.0; // a uniform: no rebuild\n *\n * `'planck'`: blackbody colour; `'soot'`: × λ^−exponent (0–3). The colour is normalized (largest channel 1); the\n * volume's power still grows with temperature⁴ (`sampleEmission`). The CIE 1931 colour matching functions are the\n * analytic fit of Wyman, Sloan & Shirley (2013; D33): against the CIE table the normalized colour moves by ≤ 0.021\n * per channel over 1,000–40,000 K (chromaticity Δxy ≤ 0.0016 from 3,000 K up, 0.015 at 1,000 K where the fit's red\n * tail past ~680 nm is short).\n */\n\nimport * as THREE from \"three\";\nimport * as TSL from \"three/tsl\";\nimport type { VDBTslNode } from \"../grid-node.js\";\nimport {\n frameBlackbodyMaxTemperature,\n frameBlackbodyMinTemperature,\n frameBlackbodyTableRows,\n frameBlackbodyTableSize,\n frameMaxSootExponent,\n vdbCie1931Fit,\n vdbFrameBlackbodyTable,\n vdbFrameEmissionSpectrum,\n type VDBColorMatchingFunctions,\n} from \"../../tools/frame/blackbody.js\";\n\nconst { clamp, float, int, ivec2, log, max, min, mix, texture, uniform } = TSL as unknown as Record<string, VDBTslNode>;\n\ntype N = VDBTslNode;\n\nconst tableTextures = new WeakMap<VDBColorMatchingFunctions, THREE.DataTexture>();\n\n/** The 256 × 16 RGBA float table as a texture (made once per `cmf`; read with `load`, no filtering). */\nexport function getFrameBlackbodyMap(cmf: VDBColorMatchingFunctions = vdbCie1931Fit): THREE.DataTexture {\n let tableTexture = tableTextures.get(cmf);\n if (!tableTexture) {\n tableTexture = new THREE.DataTexture(vdbFrameBlackbodyTable(cmf), frameBlackbodyTableSize, frameBlackbodyTableRows, THREE.RGBAFormat, THREE.FloatType);\n tableTexture.minFilter = THREE.NearestFilter;\n tableTexture.magFilter = THREE.NearestFilter;\n tableTexture.generateMipmaps = false;\n tableTexture.needsUpdate = true;\n tableTextures.set(cmf, tableTexture);\n }\n\n return tableTexture;\n}\n\n/** frameBlackbodyColor: the table at a temperature (K) and soot exponent, linear in log temperature and exponent. */\nexport const frameBlackbodyColor = (map: N, temperature: N, exponent: N): N => {\n const temperatureScale = Math.log(frameBlackbodyMaxTemperature / frameBlackbodyMinTemperature);\n const logTemperature = log(max(temperature, 1e-3).div(frameBlackbodyMinTemperature));\n const x = clamp(logTemperature.div(temperatureScale), 0.0, 1.0)\n .mul(frameBlackbodyTableSize - 1)\n .toVar();\n const y = clamp(exponent.div(frameMaxSootExponent), 0.0, 1.0)\n .mul(frameBlackbodyTableRows - 1)\n .toVar();\n const column = min(int(x), int(frameBlackbodyTableSize - 2)).toVar();\n const row = min(int(y), int(frameBlackbodyTableRows - 2)).toVar();\n const blendX = x.sub(float(column)).toVar();\n const texel = (offsetX: number, offsetY: number) => map.load(ivec2(column.add(offsetX), row.add(offsetY))).rgb;\n\n return mix(mix(texel(0, 0), texel(1, 0), blendX), mix(texel(0, 1), texel(1, 1), blendX), y.sub(float(row)));\n};\n\n/** An emission colour hook with its soot exponent uniform. */\nexport interface VDBFrameBlackbodyHook {\n (temperature: N): N;\n /** The soot exponent (0–3; 'planck': 0). Set `.value` at runtime. */\n readonly sootExponent: { value: number };\n readonly spectrum: \"planck\" | \"soot\";\n /** The table texture this hook reads (one per colour matching functions; D33). */\n readonly table: THREE.DataTexture;\n}\n\n/**\n * The `emissionColor` hook of his `'planck'` / `'soot'` emission spectra (`VDBFrameVolume` / `vdbVolumeNodes`\n * `emissionColor`). Temperatures ≤ 0 give black (the source's `sampleEmission` already selects them out).\n * `options.cmf`: the CIE 1931 colour matching functions (x̄, ȳ, z̄ at a wavelength in nm, read at 380–780 nm in 5 nm\n * steps); default the analytic fit `vdbCie1931Fit` (D33). Pass the exact CIE table here to match his colours exactly.\n */\nexport function vdbFrameBlackbodyEmission(spectrum: \"planck\" | \"soot\" = \"planck\", sootExponent = 1.39, options: { cmf?: VDBColorMatchingFunctions } = {}): VDBFrameBlackbodyHook {\n const [, exponent] = vdbFrameEmissionSpectrum(spectrum, sootExponent);\n const exponentNode = uniform(exponent);\n const table = getFrameBlackbodyMap(options.cmf);\n const map = texture(table);\n const hook = ((temperature: N) => frameBlackbodyColor(map, temperature, exponentNode)) as VDBFrameBlackbodyHook;\n\n Object.defineProperty(hook, \"sootExponent\", { value: exponentNode });\n Object.defineProperty(hook, \"spectrum\", { value: spectrum });\n Object.defineProperty(hook, \"table\", { value: table });\n\n return hook;\n}\n"]}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { VDBTslNode } from "../grid-node.js";
|
|
2
|
+
import type { VDBVolumeNodes, VDBVolumeUniforms } from "../volume-source.js";
|
|
3
|
+
type N = VDBTslNode;
|
|
4
|
+
export declare const minComponent: (v: VDBTslNode) => VDBTslNode;
|
|
5
|
+
export declare const maxComponent: (v: VDBTslNode) => VDBTslNode;
|
|
6
|
+
export declare const frameFragCoord: (targetSize: N) => N;
|
|
7
|
+
export declare const frameLoad: (textureNode: N, texel: N, targetSize: N) => N;
|
|
8
|
+
export declare const frameFullscreenVertex: N;
|
|
9
|
+
export declare const frameSample: (textureNode: N, uv: N) => N;
|
|
10
|
+
export declare const createFroxelUniforms: () => {
|
|
11
|
+
froxelGrid: any;
|
|
12
|
+
froxelColumns: any;
|
|
13
|
+
froxelRange: any;
|
|
14
|
+
froxelProjectionInverse: any;
|
|
15
|
+
froxelSubSteps: any;
|
|
16
|
+
froxelAtlasSize: any;
|
|
17
|
+
frameJitter: any;
|
|
18
|
+
frameFadeRadius: any;
|
|
19
|
+
};
|
|
20
|
+
export type FroxelUniforms = ReturnType<typeof createFroxelUniforms>;
|
|
21
|
+
export declare const frameSliceDepth: (froxel: FroxelUniforms, t: N) => N;
|
|
22
|
+
export declare const frameGetViewPosition: (froxel: FroxelUniforms, uv: N, viewDepth: N) => N;
|
|
23
|
+
export interface FroxelCell {
|
|
24
|
+
tile: N;
|
|
25
|
+
slice: N;
|
|
26
|
+
uv: N;
|
|
27
|
+
sliceNear: N;
|
|
28
|
+
sliceFar: N;
|
|
29
|
+
viewNear: N;
|
|
30
|
+
viewFar: N;
|
|
31
|
+
}
|
|
32
|
+
export declare const frameGetFroxel: (froxel: FroxelUniforms, fragCoord: N) => FroxelCell;
|
|
33
|
+
export declare const frameDistanceFade: (froxel: FroxelUniforms, viewPosition: N) => N;
|
|
34
|
+
export declare const getFroxelLod: (froxel: FroxelUniforms, cell: FroxelCell, volume: VDBVolumeNodes, subStepLength: N, worldScale: N) => N;
|
|
35
|
+
export declare const getSampledLod: (source: VDBVolumeUniforms, hasMask: boolean, widthLod: N, mipmaps: boolean) => N;
|
|
36
|
+
export declare const getBoxSteps: (volume: VDBVolumeNodes, localNear: N, localFar: N, segment: N, sampledLod: N, froxelSubSteps: N) => N;
|
|
37
|
+
export declare const frameNoise: (jitter: N, pixel: N) => N;
|
|
38
|
+
export declare const frameHenyeyGreenstein: (cosTheta: N, g: N) => N;
|
|
39
|
+
export declare const frameHenyeyGreensteinColor: (cosTheta: N, g: N) => N;
|
|
40
|
+
export declare const getFrameMieMap: () => N;
|
|
41
|
+
export declare const frameMieTexel: (cosTheta: N) => N;
|
|
42
|
+
export declare const framePhaseWeight: (framePhase: N, rayDirection: N, lightDirection: N) => N;
|
|
43
|
+
export declare const framePhaseColor: (framePhase: N, phaseSpectrum: N, rayDirection: N, lightDirection: N) => N;
|
|
44
|
+
export declare const framePhaseWeightScaled: (framePhase: N, cosTheta: N, gScale: N) => N;
|
|
45
|
+
export declare const frameShadowAbsorption: (extinction: N, albedo: N) => N;
|
|
46
|
+
export declare const frameShadowStep: (extinction: N, absorption: N, multipleScattering: N) => N;
|
|
47
|
+
export declare const frameShadowDepth: (depths: N, multipleScattering: N) => N;
|
|
48
|
+
export declare const frameShadowMarchDepth: (depths: N, multipleScattering: N, octaves: N) => N;
|
|
49
|
+
export declare const frameShadowTransmittance: (depths: N, multipleScattering: N, octaves: N) => N;
|
|
50
|
+
export declare const frameShadowOpticalDepth: (shadowY: N) => N;
|
|
51
|
+
export declare const frameOctaveLight: (octaves: N, opticalDepth: N, framePhase: N | null, cosTheta: N | null) => N;
|
|
52
|
+
export declare const frameShadowedLight: (framePhase: N, phaseSpectrum: N, octaves: N, rayDirection: N, lightDirection: N, shadow: N) => N;
|
|
53
|
+
export declare const frameIsotropicDiffusion: (frontReduced: N, backReduced: N, frontEffective: N) => N;
|
|
54
|
+
export declare const frameTwoSidedDiffusion: (direct: N, frontReduced: N, frontEffective: N, backReduced: N) => N;
|
|
55
|
+
export declare const frameShadowTotal: (shadowY: N, octaves: N) => N;
|
|
56
|
+
export interface FrameSpectralDepths {
|
|
57
|
+
x: N;
|
|
58
|
+
y: N;
|
|
59
|
+
z: N;
|
|
60
|
+
}
|
|
61
|
+
export interface FrameSpectralShadow {
|
|
62
|
+
x: N;
|
|
63
|
+
y: N;
|
|
64
|
+
}
|
|
65
|
+
export declare const frameMeanComponent: (value: N) => N;
|
|
66
|
+
export declare const frameSpectralShadowUnit: (spectrum: N, albedo: N, multipleScattering: N) => FrameSpectralDepths;
|
|
67
|
+
export declare const frameSpectralShadowDepths: (unit: FrameSpectralDepths, opticalDepth: N) => FrameSpectralDepths;
|
|
68
|
+
export declare const frameSpectralShadowStep: (extinction: N, absorption: N, multipleScattering: N) => FrameSpectralDepths;
|
|
69
|
+
export declare const frameSpectralGridAlbedo: (extinction: N, absorption: N) => N;
|
|
70
|
+
export declare const frameSpectralShadowTransmittance: (depths: FrameSpectralDepths, multipleScattering: N, octaves: N) => FrameSpectralShadow;
|
|
71
|
+
export declare const frameSpectralOctaveLight: (octaves: N, opticalDepth: N, albedo: N, framePhase: N | null, cosTheta: N | null) => N;
|
|
72
|
+
export declare const frameSpectralShadowTotal: (shadowY: N, octaves: N, albedo: N) => N;
|
|
73
|
+
export declare const frameSpectralShadowedLight: (framePhase: N, phaseSpectrum: N, octaves: N, rayDirection: N, lightDirection: N, shadow: FrameSpectralShadow, albedo: N) => N;
|
|
74
|
+
export declare const frameUnpackSpectralGroup: (map0: N, map1: N, map2: N) => {
|
|
75
|
+
a: FrameSpectralShadow;
|
|
76
|
+
b: FrameSpectralShadow;
|
|
77
|
+
};
|
|
78
|
+
export declare const frameMaxLights = 16;
|
|
79
|
+
export declare const frameMaxHemisphereLights = 4;
|
|
80
|
+
export declare const frameMaxEnvironmentLights = 12;
|
|
81
|
+
export declare const createLightUniforms: () => {
|
|
82
|
+
frameAmbientColor: any;
|
|
83
|
+
frameLightProbe: any;
|
|
84
|
+
frameHemiSkyColor: any;
|
|
85
|
+
frameHemiGroundColor: any;
|
|
86
|
+
frameSkyDirection: any;
|
|
87
|
+
frameHemiCount: any;
|
|
88
|
+
frameHemiSkyColors: any;
|
|
89
|
+
frameHemiGroundColors: any;
|
|
90
|
+
frameHemiDirections: any;
|
|
91
|
+
frameLightCount: any;
|
|
92
|
+
frameLightPositions: any;
|
|
93
|
+
frameLightColors: any;
|
|
94
|
+
frameLightSpots: any;
|
|
95
|
+
frameLightFalloffs: any;
|
|
96
|
+
frameEnvironmentCount: any;
|
|
97
|
+
frameEnvironmentDirections: any;
|
|
98
|
+
frameEnvironmentColors: any;
|
|
99
|
+
frameEnvironmentUnshadowed: any;
|
|
100
|
+
};
|
|
101
|
+
export type LightUniforms = ReturnType<typeof createLightUniforms>;
|
|
102
|
+
export declare const createFrameVolumeUniforms: () => {
|
|
103
|
+
frameViewToLocal: any;
|
|
104
|
+
frameLocalToView: any;
|
|
105
|
+
frameWorldToLocal: any;
|
|
106
|
+
frameScatterColor: any;
|
|
107
|
+
frameExtinctionSpectrum: any;
|
|
108
|
+
frameAbsorbance: any;
|
|
109
|
+
frameOpacity: any;
|
|
110
|
+
framePhase: any;
|
|
111
|
+
framePhaseSpectrum: any;
|
|
112
|
+
};
|
|
113
|
+
export type FrameVolumeUniforms = ReturnType<typeof createFrameVolumeUniforms>;
|
|
114
|
+
export declare const frameMaxShadowCascades = 4;
|
|
115
|
+
export declare const createGridUniforms: (frameJitter: N) => {
|
|
116
|
+
frameGridMin: any;
|
|
117
|
+
frameGridSize: any;
|
|
118
|
+
frameGridVoxel: any;
|
|
119
|
+
frameGridCount: any;
|
|
120
|
+
frameGridResolution: any;
|
|
121
|
+
frameGridColumns: any;
|
|
122
|
+
frameGridAtlasSize: any;
|
|
123
|
+
frameJitter: any;
|
|
124
|
+
};
|
|
125
|
+
export type GridUniforms = ReturnType<typeof createGridUniforms>;
|
|
126
|
+
export declare const createEnvironmentGridUniforms: () => {
|
|
127
|
+
frameEnvironmentGridCascade: any;
|
|
128
|
+
frameEnvironmentGridColumns: any;
|
|
129
|
+
frameEnvironmentGridAtlasSize: any;
|
|
130
|
+
};
|
|
131
|
+
export type EnvironmentGridUniforms = ReturnType<typeof createEnvironmentGridUniforms>;
|
|
132
|
+
export declare const createGridNodes: (grid: GridUniforms) => {
|
|
133
|
+
gridUvw: (cascade: N, worldPosition: N) => N;
|
|
134
|
+
insideGrid: (uvw: N) => N;
|
|
135
|
+
findCascade: (worldPosition: N, firstCascade: N) => N;
|
|
136
|
+
sampleTiles: (atlas: N, resolution: N, tileOffset: N, columns: N, atlasSize: N, uvw: N) => N;
|
|
137
|
+
sampleGrid: (atlas: N, cascade: N, uvw: N) => N;
|
|
138
|
+
sampleEnvironmentGrid: (map: N, environmentGrid: EnvironmentGridUniforms, worldPosition: N, outside: N) => N;
|
|
139
|
+
sampleShadows: (maps: N[], worldPosition: N) => N[];
|
|
140
|
+
getGridCell: (fragCoord: N) => {
|
|
141
|
+
cascade: N;
|
|
142
|
+
gridUvw: N;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
export type GridNodes = ReturnType<typeof createGridNodes>;
|
|
146
|
+
export declare const createTileUniforms: () => {
|
|
147
|
+
frameTileSize: any;
|
|
148
|
+
frameTileColumns: any;
|
|
149
|
+
frameTargetSize: any;
|
|
150
|
+
};
|
|
151
|
+
export type TileUniforms = ReturnType<typeof createTileUniforms>;
|
|
152
|
+
export declare const createAreaUniforms: () => {
|
|
153
|
+
frameAreaRect: any;
|
|
154
|
+
frameAreaSliceStart: any;
|
|
155
|
+
};
|
|
156
|
+
export declare const frameTileVertex: (tileUniforms: TileUniforms, rect: N, sliceStart: N) => N;
|
|
157
|
+
export {};
|