@luma.gl/shaders 0.0.0-stage → 10.0.0-alpha.11
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/LICENSE +38 -0
- package/README.md +25 -2
- package/dist/dist.dev.js +21598 -0
- package/dist/dist.min.js +13439 -0
- package/dist/glsl.cjs +33 -0
- package/dist/glsl.cjs.map +6 -0
- package/dist/glsl.d.ts +6 -0
- package/dist/glsl.d.ts.map +1 -0
- package/dist/glsl.js +7 -0
- package/dist/glsl.js.map +1 -0
- package/dist/index.cjs +278 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/color/normalize-byte-colors.cjs +50 -0
- package/dist/lib/color/normalize-byte-colors.d.ts +23 -0
- package/dist/lib/color/normalize-byte-colors.d.ts.map +1 -0
- package/dist/lib/color/normalize-byte-colors.js +42 -0
- package/dist/lib/color/normalize-byte-colors.js.map +1 -0
- package/dist/lib/filters/prop-types.cjs +90 -0
- package/dist/lib/filters/prop-types.d.ts +44 -0
- package/dist/lib/filters/prop-types.d.ts.map +1 -0
- package/dist/lib/filters/prop-types.js +96 -0
- package/dist/lib/filters/prop-types.js.map +1 -0
- package/dist/lib/glsl-shader-assembler.cjs +50 -0
- package/dist/lib/glsl-shader-assembler.d.ts +19 -0
- package/dist/lib/glsl-shader-assembler.d.ts.map +1 -0
- package/dist/lib/glsl-shader-assembler.js +29 -0
- package/dist/lib/glsl-shader-assembler.js.map +1 -0
- package/dist/lib/glsl-utils/get-shader-info.cjs +52 -0
- package/dist/lib/glsl-utils/get-shader-info.d.ts +9 -0
- package/dist/lib/glsl-utils/get-shader-info.d.ts.map +1 -0
- package/dist/lib/glsl-utils/get-shader-info.js +33 -0
- package/dist/lib/glsl-utils/get-shader-info.js.map +1 -0
- package/dist/lib/glsl-utils/shader-utils.cjs +126 -0
- package/dist/lib/glsl-utils/shader-utils.d.ts +23 -0
- package/dist/lib/glsl-utils/shader-utils.d.ts.map +1 -0
- package/dist/lib/glsl-utils/shader-utils.js +92 -0
- package/dist/lib/glsl-utils/shader-utils.js.map +1 -0
- package/dist/lib/preprocessor/preprocessor.cjs +128 -0
- package/dist/lib/preprocessor/preprocessor.d.ts +15 -0
- package/dist/lib/preprocessor/preprocessor.d.ts.map +1 -0
- package/dist/lib/preprocessor/preprocessor.js +120 -0
- package/dist/lib/preprocessor/preprocessor.js.map +1 -0
- package/dist/lib/shader-assembler-base.cjs +132 -0
- package/dist/lib/shader-assembler-base.d.ts +51 -0
- package/dist/lib/shader-assembler-base.d.ts.map +1 -0
- package/dist/lib/shader-assembler-base.js +127 -0
- package/dist/lib/shader-assembler-base.js.map +1 -0
- package/dist/lib/shader-assembler.cjs +33 -0
- package/dist/lib/shader-assembler.d.ts +4 -0
- package/dist/lib/shader-assembler.d.ts.map +1 -0
- package/dist/lib/shader-assembler.js +7 -0
- package/dist/lib/shader-assembler.js.map +1 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.cjs +181 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts +70 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.js +208 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.js.map +1 -0
- package/dist/lib/shader-assembly/assemble-shaders.cjs +42 -0
- package/dist/lib/shader-assembly/assemble-shaders.d.ts +10 -0
- package/dist/lib/shader-assembly/assemble-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-shaders.js +10 -0
- package/dist/lib/shader-assembly/assemble-shaders.js.map +1 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.cjs +498 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts +70 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.js +480 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.js.map +1 -0
- package/dist/lib/shader-assembly/platform-defines.cjs +79 -0
- package/dist/lib/shader-assembly/platform-defines.d.ts +4 -0
- package/dist/lib/shader-assembly/platform-defines.d.ts.map +1 -0
- package/dist/lib/shader-assembly/platform-defines.js +52 -0
- package/dist/lib/shader-assembly/platform-defines.js.map +1 -0
- package/dist/lib/shader-assembly/platform-info.cjs +15 -0
- package/dist/lib/shader-assembly/platform-info.d.ts +20 -0
- package/dist/lib/shader-assembly/platform-info.d.ts.map +1 -0
- package/dist/lib/shader-assembly/platform-info.js +5 -0
- package/dist/lib/shader-assembly/platform-info.js.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.cjs +96 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.d.ts +16 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.js +79 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.js.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-types.cjs +15 -0
- package/dist/lib/shader-assembly/shader-assembly-types.d.ts +132 -0
- package/dist/lib/shader-assembly/shader-assembly-types.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-types.js +5 -0
- package/dist/lib/shader-assembly/shader-assembly-types.js.map +1 -0
- package/dist/lib/shader-assembly/shader-injection-targets.cjs +103 -0
- package/dist/lib/shader-assembly/shader-injection-targets.d.ts +46 -0
- package/dist/lib/shader-assembly/shader-injection-targets.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-injection-targets.js +83 -0
- package/dist/lib/shader-assembly/shader-injection-targets.js.map +1 -0
- package/dist/lib/shader-assembly/shader-injections.cjs +204 -0
- package/dist/lib/shader-assembly/shader-injections.d.ts +49 -0
- package/dist/lib/shader-assembly/shader-injections.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-injections.js +207 -0
- package/dist/lib/shader-assembly/shader-injections.js.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.cjs +434 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts +15 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.js +438 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.js.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.cjs +254 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.d.ts +12 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.js +237 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.cjs +166 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.d.ts +37 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.js +144 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.cjs +184 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.d.ts +19 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.js +151 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.cjs +163 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.d.ts +8 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.js +145 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.cjs +502 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.d.ts +14 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.js +498 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.js.map +1 -0
- package/dist/lib/shader-generator/generate-shader.cjs +36 -0
- package/dist/lib/shader-generator/generate-shader.d.ts +8 -0
- package/dist/lib/shader-generator/generate-shader.d.ts.map +1 -0
- package/dist/lib/shader-generator/generate-shader.js +15 -0
- package/dist/lib/shader-generator/generate-shader.js.map +1 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.cjs +94 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.d.ts +7 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.d.ts.map +1 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.js +79 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.js.map +1 -0
- package/dist/lib/shader-generator/utils/capitalize.cjs +29 -0
- package/dist/lib/shader-generator/utils/capitalize.d.ts +7 -0
- package/dist/lib/shader-generator/utils/capitalize.d.ts.map +1 -0
- package/dist/lib/shader-generator/utils/capitalize.js +12 -0
- package/dist/lib/shader-generator/utils/capitalize.js.map +1 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.cjs +46 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts +7 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts.map +1 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.js +23 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.js.map +1 -0
- package/dist/lib/shader-module/composite-shader-pass.cjs +15 -0
- package/dist/lib/shader-module/composite-shader-pass.d.ts +41 -0
- package/dist/lib/shader-module/composite-shader-pass.d.ts.map +1 -0
- package/dist/lib/shader-module/composite-shader-pass.js +5 -0
- package/dist/lib/shader-module/composite-shader-pass.js.map +1 -0
- package/dist/lib/shader-module/shader-module-dependencies.cjs +83 -0
- package/dist/lib/shader-module/shader-module-dependencies.d.ts +39 -0
- package/dist/lib/shader-module/shader-module-dependencies.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module-dependencies.js +103 -0
- package/dist/lib/shader-module/shader-module-dependencies.js.map +1 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.cjs +224 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.d.ts +91 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.js +253 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.js.map +1 -0
- package/dist/lib/shader-module/shader-module.cjs +99 -0
- package/dist/lib/shader-module/shader-module.d.ts +94 -0
- package/dist/lib/shader-module/shader-module.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module.js +101 -0
- package/dist/lib/shader-module/shader-module.js.map +1 -0
- package/dist/lib/shader-module/shader-pass.cjs +15 -0
- package/dist/lib/shader-module/shader-pass.d.ts +48 -0
- package/dist/lib/shader-module/shader-pass.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-pass.js +5 -0
- package/dist/lib/shader-module/shader-pass.js.map +1 -0
- package/dist/lib/shader-plugin.cjs +156 -0
- package/dist/lib/shader-plugin.d.ts +61 -0
- package/dist/lib/shader-plugin.d.ts.map +1 -0
- package/dist/lib/shader-plugin.js +147 -0
- package/dist/lib/shader-plugin.js.map +1 -0
- package/dist/lib/shader-transpiler/shader-transpiler.cjs +15 -0
- package/dist/lib/shader-transpiler/shader-transpiler.d.ts +27 -0
- package/dist/lib/shader-transpiler/shader-transpiler.d.ts.map +1 -0
- package/dist/lib/shader-transpiler/shader-transpiler.js +5 -0
- package/dist/lib/shader-transpiler/shader-transpiler.js.map +1 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.cjs +71 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.d.ts +9 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.d.ts.map +1 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.js +69 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.js.map +1 -0
- package/dist/lib/utils/assert.cjs +34 -0
- package/dist/lib/utils/assert.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts.map +1 -0
- package/dist/lib/utils/assert.js +13 -0
- package/dist/lib/utils/assert.js.map +1 -0
- package/dist/lib/utils/uniform-types.cjs +15 -0
- package/dist/lib/utils/uniform-types.d.ts +18 -0
- package/dist/lib/utils/uniform-types.d.ts.map +1 -0
- package/dist/lib/utils/uniform-types.js +5 -0
- package/dist/lib/utils/uniform-types.js.map +1 -0
- package/dist/lib/wgsl-shader-assembler.cjs +99 -0
- package/dist/lib/wgsl-shader-assembler.d.ts +34 -0
- package/dist/lib/wgsl-shader-assembler.d.ts.map +1 -0
- package/dist/lib/wgsl-shader-assembler.js +84 -0
- package/dist/lib/wgsl-shader-assembler.js.map +1 -0
- package/dist/module-injectors.cjs +59 -0
- package/dist/module-injectors.d.ts +3 -0
- package/dist/module-injectors.d.ts.map +1 -0
- package/dist/module-injectors.js +31 -0
- package/dist/module-injectors.js.map +1 -0
- package/dist/modules/color/float-colors.cjs +275 -0
- package/dist/modules/color/float-colors.d.ts +132 -0
- package/dist/modules/color/float-colors.d.ts.map +1 -0
- package/dist/modules/color/float-colors.js +248 -0
- package/dist/modules/color/float-colors.js.map +1 -0
- package/dist/modules/engine/clip/clip.cjs +142 -0
- package/dist/modules/engine/clip/clip.d.ts +12 -0
- package/dist/modules/engine/clip/clip.d.ts.map +1 -0
- package/dist/modules/engine/clip/clip.js +119 -0
- package/dist/modules/engine/clip/clip.js.map +1 -0
- package/dist/modules/engine/filter/filter.cjs +103 -0
- package/dist/modules/engine/filter/filter.d.ts +12 -0
- package/dist/modules/engine/filter/filter.d.ts.map +1 -0
- package/dist/modules/engine/filter/filter.js +80 -0
- package/dist/modules/engine/filter/filter.js.map +1 -0
- package/dist/modules/engine/geometry/geometry.cjs +63 -0
- package/dist/modules/engine/geometry/geometry.d.ts +9 -0
- package/dist/modules/engine/geometry/geometry.d.ts.map +1 -0
- package/dist/modules/engine/geometry/geometry.js +42 -0
- package/dist/modules/engine/geometry/geometry.js.map +1 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.cjs +255 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.d.ts +34 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.d.ts.map +1 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.js +228 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.js.map +1 -0
- package/dist/modules/engine/picking/picking.cjs +210 -0
- package/dist/modules/engine/picking/picking.d.ts +77 -0
- package/dist/modules/engine/picking/picking.d.ts.map +1 -0
- package/dist/modules/engine/picking/picking.js +198 -0
- package/dist/modules/engine/picking/picking.js.map +1 -0
- package/dist/modules/engine/project/project.cjs +138 -0
- package/dist/modules/engine/project/project.d.ts +39 -0
- package/dist/modules/engine/project/project.d.ts.map +1 -0
- package/dist/modules/engine/project/project.js +129 -0
- package/dist/modules/engine/project/project.js.map +1 -0
- package/dist/modules/engine/skin/skin.cjs +212 -0
- package/dist/modules/engine/skin/skin.d.ts +52 -0
- package/dist/modules/engine/skin/skin.d.ts.map +1 -0
- package/dist/modules/engine/skin/skin.js +179 -0
- package/dist/modules/engine/skin/skin.js.map +1 -0
- package/dist/modules/engine/transform/transform.cjs +72 -0
- package/dist/modules/engine/transform/transform.d.ts +6 -0
- package/dist/modules/engine/transform/transform.d.ts.map +1 -0
- package/dist/modules/engine/transform/transform.js +49 -0
- package/dist/modules/engine/transform/transform.js.map +1 -0
- package/dist/modules/geometry/path-dash/path-dash.cjs +93 -0
- package/dist/modules/geometry/path-dash/path-dash.d.ts +10 -0
- package/dist/modules/geometry/path-dash/path-dash.d.ts.map +1 -0
- package/dist/modules/geometry/path-dash/path-dash.js +66 -0
- package/dist/modules/geometry/path-dash/path-dash.js.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.cjs +117 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.d.ts +3 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.d.ts.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.js +87 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.js.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.cjs +64 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.d.ts +14 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.d.ts.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.js +43 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.js.map +1 -0
- package/dist/modules/geometry/point-glow/point-glow.cjs +104 -0
- package/dist/modules/geometry/point-glow/point-glow.d.ts +11 -0
- package/dist/modules/geometry/point-glow/point-glow.d.ts.map +1 -0
- package/dist/modules/geometry/point-glow/point-glow.js +77 -0
- package/dist/modules/geometry/point-glow/point-glow.js.map +1 -0
- package/dist/modules/geometry/precipitation/precipitation.cjs +122 -0
- package/dist/modules/geometry/precipitation/precipitation.d.ts +40 -0
- package/dist/modules/geometry/precipitation/precipitation.d.ts.map +1 -0
- package/dist/modules/geometry/precipitation/precipitation.js +95 -0
- package/dist/modules/geometry/precipitation/precipitation.js.map +1 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.cjs +158 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.d.ts +60 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.d.ts.map +1 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.js +137 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.js.map +1 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.cjs +2304 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.d.ts +3 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.d.ts.map +1 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.js +2283 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.js.map +1 -0
- package/dist/modules/geospatial/dggs/dggs.cjs +31 -0
- package/dist/modules/geospatial/dggs/dggs.d.ts +6 -0
- package/dist/modules/geospatial/dggs/dggs.d.ts.map +1 -0
- package/dist/modules/geospatial/dggs/dggs.js +10 -0
- package/dist/modules/geospatial/dggs/dggs.js.map +1 -0
- package/dist/modules/lighting/area-lighting/area-light-types.cjs +68 -0
- package/dist/modules/lighting/area-lighting/area-light-types.d.ts +34 -0
- package/dist/modules/lighting/area-lighting/area-light-types.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/area-light-types.js +40 -0
- package/dist/modules/lighting/area-lighting/area-light-types.js.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.cjs +101 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.d.ts +3 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.js +71 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.js.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting.cjs +62 -0
- package/dist/modules/lighting/area-lighting/area-lighting.d.ts +89 -0
- package/dist/modules/lighting/area-lighting/area-lighting.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting.js +41 -0
- package/dist/modules/lighting/area-lighting/area-lighting.js.map +1 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.cjs +192 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.d.ts +3 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.js +162 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.js.map +1 -0
- package/dist/modules/lighting/atmosphere/atmosphere.cjs +253 -0
- package/dist/modules/lighting/atmosphere/atmosphere.d.ts +45 -0
- package/dist/modules/lighting/atmosphere/atmosphere.d.ts.map +1 -0
- package/dist/modules/lighting/atmosphere/atmosphere.js +228 -0
- package/dist/modules/lighting/atmosphere/atmosphere.js.map +1 -0
- package/dist/modules/lighting/clouds/clouds.cjs +216 -0
- package/dist/modules/lighting/clouds/clouds.d.ts +58 -0
- package/dist/modules/lighting/clouds/clouds.d.ts.map +1 -0
- package/dist/modules/lighting/clouds/clouds.js +192 -0
- package/dist/modules/lighting/clouds/clouds.js.map +1 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.cjs +40 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.d.ts +6 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.d.ts.map +1 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.js +15 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.js.map +1 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.cjs +348 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.d.ts +188 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.d.ts.map +1 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.js +307 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.js.map +1 -0
- package/dist/modules/lighting/firefly/firefly.cjs +74 -0
- package/dist/modules/lighting/firefly/firefly.d.ts +36 -0
- package/dist/modules/lighting/firefly/firefly.d.ts.map +1 -0
- package/dist/modules/lighting/firefly/firefly.js +53 -0
- package/dist/modules/lighting/firefly/firefly.js.map +1 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.cjs +143 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.d.ts +53 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.d.ts.map +1 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.js +119 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.js.map +1 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.cjs +61 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +12 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.js +40 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.js.map +1 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.cjs +139 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.d.ts +14 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.d.ts.map +1 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.js +114 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.js.map +1 -0
- package/dist/modules/lighting/height-fog/height-fog.cjs +104 -0
- package/dist/modules/lighting/height-fog/height-fog.d.ts +60 -0
- package/dist/modules/lighting/height-fog/height-fog.d.ts.map +1 -0
- package/dist/modules/lighting/height-fog/height-fog.js +77 -0
- package/dist/modules/lighting/height-fog/height-fog.js.map +1 -0
- package/dist/modules/lighting/ibl/ibl.cjs +63 -0
- package/dist/modules/lighting/ibl/ibl.d.ts +25 -0
- package/dist/modules/lighting/ibl/ibl.d.ts.map +1 -0
- package/dist/modules/lighting/ibl/ibl.js +33 -0
- package/dist/modules/lighting/ibl/ibl.js.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-material.cjs +54 -0
- package/dist/modules/lighting/lambert-material/lambert-material.d.ts +10 -0
- package/dist/modules/lighting/lambert-material/lambert-material.d.ts.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-material.js +33 -0
- package/dist/modules/lighting/lambert-material/lambert-material.js.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.cjs +88 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.d.ts +3 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.js +60 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.js.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.cjs +97 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.d.ts +2 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.js +73 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.js.map +1 -0
- package/dist/modules/lighting/lights/lighting-glsl.cjs +116 -0
- package/dist/modules/lighting/lights/lighting-glsl.d.ts +2 -0
- package/dist/modules/lighting/lights/lighting-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/lights/lighting-glsl.js +92 -0
- package/dist/modules/lighting/lights/lighting-glsl.js.map +1 -0
- package/dist/modules/lighting/lights/lighting-wgsl.cjs +115 -0
- package/dist/modules/lighting/lights/lighting-wgsl.d.ts +2 -0
- package/dist/modules/lighting/lights/lighting-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/lights/lighting-wgsl.js +91 -0
- package/dist/modules/lighting/lights/lighting-wgsl.js.map +1 -0
- package/dist/modules/lighting/lights/lighting.cjs +210 -0
- package/dist/modules/lighting/lights/lighting.d.ts +163 -0
- package/dist/modules/lighting/lights/lighting.d.ts.map +1 -0
- package/dist/modules/lighting/lights/lighting.js +208 -0
- package/dist/modules/lighting/lights/lighting.js.map +1 -0
- package/dist/modules/lighting/no-material/dirlight.cjs +112 -0
- package/dist/modules/lighting/no-material/dirlight.d.ts +33 -0
- package/dist/modules/lighting/no-material/dirlight.d.ts.map +1 -0
- package/dist/modules/lighting/no-material/dirlight.js +86 -0
- package/dist/modules/lighting/no-material/dirlight.js.map +1 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.cjs +87 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.d.ts +21 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js +61 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js.map +1 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.cjs +87 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.d.ts +21 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js +61 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.cjs +1789 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts +3 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.js +1767 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.cjs +2084 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts +3 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js +2062 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material.cjs +315 -0
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts +516 -0
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material.js +292 -0
- package/dist/modules/lighting/pbr-material/pbr-material.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.cjs +63 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.d.ts +10 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.js +37 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.cjs +109 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.d.ts +52 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.js +83 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.js.map +1 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.cjs +97 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.d.ts +15 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.js +69 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.js.map +1 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.cjs +114 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.d.ts +15 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.js +88 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.js.map +1 -0
- package/dist/modules/lighting/phong-material/phong-material.cjs +61 -0
- package/dist/modules/lighting/phong-material/phong-material.d.ts +13 -0
- package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -0
- package/dist/modules/lighting/phong-material/phong-material.js +40 -0
- package/dist/modules/lighting/phong-material/phong-material.js.map +1 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.cjs +100 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +3 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +72 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.js.map +1 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.cjs +153 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts +2 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js +129 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js.map +1 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.cjs +379 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.d.ts +41 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.d.ts.map +1 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.js +345 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.js.map +1 -0
- package/dist/modules/lighting/shadow/shadow-glsl.cjs +228 -0
- package/dist/modules/lighting/shadow/shadow-glsl.d.ts +3 -0
- package/dist/modules/lighting/shadow/shadow-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/shadow/shadow-glsl.js +204 -0
- package/dist/modules/lighting/shadow/shadow-glsl.js.map +1 -0
- package/dist/modules/lighting/shadow/shadow-types.cjs +15 -0
- package/dist/modules/lighting/shadow/shadow-types.d.ts +63 -0
- package/dist/modules/lighting/shadow/shadow-types.d.ts.map +1 -0
- package/dist/modules/lighting/shadow/shadow-types.js +5 -0
- package/dist/modules/lighting/shadow/shadow-types.js.map +1 -0
- package/dist/modules/lighting/shadow/shadow.cjs +458 -0
- package/dist/modules/lighting/shadow/shadow.d.ts +117 -0
- package/dist/modules/lighting/shadow/shadow.d.ts.map +1 -0
- package/dist/modules/lighting/shadow/shadow.js +450 -0
- package/dist/modules/lighting/shadow/shadow.js.map +1 -0
- package/dist/modules/lighting/surface-weather/surface-weather.cjs +199 -0
- package/dist/modules/lighting/surface-weather/surface-weather.d.ts +54 -0
- package/dist/modules/lighting/surface-weather/surface-weather.d.ts.map +1 -0
- package/dist/modules/lighting/surface-weather/surface-weather.js +175 -0
- package/dist/modules/lighting/surface-weather/surface-weather.js.map +1 -0
- package/dist/modules/lighting/unlit-material/unlit-material.cjs +60 -0
- package/dist/modules/lighting/unlit-material/unlit-material.d.ts +9 -0
- package/dist/modules/lighting/unlit-material/unlit-material.d.ts.map +1 -0
- package/dist/modules/lighting/unlit-material/unlit-material.js +40 -0
- package/dist/modules/lighting/unlit-material/unlit-material.js.map +1 -0
- package/dist/modules/lighting/water-material/river-water-material.cjs +56 -0
- package/dist/modules/lighting/water-material/river-water-material.d.ts +21 -0
- package/dist/modules/lighting/water-material/river-water-material.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/river-water-material.js +36 -0
- package/dist/modules/lighting/water-material/river-water-material.js.map +1 -0
- package/dist/modules/lighting/water-material/river-water-shaders.cjs +261 -0
- package/dist/modules/lighting/water-material/river-water-shaders.d.ts +3 -0
- package/dist/modules/lighting/water-material/river-water-shaders.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/river-water-shaders.js +233 -0
- package/dist/modules/lighting/water-material/river-water-shaders.js.map +1 -0
- package/dist/modules/lighting/water-material/water-material.cjs +188 -0
- package/dist/modules/lighting/water-material/water-material.d.ts +28 -0
- package/dist/modules/lighting/water-material/water-material.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/water-material.js +179 -0
- package/dist/modules/lighting/water-material/water-material.js.map +1 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.cjs +260 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.d.ts +3 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.js +232 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.js.map +1 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.cjs +254 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.d.ts +2 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.js +230 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.js.map +1 -0
- package/dist/modules/math/fp16/fp16-utils.cjs +112 -0
- package/dist/modules/math/fp16/fp16-utils.d.ts +13 -0
- package/dist/modules/math/fp16/fp16-utils.d.ts.map +1 -0
- package/dist/modules/math/fp16/fp16-utils.js +118 -0
- package/dist/modules/math/fp16/fp16-utils.js.map +1 -0
- package/dist/modules/math/fp32/fp32.cjs +310 -0
- package/dist/modules/math/fp32/fp32.d.ts +9 -0
- package/dist/modules/math/fp32/fp32.d.ts.map +1 -0
- package/dist/modules/math/fp32/fp32.js +288 -0
- package/dist/modules/math/fp32/fp32.js.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.cjs +229 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.d.ts +2 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.js +205 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.js.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.cjs +144 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.d.ts +10 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.js +128 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.js.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.cjs +583 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.d.ts +11 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.js +563 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.js.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.cjs +946 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.d.ts +3 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.js +923 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.js.map +1 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.cjs +699 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.d.ts +2 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.js +675 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.js.map +1 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.cjs +180 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.d.ts +3 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.js +157 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.js.map +1 -0
- package/dist/modules/math/fp64/fp64-utils.cjs +50 -0
- package/dist/modules/math/fp64/fp64-utils.d.ts +22 -0
- package/dist/modules/math/fp64/fp64-utils.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-utils.js +42 -0
- package/dist/modules/math/fp64/fp64-utils.js.map +1 -0
- package/dist/modules/math/fp64/fp64.cjs +68 -0
- package/dist/modules/math/fp64/fp64.d.ts +24 -0
- package/dist/modules/math/fp64/fp64.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64.js +46 -0
- package/dist/modules/math/fp64/fp64.js.map +1 -0
- package/dist/modules/math/random/random.cjs +46 -0
- package/dist/modules/math/random/random.d.ts +7 -0
- package/dist/modules/math/random/random.d.ts.map +1 -0
- package/dist/modules/math/random/random.js +21 -0
- package/dist/modules/math/random/random.js.map +1 -0
- package/dist/modules/math/value-noise/value-noise.cjs +95 -0
- package/dist/modules/math/value-noise/value-noise.d.ts +7 -0
- package/dist/modules/math/value-noise/value-noise.d.ts.map +1 -0
- package/dist/modules/math/value-noise/value-noise.js +68 -0
- package/dist/modules/math/value-noise/value-noise.js.map +1 -0
- package/dist/modules/volume/volume-raymarch.cjs +107 -0
- package/dist/modules/volume/volume-raymarch.d.ts +6 -0
- package/dist/modules/volume/volume-raymarch.d.ts.map +1 -0
- package/dist/modules/volume/volume-raymarch.js +84 -0
- package/dist/modules/volume/volume-raymarch.js.map +1 -0
- package/dist/types/align-to.cjs +38 -0
- package/dist/types/align-to.d.ts +3 -0
- package/dist/types/align-to.d.ts.map +1 -0
- package/dist/types/align-to.js +13 -0
- package/dist/types/align-to.js.map +1 -0
- package/dist/types/primitive-data-types.cjs +15 -0
- package/dist/types/primitive-data-types.d.ts +7 -0
- package/dist/types/primitive-data-types.d.ts.map +1 -0
- package/dist/types/primitive-data-types.js +5 -0
- package/dist/types/primitive-data-types.js.map +1 -0
- package/dist/types/sampler-props.cjs +15 -0
- package/dist/types/sampler-props.d.ts +26 -0
- package/dist/types/sampler-props.d.ts.map +1 -0
- package/dist/types/sampler-props.js +5 -0
- package/dist/types/sampler-props.js.map +1 -0
- package/dist/types/shader-block-layout.cjs +184 -0
- package/dist/types/shader-block-layout.d.ts +72 -0
- package/dist/types/shader-block-layout.d.ts.map +1 -0
- package/dist/types/shader-block-layout.js +209 -0
- package/dist/types/shader-block-layout.js.map +1 -0
- package/dist/types/shader-layout.cjs +15 -0
- package/dist/types/shader-layout.d.ts +178 -0
- package/dist/types/shader-layout.d.ts.map +1 -0
- package/dist/types/shader-layout.js +5 -0
- package/dist/types/shader-layout.js.map +1 -0
- package/dist/types/shader-type-decoder.cjs +240 -0
- package/dist/types/shader-type-decoder.d.ts +41 -0
- package/dist/types/shader-type-decoder.d.ts.map +1 -0
- package/dist/types/shader-type-decoder.js +210 -0
- package/dist/types/shader-type-decoder.js.map +1 -0
- package/dist/types/shader-types.cjs +15 -0
- package/dist/types/shader-types.d.ts +101 -0
- package/dist/types/shader-types.d.ts.map +1 -0
- package/dist/types/shader-types.js +30 -0
- package/dist/types/shader-types.js.map +1 -0
- package/dist/types/texture-formats.cjs +15 -0
- package/dist/types/texture-formats.d.ts +24 -0
- package/dist/types/texture-formats.d.ts.map +1 -0
- package/dist/types/texture-formats.js +5 -0
- package/dist/types/texture-formats.js.map +1 -0
- package/dist/types.cjs +53 -0
- package/dist/types.cjs.map +6 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/wgsl.cjs +55 -0
- package/dist/wgsl.cjs.map +6 -0
- package/dist/wgsl.d.ts +8 -0
- package/dist/wgsl.d.ts.map +1 -0
- package/dist/wgsl.js +9 -0
- package/dist/wgsl.js.map +1 -0
- package/package.json +65 -4
- package/src/glsl.ts +13 -0
- package/src/index.ts +307 -0
- package/src/lib/color/normalize-byte-colors.ts +57 -0
- package/src/lib/filters/prop-types.ts +150 -0
- package/src/lib/glsl-shader-assembler.ts +39 -0
- package/src/lib/glsl-utils/get-shader-info.ts +42 -0
- package/src/lib/glsl-utils/shader-utils.ts +110 -0
- package/src/lib/preprocessor/preprocessor.ts +157 -0
- package/src/lib/shader-assembler-base.ts +169 -0
- package/src/lib/shader-assembler.ts +7 -0
- package/src/lib/shader-assembly/assemble-glsl-shaders.ts +305 -0
- package/src/lib/shader-assembly/assemble-shaders.ts +13 -0
- package/src/lib/shader-assembly/assemble-wgsl-shaders.ts +830 -0
- package/src/lib/shader-assembly/platform-defines.ts +58 -0
- package/src/lib/shader-assembly/platform-info.ts +23 -0
- package/src/lib/shader-assembly/shader-assembly-shared.ts +95 -0
- package/src/lib/shader-assembly/shader-assembly-types.ts +146 -0
- package/src/lib/shader-assembly/shader-injection-targets.ts +148 -0
- package/src/lib/shader-assembly/shader-injections.ts +298 -0
- package/src/lib/shader-assembly/shader-plugin-varyings.ts +555 -0
- package/src/lib/shader-assembly/shader-plugin-vertex-inputs.ts +279 -0
- package/src/lib/shader-assembly/wgsl-binding-debug.ts +227 -0
- package/src/lib/shader-assembly/wgsl-binding-scan.ts +228 -0
- package/src/lib/shader-assembly/wgsl-injection-target-names.ts +180 -0
- package/src/lib/shader-assembly/wgsl-interface-scan.ts +676 -0
- package/src/lib/shader-generator/generate-shader.ts +27 -0
- package/src/lib/shader-generator/glsl/generate-glsl.ts +101 -0
- package/src/lib/shader-generator/utils/capitalize.ts +12 -0
- package/src/lib/shader-generator/wgsl/generate-wgsl.ts +40 -0
- package/src/lib/shader-module/composite-shader-pass.ts +47 -0
- package/src/lib/shader-module/shader-module-dependencies.ts +128 -0
- package/src/lib/shader-module/shader-module-uniform-layout.ts +420 -0
- package/src/lib/shader-module/shader-module.ts +237 -0
- package/src/lib/shader-module/shader-pass.ts +69 -0
- package/src/lib/shader-plugin.ts +236 -0
- package/src/lib/shader-transpiler/shader-transpiler.ts +34 -0
- package/src/lib/shader-transpiler/transpile-glsl-shader.ts +78 -0
- package/src/lib/utils/assert.ts +13 -0
- package/src/lib/utils/uniform-types.ts +89 -0
- package/src/lib/wgsl-shader-assembler.ts +122 -0
- package/src/module-injectors.ts +32 -0
- package/src/modules/color/float-colors.ts +334 -0
- package/src/modules/engine/clip/clip.ts +139 -0
- package/src/modules/engine/filter/filter.ts +99 -0
- package/src/modules/engine/geometry/geometry.ts +45 -0
- package/src/modules/engine/gpu-animation/gpu-animation.ts +244 -0
- package/src/modules/engine/picking/README.md +88 -0
- package/src/modules/engine/picking/picking.ts +252 -0
- package/src/modules/engine/project/project.ts +166 -0
- package/src/modules/engine/skin/skin.ts +233 -0
- package/src/modules/engine/transform/transform.ts +50 -0
- package/src/modules/geometry/path-dash/path-dash.ts +68 -0
- package/src/modules/geometry/pattern-fill/pattern-fill-shaders.ts +88 -0
- package/src/modules/geometry/pattern-fill/pattern-fill.ts +54 -0
- package/src/modules/geometry/point-glow/point-glow.ts +87 -0
- package/src/modules/geometry/precipitation/README.md +19 -0
- package/src/modules/geometry/precipitation/precipitation.ts +108 -0
- package/src/modules/geometry/sketch-stroke/sketch-stroke.ts +160 -0
- package/src/modules/geospatial/dggs/dggs-wgsl.ts +2284 -0
- package/src/modules/geospatial/dggs/dggs.ts +12 -0
- package/src/modules/lighting/area-lighting/area-light-types.ts +71 -0
- package/src/modules/lighting/area-lighting/area-lighting-shaders.ts +72 -0
- package/src/modules/lighting/area-lighting/area-lighting.ts +63 -0
- package/src/modules/lighting/area-lighting/ltc-shaders.ts +163 -0
- package/src/modules/lighting/atmosphere/README.md +25 -0
- package/src/modules/lighting/atmosphere/atmosphere.ts +246 -0
- package/src/modules/lighting/clouds/README.md +24 -0
- package/src/modules/lighting/clouds/clouds.ts +216 -0
- package/src/modules/lighting/clustered-light-grid/clustered-light-grid.ts +17 -0
- package/src/modules/lighting/contact-shadow/contact-shadow.ts +365 -0
- package/src/modules/lighting/firefly/firefly.ts +64 -0
- package/src/modules/lighting/globe-clouds/globe-clouds.ts +124 -0
- package/src/modules/lighting/gouraud-material/gouraud-material.ts +55 -0
- package/src/modules/lighting/height-fog/README.md +36 -0
- package/src/modules/lighting/height-fog/height-fog-functions.ts +116 -0
- package/src/modules/lighting/height-fog/height-fog.ts +96 -0
- package/src/modules/lighting/ibl/ibl.ts +43 -0
- package/src/modules/lighting/lambert-material/lambert-material.ts +42 -0
- package/src/modules/lighting/lambert-material/lambert-shaders-glsl.ts +61 -0
- package/src/modules/lighting/lambert-material/lambert-shaders-wgsl.ts +73 -0
- package/src/modules/lighting/lights/lighting-glsl.ts +92 -0
- package/src/modules/lighting/lights/lighting-wgsl.ts +91 -0
- package/src/modules/lighting/lights/lighting.ts +385 -0
- package/src/modules/lighting/no-material/dirlight.ts +101 -0
- package/src/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.ts +78 -0
- package/src/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.ts +78 -0
- package/src/modules/lighting/pbr-material/pbr-material-glsl.ts +1770 -0
- package/src/modules/lighting/pbr-material/pbr-material-wgsl.ts +2065 -0
- package/src/modules/lighting/pbr-material/pbr-material.ts +517 -0
- package/src/modules/lighting/pbr-material/pbr-projection.ts +50 -0
- package/src/modules/lighting/pbr-material/pbr-scene.ts +112 -0
- package/src/modules/lighting/pbr-shadow/pbr-shadow.ts +85 -0
- package/src/modules/lighting/pbr-surface/pbr-surface.ts +103 -0
- package/src/modules/lighting/phong-material/phong-material.ts +53 -0
- package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +73 -0
- package/src/modules/lighting/phong-material/phong-shaders-wgsl.ts +129 -0
- package/src/modules/lighting/prefiltered-environment/prefiltered-environment.ts +370 -0
- package/src/modules/lighting/shadow/shadow-glsl.ts +204 -0
- package/src/modules/lighting/shadow/shadow-types.ts +68 -0
- package/src/modules/lighting/shadow/shadow.ts +536 -0
- package/src/modules/lighting/surface-weather/README.md +28 -0
- package/src/modules/lighting/surface-weather/surface-weather.ts +198 -0
- package/src/modules/lighting/unlit-material/unlit-material.ts +44 -0
- package/src/modules/lighting/water-material/river-water-material.ts +58 -0
- package/src/modules/lighting/water-material/river-water-shaders.ts +234 -0
- package/src/modules/lighting/water-material/water-material.ts +234 -0
- package/src/modules/lighting/water-material/water-shaders-glsl.ts +233 -0
- package/src/modules/lighting/water-material/water-shaders-wgsl.ts +230 -0
- package/src/modules/math/fp16/fp16-utils.ts +156 -0
- package/src/modules/math/fp32/fp32.ts +291 -0
- package/src/modules/math/fp64/fp64-arithmetic-glsl.ts +205 -0
- package/src/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.ts +129 -0
- package/src/modules/math/fp64/fp64-arithmetic-wgsl-integer.ts +564 -0
- package/src/modules/math/fp64/fp64-arithmetic-wgsl.ts +924 -0
- package/src/modules/math/fp64/fp64-functions-glsl.ts +675 -0
- package/src/modules/math/fp64/fp64-functions-wgsl.ts +157 -0
- package/src/modules/math/fp64/fp64-utils.ts +46 -0
- package/src/modules/math/fp64/fp64.ts +64 -0
- package/src/modules/math/random/random.ts +25 -0
- package/src/modules/math/value-noise/value-noise.ts +70 -0
- package/src/modules/volume/volume-raymarch.ts +87 -0
- package/src/types/align-to.ts +13 -0
- package/src/types/primitive-data-types.ts +10 -0
- package/src/types/sampler-props.ts +39 -0
- package/src/types/shader-block-layout.ts +340 -0
- package/src/types/shader-layout.ts +208 -0
- package/src/types/shader-type-decoder.ts +285 -0
- package/src/types/shader-types.ts +207 -0
- package/src/types/texture-formats.ts +157 -0
- package/src/types.ts +116 -0
- package/src/wgsl.ts +34 -0
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {SHADOW_GLSL} from './shadow-glsl';
|
|
6
|
+
import type {NumberArray3, NumberArray4, NumberArray16} from '@math.gl/core';
|
|
7
|
+
import type {ShaderModule} from '../../../lib/shader-module/shader-module';
|
|
8
|
+
import type {
|
|
9
|
+
DirectionalShadowLight,
|
|
10
|
+
PointShadowLight,
|
|
11
|
+
ShadowProps,
|
|
12
|
+
SpotShadowLight
|
|
13
|
+
} from './shadow-types';
|
|
14
|
+
|
|
15
|
+
const MAX_CASCADES = 4;
|
|
16
|
+
const MAX_SPOT_LIGHTS = 4;
|
|
17
|
+
const MAX_POINT_LIGHTS = 4;
|
|
18
|
+
const MAX_POINT_MATRICES = 24;
|
|
19
|
+
|
|
20
|
+
type DirectionalShadowUniform = {
|
|
21
|
+
direction: Readonly<NumberArray3>;
|
|
22
|
+
strength: number;
|
|
23
|
+
normalBias: number;
|
|
24
|
+
sourceAngularRadius: number;
|
|
25
|
+
cascadeBlendFraction: number;
|
|
26
|
+
farFadeFraction: number;
|
|
27
|
+
shadowDistance: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type SpotShadowUniform = {
|
|
31
|
+
position: Readonly<NumberArray3>;
|
|
32
|
+
range: number;
|
|
33
|
+
direction: Readonly<NumberArray3>;
|
|
34
|
+
outerConeCos: number;
|
|
35
|
+
sourceRadius: number;
|
|
36
|
+
normalBias: number;
|
|
37
|
+
strength: number;
|
|
38
|
+
nearPlane: number;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type PointShadowUniform = {
|
|
42
|
+
position: Readonly<NumberArray3>;
|
|
43
|
+
range: number;
|
|
44
|
+
sourceRadius: number;
|
|
45
|
+
normalBias: number;
|
|
46
|
+
strength: number;
|
|
47
|
+
nearPlane: number;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type ShadowUniforms = {
|
|
51
|
+
directionalLightCount: number;
|
|
52
|
+
spotLightCount: number;
|
|
53
|
+
pointLightCount: number;
|
|
54
|
+
cascadeCount: number;
|
|
55
|
+
blockerSampleCount: number;
|
|
56
|
+
filterSampleCount: number;
|
|
57
|
+
cascadeSplits: Readonly<NumberArray4>;
|
|
58
|
+
directionalViewProjectionMatrices: readonly Readonly<NumberArray16>[];
|
|
59
|
+
spotViewProjectionMatrices: readonly Readonly<NumberArray16>[];
|
|
60
|
+
pointViewProjectionMatrices: readonly Readonly<NumberArray16>[];
|
|
61
|
+
directionalLights: readonly DirectionalShadowUniform[];
|
|
62
|
+
spotLights: readonly SpotShadowUniform[];
|
|
63
|
+
pointLights: readonly PointShadowUniform[];
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type ShadowBindings<TextureT = unknown, SamplerT = unknown> = {
|
|
67
|
+
directionalShadowTexture: TextureT;
|
|
68
|
+
spotShadowTexture: TextureT;
|
|
69
|
+
pointShadowTexture: TextureT;
|
|
70
|
+
shadowComparisonSampler?: SamplerT;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const DIRECTIONAL_LIGHT_UNIFORM_TYPE = {
|
|
74
|
+
direction: 'vec3<f32>',
|
|
75
|
+
strength: 'f32',
|
|
76
|
+
normalBias: 'f32',
|
|
77
|
+
sourceAngularRadius: 'f32',
|
|
78
|
+
cascadeBlendFraction: 'f32',
|
|
79
|
+
farFadeFraction: 'f32',
|
|
80
|
+
shadowDistance: 'f32'
|
|
81
|
+
} as const;
|
|
82
|
+
|
|
83
|
+
const SPOT_LIGHT_UNIFORM_TYPE = {
|
|
84
|
+
position: 'vec3<f32>',
|
|
85
|
+
range: 'f32',
|
|
86
|
+
direction: 'vec3<f32>',
|
|
87
|
+
outerConeCos: 'f32',
|
|
88
|
+
sourceRadius: 'f32',
|
|
89
|
+
normalBias: 'f32',
|
|
90
|
+
strength: 'f32',
|
|
91
|
+
nearPlane: 'f32'
|
|
92
|
+
} as const;
|
|
93
|
+
|
|
94
|
+
const POINT_LIGHT_UNIFORM_TYPE = {
|
|
95
|
+
position: 'vec3<f32>',
|
|
96
|
+
range: 'f32',
|
|
97
|
+
sourceRadius: 'f32',
|
|
98
|
+
normalBias: 'f32',
|
|
99
|
+
strength: 'f32',
|
|
100
|
+
nearPlane: 'f32'
|
|
101
|
+
} as const;
|
|
102
|
+
|
|
103
|
+
const SHADOW_WGSL = /* wgsl */ `\
|
|
104
|
+
const SHADOW_PI: f32 = 3.141592653589793;
|
|
105
|
+
|
|
106
|
+
struct DirectionalShadowLightUniform {
|
|
107
|
+
direction: vec3f,
|
|
108
|
+
strength: f32,
|
|
109
|
+
normalBias: f32,
|
|
110
|
+
sourceAngularRadius: f32,
|
|
111
|
+
cascadeBlendFraction: f32,
|
|
112
|
+
farFadeFraction: f32,
|
|
113
|
+
shadowDistance: f32,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
struct SpotShadowLightUniform {
|
|
117
|
+
position: vec3f,
|
|
118
|
+
range: f32,
|
|
119
|
+
direction: vec3f,
|
|
120
|
+
outerConeCos: f32,
|
|
121
|
+
sourceRadius: f32,
|
|
122
|
+
normalBias: f32,
|
|
123
|
+
strength: f32,
|
|
124
|
+
nearPlane: f32,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
struct PointShadowLightUniform {
|
|
128
|
+
position: vec3f,
|
|
129
|
+
range: f32,
|
|
130
|
+
sourceRadius: f32,
|
|
131
|
+
normalBias: f32,
|
|
132
|
+
strength: f32,
|
|
133
|
+
nearPlane: f32,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
struct ShadowUniforms {
|
|
137
|
+
directionalLightCount: i32,
|
|
138
|
+
spotLightCount: i32,
|
|
139
|
+
pointLightCount: i32,
|
|
140
|
+
cascadeCount: i32,
|
|
141
|
+
blockerSampleCount: i32,
|
|
142
|
+
filterSampleCount: i32,
|
|
143
|
+
cascadeSplits: vec4f,
|
|
144
|
+
directionalViewProjectionMatrices: array<mat4x4f, 4>,
|
|
145
|
+
spotViewProjectionMatrices: array<mat4x4f, 4>,
|
|
146
|
+
pointViewProjectionMatrices: array<mat4x4f, 24>,
|
|
147
|
+
directionalLights: array<DirectionalShadowLightUniform, 1>,
|
|
148
|
+
spotLights: array<SpotShadowLightUniform, 4>,
|
|
149
|
+
pointLights: array<PointShadowLightUniform, 4>,
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
@group(2) @binding(auto) var<uniform> shadow: ShadowUniforms;
|
|
153
|
+
@group(2) @binding(auto) var directionalShadowTexture: texture_depth_2d_array;
|
|
154
|
+
@group(2) @binding(auto) var spotShadowTexture: texture_depth_2d_array;
|
|
155
|
+
@group(2) @binding(auto) var pointShadowTexture: texture_depth_cube_array;
|
|
156
|
+
@group(2) @binding(auto) var directionalShadowTextureSampler: sampler;
|
|
157
|
+
@group(2) @binding(auto) var shadowComparisonSampler: sampler_comparison;
|
|
158
|
+
|
|
159
|
+
fn shadow_hash(position: vec3f) -> f32 {
|
|
160
|
+
return fract(sin(dot(position, vec3f(12.9898, 78.233, 37.719))) * 43758.5453);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
fn shadow_diskSample(index: i32, count: i32, rotation: f32) -> vec2f {
|
|
164
|
+
let fraction = (f32(index) + 0.5) / max(f32(count), 1.0);
|
|
165
|
+
let angle = f32(index) * 2.39996323 + rotation;
|
|
166
|
+
return sqrt(fraction) * vec2f(cos(angle), sin(angle));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
fn shadow_project(matrix: mat4x4f, worldPosition: vec3f) -> vec3f {
|
|
170
|
+
let clip = matrix * vec4f(worldPosition, 1.0);
|
|
171
|
+
let ndc = clip.xyz / max(abs(clip.w), 0.00001);
|
|
172
|
+
return vec3f(ndc.x * 0.5 + 0.5, 0.5 - ndc.y * 0.5, ndc.z);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
fn shadow_validProjection(projected: vec3f) -> bool {
|
|
176
|
+
return all(projected.xy >= vec2f(0.0)) && all(projected.xy <= vec2f(1.0)) &&
|
|
177
|
+
projected.z >= 0.0 && projected.z <= 1.0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
fn shadow_directionalCascadeIndex(viewDepth: f32) -> i32 {
|
|
181
|
+
var cascadeIndex = 0;
|
|
182
|
+
for (var index: i32 = 0; index < 4; index++) {
|
|
183
|
+
if (index >= shadow.cascadeCount) { break; }
|
|
184
|
+
cascadeIndex = index;
|
|
185
|
+
if (viewDepth <= shadow.cascadeSplits[index]) { break; }
|
|
186
|
+
}
|
|
187
|
+
return cascadeIndex;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
fn shadow_getDirectionalCascadeIndex(viewDepth: f32) -> i32 {
|
|
191
|
+
if (shadow.directionalLightCount == 0) { return -1; }
|
|
192
|
+
return shadow_directionalCascadeIndex(viewDepth);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
fn shadow_directionalPCSS(cascadeIndex: i32, worldPosition: vec3f, viewDepth: f32) -> f32 {
|
|
196
|
+
let projected = shadow_project(shadow.directionalViewProjectionMatrices[cascadeIndex], worldPosition);
|
|
197
|
+
if (!shadow_validProjection(projected)) { return 1.0; }
|
|
198
|
+
let dimensions = vec2f(textureDimensions(directionalShadowTexture));
|
|
199
|
+
let texel = 1.0 / dimensions;
|
|
200
|
+
let light = shadow.directionalLights[0];
|
|
201
|
+
let rotation = shadow_hash(worldPosition) * 2.0 * SHADOW_PI;
|
|
202
|
+
let searchRadius = max(texel.x, light.sourceAngularRadius * viewDepth / max(light.shadowDistance, 0.001));
|
|
203
|
+
var blockerDepth = 0.0;
|
|
204
|
+
var blockerCount = 0.0;
|
|
205
|
+
for (var index: i32 = 0; index < 24; index++) {
|
|
206
|
+
if (index >= shadow.blockerSampleCount) { break; }
|
|
207
|
+
let offset = shadow_diskSample(index, shadow.blockerSampleCount, rotation) * searchRadius;
|
|
208
|
+
let sampleDepth = textureSampleLevel(
|
|
209
|
+
directionalShadowTexture,
|
|
210
|
+
directionalShadowTextureSampler,
|
|
211
|
+
clamp(projected.xy + offset, vec2f(0.0), vec2f(1.0)),
|
|
212
|
+
cascadeIndex,
|
|
213
|
+
0
|
|
214
|
+
);
|
|
215
|
+
if (sampleDepth < projected.z) {
|
|
216
|
+
blockerDepth += sampleDepth;
|
|
217
|
+
blockerCount += 1.0;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (blockerCount == 0.0) { return 1.0; }
|
|
221
|
+
let averageBlocker = blockerDepth / blockerCount;
|
|
222
|
+
let penumbra = clamp((projected.z - averageBlocker) / max(abs(averageBlocker), 0.001), 0.0, 1.0);
|
|
223
|
+
let filterRadius = max(texel.x, searchRadius * (1.0 + penumbra * 18.0));
|
|
224
|
+
var visibility = 0.0;
|
|
225
|
+
for (var index: i32 = 0; index < 48; index++) {
|
|
226
|
+
if (index >= shadow.filterSampleCount) { break; }
|
|
227
|
+
let offset = shadow_diskSample(index, shadow.filterSampleCount, rotation) * filterRadius;
|
|
228
|
+
visibility += textureSampleCompareLevel(
|
|
229
|
+
directionalShadowTexture,
|
|
230
|
+
shadowComparisonSampler,
|
|
231
|
+
clamp(projected.xy + offset, vec2f(0.0), vec2f(1.0)),
|
|
232
|
+
cascadeIndex,
|
|
233
|
+
projected.z
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
return visibility / max(f32(shadow.filterSampleCount), 1.0);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
fn shadow_getDirectionalFactor(worldPosition: vec3f, worldNormal: vec3f, viewDepth: f32) -> f32 {
|
|
240
|
+
if (shadow.directionalLightCount == 0 || viewDepth <= 0.0) { return 1.0; }
|
|
241
|
+
let light = shadow.directionalLights[0];
|
|
242
|
+
if (viewDepth >= light.shadowDistance) { return 1.0; }
|
|
243
|
+
let biasedPosition = worldPosition + normalize(worldNormal) * light.normalBias;
|
|
244
|
+
let cascadeIndex = shadow_directionalCascadeIndex(viewDepth);
|
|
245
|
+
var visibility = shadow_directionalPCSS(cascadeIndex, biasedPosition, viewDepth);
|
|
246
|
+
if (cascadeIndex + 1 < shadow.cascadeCount) {
|
|
247
|
+
var cascadeStart = 0.0;
|
|
248
|
+
if (cascadeIndex > 0) { cascadeStart = shadow.cascadeSplits[cascadeIndex - 1]; }
|
|
249
|
+
let cascadeEnd = shadow.cascadeSplits[cascadeIndex];
|
|
250
|
+
let blendWidth = max((cascadeEnd - cascadeStart) * light.cascadeBlendFraction, 0.0001);
|
|
251
|
+
let blend = smoothstep(cascadeEnd - blendWidth, cascadeEnd, viewDepth);
|
|
252
|
+
if (blend > 0.0) {
|
|
253
|
+
visibility = mix(
|
|
254
|
+
visibility,
|
|
255
|
+
shadow_directionalPCSS(cascadeIndex + 1, biasedPosition, viewDepth),
|
|
256
|
+
blend
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
let fadeWidth = max(light.shadowDistance * light.farFadeFraction, 0.0001);
|
|
261
|
+
let farFade = smoothstep(light.shadowDistance - fadeWidth, light.shadowDistance, viewDepth);
|
|
262
|
+
visibility = mix(visibility, 1.0, farFade);
|
|
263
|
+
return mix(1.0, visibility, light.strength);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
fn shadow_spotPCSS(lightIndex: i32, worldPosition: vec3f) -> f32 {
|
|
267
|
+
let projected = shadow_project(shadow.spotViewProjectionMatrices[lightIndex], worldPosition);
|
|
268
|
+
if (!shadow_validProjection(projected)) { return 1.0; }
|
|
269
|
+
let light = shadow.spotLights[lightIndex];
|
|
270
|
+
let dimensions = vec2f(textureDimensions(spotShadowTexture));
|
|
271
|
+
let texel = 1.0 / dimensions;
|
|
272
|
+
let distanceToLight = length(worldPosition - light.position);
|
|
273
|
+
let searchRadius = max(texel.x, light.sourceRadius / max(distanceToLight, 0.001) * 0.5);
|
|
274
|
+
let rotation = shadow_hash(worldPosition) * 2.0 * SHADOW_PI;
|
|
275
|
+
var blockerDepth = 0.0;
|
|
276
|
+
var blockerCount = 0.0;
|
|
277
|
+
for (var index: i32 = 0; index < 24; index++) {
|
|
278
|
+
if (index >= shadow.blockerSampleCount) { break; }
|
|
279
|
+
let offset = shadow_diskSample(index, shadow.blockerSampleCount, rotation) * searchRadius;
|
|
280
|
+
let sampleDepth = textureSampleLevel(
|
|
281
|
+
spotShadowTexture,
|
|
282
|
+
directionalShadowTextureSampler,
|
|
283
|
+
clamp(projected.xy + offset, vec2f(0.0), vec2f(1.0)),
|
|
284
|
+
lightIndex,
|
|
285
|
+
0
|
|
286
|
+
);
|
|
287
|
+
if (sampleDepth < projected.z) { blockerDepth += sampleDepth; blockerCount += 1.0; }
|
|
288
|
+
}
|
|
289
|
+
if (blockerCount == 0.0) { return 1.0; }
|
|
290
|
+
let averageBlocker = blockerDepth / blockerCount;
|
|
291
|
+
let penumbra = clamp((projected.z - averageBlocker) / max(abs(averageBlocker), 0.001), 0.0, 1.0);
|
|
292
|
+
let filterRadius = max(texel.x, searchRadius * (1.0 + penumbra * 16.0));
|
|
293
|
+
var visibility = 0.0;
|
|
294
|
+
for (var index: i32 = 0; index < 48; index++) {
|
|
295
|
+
if (index >= shadow.filterSampleCount) { break; }
|
|
296
|
+
let offset = shadow_diskSample(index, shadow.filterSampleCount, rotation) * filterRadius;
|
|
297
|
+
visibility += textureSampleCompareLevel(
|
|
298
|
+
spotShadowTexture,
|
|
299
|
+
shadowComparisonSampler,
|
|
300
|
+
clamp(projected.xy + offset, vec2f(0.0), vec2f(1.0)),
|
|
301
|
+
lightIndex,
|
|
302
|
+
projected.z
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
return visibility / max(f32(shadow.filterSampleCount), 1.0);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
fn shadow_getSpotFactor(lightIndex: i32, worldPosition: vec3f, worldNormal: vec3f) -> f32 {
|
|
309
|
+
if (lightIndex < 0 || lightIndex >= shadow.spotLightCount) { return 1.0; }
|
|
310
|
+
let light = shadow.spotLights[lightIndex];
|
|
311
|
+
let fromLight = worldPosition - light.position;
|
|
312
|
+
let distanceToLight = length(fromLight);
|
|
313
|
+
let coneCos = dot(normalize(fromLight), normalize(light.direction));
|
|
314
|
+
if (distanceToLight >= light.range || coneCos < light.outerConeCos) { return 1.0; }
|
|
315
|
+
let biasedPosition = worldPosition + normalize(worldNormal) * light.normalBias;
|
|
316
|
+
return mix(1.0, shadow_spotPCSS(lightIndex, biasedPosition), light.strength);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
fn shadow_pointReferenceDepth(majorDistance: f32, nearPlane: f32, farPlane: f32) -> f32 {
|
|
320
|
+
// Match the cube-face projection and stored WebGPU depth in [0, 1].
|
|
321
|
+
return farPlane / (farPlane - nearPlane) -
|
|
322
|
+
(farPlane * nearPlane) / ((farPlane - nearPlane) * majorDistance);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
fn shadow_pointBasis(direction: vec3f) -> mat2x3f {
|
|
326
|
+
let reference = select(vec3f(0.0, 1.0, 0.0), vec3f(0.0, 0.0, 1.0), abs(direction.y) > 0.99);
|
|
327
|
+
let tangent = normalize(cross(direction, reference));
|
|
328
|
+
return mat2x3f(tangent, normalize(cross(direction, tangent)));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
fn shadow_getPointFactor(lightIndex: i32, worldPosition: vec3f, worldNormal: vec3f) -> f32 {
|
|
332
|
+
if (lightIndex < 0 || lightIndex >= shadow.pointLightCount) { return 1.0; }
|
|
333
|
+
let light = shadow.pointLights[lightIndex];
|
|
334
|
+
let biasedPosition = worldPosition + normalize(worldNormal) * light.normalBias;
|
|
335
|
+
let fromLight = biasedPosition - light.position;
|
|
336
|
+
let distanceToLight = length(fromLight);
|
|
337
|
+
if (distanceToLight >= light.range || distanceToLight <= light.nearPlane) { return 1.0; }
|
|
338
|
+
let direction = normalize(fromLight);
|
|
339
|
+
let majorDistance = max(max(abs(fromLight.x), abs(fromLight.y)), abs(fromLight.z));
|
|
340
|
+
let referenceDepth = shadow_pointReferenceDepth(majorDistance, light.nearPlane, light.range);
|
|
341
|
+
let searchRadius = light.sourceRadius / max(distanceToLight, 0.001);
|
|
342
|
+
let rotation = shadow_hash(worldPosition) * 2.0 * SHADOW_PI;
|
|
343
|
+
let basis = shadow_pointBasis(direction);
|
|
344
|
+
var blockerDepth = 0.0;
|
|
345
|
+
var blockerCount = 0.0;
|
|
346
|
+
for (var index: i32 = 0; index < 24; index++) {
|
|
347
|
+
if (index >= shadow.blockerSampleCount) { break; }
|
|
348
|
+
let disk = shadow_diskSample(index, shadow.blockerSampleCount, rotation) * searchRadius;
|
|
349
|
+
let sampleDirection = normalize(direction + basis[0] * disk.x + basis[1] * disk.y);
|
|
350
|
+
let sampleDepth = textureSampleLevel(
|
|
351
|
+
pointShadowTexture,
|
|
352
|
+
directionalShadowTextureSampler,
|
|
353
|
+
sampleDirection,
|
|
354
|
+
lightIndex,
|
|
355
|
+
0
|
|
356
|
+
);
|
|
357
|
+
if (sampleDepth < referenceDepth) { blockerDepth += sampleDepth; blockerCount += 1.0; }
|
|
358
|
+
}
|
|
359
|
+
if (blockerCount == 0.0) { return 1.0; }
|
|
360
|
+
let averageBlocker = blockerDepth / blockerCount;
|
|
361
|
+
let penumbra = clamp((referenceDepth - averageBlocker) / max(abs(averageBlocker), 0.001), 0.0, 1.0);
|
|
362
|
+
let filterRadius = searchRadius * (1.0 + penumbra * 12.0);
|
|
363
|
+
var visibility = 0.0;
|
|
364
|
+
for (var index: i32 = 0; index < 48; index++) {
|
|
365
|
+
if (index >= shadow.filterSampleCount) { break; }
|
|
366
|
+
let disk = shadow_diskSample(index, shadow.filterSampleCount, rotation) * filterRadius;
|
|
367
|
+
let sampleDirection = normalize(direction + basis[0] * disk.x + basis[1] * disk.y);
|
|
368
|
+
visibility += textureSampleCompareLevel(
|
|
369
|
+
pointShadowTexture,
|
|
370
|
+
shadowComparisonSampler,
|
|
371
|
+
sampleDirection,
|
|
372
|
+
lightIndex,
|
|
373
|
+
referenceDepth
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
visibility /= max(f32(shadow.filterSampleCount), 1.0);
|
|
377
|
+
return mix(1.0, visibility, light.strength);
|
|
378
|
+
}
|
|
379
|
+
`;
|
|
380
|
+
|
|
381
|
+
/** Backend-aware shadow sampling module. Applications explicitly apply factors to direct-light terms. */
|
|
382
|
+
export const shadow = {
|
|
383
|
+
name: 'shadow',
|
|
384
|
+
source: SHADOW_WGSL,
|
|
385
|
+
fs: SHADOW_GLSL,
|
|
386
|
+
props: {} as ShadowProps,
|
|
387
|
+
uniforms: {} as ShadowUniforms,
|
|
388
|
+
bindings: {} as ShadowBindings,
|
|
389
|
+
uniformTypes: {
|
|
390
|
+
directionalLightCount: 'i32',
|
|
391
|
+
spotLightCount: 'i32',
|
|
392
|
+
pointLightCount: 'i32',
|
|
393
|
+
cascadeCount: 'i32',
|
|
394
|
+
blockerSampleCount: 'i32',
|
|
395
|
+
filterSampleCount: 'i32',
|
|
396
|
+
cascadeSplits: 'vec4<f32>',
|
|
397
|
+
directionalViewProjectionMatrices: ['mat4x4<f32>', MAX_CASCADES],
|
|
398
|
+
spotViewProjectionMatrices: ['mat4x4<f32>', MAX_SPOT_LIGHTS],
|
|
399
|
+
pointViewProjectionMatrices: ['mat4x4<f32>', MAX_POINT_MATRICES],
|
|
400
|
+
directionalLights: [DIRECTIONAL_LIGHT_UNIFORM_TYPE, 1],
|
|
401
|
+
spotLights: [SPOT_LIGHT_UNIFORM_TYPE, MAX_SPOT_LIGHTS],
|
|
402
|
+
pointLights: [POINT_LIGHT_UNIFORM_TYPE, MAX_POINT_LIGHTS]
|
|
403
|
+
},
|
|
404
|
+
bindingLayout: [
|
|
405
|
+
{name: 'shadow', group: 2},
|
|
406
|
+
{name: 'directionalShadowTexture', group: 2},
|
|
407
|
+
{name: 'spotShadowTexture', group: 2},
|
|
408
|
+
{name: 'pointShadowTexture', group: 2},
|
|
409
|
+
{name: 'shadowComparisonSampler', group: 2}
|
|
410
|
+
],
|
|
411
|
+
getUniforms(props: Partial<ShadowProps>): Partial<ShadowUniforms & ShadowBindings> {
|
|
412
|
+
if (
|
|
413
|
+
!props.directionalLights ||
|
|
414
|
+
!props.spotLights ||
|
|
415
|
+
!props.pointLights ||
|
|
416
|
+
!props.cascadeSplits ||
|
|
417
|
+
!props.directionalViewProjectionMatrices ||
|
|
418
|
+
!props.spotViewProjectionMatrices ||
|
|
419
|
+
!props.pointViewProjectionMatrices ||
|
|
420
|
+
!props.directionalShadowTexture ||
|
|
421
|
+
!props.spotShadowTexture ||
|
|
422
|
+
!props.pointShadowTexture ||
|
|
423
|
+
!props.nonFilteringSampler ||
|
|
424
|
+
!props.comparisonSampler
|
|
425
|
+
) {
|
|
426
|
+
return {};
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
directionalLightCount: props.directionalLights.length,
|
|
430
|
+
spotLightCount: props.spotLights.length,
|
|
431
|
+
pointLightCount: props.pointLights.length,
|
|
432
|
+
cascadeCount: props.cascadeCount,
|
|
433
|
+
blockerSampleCount: props.blockerSampleCount,
|
|
434
|
+
filterSampleCount: props.filterSampleCount,
|
|
435
|
+
cascadeSplits: props.cascadeSplits as Readonly<NumberArray4>,
|
|
436
|
+
directionalViewProjectionMatrices:
|
|
437
|
+
props.directionalViewProjectionMatrices as readonly Readonly<NumberArray16>[],
|
|
438
|
+
spotViewProjectionMatrices:
|
|
439
|
+
props.spotViewProjectionMatrices as readonly Readonly<NumberArray16>[],
|
|
440
|
+
pointViewProjectionMatrices:
|
|
441
|
+
props.pointViewProjectionMatrices as readonly Readonly<NumberArray16>[],
|
|
442
|
+
directionalLights: padDirectionalLights(props.directionalLights),
|
|
443
|
+
spotLights: padSpotLights(props.spotLights),
|
|
444
|
+
pointLights: padPointLights(props.pointLights),
|
|
445
|
+
directionalShadowTexture: props.directionalShadowTexture,
|
|
446
|
+
spotShadowTexture: props.spotShadowTexture,
|
|
447
|
+
pointShadowTexture: props.pointShadowTexture,
|
|
448
|
+
...(props.directionalShadowTexture.device.type === 'webgpu'
|
|
449
|
+
? {shadowComparisonSampler: props.comparisonSampler}
|
|
450
|
+
: {})
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
} as const satisfies ShaderModule<ShadowProps, ShadowUniforms, ShadowBindings>;
|
|
454
|
+
|
|
455
|
+
function padDirectionalLights(
|
|
456
|
+
lights: readonly DirectionalShadowLight[]
|
|
457
|
+
): DirectionalShadowUniform[] {
|
|
458
|
+
const light = lights[0];
|
|
459
|
+
return [
|
|
460
|
+
light
|
|
461
|
+
? {
|
|
462
|
+
direction: light.direction,
|
|
463
|
+
strength: light.strength ?? 1,
|
|
464
|
+
normalBias: light.normalBias ?? 0.04,
|
|
465
|
+
sourceAngularRadius: light.sourceAngularRadius ?? 0.00465,
|
|
466
|
+
cascadeBlendFraction: light.cascadeBlendFraction ?? 0.1,
|
|
467
|
+
farFadeFraction: light.farFadeFraction ?? 0.1,
|
|
468
|
+
shadowDistance: light.shadowDistance ?? 1
|
|
469
|
+
}
|
|
470
|
+
: {
|
|
471
|
+
direction: [0, 1, 0],
|
|
472
|
+
strength: 0,
|
|
473
|
+
normalBias: 0,
|
|
474
|
+
sourceAngularRadius: 0,
|
|
475
|
+
cascadeBlendFraction: 0,
|
|
476
|
+
farFadeFraction: 0,
|
|
477
|
+
shadowDistance: 1
|
|
478
|
+
}
|
|
479
|
+
];
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function padSpotLights(lights: readonly SpotShadowLight[]): SpotShadowUniform[] {
|
|
483
|
+
return padArray(
|
|
484
|
+
lights.map(light => ({
|
|
485
|
+
position: light.position,
|
|
486
|
+
range: light.range,
|
|
487
|
+
direction: light.direction,
|
|
488
|
+
outerConeCos: Math.cos(light.outerConeAngle),
|
|
489
|
+
sourceRadius: light.sourceRadius ?? 0.2,
|
|
490
|
+
normalBias: light.normalBias ?? 0.025,
|
|
491
|
+
strength: light.strength ?? 1,
|
|
492
|
+
nearPlane: light.nearPlane ?? 0.1
|
|
493
|
+
})),
|
|
494
|
+
MAX_SPOT_LIGHTS,
|
|
495
|
+
{
|
|
496
|
+
position: [0, 0, 0],
|
|
497
|
+
range: 1,
|
|
498
|
+
direction: [0, -1, 0],
|
|
499
|
+
outerConeCos: 1,
|
|
500
|
+
sourceRadius: 0,
|
|
501
|
+
normalBias: 0,
|
|
502
|
+
strength: 0,
|
|
503
|
+
nearPlane: 0.1
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function padPointLights(lights: readonly PointShadowLight[]): PointShadowUniform[] {
|
|
509
|
+
return padArray(
|
|
510
|
+
lights.map(light => ({
|
|
511
|
+
position: light.position,
|
|
512
|
+
range: light.range,
|
|
513
|
+
sourceRadius: light.sourceRadius ?? 0.2,
|
|
514
|
+
normalBias: light.normalBias ?? 0.025,
|
|
515
|
+
strength: light.strength ?? 1,
|
|
516
|
+
nearPlane: light.nearPlane ?? 0.1
|
|
517
|
+
})),
|
|
518
|
+
MAX_POINT_LIGHTS,
|
|
519
|
+
{
|
|
520
|
+
position: [0, 0, 0],
|
|
521
|
+
range: 1,
|
|
522
|
+
sourceRadius: 0,
|
|
523
|
+
normalBias: 0,
|
|
524
|
+
strength: 0,
|
|
525
|
+
nearPlane: 0.1
|
|
526
|
+
}
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
function padArray<T>(values: readonly T[], length: number, fallback: T): T[] {
|
|
531
|
+
const result = values.slice(0, length);
|
|
532
|
+
while (result.length < length) {
|
|
533
|
+
result.push(fallback);
|
|
534
|
+
}
|
|
535
|
+
return result;
|
|
536
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# surfaceWeather
|
|
2
|
+
|
|
3
|
+
GLSL/WGSL material helpers for wet surfaces, world-anchored puddle patches and upward-facing
|
|
4
|
+
snow coverage. State, time, shelter masks and accumulation rates are application-owned.
|
|
5
|
+
The same helpers work with Lambert, Phong or PBR material adapters without a new render pass.
|
|
6
|
+
|
|
7
|
+
* `surfaceWeather_getAlbedo(albedo, position, normal, exposure)` darkens wet material and
|
|
8
|
+
blends snow color according to coverage, patch noise and upward slope.
|
|
9
|
+
* `surfaceWeather_getRoughness(roughness, position, normal, exposure)` lowers wet roughness
|
|
10
|
+
and raises snow roughness. Feed this into PBR or a scene-buffer roughness attachment.
|
|
11
|
+
* `surfaceWeather_getReflection(position, normal, camera, lightDirection, lightColor, exposure)`
|
|
12
|
+
supplies approximate dielectric highlights and uniform sky tint for simple material adapters.
|
|
13
|
+
It is not scene reflection, SSR, a planar reflection or a simulated fluid surface.
|
|
14
|
+
* `surfaceWeather_getSnow`, `surfaceWeather_getWetness` and `surfaceWeather_getPuddle` expose
|
|
15
|
+
the individual coverage terms for custom materials.
|
|
16
|
+
|
|
17
|
+
Positions and `scale` use metres, normals use an east/north/up frame, and `lightDirection`
|
|
18
|
+
points toward the light. `exposure` is a 0–1 mask: water and fully sheltered surfaces use zero.
|
|
19
|
+
Wetness, snow and puddles range from 0 to 1. Noise is static in world space and reuses the
|
|
20
|
+
same valueNoise dependency as clouds and height fog. Incremental uniforms preserve state.
|
|
21
|
+
|
|
22
|
+
`integrateSurfaceWeather(state, rates, elapsedSeconds)` returns bounded wetness/snow with
|
|
23
|
+
exact constant-rate integration, independent of frame rate. Incoming rainfall/snowfall fills
|
|
24
|
+
remaining capacity; evaporation/snowmelt removes existing coverage. Rates are inverse seconds.
|
|
25
|
+
Zero elapsed time preserves state exactly. The caller decides whether to advance, pause or
|
|
26
|
+
reset state; accumulated cover can remain after precipitation stops. There is no GPU state
|
|
27
|
+
texture, particle deposition, snow depth/displacement, temperature model or automatic shelter
|
|
28
|
+
calculation. Riverfront Weather demonstrates scalar accumulation and excludes water explicitly.
|