@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,307 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
const IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
5
|
+
export const contactShadowTrace = {
|
|
6
|
+
name: 'contactShadowTrace',
|
|
7
|
+
source: /* wgsl */ `\
|
|
8
|
+
struct contactShadowTraceUniforms {
|
|
9
|
+
projectionMatrix: mat4x4f,
|
|
10
|
+
inverseProjectionMatrix: mat4x4f,
|
|
11
|
+
lightDirectionView: vec3f,
|
|
12
|
+
maxDistance: f32,
|
|
13
|
+
thickness: f32,
|
|
14
|
+
stepCount: f32,
|
|
15
|
+
frameIndex: f32,
|
|
16
|
+
normalBias: f32,
|
|
17
|
+
};
|
|
18
|
+
@group(0) @binding(auto) var<uniform> contactShadowTrace: contactShadowTraceUniforms;
|
|
19
|
+
@group(0) @binding(auto) var depthTexture: texture_depth_2d;
|
|
20
|
+
@group(0) @binding(auto) var depthTextureSampler: sampler;
|
|
21
|
+
@group(0) @binding(auto) var normalTexture: texture_2d<f32>;
|
|
22
|
+
@group(0) @binding(auto) var normalTextureSampler: sampler;
|
|
23
|
+
|
|
24
|
+
fn contactShadow_reconstructViewPosition(uv: vec2f, depth: f32) -> vec3f {
|
|
25
|
+
let clip = vec4f(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, depth, 1.0);
|
|
26
|
+
let view = contactShadowTrace.inverseProjectionMatrix * clip;
|
|
27
|
+
return view.xyz / max(abs(view.w), 0.00001);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
fn contactShadow_projectViewPosition(position: vec3f) -> vec2f {
|
|
31
|
+
let clip = contactShadowTrace.projectionMatrix * vec4f(position, 1.0);
|
|
32
|
+
let ndc = clip.xy / max(abs(clip.w), 0.00001);
|
|
33
|
+
return vec2f(ndc.x * 0.5 + 0.5, 0.5 - ndc.y * 0.5);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fn contactShadowTrace_sampleColor(
|
|
37
|
+
sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f
|
|
38
|
+
) -> vec4f {
|
|
39
|
+
let centerDepth = textureSampleLevel(depthTexture, depthTextureSampler, texCoord, 0);
|
|
40
|
+
if (centerDepth >= 0.99999) { return vec4f(1.0); }
|
|
41
|
+
let centerNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, texCoord, 0.0).xyz * 2.0 - 1.0);
|
|
42
|
+
let centerPosition = contactShadow_reconstructViewPosition(texCoord, centerDepth) + centerNormal * contactShadowTrace.normalBias;
|
|
43
|
+
let rayDirection = normalize(contactShadowTrace.lightDirectionView);
|
|
44
|
+
let noise = fract(sin(dot(texCoord * texSize + contactShadowTrace.frameIndex, vec2f(12.9898, 78.233))) * 43758.5453);
|
|
45
|
+
for (var index: i32 = 0; index < 40; index++) {
|
|
46
|
+
if (f32(index) >= contactShadowTrace.stepCount) { break; }
|
|
47
|
+
let fraction = (f32(index) + 0.35 + noise * 0.5) / max(contactShadowTrace.stepCount, 1.0);
|
|
48
|
+
let travel = contactShadowTrace.maxDistance * fraction * fraction;
|
|
49
|
+
let rayPosition = centerPosition + rayDirection * travel;
|
|
50
|
+
let sampleUv = contactShadow_projectViewPosition(rayPosition);
|
|
51
|
+
if (any(sampleUv <= vec2f(0.0)) || any(sampleUv >= vec2f(1.0))) { break; }
|
|
52
|
+
let sampleDepth = textureSampleLevel(depthTexture, depthTextureSampler, sampleUv, 0);
|
|
53
|
+
if (sampleDepth >= 0.99999) { continue; }
|
|
54
|
+
let scenePosition = contactShadow_reconstructViewPosition(sampleUv, sampleDepth);
|
|
55
|
+
let depthDelta = (-rayPosition.z) - (-scenePosition.z);
|
|
56
|
+
let hitThickness = contactShadowTrace.thickness + travel * 0.02;
|
|
57
|
+
if (depthDelta >= 0.0 && depthDelta <= hitThickness) {
|
|
58
|
+
let distanceFade = 1.0 - clamp(travel / contactShadowTrace.maxDistance, 0.0, 1.0);
|
|
59
|
+
return vec4f(vec3f(1.0 - distanceFade), 1.0);
|
|
60
|
+
}
|
|
61
|
+
if (depthDelta > hitThickness * 8.0) { break; }
|
|
62
|
+
}
|
|
63
|
+
return vec4f(1.0);
|
|
64
|
+
}`,
|
|
65
|
+
fs: /* glsl */ `
|
|
66
|
+
layout(std140) uniform contactShadowTraceUniforms {
|
|
67
|
+
mat4 projectionMatrix;
|
|
68
|
+
mat4 inverseProjectionMatrix;
|
|
69
|
+
vec3 lightDirectionView;
|
|
70
|
+
float maxDistance;
|
|
71
|
+
float thickness;
|
|
72
|
+
float stepCount;
|
|
73
|
+
float frameIndex;
|
|
74
|
+
float normalBias;
|
|
75
|
+
} contactShadowTrace;
|
|
76
|
+
uniform sampler2D depthTexture;
|
|
77
|
+
uniform sampler2D normalTexture;
|
|
78
|
+
vec3 contactShadow_reconstructViewPosition(vec2 uv, float depth) {
|
|
79
|
+
vec4 view = contactShadowTrace.inverseProjectionMatrix * vec4(uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
|
|
80
|
+
return view.xyz / max(abs(view.w), 0.00001);
|
|
81
|
+
}
|
|
82
|
+
vec2 contactShadow_projectViewPosition(vec3 position) {
|
|
83
|
+
vec4 clip = contactShadowTrace.projectionMatrix * vec4(position,1.0);
|
|
84
|
+
return clip.xy / max(abs(clip.w),0.00001) * 0.5 + 0.5;
|
|
85
|
+
}
|
|
86
|
+
vec4 contactShadowTrace_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {
|
|
87
|
+
float centerDepth = texture(depthTexture,texCoord).r;
|
|
88
|
+
if(centerDepth >= 0.99999) return vec4(1.0);
|
|
89
|
+
vec3 centerNormal = normalize(texture(normalTexture,texCoord).xyz * 2.0 - 1.0);
|
|
90
|
+
vec3 centerPosition = contactShadow_reconstructViewPosition(texCoord,centerDepth) + centerNormal * contactShadowTrace.normalBias;
|
|
91
|
+
vec3 rayDirection = normalize(contactShadowTrace.lightDirectionView);
|
|
92
|
+
float noise = fract(sin(dot(texCoord * texSize + contactShadowTrace.frameIndex,vec2(12.9898,78.233))) * 43758.5453);
|
|
93
|
+
for(int index=0;index<40;index++) {
|
|
94
|
+
if(float(index)>=contactShadowTrace.stepCount) break;
|
|
95
|
+
float fraction=(float(index)+0.35+noise*0.5)/max(contactShadowTrace.stepCount,1.0);
|
|
96
|
+
float travel=contactShadowTrace.maxDistance*fraction*fraction;
|
|
97
|
+
vec3 rayPosition=centerPosition+rayDirection*travel;
|
|
98
|
+
vec2 sampleUv=contactShadow_projectViewPosition(rayPosition);
|
|
99
|
+
if(any(lessThanEqual(sampleUv,vec2(0.0)))||any(greaterThanEqual(sampleUv,vec2(1.0))))break;
|
|
100
|
+
float sampleDepth=texture(depthTexture,sampleUv).r;
|
|
101
|
+
if(sampleDepth>=0.99999)continue;
|
|
102
|
+
vec3 scenePosition=contactShadow_reconstructViewPosition(sampleUv,sampleDepth);
|
|
103
|
+
float depthDelta=(-rayPosition.z)-(-scenePosition.z);
|
|
104
|
+
float hitThickness=contactShadowTrace.thickness+travel*0.02;
|
|
105
|
+
if(depthDelta>=0.0&&depthDelta<=hitThickness) {
|
|
106
|
+
float distanceFade=1.0-clamp(travel/contactShadowTrace.maxDistance,0.0,1.0);
|
|
107
|
+
return vec4(vec3(1.0-distanceFade),1.0);
|
|
108
|
+
}
|
|
109
|
+
if(depthDelta>hitThickness*8.0)break;
|
|
110
|
+
}
|
|
111
|
+
return vec4(1.0);
|
|
112
|
+
}
|
|
113
|
+
`,
|
|
114
|
+
bindingLayout: [
|
|
115
|
+
{ name: 'depthTexture', group: 0 },
|
|
116
|
+
{ name: 'normalTexture', group: 0 }
|
|
117
|
+
],
|
|
118
|
+
props: {},
|
|
119
|
+
uniforms: {},
|
|
120
|
+
bindings: {},
|
|
121
|
+
uniformTypes: {
|
|
122
|
+
projectionMatrix: 'mat4x4<f32>',
|
|
123
|
+
inverseProjectionMatrix: 'mat4x4<f32>',
|
|
124
|
+
lightDirectionView: 'vec3<f32>',
|
|
125
|
+
maxDistance: 'f32',
|
|
126
|
+
thickness: 'f32',
|
|
127
|
+
stepCount: 'f32',
|
|
128
|
+
frameIndex: 'f32',
|
|
129
|
+
normalBias: 'f32'
|
|
130
|
+
},
|
|
131
|
+
propTypes: {
|
|
132
|
+
projectionMatrix: { value: IDENTITY_MATRIX, private: true },
|
|
133
|
+
inverseProjectionMatrix: { value: IDENTITY_MATRIX, private: true },
|
|
134
|
+
lightDirectionView: { value: [0, 1, 0], private: true },
|
|
135
|
+
maxDistance: { value: 4, min: 0.1, softMax: 16 },
|
|
136
|
+
thickness: { value: 0.12, min: 0.005, softMax: 1 },
|
|
137
|
+
stepCount: { value: 24, min: 1, max: 40 },
|
|
138
|
+
frameIndex: { value: 0, private: true },
|
|
139
|
+
normalBias: { value: 0.035, min: 0, softMax: 0.2 }
|
|
140
|
+
},
|
|
141
|
+
passes: [{ sampler: true }]
|
|
142
|
+
};
|
|
143
|
+
export const contactShadowBilateralBlur = {
|
|
144
|
+
name: 'contactShadowBilateralBlur',
|
|
145
|
+
source: /* wgsl */ `\
|
|
146
|
+
struct contactShadowBilateralBlurUniforms {
|
|
147
|
+
direction: vec2f,
|
|
148
|
+
radius: f32,
|
|
149
|
+
depthSigma: f32,
|
|
150
|
+
normalPower: f32,
|
|
151
|
+
};
|
|
152
|
+
@group(0) @binding(auto) var<uniform> contactShadowBilateralBlur: contactShadowBilateralBlurUniforms;
|
|
153
|
+
@group(0) @binding(auto) var depthTexture: texture_depth_2d;
|
|
154
|
+
@group(0) @binding(auto) var depthTextureSampler: sampler;
|
|
155
|
+
@group(0) @binding(auto) var normalTexture: texture_2d<f32>;
|
|
156
|
+
@group(0) @binding(auto) var normalTextureSampler: sampler;
|
|
157
|
+
|
|
158
|
+
fn contactShadowBilateralBlur_sampleColor(
|
|
159
|
+
sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f
|
|
160
|
+
) -> vec4f {
|
|
161
|
+
let sourceDimensions = vec2f(textureDimensions(sourceTexture));
|
|
162
|
+
let texel = contactShadowBilateralBlur.direction / sourceDimensions;
|
|
163
|
+
let centerDepth = textureSampleLevel(depthTexture, depthTextureSampler, texCoord, 0);
|
|
164
|
+
let centerNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, texCoord, 0.0).xyz * 2.0 - 1.0);
|
|
165
|
+
var result = textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0).r;
|
|
166
|
+
var totalWeight = 1.0;
|
|
167
|
+
for (var index: i32 = 1; index <= 6; index++) {
|
|
168
|
+
if (f32(index) > contactShadowBilateralBlur.radius) { break; }
|
|
169
|
+
for (var side: i32 = -1; side <= 1; side += 2) {
|
|
170
|
+
let sampleUv = clamp(texCoord + texel * f32(index * side), vec2f(0.0), vec2f(1.0));
|
|
171
|
+
let sampleDepth = textureSampleLevel(depthTexture, depthTextureSampler, sampleUv, 0);
|
|
172
|
+
let sampleNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, sampleUv, 0.0).xyz * 2.0 - 1.0);
|
|
173
|
+
let depthDelta = abs(sampleDepth - centerDepth);
|
|
174
|
+
let depthWeight = exp(-(depthDelta * depthDelta) / max(2.0 * contactShadowBilateralBlur.depthSigma * contactShadowBilateralBlur.depthSigma, 0.000001));
|
|
175
|
+
let normalWeight = pow(max(dot(centerNormal, sampleNormal), 0.0), contactShadowBilateralBlur.normalPower);
|
|
176
|
+
let spatialWeight = exp(-f32(index * index) / 8.0);
|
|
177
|
+
let weight = depthWeight * normalWeight * spatialWeight;
|
|
178
|
+
result += textureSampleLevel(sourceTexture, sourceTextureSampler, sampleUv, 0.0).r * weight;
|
|
179
|
+
totalWeight += weight;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
let visibility = result / totalWeight;
|
|
183
|
+
return vec4f(vec3f(visibility), 1.0);
|
|
184
|
+
}`,
|
|
185
|
+
fs: /* glsl */ `
|
|
186
|
+
layout(std140) uniform contactShadowBilateralBlurUniforms {
|
|
187
|
+
vec2 direction;
|
|
188
|
+
float radius;
|
|
189
|
+
float depthSigma;
|
|
190
|
+
float normalPower;
|
|
191
|
+
} contactShadowBilateralBlur;
|
|
192
|
+
uniform sampler2D depthTexture;
|
|
193
|
+
uniform sampler2D normalTexture;
|
|
194
|
+
vec4 contactShadowBilateralBlur_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {
|
|
195
|
+
vec2 texel=contactShadowBilateralBlur.direction/vec2(textureSize(sourceTexture,0));
|
|
196
|
+
float centerDepth=texture(depthTexture,texCoord).r;
|
|
197
|
+
vec3 centerNormal=normalize(texture(normalTexture,texCoord).xyz*2.0-1.0);
|
|
198
|
+
float result=texture(sourceTexture,texCoord).r;
|
|
199
|
+
float totalWeight=1.0;
|
|
200
|
+
for(int index=1;index<=6;index++) {
|
|
201
|
+
if(float(index)>contactShadowBilateralBlur.radius)break;
|
|
202
|
+
for(int side=-1;side<=1;side+=2) {
|
|
203
|
+
vec2 sampleUv=clamp(texCoord+texel*float(index*side),vec2(0.0),vec2(1.0));
|
|
204
|
+
float sampleDepth=texture(depthTexture,sampleUv).r;
|
|
205
|
+
vec3 sampleNormal=normalize(texture(normalTexture,sampleUv).xyz*2.0-1.0);
|
|
206
|
+
float depthDelta=abs(sampleDepth-centerDepth);
|
|
207
|
+
float depthWeight=exp(-(depthDelta*depthDelta)/max(2.0*contactShadowBilateralBlur.depthSigma*contactShadowBilateralBlur.depthSigma,0.000001));
|
|
208
|
+
float normalWeight=pow(max(dot(centerNormal,sampleNormal),0.0),contactShadowBilateralBlur.normalPower);
|
|
209
|
+
float spatialWeight=exp(-float(index*index)/8.0);
|
|
210
|
+
float weight=depthWeight*normalWeight*spatialWeight;
|
|
211
|
+
result+=texture(sourceTexture,sampleUv).r*weight;totalWeight+=weight;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return vec4(vec3(result/totalWeight),1.0);
|
|
215
|
+
}
|
|
216
|
+
`,
|
|
217
|
+
bindingLayout: [
|
|
218
|
+
{ name: 'depthTexture', group: 0 },
|
|
219
|
+
{ name: 'normalTexture', group: 0 }
|
|
220
|
+
],
|
|
221
|
+
props: {},
|
|
222
|
+
uniforms: {},
|
|
223
|
+
bindings: {},
|
|
224
|
+
uniformTypes: {
|
|
225
|
+
direction: 'vec2<f32>',
|
|
226
|
+
radius: 'f32',
|
|
227
|
+
depthSigma: 'f32',
|
|
228
|
+
normalPower: 'f32'
|
|
229
|
+
},
|
|
230
|
+
propTypes: {
|
|
231
|
+
direction: { value: [1, 0], private: true },
|
|
232
|
+
radius: { value: 4, min: 1, max: 6 },
|
|
233
|
+
depthSigma: { value: 0.006, min: 0.0001, softMax: 0.05 },
|
|
234
|
+
normalPower: { value: 24, min: 1, softMax: 64 }
|
|
235
|
+
},
|
|
236
|
+
passes: [{ sampler: true }]
|
|
237
|
+
};
|
|
238
|
+
export const contactShadowComposite = {
|
|
239
|
+
name: 'contactShadowComposite',
|
|
240
|
+
source: /* wgsl */ `\
|
|
241
|
+
struct contactShadowCompositeUniforms {
|
|
242
|
+
strength: f32,
|
|
243
|
+
debugMode: f32,
|
|
244
|
+
};
|
|
245
|
+
@group(0) @binding(auto) var<uniform> contactShadowComposite: contactShadowCompositeUniforms;
|
|
246
|
+
@group(0) @binding(auto) var contactShadowTexture: texture_2d<f32>;
|
|
247
|
+
@group(0) @binding(auto) var contactShadowTextureSampler: sampler;
|
|
248
|
+
@group(0) @binding(auto) var directionalDirectTexture: texture_2d<f32>;
|
|
249
|
+
@group(0) @binding(auto) var directionalDirectTextureSampler: sampler;
|
|
250
|
+
@group(0) @binding(auto) var shadowDebugTexture: texture_2d<f32>;
|
|
251
|
+
@group(0) @binding(auto) var shadowDebugTextureSampler: sampler;
|
|
252
|
+
|
|
253
|
+
fn contactShadowComposite_sampleColor(
|
|
254
|
+
sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f
|
|
255
|
+
) -> vec4f {
|
|
256
|
+
let color = textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0);
|
|
257
|
+
let contact = textureSampleLevel(contactShadowTexture, contactShadowTextureSampler, texCoord, 0.0).r;
|
|
258
|
+
let appliedContact = mix(1.0, contact, contactShadowComposite.strength);
|
|
259
|
+
if (contactShadowComposite.debugMode > 0.5 && contactShadowComposite.debugMode < 1.5) {
|
|
260
|
+
return vec4f(vec3f(contact), 1.0);
|
|
261
|
+
}
|
|
262
|
+
if (contactShadowComposite.debugMode >= 1.5) {
|
|
263
|
+
let factors = textureSampleLevel(shadowDebugTexture, shadowDebugTextureSampler, texCoord, 0.0).rgb;
|
|
264
|
+
return vec4f(vec3f(factors.x * factors.y * factors.z * contact), 1.0);
|
|
265
|
+
}
|
|
266
|
+
let directionalDirect = textureSampleLevel(
|
|
267
|
+
directionalDirectTexture,
|
|
268
|
+
directionalDirectTextureSampler,
|
|
269
|
+
texCoord,
|
|
270
|
+
0.0
|
|
271
|
+
).rgb;
|
|
272
|
+
return vec4f(max(color.rgb - directionalDirect * (1.0 - appliedContact), vec3f(0.0)), color.a);
|
|
273
|
+
}`,
|
|
274
|
+
fs: /* glsl */ `
|
|
275
|
+
layout(std140) uniform contactShadowCompositeUniforms {
|
|
276
|
+
float strength;
|
|
277
|
+
float debugMode;
|
|
278
|
+
} contactShadowComposite;
|
|
279
|
+
uniform sampler2D contactShadowTexture;
|
|
280
|
+
uniform sampler2D directionalDirectTexture;
|
|
281
|
+
uniform sampler2D shadowDebugTexture;
|
|
282
|
+
vec4 contactShadowComposite_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {
|
|
283
|
+
vec4 color=texture(sourceTexture,texCoord);
|
|
284
|
+
float contact=texture(contactShadowTexture,texCoord).r;
|
|
285
|
+
float appliedContact=mix(1.0,contact,contactShadowComposite.strength);
|
|
286
|
+
if(contactShadowComposite.debugMode>0.5&&contactShadowComposite.debugMode<1.5)return vec4(vec3(contact),1.0);
|
|
287
|
+
if(contactShadowComposite.debugMode>=1.5){vec3 factors=texture(shadowDebugTexture,texCoord).rgb;return vec4(vec3(factors.x*factors.y*factors.z*contact),1.0);}
|
|
288
|
+
vec3 directionalDirect=texture(directionalDirectTexture,texCoord).rgb;
|
|
289
|
+
return vec4(max(color.rgb-directionalDirect*(1.0-appliedContact),vec3(0.0)),color.a);
|
|
290
|
+
}
|
|
291
|
+
`,
|
|
292
|
+
bindingLayout: [
|
|
293
|
+
{ name: 'contactShadowTexture', group: 0 },
|
|
294
|
+
{ name: 'directionalDirectTexture', group: 0 },
|
|
295
|
+
{ name: 'shadowDebugTexture', group: 0 }
|
|
296
|
+
],
|
|
297
|
+
props: {},
|
|
298
|
+
uniforms: {},
|
|
299
|
+
bindings: {},
|
|
300
|
+
uniformTypes: { strength: 'f32', debugMode: 'f32' },
|
|
301
|
+
propTypes: {
|
|
302
|
+
strength: { value: 1, min: 0, max: 1 },
|
|
303
|
+
debugMode: { value: 0, min: 0, max: 2, private: true }
|
|
304
|
+
},
|
|
305
|
+
passes: [{ sampler: true }]
|
|
306
|
+
};
|
|
307
|
+
//# sourceMappingURL=contact-shadow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-shadow.js","sourceRoot":"","sources":["../../../../src/modules/lighting/contact-shadow/contact-shadow.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAK5D,MAAM,eAAe,GAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AA0BxF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,oBAAoB;IAC1B,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyDnB;IACA,EAAE,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDhB;IACC,aAAa,EAAE;QACb,EAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,EAAC;QAChC,EAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,EAAC;KAClC;IACD,KAAK,EAAE,EAA2D;IAClE,QAAQ,EAAE,EAA0B;IACpC,QAAQ,EAAE,EAA2B;IACrC,YAAY,EAAE;QACZ,gBAAgB,EAAE,aAAa;QAC/B,uBAAuB,EAAE,aAAa;QACtC,kBAAkB,EAAE,WAAW;QAC/B,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,KAAK;KAClB;IACD,SAAS,EAAE;QACT,gBAAgB,EAAE,EAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAC;QACzD,uBAAuB,EAAE,EAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAC;QAChE,kBAAkB,EAAE,EAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAC;QACrD,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAC;QAC9C,SAAS,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAC;QAChD,SAAS,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAC;QACvC,UAAU,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAC;QACrC,UAAU,EAAE,EAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAC;KACjD;IACD,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CAK1B,CAAC;AASF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,IAAI,EAAE,4BAA4B;IAClC,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCnB;IACA,EAAE,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BhB;IACC,aAAa,EAAE;QACb,EAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,EAAC;QAChC,EAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,EAAC;KAClC;IACD,KAAK,EAAE,EAA0D;IACjE,QAAQ,EAAE,EAAyB;IACnC,QAAQ,EAAE,EAA2B;IACrC,YAAY,EAAE;QACZ,SAAS,EAAE,WAAW;QACtB,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,KAAK;KACnB;IACD,SAAS,EAAE;QACT,SAAS,EAAE,EAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAC;QACzC,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC;QAClC,UAAU,EAAE,EAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC;QACtD,WAAW,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC;KAC9C;IACD,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CAK1B,CAAC;AAUF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,wBAAwB;IAC9B,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCnB;IACA,EAAE,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;CAiBhB;IACC,aAAa,EAAE;QACb,EAAC,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC,EAAC;QACxC,EAAC,IAAI,EAAE,0BAA0B,EAAE,KAAK,EAAE,CAAC,EAAC;QAC5C,EAAC,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAC;KACvC;IACD,KAAK,EAAE,EAAkE;IACzE,QAAQ,EAAE,EAA8B;IACxC,QAAQ,EAAE,EAA8B;IACxC,YAAY,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAC;IACjD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC;QACpC,SAAS,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAC;KACrD;IACD,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CAM1B,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var firefly_exports = {};
|
|
19
|
+
__export(firefly_exports, {
|
|
20
|
+
firefly: () => firefly
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(firefly_exports);
|
|
23
|
+
const uniforms = { enabled: 0, time: 0, radius: 8, speed: 0.6, pulse: 0.85 };
|
|
24
|
+
const firefly = {
|
|
25
|
+
name: "firefly",
|
|
26
|
+
uniformTypes: { enabled: "f32", time: "f32", radius: "f32", speed: "f32", pulse: "f32" },
|
|
27
|
+
defaultUniforms: uniforms,
|
|
28
|
+
getUniforms(props = {}, previous = uniforms) {
|
|
29
|
+
return { ...uniforms, ...previous, ...props };
|
|
30
|
+
},
|
|
31
|
+
source: `struct FireflyUniforms {enabled: f32, time: f32, radius: f32, speed: f32, pulse: f32};
|
|
32
|
+
@group(3) @binding(auto) var<uniform> firefly: FireflyUniforms;
|
|
33
|
+
fn firefly_getPosition(position: vec3f, seed: f32, time: f32) -> vec3f {
|
|
34
|
+
if (firefly.enabled <= 0.0) { return position; }
|
|
35
|
+
let phase = seed * 2.399963;
|
|
36
|
+
let travel = time * firefly.speed;
|
|
37
|
+
let offset = vec3f(sin(travel * 0.71 + phase) + sin(travel * 1.31 + phase * 1.7) * 0.35,
|
|
38
|
+
cos(travel * 0.83 + phase * 1.2) + sin(travel * 0.47 + phase * 2.3) * 0.4,
|
|
39
|
+
sin(travel * 0.59 + phase * 1.9) * 0.3);
|
|
40
|
+
return position + offset * firefly.radius * firefly.enabled;
|
|
41
|
+
}
|
|
42
|
+
fn firefly_getBrightness(seed: f32, time: f32) -> f32 {
|
|
43
|
+
if (firefly.enabled <= 0.0) { return 1.0; }
|
|
44
|
+
let phase = seed * 2.399963;
|
|
45
|
+
let pulse = pow(0.5 + 0.5 * sin(time * firefly.speed * (1.6 + fract(seed * 0.37)) + phase), 3.0);
|
|
46
|
+
return mix(1.0, mix(0.08, 1.0, pulse), firefly.pulse * firefly.enabled);
|
|
47
|
+
}`,
|
|
48
|
+
vs: `layout(std140) uniform fireflyUniforms {
|
|
49
|
+
float enabled;
|
|
50
|
+
float time;
|
|
51
|
+
float radius;
|
|
52
|
+
float speed;
|
|
53
|
+
float pulse;
|
|
54
|
+
} firefly;
|
|
55
|
+
vec3 firefly_getPosition(vec3 position, float seed, float time) {
|
|
56
|
+
if (firefly.enabled <= 0.0) { return position; }
|
|
57
|
+
float phase = seed * 2.399963;
|
|
58
|
+
float travel = time * firefly.speed;
|
|
59
|
+
vec3 offset = vec3(sin(travel * 0.71 + phase) + sin(travel * 1.31 + phase * 1.7) * 0.35,
|
|
60
|
+
cos(travel * 0.83 + phase * 1.2) + sin(travel * 0.47 + phase * 2.3) * 0.4,
|
|
61
|
+
sin(travel * 0.59 + phase * 1.9) * 0.3);
|
|
62
|
+
return position + offset * firefly.radius * firefly.enabled;
|
|
63
|
+
}
|
|
64
|
+
float firefly_getBrightness(float seed, float time) {
|
|
65
|
+
if (firefly.enabled <= 0.0) { return 1.0; }
|
|
66
|
+
float phase = seed * 2.399963;
|
|
67
|
+
float pulse = pow(0.5 + 0.5 * sin(time * firefly.speed * (1.6 + fract(seed * 0.37)) + phase), 3.0);
|
|
68
|
+
return mix(1.0, mix(0.08, 1.0, pulse), firefly.pulse * firefly.enabled);
|
|
69
|
+
}`
|
|
70
|
+
};
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
firefly
|
|
74
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type FireflyProps = {
|
|
2
|
+
enabled?: number;
|
|
3
|
+
time?: number;
|
|
4
|
+
radius?: number;
|
|
5
|
+
speed?: number;
|
|
6
|
+
pulse?: number;
|
|
7
|
+
};
|
|
8
|
+
export type FireflyUniforms = Required<FireflyProps>;
|
|
9
|
+
/** Seeded smooth wandering and independently phased bioluminescence. Positions are in metres. */
|
|
10
|
+
export declare const firefly: {
|
|
11
|
+
readonly name: "firefly";
|
|
12
|
+
readonly uniformTypes: {
|
|
13
|
+
readonly enabled: "f32";
|
|
14
|
+
readonly time: "f32";
|
|
15
|
+
readonly radius: "f32";
|
|
16
|
+
readonly speed: "f32";
|
|
17
|
+
readonly pulse: "f32";
|
|
18
|
+
};
|
|
19
|
+
readonly defaultUniforms: {
|
|
20
|
+
enabled: number;
|
|
21
|
+
time: number;
|
|
22
|
+
radius: number;
|
|
23
|
+
speed: number;
|
|
24
|
+
pulse: number;
|
|
25
|
+
};
|
|
26
|
+
readonly getUniforms: (props?: Partial<FireflyProps>, previous?: Required<FireflyProps> | undefined) => {
|
|
27
|
+
enabled: number;
|
|
28
|
+
time: number;
|
|
29
|
+
radius: number;
|
|
30
|
+
speed: number;
|
|
31
|
+
pulse: number;
|
|
32
|
+
};
|
|
33
|
+
readonly source: "struct FireflyUniforms {enabled: f32, time: f32, radius: f32, speed: f32, pulse: f32};\n @group(3) @binding(auto) var<uniform> firefly: FireflyUniforms;\n fn firefly_getPosition(position: vec3f, seed: f32, time: f32) -> vec3f {\n if (firefly.enabled <= 0.0) { return position; }\n let phase = seed * 2.399963;\n let travel = time * firefly.speed;\n let offset = vec3f(sin(travel * 0.71 + phase) + sin(travel * 1.31 + phase * 1.7) * 0.35,\n cos(travel * 0.83 + phase * 1.2) + sin(travel * 0.47 + phase * 2.3) * 0.4,\n sin(travel * 0.59 + phase * 1.9) * 0.3);\n return position + offset * firefly.radius * firefly.enabled;\n }\n fn firefly_getBrightness(seed: f32, time: f32) -> f32 {\n if (firefly.enabled <= 0.0) { return 1.0; }\n let phase = seed * 2.399963;\n let pulse = pow(0.5 + 0.5 * sin(time * firefly.speed * (1.6 + fract(seed * 0.37)) + phase), 3.0);\n return mix(1.0, mix(0.08, 1.0, pulse), firefly.pulse * firefly.enabled);\n }";
|
|
34
|
+
readonly vs: "layout(std140) uniform fireflyUniforms {\n float enabled;\n float time;\n float radius;\n float speed;\n float pulse;\n } firefly;\n vec3 firefly_getPosition(vec3 position, float seed, float time) {\n if (firefly.enabled <= 0.0) { return position; }\n float phase = seed * 2.399963;\n float travel = time * firefly.speed;\n vec3 offset = vec3(sin(travel * 0.71 + phase) + sin(travel * 1.31 + phase * 1.7) * 0.35,\n cos(travel * 0.83 + phase * 1.2) + sin(travel * 0.47 + phase * 2.3) * 0.4,\n sin(travel * 0.59 + phase * 1.9) * 0.3);\n return position + offset * firefly.radius * firefly.enabled;\n }\n float firefly_getBrightness(float seed, float time) {\n if (firefly.enabled <= 0.0) { return 1.0; }\n float phase = seed * 2.399963;\n float pulse = pow(0.5 + 0.5 * sin(time * firefly.speed * (1.6 + fract(seed * 0.37)) + phase), 3.0);\n return mix(1.0, mix(0.08, 1.0, pulse), firefly.pulse * firefly.enabled);\n }";
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=firefly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firefly.d.ts","sourceRoot":"","sources":["../../../../src/modules/lighting/firefly/firefly.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;AAGrD,iGAAiG;AACjG,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;iBAVR,MAAM;cACT,MAAM;gBACJ,MAAM;eACP,MAAM;eACN,MAAM;;;;CAoDgD,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
const uniforms = { enabled: 0, time: 0, radius: 8, speed: 0.6, pulse: 0.85 };
|
|
5
|
+
/** Seeded smooth wandering and independently phased bioluminescence. Positions are in metres. */
|
|
6
|
+
export const firefly = {
|
|
7
|
+
name: 'firefly',
|
|
8
|
+
uniformTypes: { enabled: 'f32', time: 'f32', radius: 'f32', speed: 'f32', pulse: 'f32' },
|
|
9
|
+
defaultUniforms: uniforms,
|
|
10
|
+
getUniforms(props = {}, previous = uniforms) {
|
|
11
|
+
return { ...uniforms, ...previous, ...props };
|
|
12
|
+
},
|
|
13
|
+
source: `struct FireflyUniforms {enabled: f32, time: f32, radius: f32, speed: f32, pulse: f32};
|
|
14
|
+
@group(3) @binding(auto) var<uniform> firefly: FireflyUniforms;
|
|
15
|
+
fn firefly_getPosition(position: vec3f, seed: f32, time: f32) -> vec3f {
|
|
16
|
+
if (firefly.enabled <= 0.0) { return position; }
|
|
17
|
+
let phase = seed * 2.399963;
|
|
18
|
+
let travel = time * firefly.speed;
|
|
19
|
+
let offset = vec3f(sin(travel * 0.71 + phase) + sin(travel * 1.31 + phase * 1.7) * 0.35,
|
|
20
|
+
cos(travel * 0.83 + phase * 1.2) + sin(travel * 0.47 + phase * 2.3) * 0.4,
|
|
21
|
+
sin(travel * 0.59 + phase * 1.9) * 0.3);
|
|
22
|
+
return position + offset * firefly.radius * firefly.enabled;
|
|
23
|
+
}
|
|
24
|
+
fn firefly_getBrightness(seed: f32, time: f32) -> f32 {
|
|
25
|
+
if (firefly.enabled <= 0.0) { return 1.0; }
|
|
26
|
+
let phase = seed * 2.399963;
|
|
27
|
+
let pulse = pow(0.5 + 0.5 * sin(time * firefly.speed * (1.6 + fract(seed * 0.37)) + phase), 3.0);
|
|
28
|
+
return mix(1.0, mix(0.08, 1.0, pulse), firefly.pulse * firefly.enabled);
|
|
29
|
+
}`,
|
|
30
|
+
vs: `layout(std140) uniform fireflyUniforms {
|
|
31
|
+
float enabled;
|
|
32
|
+
float time;
|
|
33
|
+
float radius;
|
|
34
|
+
float speed;
|
|
35
|
+
float pulse;
|
|
36
|
+
} firefly;
|
|
37
|
+
vec3 firefly_getPosition(vec3 position, float seed, float time) {
|
|
38
|
+
if (firefly.enabled <= 0.0) { return position; }
|
|
39
|
+
float phase = seed * 2.399963;
|
|
40
|
+
float travel = time * firefly.speed;
|
|
41
|
+
vec3 offset = vec3(sin(travel * 0.71 + phase) + sin(travel * 1.31 + phase * 1.7) * 0.35,
|
|
42
|
+
cos(travel * 0.83 + phase * 1.2) + sin(travel * 0.47 + phase * 2.3) * 0.4,
|
|
43
|
+
sin(travel * 0.59 + phase * 1.9) * 0.3);
|
|
44
|
+
return position + offset * firefly.radius * firefly.enabled;
|
|
45
|
+
}
|
|
46
|
+
float firefly_getBrightness(float seed, float time) {
|
|
47
|
+
if (firefly.enabled <= 0.0) { return 1.0; }
|
|
48
|
+
float phase = seed * 2.399963;
|
|
49
|
+
float pulse = pow(0.5 + 0.5 * sin(time * firefly.speed * (1.6 + fract(seed * 0.37)) + phase), 3.0);
|
|
50
|
+
return mix(1.0, mix(0.08, 1.0, pulse), firefly.pulse * firefly.enabled);
|
|
51
|
+
}`
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=firefly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firefly.js","sourceRoot":"","sources":["../../../../src/modules/lighting/firefly/firefly.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAY5D,MAAM,QAAQ,GAAG,EAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;AAE3E,iGAAiG;AACjG,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,EAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC;IACtF,eAAe,EAAE,QAAQ;IACzB,WAAW,CAAC,KAAK,GAAG,EAAE,EAAE,QAAQ,GAAG,QAAQ;QACzC,OAAO,EAAC,GAAG,QAAQ,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAC,CAAC;IAC9C,CAAC;IACD,MAAM,EAAE;;;;;;;;;;;;;;;;IAgBN;IACF,EAAE,EAAE;;;;;;;;;;;;;;;;;;;;;IAqBF;CAC4D,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var globe_clouds_exports = {};
|
|
19
|
+
__export(globe_clouds_exports, {
|
|
20
|
+
globeClouds: () => globeClouds
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(globe_clouds_exports);
|
|
23
|
+
var import_clouds = require("../clouds/clouds.cjs");
|
|
24
|
+
const globeClouds = {
|
|
25
|
+
name: "globeClouds",
|
|
26
|
+
dependencies: [import_clouds.clouds],
|
|
27
|
+
uniformTypes: { planetRadius: "f32" },
|
|
28
|
+
defaultUniforms: { planetRadius: 6370972 },
|
|
29
|
+
fs: (
|
|
30
|
+
/* glsl */
|
|
31
|
+
`
|
|
32
|
+
layout(std140) uniform globeCloudsUniforms { float planetRadius; } globeClouds;
|
|
33
|
+
vec2 globeClouds_intersectSphere(vec3 camera, vec3 direction, float radius) {
|
|
34
|
+
float projected = dot(camera, direction);
|
|
35
|
+
float discriminant = projected * projected - dot(camera, camera) + radius * radius;
|
|
36
|
+
if (discriminant < 0.0) return vec2(-1.0);
|
|
37
|
+
float root = sqrt(discriminant);
|
|
38
|
+
return vec2(-projected - root, -projected + root);
|
|
39
|
+
}
|
|
40
|
+
float globeClouds_getDensity(vec3 position) {
|
|
41
|
+
float height = ((length(position) - 1.0) * globeClouds.planetRadius - clouds.altitude) / max(clouds.thickness, 1.0);
|
|
42
|
+
// Rotate a 3D field rather than wrapping longitude UVs: no seams or pinched poles.
|
|
43
|
+
vec2 angle = clouds.velocity * clouds.time / globeClouds.planetRadius;
|
|
44
|
+
vec3 rotated = vec3(cos(angle.x) * position.x + sin(angle.x) * position.y,
|
|
45
|
+
-sin(angle.x) * position.x + cos(angle.x) * position.y, position.z);
|
|
46
|
+
rotated = vec3(rotated.x, cos(angle.y) * rotated.y + sin(angle.y) * rotated.z,
|
|
47
|
+
-sin(angle.y) * rotated.y + cos(angle.y) * rotated.z);
|
|
48
|
+
return clouds_getDensityAt(rotated * globeClouds.planetRadius / max(clouds.scale, 1.0), height);
|
|
49
|
+
}
|
|
50
|
+
vec4 globeClouds_getColor(vec3 camera, vec3 direction) {
|
|
51
|
+
if (clouds.cover <= 0.0 || clouds.density <= 0.0) return vec4(0.0);
|
|
52
|
+
float bottom = 1.0 + clouds.altitude / globeClouds.planetRadius;
|
|
53
|
+
float top = bottom + max(clouds.thickness, 1.0) / globeClouds.planetRadius;
|
|
54
|
+
vec2 outer = globeClouds_intersectSphere(camera, direction, top);
|
|
55
|
+
if (outer.y <= 0.0) return vec4(0.0);
|
|
56
|
+
float start = max(outer.x, 0.0);
|
|
57
|
+
float end = outer.y;
|
|
58
|
+
vec2 inner = globeClouds_intersectSphere(camera, direction, bottom);
|
|
59
|
+
if (length(camera) < bottom) start = max(start, inner.y);
|
|
60
|
+
else if (inner.x >= start) end = min(end, inner.x);
|
|
61
|
+
vec2 ground = globeClouds_intersectSphere(camera, direction, 1.0);
|
|
62
|
+
if (ground.x >= 0.0) end = min(end, ground.x);
|
|
63
|
+
if (end <= start) return vec4(0.0);
|
|
64
|
+
float stepLength = (end - start) / 32.0;
|
|
65
|
+
float jitter = valueNoise_hash(direction.xy * 4096.0);
|
|
66
|
+
vec3 sunlightDirection = normalize(clouds.sunDirection);
|
|
67
|
+
float silver = pow(max(dot(direction, sunlightDirection), 0.0), 12.0);
|
|
68
|
+
vec3 radiance = vec3(0.0);
|
|
69
|
+
float transmittance = 1.0;
|
|
70
|
+
for (int sampleIndex = 0; sampleIndex < 32; sampleIndex++) {
|
|
71
|
+
vec3 position = camera + direction * (start + (float(sampleIndex) + jitter) * stepLength);
|
|
72
|
+
float density = globeClouds_getDensity(position);
|
|
73
|
+
float sunDensity = globeClouds_getDensity(position + sunlightDirection * clouds.thickness * 0.28 / globeClouds.planetRadius);
|
|
74
|
+
float daylight = smoothstep(-0.08, 0.18, dot(normalize(position), sunlightDirection));
|
|
75
|
+
float alpha = 1.0 - exp(-density * clouds.density * stepLength * globeClouds.planetRadius);
|
|
76
|
+
radiance += transmittance * alpha * clouds_getLighting(density * 0.25, sunDensity * 0.25, daylight, silver);
|
|
77
|
+
transmittance *= 1.0 - alpha;
|
|
78
|
+
if (transmittance < 0.01) break;
|
|
79
|
+
}
|
|
80
|
+
return vec4(radiance, 1.0 - transmittance);
|
|
81
|
+
}
|
|
82
|
+
`
|
|
83
|
+
),
|
|
84
|
+
source: (
|
|
85
|
+
/* wgsl */
|
|
86
|
+
`
|
|
87
|
+
struct globeCloudsUniforms { planetRadius: f32 };
|
|
88
|
+
@group(3) @binding(auto) var<uniform> globeClouds: globeCloudsUniforms;
|
|
89
|
+
fn globeClouds_intersectSphere(camera: vec3f, direction: vec3f, radius: f32) -> vec2f {
|
|
90
|
+
let projected = dot(camera, direction);
|
|
91
|
+
let discriminant = projected * projected - dot(camera, camera) + radius * radius;
|
|
92
|
+
if (discriminant < 0.0) { return vec2f(-1.0); }
|
|
93
|
+
let root = sqrt(discriminant);
|
|
94
|
+
return vec2f(-projected - root, -projected + root);
|
|
95
|
+
}
|
|
96
|
+
fn globeClouds_getDensity(position: vec3f) -> f32 {
|
|
97
|
+
let height = ((length(position) - 1.0) * globeClouds.planetRadius - clouds.altitude) / max(clouds.thickness, 1.0);
|
|
98
|
+
let angle = clouds.velocity * clouds.time / globeClouds.planetRadius;
|
|
99
|
+
var rotated = vec3f(cos(angle.x) * position.x + sin(angle.x) * position.y,
|
|
100
|
+
-sin(angle.x) * position.x + cos(angle.x) * position.y, position.z);
|
|
101
|
+
rotated = vec3f(rotated.x, cos(angle.y) * rotated.y + sin(angle.y) * rotated.z,
|
|
102
|
+
-sin(angle.y) * rotated.y + cos(angle.y) * rotated.z);
|
|
103
|
+
return clouds_getDensityAt(rotated * globeClouds.planetRadius / max(clouds.scale, 1.0), height);
|
|
104
|
+
}
|
|
105
|
+
fn globeClouds_getColor(camera: vec3f, direction: vec3f) -> vec4f {
|
|
106
|
+
if (clouds.cover <= 0.0 || clouds.density <= 0.0) { return vec4f(0.0); }
|
|
107
|
+
let bottom = 1.0 + clouds.altitude / globeClouds.planetRadius;
|
|
108
|
+
let top = bottom + max(clouds.thickness, 1.0) / globeClouds.planetRadius;
|
|
109
|
+
let outer = globeClouds_intersectSphere(camera, direction, top);
|
|
110
|
+
if (outer.y <= 0.0) { return vec4f(0.0); }
|
|
111
|
+
var start = max(outer.x, 0.0);
|
|
112
|
+
var end = outer.y;
|
|
113
|
+
let inner = globeClouds_intersectSphere(camera, direction, bottom);
|
|
114
|
+
if (length(camera) < bottom) { start = max(start, inner.y); }
|
|
115
|
+
else if (inner.x >= start) { end = min(end, inner.x); }
|
|
116
|
+
let ground = globeClouds_intersectSphere(camera, direction, 1.0);
|
|
117
|
+
if (ground.x >= 0.0) { end = min(end, ground.x); }
|
|
118
|
+
if (end <= start) { return vec4f(0.0); }
|
|
119
|
+
let stepLength = (end - start) / 32.0;
|
|
120
|
+
let jitter = valueNoise_hash(direction.xy * 4096.0);
|
|
121
|
+
let sunlightDirection = normalize(clouds.sunDirection);
|
|
122
|
+
let silver = pow(max(dot(direction, sunlightDirection), 0.0), 12.0);
|
|
123
|
+
var radiance = vec3f(0.0);
|
|
124
|
+
var transmittance = 1.0;
|
|
125
|
+
for (var sampleIndex = 0; sampleIndex < 32; sampleIndex++) {
|
|
126
|
+
let position = camera + direction * (start + (f32(sampleIndex) + jitter) * stepLength);
|
|
127
|
+
let density = globeClouds_getDensity(position);
|
|
128
|
+
let sunDensity = globeClouds_getDensity(position + sunlightDirection * clouds.thickness * 0.28 / globeClouds.planetRadius);
|
|
129
|
+
let daylight = smoothstep(-0.08, 0.18, dot(normalize(position), sunlightDirection));
|
|
130
|
+
let alpha = 1.0 - exp(-density * clouds.density * stepLength * globeClouds.planetRadius);
|
|
131
|
+
radiance += transmittance * alpha * clouds_getLighting(density * 0.25, sunDensity * 0.25, daylight, silver);
|
|
132
|
+
transmittance *= 1.0 - alpha;
|
|
133
|
+
if (transmittance < 0.01) { break; }
|
|
134
|
+
}
|
|
135
|
+
return vec4f(radiance, 1.0 - transmittance);
|
|
136
|
+
}
|
|
137
|
+
`
|
|
138
|
+
)
|
|
139
|
+
};
|
|
140
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
141
|
+
0 && (module.exports = {
|
|
142
|
+
globeClouds
|
|
143
|
+
});
|