@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,348 @@
|
|
|
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 contact_shadow_exports = {};
|
|
19
|
+
__export(contact_shadow_exports, {
|
|
20
|
+
contactShadowBilateralBlur: () => contactShadowBilateralBlur,
|
|
21
|
+
contactShadowComposite: () => contactShadowComposite,
|
|
22
|
+
contactShadowTrace: () => contactShadowTrace
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(contact_shadow_exports);
|
|
25
|
+
const IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
26
|
+
const contactShadowTrace = {
|
|
27
|
+
name: "contactShadowTrace",
|
|
28
|
+
source: (
|
|
29
|
+
/* wgsl */
|
|
30
|
+
`struct contactShadowTraceUniforms {
|
|
31
|
+
projectionMatrix: mat4x4f,
|
|
32
|
+
inverseProjectionMatrix: mat4x4f,
|
|
33
|
+
lightDirectionView: vec3f,
|
|
34
|
+
maxDistance: f32,
|
|
35
|
+
thickness: f32,
|
|
36
|
+
stepCount: f32,
|
|
37
|
+
frameIndex: f32,
|
|
38
|
+
normalBias: f32,
|
|
39
|
+
};
|
|
40
|
+
@group(0) @binding(auto) var<uniform> contactShadowTrace: contactShadowTraceUniforms;
|
|
41
|
+
@group(0) @binding(auto) var depthTexture: texture_depth_2d;
|
|
42
|
+
@group(0) @binding(auto) var depthTextureSampler: sampler;
|
|
43
|
+
@group(0) @binding(auto) var normalTexture: texture_2d<f32>;
|
|
44
|
+
@group(0) @binding(auto) var normalTextureSampler: sampler;
|
|
45
|
+
|
|
46
|
+
fn contactShadow_reconstructViewPosition(uv: vec2f, depth: f32) -> vec3f {
|
|
47
|
+
let clip = vec4f(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, depth, 1.0);
|
|
48
|
+
let view = contactShadowTrace.inverseProjectionMatrix * clip;
|
|
49
|
+
return view.xyz / max(abs(view.w), 0.00001);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
fn contactShadow_projectViewPosition(position: vec3f) -> vec2f {
|
|
53
|
+
let clip = contactShadowTrace.projectionMatrix * vec4f(position, 1.0);
|
|
54
|
+
let ndc = clip.xy / max(abs(clip.w), 0.00001);
|
|
55
|
+
return vec2f(ndc.x * 0.5 + 0.5, 0.5 - ndc.y * 0.5);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fn contactShadowTrace_sampleColor(
|
|
59
|
+
sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f
|
|
60
|
+
) -> vec4f {
|
|
61
|
+
let centerDepth = textureSampleLevel(depthTexture, depthTextureSampler, texCoord, 0);
|
|
62
|
+
if (centerDepth >= 0.99999) { return vec4f(1.0); }
|
|
63
|
+
let centerNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, texCoord, 0.0).xyz * 2.0 - 1.0);
|
|
64
|
+
let centerPosition = contactShadow_reconstructViewPosition(texCoord, centerDepth) + centerNormal * contactShadowTrace.normalBias;
|
|
65
|
+
let rayDirection = normalize(contactShadowTrace.lightDirectionView);
|
|
66
|
+
let noise = fract(sin(dot(texCoord * texSize + contactShadowTrace.frameIndex, vec2f(12.9898, 78.233))) * 43758.5453);
|
|
67
|
+
for (var index: i32 = 0; index < 40; index++) {
|
|
68
|
+
if (f32(index) >= contactShadowTrace.stepCount) { break; }
|
|
69
|
+
let fraction = (f32(index) + 0.35 + noise * 0.5) / max(contactShadowTrace.stepCount, 1.0);
|
|
70
|
+
let travel = contactShadowTrace.maxDistance * fraction * fraction;
|
|
71
|
+
let rayPosition = centerPosition + rayDirection * travel;
|
|
72
|
+
let sampleUv = contactShadow_projectViewPosition(rayPosition);
|
|
73
|
+
if (any(sampleUv <= vec2f(0.0)) || any(sampleUv >= vec2f(1.0))) { break; }
|
|
74
|
+
let sampleDepth = textureSampleLevel(depthTexture, depthTextureSampler, sampleUv, 0);
|
|
75
|
+
if (sampleDepth >= 0.99999) { continue; }
|
|
76
|
+
let scenePosition = contactShadow_reconstructViewPosition(sampleUv, sampleDepth);
|
|
77
|
+
let depthDelta = (-rayPosition.z) - (-scenePosition.z);
|
|
78
|
+
let hitThickness = contactShadowTrace.thickness + travel * 0.02;
|
|
79
|
+
if (depthDelta >= 0.0 && depthDelta <= hitThickness) {
|
|
80
|
+
let distanceFade = 1.0 - clamp(travel / contactShadowTrace.maxDistance, 0.0, 1.0);
|
|
81
|
+
return vec4f(vec3f(1.0 - distanceFade), 1.0);
|
|
82
|
+
}
|
|
83
|
+
if (depthDelta > hitThickness * 8.0) { break; }
|
|
84
|
+
}
|
|
85
|
+
return vec4f(1.0);
|
|
86
|
+
}`
|
|
87
|
+
),
|
|
88
|
+
fs: (
|
|
89
|
+
/* glsl */
|
|
90
|
+
`
|
|
91
|
+
layout(std140) uniform contactShadowTraceUniforms {
|
|
92
|
+
mat4 projectionMatrix;
|
|
93
|
+
mat4 inverseProjectionMatrix;
|
|
94
|
+
vec3 lightDirectionView;
|
|
95
|
+
float maxDistance;
|
|
96
|
+
float thickness;
|
|
97
|
+
float stepCount;
|
|
98
|
+
float frameIndex;
|
|
99
|
+
float normalBias;
|
|
100
|
+
} contactShadowTrace;
|
|
101
|
+
uniform sampler2D depthTexture;
|
|
102
|
+
uniform sampler2D normalTexture;
|
|
103
|
+
vec3 contactShadow_reconstructViewPosition(vec2 uv, float depth) {
|
|
104
|
+
vec4 view = contactShadowTrace.inverseProjectionMatrix * vec4(uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
|
|
105
|
+
return view.xyz / max(abs(view.w), 0.00001);
|
|
106
|
+
}
|
|
107
|
+
vec2 contactShadow_projectViewPosition(vec3 position) {
|
|
108
|
+
vec4 clip = contactShadowTrace.projectionMatrix * vec4(position,1.0);
|
|
109
|
+
return clip.xy / max(abs(clip.w),0.00001) * 0.5 + 0.5;
|
|
110
|
+
}
|
|
111
|
+
vec4 contactShadowTrace_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {
|
|
112
|
+
float centerDepth = texture(depthTexture,texCoord).r;
|
|
113
|
+
if(centerDepth >= 0.99999) return vec4(1.0);
|
|
114
|
+
vec3 centerNormal = normalize(texture(normalTexture,texCoord).xyz * 2.0 - 1.0);
|
|
115
|
+
vec3 centerPosition = contactShadow_reconstructViewPosition(texCoord,centerDepth) + centerNormal * contactShadowTrace.normalBias;
|
|
116
|
+
vec3 rayDirection = normalize(contactShadowTrace.lightDirectionView);
|
|
117
|
+
float noise = fract(sin(dot(texCoord * texSize + contactShadowTrace.frameIndex,vec2(12.9898,78.233))) * 43758.5453);
|
|
118
|
+
for(int index=0;index<40;index++) {
|
|
119
|
+
if(float(index)>=contactShadowTrace.stepCount) break;
|
|
120
|
+
float fraction=(float(index)+0.35+noise*0.5)/max(contactShadowTrace.stepCount,1.0);
|
|
121
|
+
float travel=contactShadowTrace.maxDistance*fraction*fraction;
|
|
122
|
+
vec3 rayPosition=centerPosition+rayDirection*travel;
|
|
123
|
+
vec2 sampleUv=contactShadow_projectViewPosition(rayPosition);
|
|
124
|
+
if(any(lessThanEqual(sampleUv,vec2(0.0)))||any(greaterThanEqual(sampleUv,vec2(1.0))))break;
|
|
125
|
+
float sampleDepth=texture(depthTexture,sampleUv).r;
|
|
126
|
+
if(sampleDepth>=0.99999)continue;
|
|
127
|
+
vec3 scenePosition=contactShadow_reconstructViewPosition(sampleUv,sampleDepth);
|
|
128
|
+
float depthDelta=(-rayPosition.z)-(-scenePosition.z);
|
|
129
|
+
float hitThickness=contactShadowTrace.thickness+travel*0.02;
|
|
130
|
+
if(depthDelta>=0.0&&depthDelta<=hitThickness) {
|
|
131
|
+
float distanceFade=1.0-clamp(travel/contactShadowTrace.maxDistance,0.0,1.0);
|
|
132
|
+
return vec4(vec3(1.0-distanceFade),1.0);
|
|
133
|
+
}
|
|
134
|
+
if(depthDelta>hitThickness*8.0)break;
|
|
135
|
+
}
|
|
136
|
+
return vec4(1.0);
|
|
137
|
+
}
|
|
138
|
+
`
|
|
139
|
+
),
|
|
140
|
+
bindingLayout: [
|
|
141
|
+
{ name: "depthTexture", group: 0 },
|
|
142
|
+
{ name: "normalTexture", group: 0 }
|
|
143
|
+
],
|
|
144
|
+
props: {},
|
|
145
|
+
uniforms: {},
|
|
146
|
+
bindings: {},
|
|
147
|
+
uniformTypes: {
|
|
148
|
+
projectionMatrix: "mat4x4<f32>",
|
|
149
|
+
inverseProjectionMatrix: "mat4x4<f32>",
|
|
150
|
+
lightDirectionView: "vec3<f32>",
|
|
151
|
+
maxDistance: "f32",
|
|
152
|
+
thickness: "f32",
|
|
153
|
+
stepCount: "f32",
|
|
154
|
+
frameIndex: "f32",
|
|
155
|
+
normalBias: "f32"
|
|
156
|
+
},
|
|
157
|
+
propTypes: {
|
|
158
|
+
projectionMatrix: { value: IDENTITY_MATRIX, private: true },
|
|
159
|
+
inverseProjectionMatrix: { value: IDENTITY_MATRIX, private: true },
|
|
160
|
+
lightDirectionView: { value: [0, 1, 0], private: true },
|
|
161
|
+
maxDistance: { value: 4, min: 0.1, softMax: 16 },
|
|
162
|
+
thickness: { value: 0.12, min: 5e-3, softMax: 1 },
|
|
163
|
+
stepCount: { value: 24, min: 1, max: 40 },
|
|
164
|
+
frameIndex: { value: 0, private: true },
|
|
165
|
+
normalBias: { value: 0.035, min: 0, softMax: 0.2 }
|
|
166
|
+
},
|
|
167
|
+
passes: [{ sampler: true }]
|
|
168
|
+
};
|
|
169
|
+
const contactShadowBilateralBlur = {
|
|
170
|
+
name: "contactShadowBilateralBlur",
|
|
171
|
+
source: (
|
|
172
|
+
/* wgsl */
|
|
173
|
+
`struct contactShadowBilateralBlurUniforms {
|
|
174
|
+
direction: vec2f,
|
|
175
|
+
radius: f32,
|
|
176
|
+
depthSigma: f32,
|
|
177
|
+
normalPower: f32,
|
|
178
|
+
};
|
|
179
|
+
@group(0) @binding(auto) var<uniform> contactShadowBilateralBlur: contactShadowBilateralBlurUniforms;
|
|
180
|
+
@group(0) @binding(auto) var depthTexture: texture_depth_2d;
|
|
181
|
+
@group(0) @binding(auto) var depthTextureSampler: sampler;
|
|
182
|
+
@group(0) @binding(auto) var normalTexture: texture_2d<f32>;
|
|
183
|
+
@group(0) @binding(auto) var normalTextureSampler: sampler;
|
|
184
|
+
|
|
185
|
+
fn contactShadowBilateralBlur_sampleColor(
|
|
186
|
+
sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f
|
|
187
|
+
) -> vec4f {
|
|
188
|
+
let sourceDimensions = vec2f(textureDimensions(sourceTexture));
|
|
189
|
+
let texel = contactShadowBilateralBlur.direction / sourceDimensions;
|
|
190
|
+
let centerDepth = textureSampleLevel(depthTexture, depthTextureSampler, texCoord, 0);
|
|
191
|
+
let centerNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, texCoord, 0.0).xyz * 2.0 - 1.0);
|
|
192
|
+
var result = textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0).r;
|
|
193
|
+
var totalWeight = 1.0;
|
|
194
|
+
for (var index: i32 = 1; index <= 6; index++) {
|
|
195
|
+
if (f32(index) > contactShadowBilateralBlur.radius) { break; }
|
|
196
|
+
for (var side: i32 = -1; side <= 1; side += 2) {
|
|
197
|
+
let sampleUv = clamp(texCoord + texel * f32(index * side), vec2f(0.0), vec2f(1.0));
|
|
198
|
+
let sampleDepth = textureSampleLevel(depthTexture, depthTextureSampler, sampleUv, 0);
|
|
199
|
+
let sampleNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, sampleUv, 0.0).xyz * 2.0 - 1.0);
|
|
200
|
+
let depthDelta = abs(sampleDepth - centerDepth);
|
|
201
|
+
let depthWeight = exp(-(depthDelta * depthDelta) / max(2.0 * contactShadowBilateralBlur.depthSigma * contactShadowBilateralBlur.depthSigma, 0.000001));
|
|
202
|
+
let normalWeight = pow(max(dot(centerNormal, sampleNormal), 0.0), contactShadowBilateralBlur.normalPower);
|
|
203
|
+
let spatialWeight = exp(-f32(index * index) / 8.0);
|
|
204
|
+
let weight = depthWeight * normalWeight * spatialWeight;
|
|
205
|
+
result += textureSampleLevel(sourceTexture, sourceTextureSampler, sampleUv, 0.0).r * weight;
|
|
206
|
+
totalWeight += weight;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
let visibility = result / totalWeight;
|
|
210
|
+
return vec4f(vec3f(visibility), 1.0);
|
|
211
|
+
}`
|
|
212
|
+
),
|
|
213
|
+
fs: (
|
|
214
|
+
/* glsl */
|
|
215
|
+
`
|
|
216
|
+
layout(std140) uniform contactShadowBilateralBlurUniforms {
|
|
217
|
+
vec2 direction;
|
|
218
|
+
float radius;
|
|
219
|
+
float depthSigma;
|
|
220
|
+
float normalPower;
|
|
221
|
+
} contactShadowBilateralBlur;
|
|
222
|
+
uniform sampler2D depthTexture;
|
|
223
|
+
uniform sampler2D normalTexture;
|
|
224
|
+
vec4 contactShadowBilateralBlur_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {
|
|
225
|
+
vec2 texel=contactShadowBilateralBlur.direction/vec2(textureSize(sourceTexture,0));
|
|
226
|
+
float centerDepth=texture(depthTexture,texCoord).r;
|
|
227
|
+
vec3 centerNormal=normalize(texture(normalTexture,texCoord).xyz*2.0-1.0);
|
|
228
|
+
float result=texture(sourceTexture,texCoord).r;
|
|
229
|
+
float totalWeight=1.0;
|
|
230
|
+
for(int index=1;index<=6;index++) {
|
|
231
|
+
if(float(index)>contactShadowBilateralBlur.radius)break;
|
|
232
|
+
for(int side=-1;side<=1;side+=2) {
|
|
233
|
+
vec2 sampleUv=clamp(texCoord+texel*float(index*side),vec2(0.0),vec2(1.0));
|
|
234
|
+
float sampleDepth=texture(depthTexture,sampleUv).r;
|
|
235
|
+
vec3 sampleNormal=normalize(texture(normalTexture,sampleUv).xyz*2.0-1.0);
|
|
236
|
+
float depthDelta=abs(sampleDepth-centerDepth);
|
|
237
|
+
float depthWeight=exp(-(depthDelta*depthDelta)/max(2.0*contactShadowBilateralBlur.depthSigma*contactShadowBilateralBlur.depthSigma,0.000001));
|
|
238
|
+
float normalWeight=pow(max(dot(centerNormal,sampleNormal),0.0),contactShadowBilateralBlur.normalPower);
|
|
239
|
+
float spatialWeight=exp(-float(index*index)/8.0);
|
|
240
|
+
float weight=depthWeight*normalWeight*spatialWeight;
|
|
241
|
+
result+=texture(sourceTexture,sampleUv).r*weight;totalWeight+=weight;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return vec4(vec3(result/totalWeight),1.0);
|
|
245
|
+
}
|
|
246
|
+
`
|
|
247
|
+
),
|
|
248
|
+
bindingLayout: [
|
|
249
|
+
{ name: "depthTexture", group: 0 },
|
|
250
|
+
{ name: "normalTexture", group: 0 }
|
|
251
|
+
],
|
|
252
|
+
props: {},
|
|
253
|
+
uniforms: {},
|
|
254
|
+
bindings: {},
|
|
255
|
+
uniformTypes: {
|
|
256
|
+
direction: "vec2<f32>",
|
|
257
|
+
radius: "f32",
|
|
258
|
+
depthSigma: "f32",
|
|
259
|
+
normalPower: "f32"
|
|
260
|
+
},
|
|
261
|
+
propTypes: {
|
|
262
|
+
direction: { value: [1, 0], private: true },
|
|
263
|
+
radius: { value: 4, min: 1, max: 6 },
|
|
264
|
+
depthSigma: { value: 6e-3, min: 1e-4, softMax: 0.05 },
|
|
265
|
+
normalPower: { value: 24, min: 1, softMax: 64 }
|
|
266
|
+
},
|
|
267
|
+
passes: [{ sampler: true }]
|
|
268
|
+
};
|
|
269
|
+
const contactShadowComposite = {
|
|
270
|
+
name: "contactShadowComposite",
|
|
271
|
+
source: (
|
|
272
|
+
/* wgsl */
|
|
273
|
+
`struct contactShadowCompositeUniforms {
|
|
274
|
+
strength: f32,
|
|
275
|
+
debugMode: f32,
|
|
276
|
+
};
|
|
277
|
+
@group(0) @binding(auto) var<uniform> contactShadowComposite: contactShadowCompositeUniforms;
|
|
278
|
+
@group(0) @binding(auto) var contactShadowTexture: texture_2d<f32>;
|
|
279
|
+
@group(0) @binding(auto) var contactShadowTextureSampler: sampler;
|
|
280
|
+
@group(0) @binding(auto) var directionalDirectTexture: texture_2d<f32>;
|
|
281
|
+
@group(0) @binding(auto) var directionalDirectTextureSampler: sampler;
|
|
282
|
+
@group(0) @binding(auto) var shadowDebugTexture: texture_2d<f32>;
|
|
283
|
+
@group(0) @binding(auto) var shadowDebugTextureSampler: sampler;
|
|
284
|
+
|
|
285
|
+
fn contactShadowComposite_sampleColor(
|
|
286
|
+
sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f
|
|
287
|
+
) -> vec4f {
|
|
288
|
+
let color = textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0);
|
|
289
|
+
let contact = textureSampleLevel(contactShadowTexture, contactShadowTextureSampler, texCoord, 0.0).r;
|
|
290
|
+
let appliedContact = mix(1.0, contact, contactShadowComposite.strength);
|
|
291
|
+
if (contactShadowComposite.debugMode > 0.5 && contactShadowComposite.debugMode < 1.5) {
|
|
292
|
+
return vec4f(vec3f(contact), 1.0);
|
|
293
|
+
}
|
|
294
|
+
if (contactShadowComposite.debugMode >= 1.5) {
|
|
295
|
+
let factors = textureSampleLevel(shadowDebugTexture, shadowDebugTextureSampler, texCoord, 0.0).rgb;
|
|
296
|
+
return vec4f(vec3f(factors.x * factors.y * factors.z * contact), 1.0);
|
|
297
|
+
}
|
|
298
|
+
let directionalDirect = textureSampleLevel(
|
|
299
|
+
directionalDirectTexture,
|
|
300
|
+
directionalDirectTextureSampler,
|
|
301
|
+
texCoord,
|
|
302
|
+
0.0
|
|
303
|
+
).rgb;
|
|
304
|
+
return vec4f(max(color.rgb - directionalDirect * (1.0 - appliedContact), vec3f(0.0)), color.a);
|
|
305
|
+
}`
|
|
306
|
+
),
|
|
307
|
+
fs: (
|
|
308
|
+
/* glsl */
|
|
309
|
+
`
|
|
310
|
+
layout(std140) uniform contactShadowCompositeUniforms {
|
|
311
|
+
float strength;
|
|
312
|
+
float debugMode;
|
|
313
|
+
} contactShadowComposite;
|
|
314
|
+
uniform sampler2D contactShadowTexture;
|
|
315
|
+
uniform sampler2D directionalDirectTexture;
|
|
316
|
+
uniform sampler2D shadowDebugTexture;
|
|
317
|
+
vec4 contactShadowComposite_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {
|
|
318
|
+
vec4 color=texture(sourceTexture,texCoord);
|
|
319
|
+
float contact=texture(contactShadowTexture,texCoord).r;
|
|
320
|
+
float appliedContact=mix(1.0,contact,contactShadowComposite.strength);
|
|
321
|
+
if(contactShadowComposite.debugMode>0.5&&contactShadowComposite.debugMode<1.5)return vec4(vec3(contact),1.0);
|
|
322
|
+
if(contactShadowComposite.debugMode>=1.5){vec3 factors=texture(shadowDebugTexture,texCoord).rgb;return vec4(vec3(factors.x*factors.y*factors.z*contact),1.0);}
|
|
323
|
+
vec3 directionalDirect=texture(directionalDirectTexture,texCoord).rgb;
|
|
324
|
+
return vec4(max(color.rgb-directionalDirect*(1.0-appliedContact),vec3(0.0)),color.a);
|
|
325
|
+
}
|
|
326
|
+
`
|
|
327
|
+
),
|
|
328
|
+
bindingLayout: [
|
|
329
|
+
{ name: "contactShadowTexture", group: 0 },
|
|
330
|
+
{ name: "directionalDirectTexture", group: 0 },
|
|
331
|
+
{ name: "shadowDebugTexture", group: 0 }
|
|
332
|
+
],
|
|
333
|
+
props: {},
|
|
334
|
+
uniforms: {},
|
|
335
|
+
bindings: {},
|
|
336
|
+
uniformTypes: { strength: "f32", debugMode: "f32" },
|
|
337
|
+
propTypes: {
|
|
338
|
+
strength: { value: 1, min: 0, max: 1 },
|
|
339
|
+
debugMode: { value: 0, min: 0, max: 2, private: true }
|
|
340
|
+
},
|
|
341
|
+
passes: [{ sampler: true }]
|
|
342
|
+
};
|
|
343
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
344
|
+
0 && (module.exports = {
|
|
345
|
+
contactShadowBilateralBlur,
|
|
346
|
+
contactShadowComposite,
|
|
347
|
+
contactShadowTrace
|
|
348
|
+
});
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import type { NumberArray3, NumberArray16 } from '@math.gl/core';
|
|
2
|
+
export type ContactShadowBindings<TextureT = unknown> = {
|
|
3
|
+
depthTexture?: TextureT;
|
|
4
|
+
normalTexture?: TextureT;
|
|
5
|
+
};
|
|
6
|
+
export type ContactTraceUniforms = {
|
|
7
|
+
projectionMatrix: Readonly<NumberArray16>;
|
|
8
|
+
inverseProjectionMatrix: Readonly<NumberArray16>;
|
|
9
|
+
lightDirectionView: Readonly<NumberArray3>;
|
|
10
|
+
maxDistance: number;
|
|
11
|
+
thickness: number;
|
|
12
|
+
stepCount: number;
|
|
13
|
+
frameIndex: number;
|
|
14
|
+
normalBias: number;
|
|
15
|
+
};
|
|
16
|
+
/** Runtime controls accepted by the contact-shadow trace and composite passes. */
|
|
17
|
+
export type ContactShadowProps<TextureT = unknown> = Partial<ContactTraceUniforms> & {
|
|
18
|
+
strength?: number;
|
|
19
|
+
debugMode?: number;
|
|
20
|
+
directionalDirectTexture?: TextureT;
|
|
21
|
+
shadowDebugTexture?: TextureT;
|
|
22
|
+
};
|
|
23
|
+
export declare const contactShadowTrace: {
|
|
24
|
+
readonly name: "contactShadowTrace";
|
|
25
|
+
readonly source: "struct contactShadowTraceUniforms {\n projectionMatrix: mat4x4f,\n inverseProjectionMatrix: mat4x4f,\n lightDirectionView: vec3f,\n maxDistance: f32,\n thickness: f32,\n stepCount: f32,\n frameIndex: f32,\n normalBias: f32,\n};\n@group(0) @binding(auto) var<uniform> contactShadowTrace: contactShadowTraceUniforms;\n@group(0) @binding(auto) var depthTexture: texture_depth_2d;\n@group(0) @binding(auto) var depthTextureSampler: sampler;\n@group(0) @binding(auto) var normalTexture: texture_2d<f32>;\n@group(0) @binding(auto) var normalTextureSampler: sampler;\n\nfn contactShadow_reconstructViewPosition(uv: vec2f, depth: f32) -> vec3f {\n let clip = vec4f(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, depth, 1.0);\n let view = contactShadowTrace.inverseProjectionMatrix * clip;\n return view.xyz / max(abs(view.w), 0.00001);\n}\n\nfn contactShadow_projectViewPosition(position: vec3f) -> vec2f {\n let clip = contactShadowTrace.projectionMatrix * vec4f(position, 1.0);\n let ndc = clip.xy / max(abs(clip.w), 0.00001);\n return vec2f(ndc.x * 0.5 + 0.5, 0.5 - ndc.y * 0.5);\n}\n\nfn contactShadowTrace_sampleColor(\n sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f\n) -> vec4f {\n let centerDepth = textureSampleLevel(depthTexture, depthTextureSampler, texCoord, 0);\n if (centerDepth >= 0.99999) { return vec4f(1.0); }\n let centerNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, texCoord, 0.0).xyz * 2.0 - 1.0);\n let centerPosition = contactShadow_reconstructViewPosition(texCoord, centerDepth) + centerNormal * contactShadowTrace.normalBias;\n let rayDirection = normalize(contactShadowTrace.lightDirectionView);\n let noise = fract(sin(dot(texCoord * texSize + contactShadowTrace.frameIndex, vec2f(12.9898, 78.233))) * 43758.5453);\n for (var index: i32 = 0; index < 40; index++) {\n if (f32(index) >= contactShadowTrace.stepCount) { break; }\n let fraction = (f32(index) + 0.35 + noise * 0.5) / max(contactShadowTrace.stepCount, 1.0);\n let travel = contactShadowTrace.maxDistance * fraction * fraction;\n let rayPosition = centerPosition + rayDirection * travel;\n let sampleUv = contactShadow_projectViewPosition(rayPosition);\n if (any(sampleUv <= vec2f(0.0)) || any(sampleUv >= vec2f(1.0))) { break; }\n let sampleDepth = textureSampleLevel(depthTexture, depthTextureSampler, sampleUv, 0);\n if (sampleDepth >= 0.99999) { continue; }\n let scenePosition = contactShadow_reconstructViewPosition(sampleUv, sampleDepth);\n let depthDelta = (-rayPosition.z) - (-scenePosition.z);\n let hitThickness = contactShadowTrace.thickness + travel * 0.02;\n if (depthDelta >= 0.0 && depthDelta <= hitThickness) {\n let distanceFade = 1.0 - clamp(travel / contactShadowTrace.maxDistance, 0.0, 1.0);\n return vec4f(vec3f(1.0 - distanceFade), 1.0);\n }\n if (depthDelta > hitThickness * 8.0) { break; }\n }\n return vec4f(1.0);\n}";
|
|
26
|
+
readonly fs: "\nlayout(std140) uniform contactShadowTraceUniforms {\n mat4 projectionMatrix;\n mat4 inverseProjectionMatrix;\n vec3 lightDirectionView;\n float maxDistance;\n float thickness;\n float stepCount;\n float frameIndex;\n float normalBias;\n} contactShadowTrace;\nuniform sampler2D depthTexture;\nuniform sampler2D normalTexture;\nvec3 contactShadow_reconstructViewPosition(vec2 uv, float depth) {\n vec4 view = contactShadowTrace.inverseProjectionMatrix * vec4(uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);\n return view.xyz / max(abs(view.w), 0.00001);\n}\nvec2 contactShadow_projectViewPosition(vec3 position) {\n vec4 clip = contactShadowTrace.projectionMatrix * vec4(position,1.0);\n return clip.xy / max(abs(clip.w),0.00001) * 0.5 + 0.5;\n}\nvec4 contactShadowTrace_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {\n float centerDepth = texture(depthTexture,texCoord).r;\n if(centerDepth >= 0.99999) return vec4(1.0);\n vec3 centerNormal = normalize(texture(normalTexture,texCoord).xyz * 2.0 - 1.0);\n vec3 centerPosition = contactShadow_reconstructViewPosition(texCoord,centerDepth) + centerNormal * contactShadowTrace.normalBias;\n vec3 rayDirection = normalize(contactShadowTrace.lightDirectionView);\n float noise = fract(sin(dot(texCoord * texSize + contactShadowTrace.frameIndex,vec2(12.9898,78.233))) * 43758.5453);\n for(int index=0;index<40;index++) {\n if(float(index)>=contactShadowTrace.stepCount) break;\n float fraction=(float(index)+0.35+noise*0.5)/max(contactShadowTrace.stepCount,1.0);\n float travel=contactShadowTrace.maxDistance*fraction*fraction;\n vec3 rayPosition=centerPosition+rayDirection*travel;\n vec2 sampleUv=contactShadow_projectViewPosition(rayPosition);\n if(any(lessThanEqual(sampleUv,vec2(0.0)))||any(greaterThanEqual(sampleUv,vec2(1.0))))break;\n float sampleDepth=texture(depthTexture,sampleUv).r;\n if(sampleDepth>=0.99999)continue;\n vec3 scenePosition=contactShadow_reconstructViewPosition(sampleUv,sampleDepth);\n float depthDelta=(-rayPosition.z)-(-scenePosition.z);\n float hitThickness=contactShadowTrace.thickness+travel*0.02;\n if(depthDelta>=0.0&&depthDelta<=hitThickness) {\n float distanceFade=1.0-clamp(travel/contactShadowTrace.maxDistance,0.0,1.0);\n return vec4(vec3(1.0-distanceFade),1.0);\n }\n if(depthDelta>hitThickness*8.0)break;\n }\n return vec4(1.0);\n}\n";
|
|
27
|
+
readonly bindingLayout: readonly [{
|
|
28
|
+
readonly name: "depthTexture";
|
|
29
|
+
readonly group: 0;
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "normalTexture";
|
|
32
|
+
readonly group: 0;
|
|
33
|
+
}];
|
|
34
|
+
readonly props: Partial<ContactTraceUniforms> & ContactShadowBindings;
|
|
35
|
+
readonly uniforms: ContactTraceUniforms;
|
|
36
|
+
readonly bindings: ContactShadowBindings;
|
|
37
|
+
readonly uniformTypes: {
|
|
38
|
+
readonly projectionMatrix: "mat4x4<f32>";
|
|
39
|
+
readonly inverseProjectionMatrix: "mat4x4<f32>";
|
|
40
|
+
readonly lightDirectionView: "vec3<f32>";
|
|
41
|
+
readonly maxDistance: "f32";
|
|
42
|
+
readonly thickness: "f32";
|
|
43
|
+
readonly stepCount: "f32";
|
|
44
|
+
readonly frameIndex: "f32";
|
|
45
|
+
readonly normalBias: "f32";
|
|
46
|
+
};
|
|
47
|
+
readonly propTypes: {
|
|
48
|
+
readonly projectionMatrix: {
|
|
49
|
+
readonly value: NumberArray16;
|
|
50
|
+
readonly private: true;
|
|
51
|
+
};
|
|
52
|
+
readonly inverseProjectionMatrix: {
|
|
53
|
+
readonly value: NumberArray16;
|
|
54
|
+
readonly private: true;
|
|
55
|
+
};
|
|
56
|
+
readonly lightDirectionView: {
|
|
57
|
+
readonly value: readonly [0, 1, 0];
|
|
58
|
+
readonly private: true;
|
|
59
|
+
};
|
|
60
|
+
readonly maxDistance: {
|
|
61
|
+
readonly value: 4;
|
|
62
|
+
readonly min: 0.1;
|
|
63
|
+
readonly softMax: 16;
|
|
64
|
+
};
|
|
65
|
+
readonly thickness: {
|
|
66
|
+
readonly value: 0.12;
|
|
67
|
+
readonly min: 0.005;
|
|
68
|
+
readonly softMax: 1;
|
|
69
|
+
};
|
|
70
|
+
readonly stepCount: {
|
|
71
|
+
readonly value: 24;
|
|
72
|
+
readonly min: 1;
|
|
73
|
+
readonly max: 40;
|
|
74
|
+
};
|
|
75
|
+
readonly frameIndex: {
|
|
76
|
+
readonly value: 0;
|
|
77
|
+
readonly private: true;
|
|
78
|
+
};
|
|
79
|
+
readonly normalBias: {
|
|
80
|
+
readonly value: 0.035;
|
|
81
|
+
readonly min: 0;
|
|
82
|
+
readonly softMax: 0.2;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
readonly passes: [{
|
|
86
|
+
readonly sampler: true;
|
|
87
|
+
}];
|
|
88
|
+
};
|
|
89
|
+
export type ContactBlurUniforms = {
|
|
90
|
+
direction: [number, number];
|
|
91
|
+
radius: number;
|
|
92
|
+
depthSigma: number;
|
|
93
|
+
normalPower: number;
|
|
94
|
+
};
|
|
95
|
+
export declare const contactShadowBilateralBlur: {
|
|
96
|
+
readonly name: "contactShadowBilateralBlur";
|
|
97
|
+
readonly source: "struct contactShadowBilateralBlurUniforms {\n direction: vec2f,\n radius: f32,\n depthSigma: f32,\n normalPower: f32,\n};\n@group(0) @binding(auto) var<uniform> contactShadowBilateralBlur: contactShadowBilateralBlurUniforms;\n@group(0) @binding(auto) var depthTexture: texture_depth_2d;\n@group(0) @binding(auto) var depthTextureSampler: sampler;\n@group(0) @binding(auto) var normalTexture: texture_2d<f32>;\n@group(0) @binding(auto) var normalTextureSampler: sampler;\n\nfn contactShadowBilateralBlur_sampleColor(\n sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f\n) -> vec4f {\n let sourceDimensions = vec2f(textureDimensions(sourceTexture));\n let texel = contactShadowBilateralBlur.direction / sourceDimensions;\n let centerDepth = textureSampleLevel(depthTexture, depthTextureSampler, texCoord, 0);\n let centerNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, texCoord, 0.0).xyz * 2.0 - 1.0);\n var result = textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0).r;\n var totalWeight = 1.0;\n for (var index: i32 = 1; index <= 6; index++) {\n if (f32(index) > contactShadowBilateralBlur.radius) { break; }\n for (var side: i32 = -1; side <= 1; side += 2) {\n let sampleUv = clamp(texCoord + texel * f32(index * side), vec2f(0.0), vec2f(1.0));\n let sampleDepth = textureSampleLevel(depthTexture, depthTextureSampler, sampleUv, 0);\n let sampleNormal = normalize(textureSampleLevel(normalTexture, normalTextureSampler, sampleUv, 0.0).xyz * 2.0 - 1.0);\n let depthDelta = abs(sampleDepth - centerDepth);\n let depthWeight = exp(-(depthDelta * depthDelta) / max(2.0 * contactShadowBilateralBlur.depthSigma * contactShadowBilateralBlur.depthSigma, 0.000001));\n let normalWeight = pow(max(dot(centerNormal, sampleNormal), 0.0), contactShadowBilateralBlur.normalPower);\n let spatialWeight = exp(-f32(index * index) / 8.0);\n let weight = depthWeight * normalWeight * spatialWeight;\n result += textureSampleLevel(sourceTexture, sourceTextureSampler, sampleUv, 0.0).r * weight;\n totalWeight += weight;\n }\n }\n let visibility = result / totalWeight;\n return vec4f(vec3f(visibility), 1.0);\n}";
|
|
98
|
+
readonly fs: "\nlayout(std140) uniform contactShadowBilateralBlurUniforms {\n vec2 direction;\n float radius;\n float depthSigma;\n float normalPower;\n} contactShadowBilateralBlur;\nuniform sampler2D depthTexture;\nuniform sampler2D normalTexture;\nvec4 contactShadowBilateralBlur_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {\n vec2 texel=contactShadowBilateralBlur.direction/vec2(textureSize(sourceTexture,0));\n float centerDepth=texture(depthTexture,texCoord).r;\n vec3 centerNormal=normalize(texture(normalTexture,texCoord).xyz*2.0-1.0);\n float result=texture(sourceTexture,texCoord).r;\n float totalWeight=1.0;\n for(int index=1;index<=6;index++) {\n if(float(index)>contactShadowBilateralBlur.radius)break;\n for(int side=-1;side<=1;side+=2) {\n vec2 sampleUv=clamp(texCoord+texel*float(index*side),vec2(0.0),vec2(1.0));\n float sampleDepth=texture(depthTexture,sampleUv).r;\n vec3 sampleNormal=normalize(texture(normalTexture,sampleUv).xyz*2.0-1.0);\n float depthDelta=abs(sampleDepth-centerDepth);\n float depthWeight=exp(-(depthDelta*depthDelta)/max(2.0*contactShadowBilateralBlur.depthSigma*contactShadowBilateralBlur.depthSigma,0.000001));\n float normalWeight=pow(max(dot(centerNormal,sampleNormal),0.0),contactShadowBilateralBlur.normalPower);\n float spatialWeight=exp(-float(index*index)/8.0);\n float weight=depthWeight*normalWeight*spatialWeight;\n result+=texture(sourceTexture,sampleUv).r*weight;totalWeight+=weight;\n }\n }\n return vec4(vec3(result/totalWeight),1.0);\n}\n";
|
|
99
|
+
readonly bindingLayout: readonly [{
|
|
100
|
+
readonly name: "depthTexture";
|
|
101
|
+
readonly group: 0;
|
|
102
|
+
}, {
|
|
103
|
+
readonly name: "normalTexture";
|
|
104
|
+
readonly group: 0;
|
|
105
|
+
}];
|
|
106
|
+
readonly props: Partial<ContactBlurUniforms> & ContactShadowBindings;
|
|
107
|
+
readonly uniforms: ContactBlurUniforms;
|
|
108
|
+
readonly bindings: ContactShadowBindings;
|
|
109
|
+
readonly uniformTypes: {
|
|
110
|
+
readonly direction: "vec2<f32>";
|
|
111
|
+
readonly radius: "f32";
|
|
112
|
+
readonly depthSigma: "f32";
|
|
113
|
+
readonly normalPower: "f32";
|
|
114
|
+
};
|
|
115
|
+
readonly propTypes: {
|
|
116
|
+
readonly direction: {
|
|
117
|
+
readonly value: readonly [1, 0];
|
|
118
|
+
readonly private: true;
|
|
119
|
+
};
|
|
120
|
+
readonly radius: {
|
|
121
|
+
readonly value: 4;
|
|
122
|
+
readonly min: 1;
|
|
123
|
+
readonly max: 6;
|
|
124
|
+
};
|
|
125
|
+
readonly depthSigma: {
|
|
126
|
+
readonly value: 0.006;
|
|
127
|
+
readonly min: 0.0001;
|
|
128
|
+
readonly softMax: 0.05;
|
|
129
|
+
};
|
|
130
|
+
readonly normalPower: {
|
|
131
|
+
readonly value: 24;
|
|
132
|
+
readonly min: 1;
|
|
133
|
+
readonly softMax: 64;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
readonly passes: [{
|
|
137
|
+
readonly sampler: true;
|
|
138
|
+
}];
|
|
139
|
+
};
|
|
140
|
+
export type ContactCompositeBindings<TextureT = unknown> = {
|
|
141
|
+
contactShadowTexture?: TextureT;
|
|
142
|
+
directionalDirectTexture?: TextureT;
|
|
143
|
+
shadowDebugTexture?: TextureT;
|
|
144
|
+
};
|
|
145
|
+
type ContactCompositeUniforms = {
|
|
146
|
+
strength: number;
|
|
147
|
+
debugMode: number;
|
|
148
|
+
};
|
|
149
|
+
export declare const contactShadowComposite: {
|
|
150
|
+
readonly name: "contactShadowComposite";
|
|
151
|
+
readonly source: "struct contactShadowCompositeUniforms {\n strength: f32,\n debugMode: f32,\n};\n@group(0) @binding(auto) var<uniform> contactShadowComposite: contactShadowCompositeUniforms;\n@group(0) @binding(auto) var contactShadowTexture: texture_2d<f32>;\n@group(0) @binding(auto) var contactShadowTextureSampler: sampler;\n@group(0) @binding(auto) var directionalDirectTexture: texture_2d<f32>;\n@group(0) @binding(auto) var directionalDirectTextureSampler: sampler;\n@group(0) @binding(auto) var shadowDebugTexture: texture_2d<f32>;\n@group(0) @binding(auto) var shadowDebugTextureSampler: sampler;\n\nfn contactShadowComposite_sampleColor(\n sourceTexture: texture_2d<f32>, sourceTextureSampler: sampler, texSize: vec2f, texCoord: vec2f\n) -> vec4f {\n let color = textureSampleLevel(sourceTexture, sourceTextureSampler, texCoord, 0.0);\n let contact = textureSampleLevel(contactShadowTexture, contactShadowTextureSampler, texCoord, 0.0).r;\n let appliedContact = mix(1.0, contact, contactShadowComposite.strength);\n if (contactShadowComposite.debugMode > 0.5 && contactShadowComposite.debugMode < 1.5) {\n return vec4f(vec3f(contact), 1.0);\n }\n if (contactShadowComposite.debugMode >= 1.5) {\n let factors = textureSampleLevel(shadowDebugTexture, shadowDebugTextureSampler, texCoord, 0.0).rgb;\n return vec4f(vec3f(factors.x * factors.y * factors.z * contact), 1.0);\n }\n let directionalDirect = textureSampleLevel(\n directionalDirectTexture,\n directionalDirectTextureSampler,\n texCoord,\n 0.0\n ).rgb;\n return vec4f(max(color.rgb - directionalDirect * (1.0 - appliedContact), vec3f(0.0)), color.a);\n}";
|
|
152
|
+
readonly fs: "\nlayout(std140) uniform contactShadowCompositeUniforms {\n float strength;\n float debugMode;\n} contactShadowComposite;\nuniform sampler2D contactShadowTexture;\nuniform sampler2D directionalDirectTexture;\nuniform sampler2D shadowDebugTexture;\nvec4 contactShadowComposite_sampleColor(sampler2D sourceTexture,vec2 texSize,vec2 texCoord) {\n vec4 color=texture(sourceTexture,texCoord);\n float contact=texture(contactShadowTexture,texCoord).r;\n float appliedContact=mix(1.0,contact,contactShadowComposite.strength);\n if(contactShadowComposite.debugMode>0.5&&contactShadowComposite.debugMode<1.5)return vec4(vec3(contact),1.0);\n if(contactShadowComposite.debugMode>=1.5){vec3 factors=texture(shadowDebugTexture,texCoord).rgb;return vec4(vec3(factors.x*factors.y*factors.z*contact),1.0);}\n vec3 directionalDirect=texture(directionalDirectTexture,texCoord).rgb;\n return vec4(max(color.rgb-directionalDirect*(1.0-appliedContact),vec3(0.0)),color.a);\n}\n";
|
|
153
|
+
readonly bindingLayout: readonly [{
|
|
154
|
+
readonly name: "contactShadowTexture";
|
|
155
|
+
readonly group: 0;
|
|
156
|
+
}, {
|
|
157
|
+
readonly name: "directionalDirectTexture";
|
|
158
|
+
readonly group: 0;
|
|
159
|
+
}, {
|
|
160
|
+
readonly name: "shadowDebugTexture";
|
|
161
|
+
readonly group: 0;
|
|
162
|
+
}];
|
|
163
|
+
readonly props: Partial<ContactCompositeUniforms> & ContactCompositeBindings;
|
|
164
|
+
readonly uniforms: ContactCompositeUniforms;
|
|
165
|
+
readonly bindings: ContactCompositeBindings;
|
|
166
|
+
readonly uniformTypes: {
|
|
167
|
+
readonly strength: "f32";
|
|
168
|
+
readonly debugMode: "f32";
|
|
169
|
+
};
|
|
170
|
+
readonly propTypes: {
|
|
171
|
+
readonly strength: {
|
|
172
|
+
readonly value: 1;
|
|
173
|
+
readonly min: 0;
|
|
174
|
+
readonly max: 1;
|
|
175
|
+
};
|
|
176
|
+
readonly debugMode: {
|
|
177
|
+
readonly value: 0;
|
|
178
|
+
readonly min: 0;
|
|
179
|
+
readonly max: 2;
|
|
180
|
+
readonly private: true;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
readonly passes: [{
|
|
184
|
+
readonly sampler: true;
|
|
185
|
+
}];
|
|
186
|
+
};
|
|
187
|
+
export {};
|
|
188
|
+
//# sourceMappingURL=contact-shadow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-shadow.d.ts","sourceRoot":"","sources":["../../../../src/modules/lighting/contact-shadow/contact-shadow.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAK/D,MAAM,MAAM,qBAAqB,CAAC,QAAQ,GAAG,OAAO,IAAI;IACtD,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,aAAa,CAAC,EAAE,QAAQ,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,gBAAgB,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC1C,uBAAuB,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACjD,kBAAkB,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,kFAAkF;AAClF,MAAM,MAAM,kBAAkB,CAAC,QAAQ,GAAG,OAAO,IAAI,OAAO,CAAC,oBAAoB,CAAC,GAAG;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,QAAQ,CAAC;IACpC,kBAAkB,CAAC,EAAE,QAAQ,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;oBAiHhB,OAAO,CAAC,oBAAoB,CAAC,GAAG,qBAAqB;uBAClD,oBAAoB;uBACpB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BtC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;oBA8ExB,OAAO,CAAC,mBAAmB,CAAC,GAAG,qBAAqB;uBACjD,mBAAmB;uBACnB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBtC,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,QAAQ,GAAG,OAAO,IAAI;IACzD,oBAAoB,CAAC,EAAE,QAAQ,CAAC;IAChC,wBAAwB,CAAC,EAAE,QAAQ,CAAC;IACpC,kBAAkB,CAAC,EAAE,QAAQ,CAAC;CAC/B,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;oBA2DpB,OAAO,CAAC,wBAAwB,CAAC,GAAG,wBAAwB;uBACzD,wBAAwB;uBACxB,wBAAwB;;;;;;;;;;;;;;;;;;;;;CAYzC,CAAC"}
|