@vfx-js/effects 1.4.4 → 1.5.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/README.md +4 -0
- package/THIRD_PARTY_NOTICES.md +61 -0
- package/lib/cjs/_bloom-common.d.ts +31 -0
- package/lib/cjs/_bloom-common.js +101 -0
- package/lib/cjs/_bloom-common.js.map +1 -0
- package/lib/cjs/_bubble-fill.d.ts +126 -0
- package/lib/cjs/_bubble-fill.js +1044 -0
- package/lib/cjs/_bubble-fill.js.map +1 -0
- package/lib/cjs/_bubble-kernel-source.d.ts +2 -0
- package/lib/cjs/_bubble-kernel-source.js +8 -0
- package/lib/cjs/_bubble-kernel-source.js.map +1 -0
- package/lib/cjs/_holo/data/kernels.d.ts +4 -0
- package/lib/cjs/_holo/data/kernels.js +10 -0
- package/lib/cjs/_holo/data/kernels.js.map +1 -0
- package/lib/cjs/_holo/data/looks.d.ts +2 -0
- package/lib/cjs/_holo/data/looks.js +595 -0
- package/lib/cjs/_holo/data/looks.js.map +1 -0
- package/lib/cjs/_holo/data/ltc.d.ts +2 -0
- package/lib/cjs/_holo/data/ltc.js +11 -0
- package/lib/cjs/_holo/data/ltc.js.map +1 -0
- package/lib/cjs/_holo/data/material-presets.d.ts +3 -0
- package/lib/cjs/_holo/data/material-presets.js +75 -0
- package/lib/cjs/_holo/data/material-presets.js.map +1 -0
- package/lib/cjs/_holo/data/not-ported.d.ts +5 -0
- package/lib/cjs/_holo/data/not-ported.js +190 -0
- package/lib/cjs/_holo/data/not-ported.js.map +1 -0
- package/lib/cjs/_holo/data/params.d.ts +4 -0
- package/lib/cjs/_holo/data/params.js +1641 -0
- package/lib/cjs/_holo/data/params.js.map +1 -0
- package/lib/cjs/_holo/data/starting-points.d.ts +199 -0
- package/lib/cjs/_holo/data/starting-points.js +193 -0
- package/lib/cjs/_holo/data/starting-points.js.map +1 -0
- package/lib/cjs/_holo/data/studio-presets.d.ts +2 -0
- package/lib/cjs/_holo/data/studio-presets.js +177 -0
- package/lib/cjs/_holo/data/studio-presets.js.map +1 -0
- package/lib/cjs/_holo/emboss-assets.d.ts +55 -0
- package/lib/cjs/_holo/emboss-assets.js +155 -0
- package/lib/cjs/_holo/emboss-assets.js.map +1 -0
- package/lib/cjs/_holo/glare.d.ts +15 -0
- package/lib/cjs/_holo/glare.js +125 -0
- package/lib/cjs/_holo/glare.js.map +1 -0
- package/lib/cjs/_holo/glsl/coat.d.ts +2 -0
- package/lib/cjs/_holo/glsl/coat.js +32 -0
- package/lib/cjs/_holo/glsl/coat.js.map +1 -0
- package/lib/cjs/_holo/glsl/common.d.ts +2 -0
- package/lib/cjs/_holo/glsl/common.js +141 -0
- package/lib/cjs/_holo/glsl/common.js.map +1 -0
- package/lib/cjs/_holo/glsl/emboss.d.ts +2 -0
- package/lib/cjs/_holo/glsl/emboss.js +246 -0
- package/lib/cjs/_holo/glsl/emboss.js.map +1 -0
- package/lib/cjs/_holo/glsl/env.d.ts +2 -0
- package/lib/cjs/_holo/glsl/env.js +52 -0
- package/lib/cjs/_holo/glsl/env.js.map +1 -0
- package/lib/cjs/_holo/glsl/glare-down.d.ts +2 -0
- package/lib/cjs/_holo/glsl/glare-down.js +65 -0
- package/lib/cjs/_holo/glsl/glare-down.js.map +1 -0
- package/lib/cjs/_holo/glsl/glare-up.d.ts +2 -0
- package/lib/cjs/_holo/glsl/glare-up.js +18 -0
- package/lib/cjs/_holo/glsl/glare-up.js.map +1 -0
- package/lib/cjs/_holo/glsl/glitter.d.ts +2 -0
- package/lib/cjs/_holo/glsl/glitter.js +325 -0
- package/lib/cjs/_holo/glsl/glitter.js.map +1 -0
- package/lib/cjs/_holo/glsl/grating.d.ts +2 -0
- package/lib/cjs/_holo/glsl/grating.js +240 -0
- package/lib/cjs/_holo/glsl/grating.js.map +1 -0
- package/lib/cjs/_holo/glsl/holo-emboss.d.ts +2 -0
- package/lib/cjs/_holo/glsl/holo-emboss.js +296 -0
- package/lib/cjs/_holo/glsl/holo-emboss.js.map +1 -0
- package/lib/cjs/_holo/glsl/holo-nebula.d.ts +2 -0
- package/lib/cjs/_holo/glsl/holo-nebula.js +186 -0
- package/lib/cjs/_holo/glsl/holo-nebula.js.map +1 -0
- package/lib/cjs/_holo/glsl/holo-prism.d.ts +2 -0
- package/lib/cjs/_holo/glsl/holo-prism.js +183 -0
- package/lib/cjs/_holo/glsl/holo-prism.js.map +1 -0
- package/lib/cjs/_holo/glsl/holo-shatter.d.ts +2 -0
- package/lib/cjs/_holo/glsl/holo-shatter.js +328 -0
- package/lib/cjs/_holo/glsl/holo-shatter.js.map +1 -0
- package/lib/cjs/_holo/glsl/holo-sparkle.d.ts +2 -0
- package/lib/cjs/_holo/glsl/holo-sparkle.js +235 -0
- package/lib/cjs/_holo/glsl/holo-sparkle.js.map +1 -0
- package/lib/cjs/_holo/glsl/holo-vortex.d.ts +2 -0
- package/lib/cjs/_holo/glsl/holo-vortex.js +201 -0
- package/lib/cjs/_holo/glsl/holo-vortex.js.map +1 -0
- package/lib/cjs/_holo/glsl/ibl.d.ts +2 -0
- package/lib/cjs/_holo/glsl/ibl.js +79 -0
- package/lib/cjs/_holo/glsl/ibl.js.map +1 -0
- package/lib/cjs/_holo/glsl/lights.d.ts +2 -0
- package/lib/cjs/_holo/glsl/lights.js +125 -0
- package/lib/cjs/_holo/glsl/lights.js.map +1 -0
- package/lib/cjs/_holo/glsl/ltc.d.ts +2 -0
- package/lib/cjs/_holo/glsl/ltc.js +66 -0
- package/lib/cjs/_holo/glsl/ltc.js.map +1 -0
- package/lib/cjs/_holo/glsl/output.d.ts +2 -0
- package/lib/cjs/_holo/glsl/output.js +113 -0
- package/lib/cjs/_holo/glsl/output.js.map +1 -0
- package/lib/cjs/_holo/glsl/paper.d.ts +2 -0
- package/lib/cjs/_holo/glsl/paper.js +165 -0
- package/lib/cjs/_holo/glsl/paper.js.map +1 -0
- package/lib/cjs/_holo/glsl/relief.d.ts +2 -0
- package/lib/cjs/_holo/glsl/relief.js +103 -0
- package/lib/cjs/_holo/glsl/relief.js.map +1 -0
- package/lib/cjs/_holo/glsl/sparkle.d.ts +2 -0
- package/lib/cjs/_holo/glsl/sparkle.js +279 -0
- package/lib/cjs/_holo/glsl/sparkle.js.map +1 -0
- package/lib/cjs/_holo/glsl/spectral.d.ts +2 -0
- package/lib/cjs/_holo/glsl/spectral.js +60 -0
- package/lib/cjs/_holo/glsl/spectral.js.map +1 -0
- package/lib/cjs/_holo/glsl/wear.d.ts +2 -0
- package/lib/cjs/_holo/glsl/wear.js +107 -0
- package/lib/cjs/_holo/glsl/wear.js.map +1 -0
- package/lib/cjs/_holo/ltc.d.ts +9 -0
- package/lib/cjs/_holo/ltc.js +56 -0
- package/lib/cjs/_holo/ltc.js.map +1 -0
- package/lib/cjs/_holo/materials/build.d.ts +32 -0
- package/lib/cjs/_holo/materials/build.js +36 -0
- package/lib/cjs/_holo/materials/build.js.map +1 -0
- package/lib/cjs/_holo/materials/emboss.d.ts +22 -0
- package/lib/cjs/_holo/materials/emboss.js +205 -0
- package/lib/cjs/_holo/materials/emboss.js.map +1 -0
- package/lib/cjs/_holo/materials/nebula.d.ts +4 -0
- package/lib/cjs/_holo/materials/nebula.js +105 -0
- package/lib/cjs/_holo/materials/nebula.js.map +1 -0
- package/lib/cjs/_holo/materials/prism.d.ts +2 -0
- package/lib/cjs/_holo/materials/prism.js +69 -0
- package/lib/cjs/_holo/materials/prism.js.map +1 -0
- package/lib/cjs/_holo/materials/registry.d.ts +11 -0
- package/lib/cjs/_holo/materials/registry.js +88 -0
- package/lib/cjs/_holo/materials/registry.js.map +1 -0
- package/lib/cjs/_holo/materials/shatter.d.ts +2 -0
- package/lib/cjs/_holo/materials/shatter.js +80 -0
- package/lib/cjs/_holo/materials/shatter.js.map +1 -0
- package/lib/cjs/_holo/materials/sparkle.d.ts +2 -0
- package/lib/cjs/_holo/materials/sparkle.js +108 -0
- package/lib/cjs/_holo/materials/sparkle.js.map +1 -0
- package/lib/cjs/_holo/materials/vortex.d.ts +2 -0
- package/lib/cjs/_holo/materials/vortex.js +85 -0
- package/lib/cjs/_holo/materials/vortex.js.map +1 -0
- package/lib/cjs/_holo/physics/emboss.d.ts +39 -0
- package/lib/cjs/_holo/physics/emboss.js +95 -0
- package/lib/cjs/_holo/physics/emboss.js.map +1 -0
- package/lib/cjs/_holo/physics/geometry.d.ts +109 -0
- package/lib/cjs/_holo/physics/geometry.js +252 -0
- package/lib/cjs/_holo/physics/geometry.js.map +1 -0
- package/lib/cjs/_holo/physics/grating.d.ts +86 -0
- package/lib/cjs/_holo/physics/grating.js +328 -0
- package/lib/cjs/_holo/physics/grating.js.map +1 -0
- package/lib/cjs/_holo/physics/sparkle.d.ts +143 -0
- package/lib/cjs/_holo/physics/sparkle.js +388 -0
- package/lib/cjs/_holo/physics/sparkle.js.map +1 -0
- package/lib/cjs/_holo/scene/env.d.ts +17 -0
- package/lib/cjs/_holo/scene/env.js +151 -0
- package/lib/cjs/_holo/scene/env.js.map +1 -0
- package/lib/cjs/_holo/scene/lights.d.ts +13 -0
- package/lib/cjs/_holo/scene/lights.js +211 -0
- package/lib/cjs/_holo/scene/lights.js.map +1 -0
- package/lib/cjs/_holo/scene/logo.d.ts +87 -0
- package/lib/cjs/_holo/scene/logo.js +655 -0
- package/lib/cjs/_holo/scene/logo.js.map +1 -0
- package/lib/cjs/_holo/scene/paper-maps.d.ts +26 -0
- package/lib/cjs/_holo/scene/paper-maps.js +391 -0
- package/lib/cjs/_holo/scene/paper-maps.js.map +1 -0
- package/lib/cjs/_holo/scene/pose.d.ts +31 -0
- package/lib/cjs/_holo/scene/pose.js +77 -0
- package/lib/cjs/_holo/scene/pose.js.map +1 -0
- package/lib/cjs/_holo/scene/relief.d.ts +24 -0
- package/lib/cjs/_holo/scene/relief.js +148 -0
- package/lib/cjs/_holo/scene/relief.js.map +1 -0
- package/lib/cjs/_holo/settings-types.d.ts +20 -0
- package/lib/cjs/_holo/settings-types.js +3 -0
- package/lib/cjs/_holo/settings-types.js.map +1 -0
- package/lib/cjs/_holo/settings.d.ts +83 -0
- package/lib/cjs/_holo/settings.js +375 -0
- package/lib/cjs/_holo/settings.js.map +1 -0
- package/lib/cjs/_holo/shader.d.ts +23 -0
- package/lib/cjs/_holo/shader.js +219 -0
- package/lib/cjs/_holo/shader.js.map +1 -0
- package/lib/cjs/_holo/spectral/atlas.d.ts +36 -0
- package/lib/cjs/_holo/spectral/atlas.js +114 -0
- package/lib/cjs/_holo/spectral/atlas.js.map +1 -0
- package/lib/cjs/_holo/spectral/cmf.d.ts +67 -0
- package/lib/cjs/_holo/spectral/cmf.js +244 -0
- package/lib/cjs/_holo/spectral/cmf.js.map +1 -0
- package/lib/cjs/_holo/spectral/float24.d.ts +8 -0
- package/lib/cjs/_holo/spectral/float24.js +70 -0
- package/lib/cjs/_holo/spectral/float24.js.map +1 -0
- package/lib/cjs/_holo/spectral/spd.d.ts +22 -0
- package/lib/cjs/_holo/spectral/spd.js +139 -0
- package/lib/cjs/_holo/spectral/spd.js.map +1 -0
- package/lib/cjs/_holo/spectral/tables.d.ts +62 -0
- package/lib/cjs/_holo/spectral/tables.js +386 -0
- package/lib/cjs/_holo/spectral/tables.js.map +1 -0
- package/lib/cjs/_holo/tier.d.ts +4 -0
- package/lib/cjs/_holo/tier.js +110 -0
- package/lib/cjs/_holo/tier.js.map +1 -0
- package/lib/cjs/_holo/types.d.ts +148 -0
- package/lib/cjs/_holo/types.js +14 -0
- package/lib/cjs/_holo/types.js.map +1 -0
- package/lib/cjs/_kernel-worker.d.ts +22 -0
- package/lib/cjs/_kernel-worker.js +174 -0
- package/lib/cjs/_kernel-worker.js.map +1 -0
- package/lib/cjs/_orbit-camera.d.ts +175 -0
- package/lib/cjs/_orbit-camera.js +366 -0
- package/lib/cjs/_orbit-camera.js.map +1 -0
- package/lib/cjs/_pad.d.ts +2 -0
- package/lib/cjs/_pad.js +11 -0
- package/lib/cjs/_pad.js.map +1 -1
- package/lib/cjs/_scene3d.d.ts +101 -0
- package/lib/cjs/_scene3d.js +794 -0
- package/lib/cjs/_scene3d.js.map +1 -0
- package/lib/cjs/_shape-kernel-source.d.ts +2 -0
- package/lib/cjs/_shape-kernel-source.js +8 -0
- package/lib/cjs/_shape-kernel-source.js.map +1 -0
- package/lib/cjs/_shape-worker.d.ts +8 -0
- package/lib/cjs/_shape-worker.js +27 -0
- package/lib/cjs/_shape-worker.js.map +1 -0
- package/lib/cjs/_silhouette.d.ts +88 -0
- package/lib/cjs/_silhouette.js +441 -0
- package/lib/cjs/_silhouette.js.map +1 -0
- package/lib/cjs/_simplex3.d.ts +2 -0
- package/lib/cjs/_simplex3.js +160 -0
- package/lib/cjs/_simplex3.js.map +1 -0
- package/lib/cjs/_source.d.ts +80 -0
- package/lib/cjs/_source.js +192 -0
- package/lib/cjs/_source.js.map +1 -0
- package/lib/cjs/_sphere-foam.d.ts +34 -0
- package/lib/cjs/_sphere-foam.js +135 -0
- package/lib/cjs/_sphere-foam.js.map +1 -0
- package/lib/cjs/_thin-film.d.ts +26 -0
- package/lib/cjs/_thin-film.js +146 -0
- package/lib/cjs/_thin-film.js.map +1 -0
- package/lib/cjs/bloom.js +40 -106
- package/lib/cjs/bloom.js.map +1 -1
- package/lib/cjs/bubble.d.ts +284 -0
- package/lib/cjs/bubble.js +1820 -0
- package/lib/cjs/bubble.js.map +1 -0
- package/lib/cjs/glass.d.ts +254 -0
- package/lib/cjs/glass.js +981 -0
- package/lib/cjs/glass.js.map +1 -0
- package/lib/cjs/holo-static.d.ts +3 -0
- package/lib/cjs/holo-static.js +29 -0
- package/lib/cjs/holo-static.js.map +1 -0
- package/lib/cjs/holo.d.ts +401 -0
- package/lib/cjs/holo.js +1613 -0
- package/lib/cjs/holo.js.map +1 -0
- package/lib/cjs/index.d.ts +18 -9
- package/lib/cjs/index.js +12 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/jpeg-glitch.js +32 -29
- package/lib/cjs/jpeg-glitch.js.map +1 -1
- package/lib/cjs/matrix.d.ts +1 -1
- package/lib/cjs/package.json +20 -5
- package/lib/cjs/swirl-particle.d.ts +257 -0
- package/lib/cjs/swirl-particle.js +2346 -0
- package/lib/cjs/swirl-particle.js.map +1 -0
- package/lib/cjs/voronoi.js +2 -75
- package/lib/cjs/voronoi.js.map +1 -1
- package/lib/esm/_bloom-common.d.ts +31 -0
- package/lib/esm/_bloom-common.js +95 -0
- package/lib/esm/_bloom-common.js.map +1 -0
- package/lib/esm/_bubble-fill.d.ts +126 -0
- package/lib/esm/_bubble-fill.js +1039 -0
- package/lib/esm/_bubble-fill.js.map +1 -0
- package/lib/esm/_bubble-kernel-source.d.ts +2 -0
- package/lib/esm/_bubble-kernel-source.js +5 -0
- package/lib/esm/_bubble-kernel-source.js.map +1 -0
- package/lib/esm/_holo/data/kernels.d.ts +4 -0
- package/lib/esm/_holo/data/kernels.js +7 -0
- package/lib/esm/_holo/data/kernels.js.map +1 -0
- package/lib/esm/_holo/data/looks.d.ts +2 -0
- package/lib/esm/_holo/data/looks.js +592 -0
- package/lib/esm/_holo/data/looks.js.map +1 -0
- package/lib/esm/_holo/data/ltc.d.ts +2 -0
- package/lib/esm/_holo/data/ltc.js +8 -0
- package/lib/esm/_holo/data/ltc.js.map +1 -0
- package/lib/esm/_holo/data/material-presets.d.ts +3 -0
- package/lib/esm/_holo/data/material-presets.js +72 -0
- package/lib/esm/_holo/data/material-presets.js.map +1 -0
- package/lib/esm/_holo/data/not-ported.d.ts +5 -0
- package/lib/esm/_holo/data/not-ported.js +187 -0
- package/lib/esm/_holo/data/not-ported.js.map +1 -0
- package/lib/esm/_holo/data/params.d.ts +4 -0
- package/lib/esm/_holo/data/params.js +1638 -0
- package/lib/esm/_holo/data/params.js.map +1 -0
- package/lib/esm/_holo/data/starting-points.d.ts +199 -0
- package/lib/esm/_holo/data/starting-points.js +190 -0
- package/lib/esm/_holo/data/starting-points.js.map +1 -0
- package/lib/esm/_holo/data/studio-presets.d.ts +2 -0
- package/lib/esm/_holo/data/studio-presets.js +174 -0
- package/lib/esm/_holo/data/studio-presets.js.map +1 -0
- package/lib/esm/_holo/emboss-assets.d.ts +55 -0
- package/lib/esm/_holo/emboss-assets.js +150 -0
- package/lib/esm/_holo/emboss-assets.js.map +1 -0
- package/lib/esm/_holo/glare.d.ts +15 -0
- package/lib/esm/_holo/glare.js +117 -0
- package/lib/esm/_holo/glare.js.map +1 -0
- package/lib/esm/_holo/glsl/coat.d.ts +2 -0
- package/lib/esm/_holo/glsl/coat.js +30 -0
- package/lib/esm/_holo/glsl/coat.js.map +1 -0
- package/lib/esm/_holo/glsl/common.d.ts +2 -0
- package/lib/esm/_holo/glsl/common.js +139 -0
- package/lib/esm/_holo/glsl/common.js.map +1 -0
- package/lib/esm/_holo/glsl/emboss.d.ts +2 -0
- package/lib/esm/_holo/glsl/emboss.js +244 -0
- package/lib/esm/_holo/glsl/emboss.js.map +1 -0
- package/lib/esm/_holo/glsl/env.d.ts +2 -0
- package/lib/esm/_holo/glsl/env.js +50 -0
- package/lib/esm/_holo/glsl/env.js.map +1 -0
- package/lib/esm/_holo/glsl/glare-down.d.ts +2 -0
- package/lib/esm/_holo/glsl/glare-down.js +63 -0
- package/lib/esm/_holo/glsl/glare-down.js.map +1 -0
- package/lib/esm/_holo/glsl/glare-up.d.ts +2 -0
- package/lib/esm/_holo/glsl/glare-up.js +16 -0
- package/lib/esm/_holo/glsl/glare-up.js.map +1 -0
- package/lib/esm/_holo/glsl/glitter.d.ts +2 -0
- package/lib/esm/_holo/glsl/glitter.js +323 -0
- package/lib/esm/_holo/glsl/glitter.js.map +1 -0
- package/lib/esm/_holo/glsl/grating.d.ts +2 -0
- package/lib/esm/_holo/glsl/grating.js +238 -0
- package/lib/esm/_holo/glsl/grating.js.map +1 -0
- package/lib/esm/_holo/glsl/holo-emboss.d.ts +2 -0
- package/lib/esm/_holo/glsl/holo-emboss.js +294 -0
- package/lib/esm/_holo/glsl/holo-emboss.js.map +1 -0
- package/lib/esm/_holo/glsl/holo-nebula.d.ts +2 -0
- package/lib/esm/_holo/glsl/holo-nebula.js +184 -0
- package/lib/esm/_holo/glsl/holo-nebula.js.map +1 -0
- package/lib/esm/_holo/glsl/holo-prism.d.ts +2 -0
- package/lib/esm/_holo/glsl/holo-prism.js +181 -0
- package/lib/esm/_holo/glsl/holo-prism.js.map +1 -0
- package/lib/esm/_holo/glsl/holo-shatter.d.ts +2 -0
- package/lib/esm/_holo/glsl/holo-shatter.js +326 -0
- package/lib/esm/_holo/glsl/holo-shatter.js.map +1 -0
- package/lib/esm/_holo/glsl/holo-sparkle.d.ts +2 -0
- package/lib/esm/_holo/glsl/holo-sparkle.js +233 -0
- package/lib/esm/_holo/glsl/holo-sparkle.js.map +1 -0
- package/lib/esm/_holo/glsl/holo-vortex.d.ts +2 -0
- package/lib/esm/_holo/glsl/holo-vortex.js +199 -0
- package/lib/esm/_holo/glsl/holo-vortex.js.map +1 -0
- package/lib/esm/_holo/glsl/ibl.d.ts +2 -0
- package/lib/esm/_holo/glsl/ibl.js +77 -0
- package/lib/esm/_holo/glsl/ibl.js.map +1 -0
- package/lib/esm/_holo/glsl/lights.d.ts +2 -0
- package/lib/esm/_holo/glsl/lights.js +123 -0
- package/lib/esm/_holo/glsl/lights.js.map +1 -0
- package/lib/esm/_holo/glsl/ltc.d.ts +2 -0
- package/lib/esm/_holo/glsl/ltc.js +64 -0
- package/lib/esm/_holo/glsl/ltc.js.map +1 -0
- package/lib/esm/_holo/glsl/output.d.ts +2 -0
- package/lib/esm/_holo/glsl/output.js +111 -0
- package/lib/esm/_holo/glsl/output.js.map +1 -0
- package/lib/esm/_holo/glsl/paper.d.ts +2 -0
- package/lib/esm/_holo/glsl/paper.js +163 -0
- package/lib/esm/_holo/glsl/paper.js.map +1 -0
- package/lib/esm/_holo/glsl/relief.d.ts +2 -0
- package/lib/esm/_holo/glsl/relief.js +101 -0
- package/lib/esm/_holo/glsl/relief.js.map +1 -0
- package/lib/esm/_holo/glsl/sparkle.d.ts +2 -0
- package/lib/esm/_holo/glsl/sparkle.js +277 -0
- package/lib/esm/_holo/glsl/sparkle.js.map +1 -0
- package/lib/esm/_holo/glsl/spectral.d.ts +2 -0
- package/lib/esm/_holo/glsl/spectral.js +58 -0
- package/lib/esm/_holo/glsl/spectral.js.map +1 -0
- package/lib/esm/_holo/glsl/wear.d.ts +2 -0
- package/lib/esm/_holo/glsl/wear.js +105 -0
- package/lib/esm/_holo/glsl/wear.js.map +1 -0
- package/lib/esm/_holo/ltc.d.ts +9 -0
- package/lib/esm/_holo/ltc.js +52 -0
- package/lib/esm/_holo/ltc.js.map +1 -0
- package/lib/esm/_holo/materials/build.d.ts +32 -0
- package/lib/esm/_holo/materials/build.js +30 -0
- package/lib/esm/_holo/materials/build.js.map +1 -0
- package/lib/esm/_holo/materials/emboss.d.ts +22 -0
- package/lib/esm/_holo/materials/emboss.js +198 -0
- package/lib/esm/_holo/materials/emboss.js.map +1 -0
- package/lib/esm/_holo/materials/nebula.d.ts +4 -0
- package/lib/esm/_holo/materials/nebula.js +98 -0
- package/lib/esm/_holo/materials/nebula.js.map +1 -0
- package/lib/esm/_holo/materials/prism.d.ts +2 -0
- package/lib/esm/_holo/materials/prism.js +63 -0
- package/lib/esm/_holo/materials/prism.js.map +1 -0
- package/lib/esm/_holo/materials/registry.d.ts +11 -0
- package/lib/esm/_holo/materials/registry.js +48 -0
- package/lib/esm/_holo/materials/registry.js.map +1 -0
- package/lib/esm/_holo/materials/shatter.d.ts +2 -0
- package/lib/esm/_holo/materials/shatter.js +74 -0
- package/lib/esm/_holo/materials/shatter.js.map +1 -0
- package/lib/esm/_holo/materials/sparkle.d.ts +2 -0
- package/lib/esm/_holo/materials/sparkle.js +102 -0
- package/lib/esm/_holo/materials/sparkle.js.map +1 -0
- package/lib/esm/_holo/materials/vortex.d.ts +2 -0
- package/lib/esm/_holo/materials/vortex.js +79 -0
- package/lib/esm/_holo/materials/vortex.js.map +1 -0
- package/lib/esm/_holo/physics/emboss.d.ts +39 -0
- package/lib/esm/_holo/physics/emboss.js +89 -0
- package/lib/esm/_holo/physics/emboss.js.map +1 -0
- package/lib/esm/_holo/physics/geometry.d.ts +109 -0
- package/lib/esm/_holo/physics/geometry.js +228 -0
- package/lib/esm/_holo/physics/geometry.js.map +1 -0
- package/lib/esm/_holo/physics/grating.d.ts +86 -0
- package/lib/esm/_holo/physics/grating.js +313 -0
- package/lib/esm/_holo/physics/grating.js.map +1 -0
- package/lib/esm/_holo/physics/sparkle.d.ts +143 -0
- package/lib/esm/_holo/physics/sparkle.js +360 -0
- package/lib/esm/_holo/physics/sparkle.js.map +1 -0
- package/lib/esm/_holo/scene/env.d.ts +17 -0
- package/lib/esm/_holo/scene/env.js +141 -0
- package/lib/esm/_holo/scene/env.js.map +1 -0
- package/lib/esm/_holo/scene/lights.d.ts +13 -0
- package/lib/esm/_holo/scene/lights.js +204 -0
- package/lib/esm/_holo/scene/lights.js.map +1 -0
- package/lib/esm/_holo/scene/logo.d.ts +87 -0
- package/lib/esm/_holo/scene/logo.js +645 -0
- package/lib/esm/_holo/scene/logo.js.map +1 -0
- package/lib/esm/_holo/scene/paper-maps.d.ts +26 -0
- package/lib/esm/_holo/scene/paper-maps.js +387 -0
- package/lib/esm/_holo/scene/paper-maps.js.map +1 -0
- package/lib/esm/_holo/scene/pose.d.ts +31 -0
- package/lib/esm/_holo/scene/pose.js +71 -0
- package/lib/esm/_holo/scene/pose.js.map +1 -0
- package/lib/esm/_holo/scene/relief.d.ts +24 -0
- package/lib/esm/_holo/scene/relief.js +142 -0
- package/lib/esm/_holo/scene/relief.js.map +1 -0
- package/lib/esm/_holo/settings-types.d.ts +20 -0
- package/lib/esm/_holo/settings-types.js +2 -0
- package/lib/esm/_holo/settings-types.js.map +1 -0
- package/lib/esm/_holo/settings.d.ts +83 -0
- package/lib/esm/_holo/settings.js +358 -0
- package/lib/esm/_holo/settings.js.map +1 -0
- package/lib/esm/_holo/shader.d.ts +23 -0
- package/lib/esm/_holo/shader.js +211 -0
- package/lib/esm/_holo/shader.js.map +1 -0
- package/lib/esm/_holo/spectral/atlas.d.ts +36 -0
- package/lib/esm/_holo/spectral/atlas.js +110 -0
- package/lib/esm/_holo/spectral/atlas.js.map +1 -0
- package/lib/esm/_holo/spectral/cmf.d.ts +67 -0
- package/lib/esm/_holo/spectral/cmf.js +230 -0
- package/lib/esm/_holo/spectral/cmf.js.map +1 -0
- package/lib/esm/_holo/spectral/float24.d.ts +8 -0
- package/lib/esm/_holo/spectral/float24.js +64 -0
- package/lib/esm/_holo/spectral/float24.js.map +1 -0
- package/lib/esm/_holo/spectral/spd.d.ts +22 -0
- package/lib/esm/_holo/spectral/spd.js +130 -0
- package/lib/esm/_holo/spectral/spd.js.map +1 -0
- package/lib/esm/_holo/spectral/tables.d.ts +62 -0
- package/lib/esm/_holo/spectral/tables.js +372 -0
- package/lib/esm/_holo/spectral/tables.js.map +1 -0
- package/lib/esm/_holo/tier.d.ts +4 -0
- package/lib/esm/_holo/tier.js +106 -0
- package/lib/esm/_holo/tier.js.map +1 -0
- package/lib/esm/_holo/types.d.ts +148 -0
- package/lib/esm/_holo/types.js +11 -0
- package/lib/esm/_holo/types.js.map +1 -0
- package/lib/esm/_kernel-worker.d.ts +22 -0
- package/lib/esm/_kernel-worker.js +169 -0
- package/lib/esm/_kernel-worker.js.map +1 -0
- package/lib/esm/_orbit-camera.d.ts +175 -0
- package/lib/esm/_orbit-camera.js +360 -0
- package/lib/esm/_orbit-camera.js.map +1 -0
- package/lib/esm/_pad.d.ts +2 -0
- package/lib/esm/_pad.js +10 -0
- package/lib/esm/_pad.js.map +1 -1
- package/lib/esm/_scene3d.d.ts +101 -0
- package/lib/esm/_scene3d.js +783 -0
- package/lib/esm/_scene3d.js.map +1 -0
- package/lib/esm/_shape-kernel-source.d.ts +2 -0
- package/lib/esm/_shape-kernel-source.js +5 -0
- package/lib/esm/_shape-kernel-source.js.map +1 -0
- package/lib/esm/_shape-worker.d.ts +8 -0
- package/lib/esm/_shape-worker.js +23 -0
- package/lib/esm/_shape-worker.js.map +1 -0
- package/lib/esm/_silhouette.d.ts +88 -0
- package/lib/esm/_silhouette.js +436 -0
- package/lib/esm/_silhouette.js.map +1 -0
- package/lib/esm/_simplex3.d.ts +2 -0
- package/lib/esm/_simplex3.js +157 -0
- package/lib/esm/_simplex3.js.map +1 -0
- package/lib/esm/_source.d.ts +80 -0
- package/lib/esm/_source.js +187 -0
- package/lib/esm/_source.js.map +1 -0
- package/lib/esm/_sphere-foam.d.ts +34 -0
- package/lib/esm/_sphere-foam.js +131 -0
- package/lib/esm/_sphere-foam.js.map +1 -0
- package/lib/esm/_thin-film.d.ts +26 -0
- package/lib/esm/_thin-film.js +140 -0
- package/lib/esm/_thin-film.js.map +1 -0
- package/lib/esm/bloom.js +40 -106
- package/lib/esm/bloom.js.map +1 -1
- package/lib/esm/bubble.d.ts +284 -0
- package/lib/esm/bubble.js +1816 -0
- package/lib/esm/bubble.js.map +1 -0
- package/lib/esm/glass.d.ts +254 -0
- package/lib/esm/glass.js +977 -0
- package/lib/esm/glass.js.map +1 -0
- package/lib/esm/holo-static.d.ts +3 -0
- package/lib/esm/holo-static.js +13 -0
- package/lib/esm/holo-static.js.map +1 -0
- package/lib/esm/holo.d.ts +401 -0
- package/lib/esm/holo.js +1606 -0
- package/lib/esm/holo.js.map +1 -0
- package/lib/esm/index.d.ts +18 -9
- package/lib/esm/index.js +7 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/jpeg-glitch.js +32 -29
- package/lib/esm/jpeg-glitch.js.map +1 -1
- package/lib/esm/matrix.d.ts +1 -1
- package/lib/esm/package.json +20 -5
- package/lib/esm/swirl-particle.d.ts +257 -0
- package/lib/esm/swirl-particle.js +2342 -0
- package/lib/esm/swirl-particle.js.map +1 -0
- package/lib/esm/voronoi.js +2 -75
- package/lib/esm/voronoi.js.map +1 -1
- package/package.json +38 -11
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
const D2R = Math.PI / 180;
|
|
2
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
3
|
+
// Card and camera constants (§5.1, §5.4, §7)
|
|
4
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
5
|
+
/** Card size [mm] (§5.1); card-plane positions are in mm with the origin at the bottom-left corner of the face. */
|
|
6
|
+
export const CARD_W_MM = 63;
|
|
7
|
+
export const CARD_H_MM = 88;
|
|
8
|
+
/** Vertical field of view of the fixed camera [deg] (§5.4). */
|
|
9
|
+
export const CAMERA_FOV_DEG = 22;
|
|
10
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
11
|
+
// Vector helpers (Vec3 = readonly tuple; Mat3 row-major)
|
|
12
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
13
|
+
export function add(a, b) {
|
|
14
|
+
return [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
|
|
15
|
+
}
|
|
16
|
+
export function sub(a, b) {
|
|
17
|
+
return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
18
|
+
}
|
|
19
|
+
export function scale(a, s) {
|
|
20
|
+
return [a[0] * s, a[1] * s, a[2] * s];
|
|
21
|
+
}
|
|
22
|
+
export function dot(a, b) {
|
|
23
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
24
|
+
}
|
|
25
|
+
export function cross(a, b) {
|
|
26
|
+
return [
|
|
27
|
+
a[1] * b[2] - a[2] * b[1],
|
|
28
|
+
a[2] * b[0] - a[0] * b[2],
|
|
29
|
+
a[0] * b[1] - a[1] * b[0],
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
export function length(a) {
|
|
33
|
+
return Math.hypot(a[0], a[1], a[2]);
|
|
34
|
+
}
|
|
35
|
+
export function normalize(a) {
|
|
36
|
+
const l = length(a);
|
|
37
|
+
return l > 0 ? [a[0] / l, a[1] / l, a[2] / l] : [0, 0, 0];
|
|
38
|
+
}
|
|
39
|
+
/** GLSL reflect(I, N) = I − 2(N·I)N. */
|
|
40
|
+
export function reflect(i, n) {
|
|
41
|
+
return sub(i, scale(n, 2 * dot(n, i)));
|
|
42
|
+
}
|
|
43
|
+
/** m·v for a row-major Mat3. */
|
|
44
|
+
export function rotate(m, v) {
|
|
45
|
+
return [
|
|
46
|
+
m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
|
|
47
|
+
m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
|
|
48
|
+
m[6] * v[0] + m[7] * v[1] + m[8] * v[2],
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
/** Column c of a row-major Mat3 (the image of the c-th basis vector). */
|
|
52
|
+
export function column(m, c) {
|
|
53
|
+
return [m[c], m[3 + c], m[6 + c]];
|
|
54
|
+
}
|
|
55
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
56
|
+
// Light directions and shapes (§4.3.1)
|
|
57
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
58
|
+
/**
|
|
59
|
+
* DialKit pad (x, y) → unit light direction in the rest frame (§4.3.1): the pad is the direction cosine, its length
|
|
60
|
+
* clamped to r = min(√(x²+y²), 0.996); l̂ = (x, y, √(1 − r²)) with (x, y) rescaled to length r.
|
|
61
|
+
*/
|
|
62
|
+
export function padToDir(x, y) {
|
|
63
|
+
const r0 = Math.hypot(x, y), r = Math.min(r0, 0.996);
|
|
64
|
+
const k = r0 > 0 ? r / r0 : 0;
|
|
65
|
+
return [x * k, y * k, Math.sqrt(1 - r * r)];
|
|
66
|
+
}
|
|
67
|
+
/** Physical sphere radius ρ = D·tan(size/2) for an angular diameter `sizeDeg` at distance `distM` [m]. */
|
|
68
|
+
export function sphereRadius(sizeDeg, distM) {
|
|
69
|
+
return distM * Math.tan(0.5 * sizeDeg * D2R);
|
|
70
|
+
}
|
|
71
|
+
/** Radial and tangential unit axes of a light at direction `dir` (§4.3.1): ê_θ = (cosθ cosφ, cosθ sinφ, −sinθ), ê_φ = (−sinφ, cosφ, 0). */
|
|
72
|
+
export function lightAxes(dir) {
|
|
73
|
+
const r = Math.hypot(dir[0], dir[1]);
|
|
74
|
+
const phi = r < 1e-4 ? 0 : Math.atan2(dir[1], dir[0]);
|
|
75
|
+
const ct = Math.sqrt(Math.max(1 - r * r, 0)), st = Math.min(r, 1);
|
|
76
|
+
const cp = Math.cos(phi), sp = Math.sin(phi);
|
|
77
|
+
return { eTheta: [ct * cp, ct * sp, -st], ePhi: [-sp, cp, 0] };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Rect half-axes (§4.3.1): U = D·tan(width/2)·ê_θ (width = radial size), W = D·tan(length/2)·ê_φ (length =
|
|
81
|
+
* tangential size), for the unrotated direction `dir` (the caller applies the gyro world-lock Q_L to P, U and W).
|
|
82
|
+
*/
|
|
83
|
+
export function rectHalfAxes(dir, widthDeg, lengthDeg, distM) {
|
|
84
|
+
const { eTheta, ePhi } = lightAxes(dir);
|
|
85
|
+
return {
|
|
86
|
+
U: scale(eTheta, distM * Math.tan(0.5 * widthDeg * D2R)),
|
|
87
|
+
W: scale(ePhi, distM * Math.tan(0.5 * lengthDeg * D2R)),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
91
|
+
// Camera and pose (§4.1, §5.4)
|
|
92
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
93
|
+
/**
|
|
94
|
+
* Camera distance (§5.4): D = max((0.088/0.70)/(2·tan(fov/2)), (0.063/0.80)/(2·tan(fov/2)·aspect)), so the card fills
|
|
95
|
+
* 70 % of the height or 80 % of the width (0.3234 m at 4:3, 0.4384 m at 390 × 844).
|
|
96
|
+
*/
|
|
97
|
+
export function cameraDistance(aspect, fovDeg = CAMERA_FOV_DEG) {
|
|
98
|
+
return framingDistance(aspect, CARD_W_MM / 2000, CARD_H_MM / 2000, fovDeg);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The §5.4 framing rule for any object (addendum A1.1): the camera distance at which an object of rest-pose half
|
|
102
|
+
* extents (halfW, halfH) [m] fills 70 % of the height or 80 % of the width, D = max((2·halfH/0.70)/(2·tan(fov/2)),
|
|
103
|
+
* (2·halfW/0.80)/(2·tan(fov/2)·aspect)). The card (31.5 × 44 mm) gives exactly `cameraDistance`.
|
|
104
|
+
*/
|
|
105
|
+
export function framingDistance(aspect, halfW, halfH, fovDeg = CAMERA_FOV_DEG) {
|
|
106
|
+
const t = 2 * Math.tan(0.5 * fovDeg * D2R);
|
|
107
|
+
return Math.max((2 * halfH) / 0.7 / t, (2 * halfW) / 0.8 / (t * Math.max(aspect, 1e-6)));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Card rotation of three.js `Euler(rx, ry, rz, 'XYZ')` (v′ = Rx·Ry·Rz·v) as a row-major Mat3 (§4.1): rx > 0 tips the
|
|
111
|
+
* top edge toward the camera (normal toward −Y), ry > 0 turns the face toward +X.
|
|
112
|
+
*/
|
|
113
|
+
export function eulerXYZ(rxDeg, ryDeg, rzDeg) {
|
|
114
|
+
const a = Math.cos(rxDeg * D2R), b = Math.sin(rxDeg * D2R);
|
|
115
|
+
const c = Math.cos(ryDeg * D2R), d = Math.sin(ryDeg * D2R);
|
|
116
|
+
const e = Math.cos(rzDeg * D2R), f = Math.sin(rzDeg * D2R);
|
|
117
|
+
return [
|
|
118
|
+
c * e,
|
|
119
|
+
-c * f,
|
|
120
|
+
d,
|
|
121
|
+
a * f + b * e * d,
|
|
122
|
+
a * e - b * f * d,
|
|
123
|
+
-b * c,
|
|
124
|
+
b * f - a * e * d,
|
|
125
|
+
b * e + a * f * d,
|
|
126
|
+
a * c,
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
130
|
+
// Refraction (§4.1, CPU twins of common.glsl refractIn / refractOut)
|
|
131
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
132
|
+
/**
|
|
133
|
+
* Refraction of the air-side direction D (pointing away from the surface) into a flat layer of index n_c with top
|
|
134
|
+
* normal N (§4.1): D_t/n_c + N·√(1 − |D_t|²/n_c²), D_t = D − N(D·N). Unit length for unit D.
|
|
135
|
+
*/
|
|
136
|
+
export function refractIn(d, n, nc) {
|
|
137
|
+
const dn = dot(d, n);
|
|
138
|
+
const t = [d[0] - n[0] * dn, d[1] - n[1] * dn, d[2] - n[2] * dn];
|
|
139
|
+
const tt = dot(t, t) / (nc * nc);
|
|
140
|
+
const z = Math.sqrt(Math.max(1 - tt, 0));
|
|
141
|
+
return [t[0] / nc + n[0] * z, t[1] / nc + n[1] * z, t[2] / nc + n[2] * z];
|
|
142
|
+
}
|
|
143
|
+
/** Inverse of refractIn: internal direction (pointing up, away from the metal) → air direction; (0, 0, 0) under TIR. */
|
|
144
|
+
export function refractOut(dIn, n, nc) {
|
|
145
|
+
const dn = dot(dIn, n);
|
|
146
|
+
const t = [
|
|
147
|
+
(dIn[0] - n[0] * dn) * nc,
|
|
148
|
+
(dIn[1] - n[1] * dn) * nc,
|
|
149
|
+
(dIn[2] - n[2] * dn) * nc,
|
|
150
|
+
];
|
|
151
|
+
const tt = dot(t, t);
|
|
152
|
+
if (tt >= 1) {
|
|
153
|
+
return [0, 0, 0];
|
|
154
|
+
}
|
|
155
|
+
const z = Math.sqrt(1 - tt);
|
|
156
|
+
return [t[0] + n[0] * z, t[1] + n[1] * z, t[2] + n[2] * z];
|
|
157
|
+
}
|
|
158
|
+
function envPanel(thetaDeg, phiDeg, widthDeg, lengthDeg, edgeDeg, profile) {
|
|
159
|
+
const th = thetaDeg * D2R, ph = phiDeg * D2R;
|
|
160
|
+
const centre = [
|
|
161
|
+
Math.sin(th) * Math.cos(ph),
|
|
162
|
+
Math.sin(th) * Math.sin(ph),
|
|
163
|
+
Math.cos(th),
|
|
164
|
+
];
|
|
165
|
+
const { eTheta, ePhi } = lightAxes(centre);
|
|
166
|
+
return {
|
|
167
|
+
centre,
|
|
168
|
+
eTheta,
|
|
169
|
+
ePhi,
|
|
170
|
+
halfU: 0.5 * widthDeg * D2R,
|
|
171
|
+
halfW: 0.5 * lengthDeg * D2R,
|
|
172
|
+
edgeRad: edgeDeg * D2R,
|
|
173
|
+
profile,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/** Edge width of every environment panel [deg] (§5.3 "3° smoothstep edges"). */
|
|
177
|
+
export const ENV_EDGE_DEG = 3;
|
|
178
|
+
/**
|
|
179
|
+
* The studio's environment panels (§5.3), per unit DialKit radiance:
|
|
180
|
+
* rims × 2 at θ 78°, φ 0°/180°, 5° × 60°; top fill at θ 62°, φ 90°, 60° × 60° with a 15 % hot centre
|
|
181
|
+
* (1 + 0.15·(1 − r²), r the normalised elliptical radius); scrim at θ 20°, φ 90°, 20° × 50°, ×0.5 at the edge
|
|
182
|
+
* nearest the lens rising linearly (in angle) to ×1.0 at the far edge.
|
|
183
|
+
*/
|
|
184
|
+
export const STUDIO_ENV_PANELS = {
|
|
185
|
+
rimRight: envPanel(78, 0, 5, 60, ENV_EDGE_DEG, () => 1),
|
|
186
|
+
rimLeft: envPanel(78, 180, 5, 60, ENV_EDGE_DEG, () => 1),
|
|
187
|
+
fill: envPanel(62, 90, 60, 60, ENV_EDGE_DEG, (su, sw) => 1 + 0.15 * (1 - Math.min(su * su + sw * sw, 1))),
|
|
188
|
+
scrim: envPanel(20, 90, 20, 50, ENV_EDGE_DEG, (su) => 0.75 + 0.25 * Math.min(Math.max(su, -1), 1)),
|
|
189
|
+
};
|
|
190
|
+
/** Coverage mask × profile of a panel in direction d (unit), and the bare mask. */
|
|
191
|
+
export function envPanelAt(p, d) {
|
|
192
|
+
const z = dot(d, p.centre);
|
|
193
|
+
if (z <= 1e-6) {
|
|
194
|
+
return { mask: 0, radiance: 0 };
|
|
195
|
+
}
|
|
196
|
+
const au = Math.atan(dot(d, p.eTheta) / z), aw = Math.atan(dot(d, p.ePhi) / z);
|
|
197
|
+
const e = 0.5 * p.edgeRad;
|
|
198
|
+
const mu = 1 - smooth01((Math.abs(au) - (p.halfU - e)) / (2 * e));
|
|
199
|
+
const mw = 1 - smooth01((Math.abs(aw) - (p.halfW - e)) / (2 * e));
|
|
200
|
+
const mask = mu * mw;
|
|
201
|
+
return {
|
|
202
|
+
mask,
|
|
203
|
+
radiance: mask > 0 ? mask * p.profile(au / p.halfU, aw / p.halfW) : 0,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function smooth01(t) {
|
|
207
|
+
const x = Math.min(Math.max(t, 0), 1);
|
|
208
|
+
return x * x * (3 - 2 * x);
|
|
209
|
+
}
|
|
210
|
+
/** §5.2 background adaptation of the DialKit ambient values (fill ×1.5, camera side ≥ 0.03, behind = 0.6·backdrop on
|
|
211
|
+
* white). A colour page passes its tone t ∈ [0, 1] (app/state.ts backgroundTone: its relative luminance) and gets
|
|
212
|
+
* the adaptation scaled by t: fill ×(1 + 0.5t), camera side ≥ 0.03t, behind = 0.6t·backdrop (black t = 0, white 1). */
|
|
213
|
+
export function envLevels(a, bg) {
|
|
214
|
+
const t = typeof bg === "number"
|
|
215
|
+
? Math.min(Math.max(bg, 0), 1)
|
|
216
|
+
: bg === "white"
|
|
217
|
+
? 1
|
|
218
|
+
: 0;
|
|
219
|
+
return {
|
|
220
|
+
rims: a.rims,
|
|
221
|
+
fill: t === 1 ? 1.5 * a.fill : (1 + 0.5 * t) * a.fill,
|
|
222
|
+
scrim: a.scrim,
|
|
223
|
+
cameraSide: t > 0 ? Math.max(a.cameraSide, 0.03 * t) : a.cameraSide,
|
|
224
|
+
cameraTexture: a.cameraTexture,
|
|
225
|
+
behind: 0.6 * t * a.backdrop,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../../src/_holo/physics/geometry.ts"],"names":[],"mappings":"AAKA,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AAE1B,kHAAkH;AAClH,6CAA6C;AAC7C,kHAAkH;AAElH,mHAAmH;AACnH,MAAM,CAAC,MAAM,SAAS,GAAG,E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AC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU;QACnE,aAAa,EAAE,CAAC,CAAC,aAAa;QAC9B,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ;KAC/B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { rAl } from "../spectral/spd.js";
|
|
2
|
+
import type { GratingSummary, LightSet, Mat3, Vec2, Vec3 } from "../types.js";
|
|
3
|
+
export { rAl };
|
|
4
|
+
/**
|
|
5
|
+
* J_m(x) by the 8-term power series Σ_{k=0}^{7} (−1)^k (x/2)^{2k+m} / (k!(k+m)!) (R02 §2.6; |error| < 4·10⁻⁵ for
|
|
6
|
+
* x ≤ 4, < 1.4·10⁻³ at x = 5; Appendix A.3). Twin of GLSL `besselJ(int, float)`; negative m by J_{−m} = (−1)^m J_m.
|
|
7
|
+
*/
|
|
8
|
+
export declare function besselJ(m: number, x: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Scalar thin-phase efficiency of a buried sinusoid (§4.4.1): η_m = J_m²(Φ), Φ = π·n_c·h·(c_i′ + c_o′)/λ, with the
|
|
11
|
+
* phase clamped at 5.5 like the GLSL `orderEff` (the series' range).
|
|
12
|
+
*/
|
|
13
|
+
export declare function orderEff(m: number, lambdaNm: number, depthNm: number, nc: number, ciIn: number, coIn: number): number;
|
|
14
|
+
/** Internal cosine of an air-side cosine c in a layer of index n_c parallel to the surface: √(1 − (1 − c²)/n_c²). */
|
|
15
|
+
export declare function cosInside(c: number, nc: number): number;
|
|
16
|
+
/** Exact unpolarised dielectric Fresnel reflectance, air → n_c, at air-side cosine c (R02 §2.6). */
|
|
17
|
+
export declare function fresnelDiel(c: number, nc: number): number;
|
|
18
|
+
/** Piecewise-linear interpolation of a per-node vec4 at λ (nodes 430/510/590/670 nm), constant beyond the end nodes (twin of GLSL `etaAt`). */
|
|
19
|
+
export declare function etaAt(e: ArrayLike<number>, lambdaNm: number, offset?: number): number;
|
|
20
|
+
/** Zeroth-order factor at the 4 spectral nodes without the flat part: f1_k = etaM_k·J₀²(Φ(λ_k)) (twin of GLSL `mirrorF1`). */
|
|
21
|
+
export declare function mirrorF1(depthNm: number, nc: number, ciIn: number, coIn: number, etaM: ArrayLike<number>): [number, number, number, number];
|
|
22
|
+
/** Table domain and size of trapWeight (§4.4.1: 601 entries on [0, 1.6]). */
|
|
23
|
+
export declare const TRAP_TABLE: {
|
|
24
|
+
readonly uMax: 1.6;
|
|
25
|
+
readonly entries: 601;
|
|
26
|
+
readonly halfWindow: 0.03;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* τ(u) of §4.4.1: the internal reflectance at the lacquer/coat top surface, F_diel(√(1 − u²), n_c) for u < 1 and 1
|
|
30
|
+
* in the TIR region, box-averaged over u ± 0.03 (the spread of direction cosines across the card). Tabulated once
|
|
31
|
+
* per index (601 entries on [0, 1.6], linear interpolation; constant beyond 1.6). `nc` defaults to 1.5; the
|
|
32
|
+
* optional argument keeps the physics right for the lacquer-index dial (1.4–1.7).
|
|
33
|
+
*/
|
|
34
|
+
export declare function trapWeight(u: number, nc?: number): number;
|
|
35
|
+
export interface EtaInputs {
|
|
36
|
+
lg: number;
|
|
37
|
+
lt: number;
|
|
38
|
+
ci: number;
|
|
39
|
+
invD: number;
|
|
40
|
+
depthNm: number;
|
|
41
|
+
nc: number;
|
|
42
|
+
lambdaNm: number;
|
|
43
|
+
R: number;
|
|
44
|
+
recycle: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Continuous spectral renormalisation etaN (§4.4.1, R02 §5.3–5.4). Orders v_m = (mλ/d − l_g, −l_t) with
|
|
48
|
+
* |v_m| < n_c contribute η_m = J_m²(Φ_m) (internal cosines of the incident and the order-m direction), weighted by
|
|
49
|
+
* κ_m = smoothstep(n_c, n_c − 0.1, |v_m|); Σ = Σ κη, trapped T = Σ κη·τ(|v_m|), P = T/Σ;
|
|
50
|
+
* etaN = 1/(Σ(1 − R·P)) with recycling, 1/Σ without.
|
|
51
|
+
*/
|
|
52
|
+
export declare function etaNormalization(o: EtaInputs): number;
|
|
53
|
+
/**
|
|
54
|
+
* Relief depth of family f (addendum A2.3.2): `depthsNm[min(f, length − 1)]` when the summary lists per-family depths
|
|
55
|
+
* (A2 Sky Sparkle: dots, haze, grating specks), else the shared `depthNm`. Without `depthsNm` every caller sees
|
|
56
|
+
* exactly the previous value, so the etaNorm uploads are bit-identical to the single-depth code (test P18).
|
|
57
|
+
*/
|
|
58
|
+
export declare function familyDepth(s: GratingSummary, f: number): number;
|
|
59
|
+
/**
|
|
60
|
+
* Per-light renormalisation (§4.4.1) from the card-frame direction cosines l of L and v of V at the card centre.
|
|
61
|
+
* ord (12 = 3 families × 4 nodes, index 4f + k): frame ĝ = M1's actual grating vector, else ĝ ∥ q̂ = normalize(l + v)
|
|
62
|
+
* (lit elements have ĝ ∥ q). mir (4): M1 its actual ĝ and pitch, else the mean over 8 orientations at the middle
|
|
63
|
+
* family. Upload as uEtaOrd[3i + f] = ord[4f..4f+3], uEtaMir[i] = mir. Depths (A2.3.2): every order family uses its
|
|
64
|
+
* own `familyDepth`; the mirror uses the depth of the family it is evaluated at (family 0 with `gAzimuthRad`, else
|
|
65
|
+
* the middle family).
|
|
66
|
+
*/
|
|
67
|
+
export declare function etaForLight(s: GratingSummary, l: Vec2, v: Vec2): {
|
|
68
|
+
ord: Float32Array;
|
|
69
|
+
mir: Float32Array;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Environment renormalisation uEtaEnv (§4.4.1): etaN with the view's direction cosines v in place of l
|
|
73
|
+
* (reciprocity), averaged over 8 orientations at the middle family; for M1's linear grating (gAzimuthRad set) its
|
|
74
|
+
* actual ĝ is used instead of the orientation mean, as for its mirrors. Depth: that family's (A2.3.2).
|
|
75
|
+
*/
|
|
76
|
+
export declare function etaForEnv(s: GratingSummary, v: Vec2): Float32Array;
|
|
77
|
+
/**
|
|
78
|
+
* The per-frame CPU work of §6.4 for FrameInputs.eta: for every light slot, l and v at the card centre in the card
|
|
79
|
+
* frame (T, B) = columns 0 and 1 of cardRot, then etaForLight; disabled slots get the neutral value 1; env from V.
|
|
80
|
+
* cardPos is the card centre in world metres (the origin, plus any flip lift).
|
|
81
|
+
*/
|
|
82
|
+
export declare function etaFrame(s: GratingSummary, lights: LightSet, cardRot: Mat3, camPos: Vec3, cardPos?: Vec3): {
|
|
83
|
+
ord: Float32Array;
|
|
84
|
+
mir: Float32Array;
|
|
85
|
+
env: Float32Array;
|
|
86
|
+
};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
// Ported from holospot engine/physics/grating.ts (https://github.com/dmitrykurash/holospot), MIT © 2026 Dmitry Kurash.
|
|
2
|
+
// CPU twins of the grating maths (spec §4.4.1, R02 §2.2, §2.6, §5.3–5.4): Bessel series, scalar order efficiencies,
|
|
3
|
+
// dielectric Fresnel, TIR/internal-Fresnel recycling and the continuous per-node, per-family etaNorm uploaded as
|
|
4
|
+
// uEtaOrd / uEtaMir / uEtaEnv. Pure module (§6.1).
|
|
5
|
+
import { rAl, smoothstep, tintT2 } from "../spectral/spd.js";
|
|
6
|
+
import { SPEC_NODES } from "../spectral/tables.js";
|
|
7
|
+
import { column, dot, normalize, sub } from "./geometry.js";
|
|
8
|
+
export { rAl };
|
|
9
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
10
|
+
// Scalar functions (twins of common.glsl / grating.glsl)
|
|
11
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
12
|
+
/**
|
|
13
|
+
* J_m(x) by the 8-term power series Σ_{k=0}^{7} (−1)^k (x/2)^{2k+m} / (k!(k+m)!) (R02 §2.6; |error| < 4·10⁻⁵ for
|
|
14
|
+
* x ≤ 4, < 1.4·10⁻³ at x = 5; Appendix A.3). Twin of GLSL `besselJ(int, float)`; negative m by J_{−m} = (−1)^m J_m.
|
|
15
|
+
*/
|
|
16
|
+
export function besselJ(m, x) {
|
|
17
|
+
const am = Math.abs(m), h = 0.5 * x;
|
|
18
|
+
let term = 1;
|
|
19
|
+
for (let i = 1; i <= am; i++) {
|
|
20
|
+
term *= h / i; // h^m / m!
|
|
21
|
+
}
|
|
22
|
+
let s = term;
|
|
23
|
+
const h2 = h * h;
|
|
24
|
+
for (let k = 1; k < 8; k++) {
|
|
25
|
+
term *= -h2 / (k * (k + am));
|
|
26
|
+
s += term;
|
|
27
|
+
}
|
|
28
|
+
return m < 0 && (am & 1) === 1 ? -s : s;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Scalar thin-phase efficiency of a buried sinusoid (§4.4.1): η_m = J_m²(Φ), Φ = π·n_c·h·(c_i′ + c_o′)/λ, with the
|
|
32
|
+
* phase clamped at 5.5 like the GLSL `orderEff` (the series' range).
|
|
33
|
+
*/
|
|
34
|
+
export function orderEff(m, lambdaNm, depthNm, nc, ciIn, coIn) {
|
|
35
|
+
const x = Math.min((Math.PI * nc * depthNm * (ciIn + coIn)) / lambdaNm, 5.5);
|
|
36
|
+
const j = besselJ(m, x);
|
|
37
|
+
return j * j;
|
|
38
|
+
}
|
|
39
|
+
/** Internal cosine of an air-side cosine c in a layer of index n_c parallel to the surface: √(1 − (1 − c²)/n_c²). */
|
|
40
|
+
export function cosInside(c, nc) {
|
|
41
|
+
return Math.sqrt(Math.max(1 - (1 - c * c) / (nc * nc), 0));
|
|
42
|
+
}
|
|
43
|
+
/** Exact unpolarised dielectric Fresnel reflectance, air → n_c, at air-side cosine c (R02 §2.6). */
|
|
44
|
+
export function fresnelDiel(c, nc) {
|
|
45
|
+
const ci = Math.min(Math.max(c, 0), 1), ct = cosInside(ci, nc);
|
|
46
|
+
const rs = (ci - nc * ct) / (ci + nc * ct), rp = (nc * ci - ct) / (nc * ci + ct);
|
|
47
|
+
return 0.5 * (rs * rs + rp * rp);
|
|
48
|
+
}
|
|
49
|
+
/** Piecewise-linear interpolation of a per-node vec4 at λ (nodes 430/510/590/670 nm), constant beyond the end nodes (twin of GLSL `etaAt`). */
|
|
50
|
+
export function etaAt(e, lambdaNm, offset = 0) {
|
|
51
|
+
const x = Math.min(Math.max((lambdaNm - 430) / 80, 0), 3);
|
|
52
|
+
let s = 0;
|
|
53
|
+
for (let k = 0; k < 4; k++) {
|
|
54
|
+
s += e[offset + k] * Math.max(0, 1 - Math.abs(x - k));
|
|
55
|
+
}
|
|
56
|
+
return s;
|
|
57
|
+
}
|
|
58
|
+
/** Zeroth-order factor at the 4 spectral nodes without the flat part: f1_k = etaM_k·J₀²(Φ(λ_k)) (twin of GLSL `mirrorF1`). */
|
|
59
|
+
export function mirrorF1(depthNm, nc, ciIn, coIn, etaM) {
|
|
60
|
+
const f = [0, 0, 0, 0];
|
|
61
|
+
for (let k = 0; k < 4; k++) {
|
|
62
|
+
const j0 = besselJ(0, Math.min((Math.PI * nc * depthNm * (ciIn + coIn)) / SPEC_NODES[k], 5.5));
|
|
63
|
+
f[k] = etaM[k] * j0 * j0;
|
|
64
|
+
}
|
|
65
|
+
return f;
|
|
66
|
+
}
|
|
67
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
68
|
+
// Trapped weight τ(u) (§4.4.1)
|
|
69
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
70
|
+
/** Table domain and size of trapWeight (§4.4.1: 601 entries on [0, 1.6]). */
|
|
71
|
+
export const TRAP_TABLE = {
|
|
72
|
+
uMax: 1.6,
|
|
73
|
+
entries: 601,
|
|
74
|
+
halfWindow: 0.03,
|
|
75
|
+
};
|
|
76
|
+
const TRAP_CACHE = new Map();
|
|
77
|
+
/** τ_raw(u): internal reflectance at the top surface of an order with tangential direction cosine u (TIR ⇒ 1). */
|
|
78
|
+
function trapRaw(u, nc) {
|
|
79
|
+
const a = Math.abs(u);
|
|
80
|
+
return a >= 1 ? 1 : fresnelDiel(Math.sqrt(1 - a * a), nc); // Stokes: internal = external reflectance of the pair
|
|
81
|
+
}
|
|
82
|
+
function buildTrapTable(nc) {
|
|
83
|
+
// Running integral G(u) = ∫₀^u τ_raw on a fine grid with a node exactly at the √-cusp u = 1, then
|
|
84
|
+
// τ(u) = [G(u + w) − G(u − w)] / 2w with G odd (τ_raw is even in u).
|
|
85
|
+
const h = 5e-4, n = Math.round((TRAP_TABLE.uMax + 2 * TRAP_TABLE.halfWindow) / h) + 1; // a node at u = 1
|
|
86
|
+
const G = new Float64Array(n);
|
|
87
|
+
let prev = trapRaw(0, nc);
|
|
88
|
+
for (let i = 1; i < n; i++) {
|
|
89
|
+
const cur = trapRaw(i * h, nc);
|
|
90
|
+
G[i] = G[i - 1] + 0.5 * h * (prev + cur);
|
|
91
|
+
prev = cur;
|
|
92
|
+
}
|
|
93
|
+
const Gat = (u) => {
|
|
94
|
+
const a = Math.abs(u), x = a / h, i = Math.min(Math.floor(x), n - 2), f = x - i;
|
|
95
|
+
const v = G[i] * (1 - f) + G[i + 1] * f;
|
|
96
|
+
return u < 0 ? -v : v;
|
|
97
|
+
};
|
|
98
|
+
const N = TRAP_TABLE.entries, w = TRAP_TABLE.halfWindow;
|
|
99
|
+
const tab = new Float64Array(N);
|
|
100
|
+
for (let i = 0; i < N; i++) {
|
|
101
|
+
const u = (TRAP_TABLE.uMax * i) / (N - 1);
|
|
102
|
+
tab[i] = (Gat(u + w) - Gat(u - w)) / (2 * w);
|
|
103
|
+
}
|
|
104
|
+
return tab;
|
|
105
|
+
}
|
|
106
|
+
let lastTrapNc = NaN;
|
|
107
|
+
let lastTrapTab = null;
|
|
108
|
+
/** The τ table for an index (built on first use, then cached). */
|
|
109
|
+
function trapTable(nc) {
|
|
110
|
+
if (nc === lastTrapNc && lastTrapTab) {
|
|
111
|
+
return lastTrapTab;
|
|
112
|
+
}
|
|
113
|
+
let tab = TRAP_CACHE.get(nc);
|
|
114
|
+
if (!tab) {
|
|
115
|
+
tab = buildTrapTable(nc);
|
|
116
|
+
TRAP_CACHE.set(nc, tab);
|
|
117
|
+
}
|
|
118
|
+
lastTrapNc = nc;
|
|
119
|
+
lastTrapTab = tab;
|
|
120
|
+
return tab;
|
|
121
|
+
}
|
|
122
|
+
function trapLookup(tab, u) {
|
|
123
|
+
const N = TRAP_TABLE.entries;
|
|
124
|
+
const x = (Math.min(Math.abs(u), TRAP_TABLE.uMax) / TRAP_TABLE.uMax) * (N - 1);
|
|
125
|
+
const i = Math.min(Math.floor(x), N - 2), f = x - i;
|
|
126
|
+
return tab[i] * (1 - f) + tab[i + 1] * f;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* τ(u) of §4.4.1: the internal reflectance at the lacquer/coat top surface, F_diel(√(1 − u²), n_c) for u < 1 and 1
|
|
130
|
+
* in the TIR region, box-averaged over u ± 0.03 (the spread of direction cosines across the card). Tabulated once
|
|
131
|
+
* per index (601 entries on [0, 1.6], linear interpolation; constant beyond 1.6). `nc` defaults to 1.5; the
|
|
132
|
+
* optional argument keeps the physics right for the lacquer-index dial (1.4–1.7).
|
|
133
|
+
*/
|
|
134
|
+
export function trapWeight(u, nc = 1.5) {
|
|
135
|
+
return trapLookup(trapTable(nc), u);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Continuous spectral renormalisation etaN (§4.4.1, R02 §5.3–5.4). Orders v_m = (mλ/d − l_g, −l_t) with
|
|
139
|
+
* |v_m| < n_c contribute η_m = J_m²(Φ_m) (internal cosines of the incident and the order-m direction), weighted by
|
|
140
|
+
* κ_m = smoothstep(n_c, n_c − 0.1, |v_m|); Σ = Σ κη, trapped T = Σ κη·τ(|v_m|), P = T/Σ;
|
|
141
|
+
* etaN = 1/(Σ(1 − R·P)) with recycling, 1/Σ without.
|
|
142
|
+
*/
|
|
143
|
+
export function etaNormalization(o) {
|
|
144
|
+
const { lg, lt, invD, depthNm, nc, lambdaNm, R } = o;
|
|
145
|
+
const ciIn = cosInside(o.ci, nc), tab = trapTable(nc);
|
|
146
|
+
const k = lambdaNm * invD; // spacing of the orders in q
|
|
147
|
+
// every order with |m·k − l_g| < n_c (a degenerate pitch, k ≤ 0 or not finite, leaves only the mirror m = 0)
|
|
148
|
+
const mMax = k > 1e-6 && Number.isFinite(k)
|
|
149
|
+
? Math.min(Math.floor((nc + Math.abs(lg)) / k) + 1, 4096)
|
|
150
|
+
: 0;
|
|
151
|
+
const lt2 = lt * lt, nc2 = nc * nc, phase = (Math.PI * nc * depthNm) / lambdaNm;
|
|
152
|
+
let sum = 0, trap = 0;
|
|
153
|
+
for (let m = -mMax; m <= mMax; m++) {
|
|
154
|
+
const vx = m * k - lg, u2 = vx * vx + lt2;
|
|
155
|
+
if (u2 >= nc2) {
|
|
156
|
+
continue; // evanescent inside the lacquer
|
|
157
|
+
}
|
|
158
|
+
const u = Math.sqrt(u2);
|
|
159
|
+
const kap = smoothstep(nc, nc - 0.1, u);
|
|
160
|
+
if (kap <= 0) {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
const coIn = Math.sqrt(Math.max(1 - u2 / nc2, 0));
|
|
164
|
+
const j = besselJ(m, Math.min(phase * (ciIn + coIn), 5.5)); // = orderEff(m, λ, h, n_c, c_i′, c_o′)
|
|
165
|
+
const e = kap * j * j;
|
|
166
|
+
sum += e;
|
|
167
|
+
trap += e * trapLookup(tab, u);
|
|
168
|
+
}
|
|
169
|
+
if (!(sum > 1e-9)) {
|
|
170
|
+
return 1; // unreachable for |l| < 1 (m = 0 always exits)
|
|
171
|
+
}
|
|
172
|
+
return o.recycle ? 1 / (sum - R * trap) : 1 / sum;
|
|
173
|
+
}
|
|
174
|
+
/** Round-trip reflectance R(λ) = R_Al(λ)·T²_M(λ) of a grating summary's metal and dye. */
|
|
175
|
+
function roundTrip(s, lambdaNm) {
|
|
176
|
+
return rAl(lambdaNm) * tintT2(lambdaNm, s.tint);
|
|
177
|
+
}
|
|
178
|
+
/** etaN at the four spectral nodes for one frame ĝ = (gx, gy) (card plane), one pitch and one relief depth, written to
|
|
179
|
+
* out[off..off+3]. */
|
|
180
|
+
function etaNodes(s, l, gx, gy, pitchNm, depthNm, out, off) {
|
|
181
|
+
const lg = l.x * gx + l.y * gy, lt = -l.x * gy + l.y * gx; // t̂ = n × ĝ = (−g_y, g_x)
|
|
182
|
+
const ci = Math.sqrt(Math.max(1 - (l.x * l.x + l.y * l.y), 0));
|
|
183
|
+
for (let k = 0; k < 4; k++) {
|
|
184
|
+
const lambdaNm = SPEC_NODES[k];
|
|
185
|
+
out[off + k] = etaNormalization({
|
|
186
|
+
lg,
|
|
187
|
+
lt,
|
|
188
|
+
ci,
|
|
189
|
+
invD: 1 / pitchNm,
|
|
190
|
+
depthNm,
|
|
191
|
+
nc: s.nc,
|
|
192
|
+
lambdaNm,
|
|
193
|
+
R: roundTrip(s, lambdaNm),
|
|
194
|
+
recycle: s.recycle,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/** Mean of etaN over the 8 orientations ψ_k = kπ/8 at one pitch and depth, written to out[off..off+3]. */
|
|
199
|
+
function etaOrientationMean(s, l, pitchNm, depthNm, out, off) {
|
|
200
|
+
const acc = new Float64Array(4), tmp = new Float64Array(4);
|
|
201
|
+
for (let k = 0; k < 8; k++) {
|
|
202
|
+
const psi = (k * Math.PI) / 8;
|
|
203
|
+
etaNodes(s, l, Math.cos(psi), Math.sin(psi), pitchNm, depthNm, tmp, 0);
|
|
204
|
+
for (let n = 0; n < 4; n++) {
|
|
205
|
+
acc[n] += tmp[n] / 8;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
for (let n = 0; n < 4; n++) {
|
|
209
|
+
out[off + n] = acc[n];
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/** Family pitch f (0–2) of a summary: M1 repeats its single pitch; M2 A/B/C; M3 min / mid / max. */
|
|
213
|
+
function familyPitch(s, f) {
|
|
214
|
+
return s.pitchesNm[Math.min(f, s.pitchesNm.length - 1)];
|
|
215
|
+
}
|
|
216
|
+
/** Index of the middle family of a summary (M2 family B, M3 the harmonic-mean pitch, M1 its single family). */
|
|
217
|
+
function middleFamily(s) {
|
|
218
|
+
return Math.floor(s.pitchesNm.length / 2);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Relief depth of family f (addendum A2.3.2): `depthsNm[min(f, length − 1)]` when the summary lists per-family depths
|
|
222
|
+
* (A2 Sky Sparkle: dots, haze, grating specks), else the shared `depthNm`. Without `depthsNm` every caller sees
|
|
223
|
+
* exactly the previous value, so the etaNorm uploads are bit-identical to the single-depth code (test P18).
|
|
224
|
+
*/
|
|
225
|
+
export function familyDepth(s, f) {
|
|
226
|
+
const d = s.depthsNm;
|
|
227
|
+
return d && d.length > 0 ? d[Math.min(f, d.length - 1)] : s.depthNm;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Per-light renormalisation (§4.4.1) from the card-frame direction cosines l of L and v of V at the card centre.
|
|
231
|
+
* ord (12 = 3 families × 4 nodes, index 4f + k): frame ĝ = M1's actual grating vector, else ĝ ∥ q̂ = normalize(l + v)
|
|
232
|
+
* (lit elements have ĝ ∥ q). mir (4): M1 its actual ĝ and pitch, else the mean over 8 orientations at the middle
|
|
233
|
+
* family. Upload as uEtaOrd[3i + f] = ord[4f..4f+3], uEtaMir[i] = mir. Depths (A2.3.2): every order family uses its
|
|
234
|
+
* own `familyDepth`; the mirror uses the depth of the family it is evaluated at (family 0 with `gAzimuthRad`, else
|
|
235
|
+
* the middle family).
|
|
236
|
+
*/
|
|
237
|
+
export function etaForLight(s, l, v) {
|
|
238
|
+
const ord = new Float32Array(12), mir = new Float32Array(4);
|
|
239
|
+
let gx, gy;
|
|
240
|
+
if (s.gAzimuthRad !== null) {
|
|
241
|
+
gx = Math.cos(s.gAzimuthRad);
|
|
242
|
+
gy = Math.sin(s.gAzimuthRad);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
const qx = l.x + v.x, qy = l.y + v.y, r = Math.hypot(qx, qy), rl = Math.hypot(l.x, l.y);
|
|
246
|
+
if (r > 1e-9) {
|
|
247
|
+
gx = qx / r;
|
|
248
|
+
gy = qy / r;
|
|
249
|
+
}
|
|
250
|
+
else if (rl > 1e-9) {
|
|
251
|
+
gx = l.x / rl;
|
|
252
|
+
gy = l.y / rl;
|
|
253
|
+
} // mirror pose: any frame through l
|
|
254
|
+
else {
|
|
255
|
+
gx = 1;
|
|
256
|
+
gy = 0;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
for (let f = 0; f < 3; f++) {
|
|
260
|
+
etaNodes(s, l, gx, gy, familyPitch(s, f), familyDepth(s, f), ord, 4 * f);
|
|
261
|
+
}
|
|
262
|
+
if (s.gAzimuthRad !== null) {
|
|
263
|
+
etaNodes(s, l, gx, gy, familyPitch(s, 0), familyDepth(s, 0), mir, 0);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
const m = middleFamily(s);
|
|
267
|
+
etaOrientationMean(s, l, familyPitch(s, m), familyDepth(s, m), mir, 0);
|
|
268
|
+
}
|
|
269
|
+
return { ord, mir };
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Environment renormalisation uEtaEnv (§4.4.1): etaN with the view's direction cosines v in place of l
|
|
273
|
+
* (reciprocity), averaged over 8 orientations at the middle family; for M1's linear grating (gAzimuthRad set) its
|
|
274
|
+
* actual ĝ is used instead of the orientation mean, as for its mirrors. Depth: that family's (A2.3.2).
|
|
275
|
+
*/
|
|
276
|
+
export function etaForEnv(s, v) {
|
|
277
|
+
const out = new Float32Array(4);
|
|
278
|
+
if (s.gAzimuthRad !== null) {
|
|
279
|
+
etaNodes(s, v, Math.cos(s.gAzimuthRad), Math.sin(s.gAzimuthRad), familyPitch(s, 0), familyDepth(s, 0), out, 0);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
const m = middleFamily(s);
|
|
283
|
+
etaOrientationMean(s, v, familyPitch(s, m), familyDepth(s, m), out, 0);
|
|
284
|
+
}
|
|
285
|
+
return out;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The per-frame CPU work of §6.4 for FrameInputs.eta: for every light slot, l and v at the card centre in the card
|
|
289
|
+
* frame (T, B) = columns 0 and 1 of cardRot, then etaForLight; disabled slots get the neutral value 1; env from V.
|
|
290
|
+
* cardPos is the card centre in world metres (the origin, plus any flip lift).
|
|
291
|
+
*/
|
|
292
|
+
export function etaFrame(s, lights, cardRot, camPos, cardPos = [0, 0, 0]) {
|
|
293
|
+
const T = column(cardRot, 0), B = column(cardRot, 1);
|
|
294
|
+
const V = normalize(sub(camPos, cardPos));
|
|
295
|
+
const v = { x: dot(V, T), y: dot(V, B) };
|
|
296
|
+
const ord = new Float32Array(48).fill(1), mir = new Float32Array(16).fill(1);
|
|
297
|
+
for (let i = 0; i < 4; i++) {
|
|
298
|
+
if (lights.type[i] === 0) {
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
const P = [
|
|
302
|
+
lights.pos[3 * i],
|
|
303
|
+
lights.pos[3 * i + 1],
|
|
304
|
+
lights.pos[3 * i + 2],
|
|
305
|
+
];
|
|
306
|
+
const L = normalize(sub(P, cardPos));
|
|
307
|
+
const e = etaForLight(s, { x: dot(L, T), y: dot(L, B) }, v);
|
|
308
|
+
ord.set(e.ord, 12 * i);
|
|
309
|
+
mir.set(e.mir, 4 * i);
|
|
310
|
+
}
|
|
311
|
+
return { ord, mir, env: etaForEnv(s, v) };
|
|
312
|
+
}
|
|
313
|
+
//# sourceMappingURL=grating.js.map
|