@luma.gl/shaders 0.0.0-stage → 10.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -2
- package/dist/dist.dev.js +19686 -0
- package/dist/dist.min.js +12180 -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 +243 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -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 +107 -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 +99 -0
- package/dist/lib/preprocessor/preprocessor.js.map +1 -0
- package/dist/lib/shader-assembler-base.cjs +133 -0
- package/dist/lib/shader-assembler-base.d.ts +52 -0
- package/dist/lib/shader-assembler-base.d.ts.map +1 -0
- package/dist/lib/shader-assembler-base.js +128 -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 +200 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts +69 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.js +221 -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 +501 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts +71 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.js +473 -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 +128 -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-hooks.cjs +103 -0
- package/dist/lib/shader-assembly/shader-hooks.d.ts +45 -0
- package/dist/lib/shader-assembly/shader-hooks.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-hooks.js +84 -0
- package/dist/lib/shader-assembly/shader-hooks.js.map +1 -0
- package/dist/lib/shader-assembly/shader-injections.cjs +180 -0
- package/dist/lib/shader-assembly/shader-injections.d.ts +34 -0
- package/dist/lib/shader-assembly/shader-injections.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-injections.js +183 -0
- package/dist/lib/shader-assembly/shader-injections.js.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.cjs +417 -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 +412 -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-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 +105 -0
- package/dist/lib/shader-module/shader-module.d.ts +98 -0
- package/dist/lib/shader-module/shader-module.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module.js +104 -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 +117 -0
- package/dist/lib/shader-plugin.d.ts +68 -0
- package/dist/lib/shader-plugin.d.ts.map +1 -0
- package/dist/lib/shader-plugin.js +98 -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 +152 -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 +129 -0
- package/dist/modules/engine/clip/clip.js.map +1 -0
- package/dist/modules/engine/filter/filter.cjs +111 -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 +88 -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/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-material/pbr-material-glsl.cjs +1767 -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 +1745 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.cjs +2062 -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 +2040 -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/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/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/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 +42 -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 +12 -0
- package/dist/types.js.map +1 -0
- package/dist/wgsl.cjs +39 -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 +259 -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 +132 -0
- package/src/lib/shader-assembler-base.ts +170 -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 +801 -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 +142 -0
- package/src/lib/shader-assembly/shader-hooks.ts +141 -0
- package/src/lib/shader-assembly/shader-injections.ts +250 -0
- package/src/lib/shader-assembly/shader-plugin-varyings.ts +524 -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-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 +244 -0
- package/src/lib/shader-module/shader-pass.ts +69 -0
- package/src/lib/shader-plugin.ts +214 -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 +149 -0
- package/src/modules/engine/filter/filter.ts +107 -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/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-material/pbr-material-glsl.ts +1748 -0
- package/src/modules/lighting/pbr-material/pbr-material-wgsl.ts +2043 -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/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/surface-weather/README.md +28 -0
- package/src/modules/lighting/surface-weather/surface-weather.ts +198 -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 +155 -0
- package/src/types.ts +48 -0
- package/src/wgsl.ts +23 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
const DEFAULT_UNIFORMS = {
|
|
5
|
+
coreRadius: 0.12,
|
|
6
|
+
coreIntensity: 1,
|
|
7
|
+
haloIntensity: 0.6,
|
|
8
|
+
falloff: 5
|
|
9
|
+
};
|
|
10
|
+
/** Linear radiance for a bounded point sprite. Blend additively or composite into an HDR target. */
|
|
11
|
+
export const pointGlow = {
|
|
12
|
+
name: 'pointGlow',
|
|
13
|
+
firstBindingSlot: 0,
|
|
14
|
+
bindingLayout: [{ name: 'pointGlow', group: 3 }],
|
|
15
|
+
uniformTypes: {
|
|
16
|
+
coreRadius: 'f32',
|
|
17
|
+
coreIntensity: 'f32',
|
|
18
|
+
haloIntensity: 'f32',
|
|
19
|
+
falloff: 'f32'
|
|
20
|
+
},
|
|
21
|
+
defaultUniforms: DEFAULT_UNIFORMS,
|
|
22
|
+
getUniforms(props = {}, previousUniforms = DEFAULT_UNIFORMS) {
|
|
23
|
+
const uniforms = { ...DEFAULT_UNIFORMS, ...previousUniforms };
|
|
24
|
+
if (props.coreRadius !== undefined)
|
|
25
|
+
uniforms.coreRadius = Math.min(1, Math.max(0, props.coreRadius));
|
|
26
|
+
if (props.coreIntensity !== undefined)
|
|
27
|
+
uniforms.coreIntensity = Math.max(0, props.coreIntensity);
|
|
28
|
+
if (props.haloIntensity !== undefined)
|
|
29
|
+
uniforms.haloIntensity = Math.max(0, props.haloIntensity);
|
|
30
|
+
if (props.falloff !== undefined)
|
|
31
|
+
uniforms.falloff = Math.max(0.01, props.falloff);
|
|
32
|
+
return uniforms;
|
|
33
|
+
},
|
|
34
|
+
fs: /* glsl */ `
|
|
35
|
+
layout(std140) uniform pointGlowUniforms {
|
|
36
|
+
float coreRadius;
|
|
37
|
+
float coreIntensity;
|
|
38
|
+
float haloIntensity;
|
|
39
|
+
float falloff;
|
|
40
|
+
} pointGlow;
|
|
41
|
+
|
|
42
|
+
// Coordinates span [-1, 1] across the sprite; tint is linear RGB.
|
|
43
|
+
vec3 pointGlow_getColor(vec2 coordinates, vec3 tint) {
|
|
44
|
+
float radius = length(coordinates);
|
|
45
|
+
float edgeWidth = max(fwidth(radius), 0.0001);
|
|
46
|
+
float envelope = 1.0 - smoothstep(1.0 - edgeWidth, 1.0, radius);
|
|
47
|
+
float core = 1.0 - smoothstep(pointGlow.coreRadius - edgeWidth * 0.5,
|
|
48
|
+
pointGlow.coreRadius + edgeWidth * 0.5, radius);
|
|
49
|
+
if (pointGlow.coreRadius <= 0.0) core = 0.0;
|
|
50
|
+
float outer = exp(-pointGlow.falloff);
|
|
51
|
+
float halo = max(0.0, (exp(-pointGlow.falloff * radius * radius) - outer) / (1.0 - outer));
|
|
52
|
+
return (vec3(core * pointGlow.coreIntensity) + tint * halo * pointGlow.haloIntensity) * envelope;
|
|
53
|
+
}
|
|
54
|
+
`,
|
|
55
|
+
source: /* wgsl */ `
|
|
56
|
+
struct pointGlowUniforms {
|
|
57
|
+
coreRadius: f32,
|
|
58
|
+
coreIntensity: f32,
|
|
59
|
+
haloIntensity: f32,
|
|
60
|
+
falloff: f32,
|
|
61
|
+
};
|
|
62
|
+
@group(3) @binding(auto) var<uniform> pointGlow: pointGlowUniforms;
|
|
63
|
+
|
|
64
|
+
fn pointGlow_getColor(coordinates: vec2<f32>, tint: vec3<f32>) -> vec3<f32> {
|
|
65
|
+
let radius = length(coordinates);
|
|
66
|
+
let edgeWidth = max(fwidth(radius), 0.0001);
|
|
67
|
+
let envelope = 1.0 - smoothstep(1.0 - edgeWidth, 1.0, radius);
|
|
68
|
+
var core = 1.0 - smoothstep(pointGlow.coreRadius - edgeWidth * 0.5,
|
|
69
|
+
pointGlow.coreRadius + edgeWidth * 0.5, radius);
|
|
70
|
+
if (pointGlow.coreRadius <= 0.0) { core = 0.0; }
|
|
71
|
+
let outer = exp(-pointGlow.falloff);
|
|
72
|
+
let halo = max(0.0, (exp(-pointGlow.falloff * radius * radius) - outer) / (1.0 - outer));
|
|
73
|
+
return (vec3<f32>(core * pointGlow.coreIntensity) + tint * halo * pointGlow.haloIntensity) * envelope;
|
|
74
|
+
}
|
|
75
|
+
`
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=point-glow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"point-glow.js","sourceRoot":"","sources":["../../../../src/modules/geometry/point-glow/point-glow.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAY5D,MAAM,gBAAgB,GAAsB;IAC1C,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,GAAG;IAClB,OAAO,EAAE,CAAC;CACX,CAAC;AAEF,oGAAoG;AACpG,MAAM,CAAC,MAAM,SAAS,GAAoD;IACxE,IAAI,EAAE,WAAW;IACjB,gBAAgB,EAAE,CAAC;IACnB,aAAa,EAAE,CAAC,EAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;IAC9C,YAAY,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,KAAK;QACpB,OAAO,EAAE,KAAK;KACf;IACD,eAAe,EAAE,gBAAgB;IACjC,WAAW,CAAC,KAAK,GAAG,EAAE,EAAE,gBAAgB,GAAG,gBAAgB;QACzD,MAAM,QAAQ,GAAG,EAAC,GAAG,gBAAgB,EAAE,GAAG,gBAAgB,EAAC,CAAC;QAC5D,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;YAChC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;QACnE,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS;YACnC,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;QAC5D,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS;YACnC,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;QAC5D,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;YAAE,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClF,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,EAAE,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;CAoBhB;IACC,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;CAoBpB;CACA,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
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 precipitation_exports = {};
|
|
19
|
+
__export(precipitation_exports, {
|
|
20
|
+
precipitation: () => precipitation
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(precipitation_exports);
|
|
23
|
+
const precipitation = {
|
|
24
|
+
name: "precipitation",
|
|
25
|
+
bindingLayout: [{ name: "precipitation", group: 3 }],
|
|
26
|
+
uniformTypes: {
|
|
27
|
+
time: "f32",
|
|
28
|
+
fallSpeed: "f32",
|
|
29
|
+
turbulence: "f32",
|
|
30
|
+
seed: "f32",
|
|
31
|
+
volumeCenter: "vec3<f32>",
|
|
32
|
+
volumeSize: "vec3<f32>",
|
|
33
|
+
wind: "vec2<f32>"
|
|
34
|
+
},
|
|
35
|
+
defaultUniforms: {
|
|
36
|
+
time: 0,
|
|
37
|
+
fallSpeed: 20,
|
|
38
|
+
turbulence: 0,
|
|
39
|
+
seed: 29,
|
|
40
|
+
volumeCenter: [0, 0, 150],
|
|
41
|
+
volumeSize: [1200, 1600, 300],
|
|
42
|
+
wind: [2, 0]
|
|
43
|
+
},
|
|
44
|
+
getUniforms(props = {}) {
|
|
45
|
+
return props;
|
|
46
|
+
},
|
|
47
|
+
vs: (
|
|
48
|
+
/* glsl */
|
|
49
|
+
`
|
|
50
|
+
layout(std140) uniform precipitationUniforms {
|
|
51
|
+
float time;
|
|
52
|
+
float fallSpeed;
|
|
53
|
+
float turbulence;
|
|
54
|
+
float seed;
|
|
55
|
+
vec3 volumeCenter;
|
|
56
|
+
vec3 volumeSize;
|
|
57
|
+
vec2 wind;
|
|
58
|
+
} precipitation;
|
|
59
|
+
float precipitation_random(uint identifier) {
|
|
60
|
+
uint value = identifier + uint(precipitation.seed) * 747796405u;
|
|
61
|
+
value = (value ^ (value >> 16u)) * 2246822519u;
|
|
62
|
+
value = (value ^ (value >> 13u)) * 3266489917u;
|
|
63
|
+
value = value ^ (value >> 16u);
|
|
64
|
+
return float(value & 16777215u) / 16777216.0;
|
|
65
|
+
}
|
|
66
|
+
vec3 precipitation_getPosition(uint identifier) {
|
|
67
|
+
vec3 randomPosition = vec3(precipitation_random(identifier * 3u), precipitation_random(identifier * 3u + 1u), precipitation_random(identifier * 3u + 2u));
|
|
68
|
+
vec3 volumeSize = max(precipitation.volumeSize, vec3(0.001));
|
|
69
|
+
vec3 minimum = precipitation.volumeCenter - volumeSize * 0.5;
|
|
70
|
+
vec3 drift = vec3(precipitation.wind, -precipitation.fallSpeed) * precipitation.time;
|
|
71
|
+
vec3 position = mod(randomPosition * volumeSize + drift - minimum, volumeSize) + minimum;
|
|
72
|
+
position.xy += precipitation.turbulence * vec2(sin(precipitation.time * 0.9 + randomPosition.z * 31.0), cos(precipitation.time * 0.7 + randomPosition.x * 23.0));
|
|
73
|
+
return position;
|
|
74
|
+
}
|
|
75
|
+
float precipitation_getFade(vec3 position) {
|
|
76
|
+
vec3 edge = 0.5 - abs((position - precipitation.volumeCenter) / max(precipitation.volumeSize, vec3(0.001)));
|
|
77
|
+
return smoothstep(0.0, 0.08, min(edge.x, min(edge.y, edge.z)));
|
|
78
|
+
}
|
|
79
|
+
`
|
|
80
|
+
),
|
|
81
|
+
source: (
|
|
82
|
+
/* wgsl */
|
|
83
|
+
`
|
|
84
|
+
struct precipitationUniforms {
|
|
85
|
+
time: f32,
|
|
86
|
+
fallSpeed: f32,
|
|
87
|
+
turbulence: f32,
|
|
88
|
+
seed: f32,
|
|
89
|
+
volumeCenter: vec3<f32>,
|
|
90
|
+
volumeSize: vec3<f32>,
|
|
91
|
+
wind: vec2<f32>,
|
|
92
|
+
};
|
|
93
|
+
@group(3) @binding(auto) var<uniform> precipitation: precipitationUniforms;
|
|
94
|
+
fn precipitation_random(identifier: u32) -> f32 {
|
|
95
|
+
var value = identifier + u32(precipitation.seed) * 747796405u;
|
|
96
|
+
value = (value ^ (value >> 16u)) * 2246822519u;
|
|
97
|
+
value = (value ^ (value >> 13u)) * 3266489917u;
|
|
98
|
+
value = value ^ (value >> 16u);
|
|
99
|
+
return f32(value & 16777215u) / 16777216.0;
|
|
100
|
+
}
|
|
101
|
+
fn precipitation_getPosition(identifier: u32) -> vec3<f32> {
|
|
102
|
+
let randomPosition = vec3<f32>(precipitation_random(identifier * 3u), precipitation_random(identifier * 3u + 1u), precipitation_random(identifier * 3u + 2u));
|
|
103
|
+
let volumeSize = max(precipitation.volumeSize, vec3<f32>(0.001));
|
|
104
|
+
let minimum = precipitation.volumeCenter - volumeSize * 0.5;
|
|
105
|
+
let drift = vec3<f32>(precipitation.wind, -precipitation.fallSpeed) * precipitation.time;
|
|
106
|
+
let unwrapped = randomPosition * volumeSize + drift - minimum;
|
|
107
|
+
var position = unwrapped - floor(unwrapped / volumeSize) * volumeSize + minimum;
|
|
108
|
+
position.x += precipitation.turbulence * sin(precipitation.time * 0.9 + randomPosition.z * 31.0);
|
|
109
|
+
position.y += precipitation.turbulence * cos(precipitation.time * 0.7 + randomPosition.x * 23.0);
|
|
110
|
+
return position;
|
|
111
|
+
}
|
|
112
|
+
fn precipitation_getFade(position: vec3<f32>) -> f32 {
|
|
113
|
+
let edge = 0.5 - abs((position - precipitation.volumeCenter) / max(precipitation.volumeSize, vec3<f32>(0.001)));
|
|
114
|
+
return smoothstep(0.0, 0.08, min(edge.x, min(edge.y, edge.z)));
|
|
115
|
+
}
|
|
116
|
+
`
|
|
117
|
+
)
|
|
118
|
+
};
|
|
119
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
120
|
+
0 && (module.exports = {
|
|
121
|
+
precipitation
|
|
122
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type PrecipitationUniforms = {
|
|
2
|
+
time: number;
|
|
3
|
+
fallSpeed: number;
|
|
4
|
+
turbulence: number;
|
|
5
|
+
seed: number;
|
|
6
|
+
volumeCenter: [number, number, number];
|
|
7
|
+
volumeSize: [number, number, number];
|
|
8
|
+
wind: [number, number];
|
|
9
|
+
};
|
|
10
|
+
export type PrecipitationProps = Partial<PrecipitationUniforms>;
|
|
11
|
+
/** Stateless, seeded falling particles in a movable volume. Coordinates are local metres. */
|
|
12
|
+
export declare const precipitation: {
|
|
13
|
+
readonly name: "precipitation";
|
|
14
|
+
readonly bindingLayout: readonly [{
|
|
15
|
+
readonly name: "precipitation";
|
|
16
|
+
readonly group: 3;
|
|
17
|
+
}];
|
|
18
|
+
readonly uniformTypes: {
|
|
19
|
+
readonly time: "f32";
|
|
20
|
+
readonly fallSpeed: "f32";
|
|
21
|
+
readonly turbulence: "f32";
|
|
22
|
+
readonly seed: "f32";
|
|
23
|
+
readonly volumeCenter: "vec3<f32>";
|
|
24
|
+
readonly volumeSize: "vec3<f32>";
|
|
25
|
+
readonly wind: "vec2<f32>";
|
|
26
|
+
};
|
|
27
|
+
readonly defaultUniforms: {
|
|
28
|
+
readonly time: 0;
|
|
29
|
+
readonly fallSpeed: 20;
|
|
30
|
+
readonly turbulence: 0;
|
|
31
|
+
readonly seed: 29;
|
|
32
|
+
readonly volumeCenter: [0, 0, 150];
|
|
33
|
+
readonly volumeSize: [1200, 1600, 300];
|
|
34
|
+
readonly wind: [2, 0];
|
|
35
|
+
};
|
|
36
|
+
readonly getUniforms: (props?: PrecipitationProps) => Partial<PrecipitationUniforms>;
|
|
37
|
+
readonly vs: "\nlayout(std140) uniform precipitationUniforms {\n float time;\n float fallSpeed;\n float turbulence;\n float seed;\n vec3 volumeCenter;\n vec3 volumeSize;\n vec2 wind;\n} precipitation;\nfloat precipitation_random(uint identifier) {\n uint value = identifier + uint(precipitation.seed) * 747796405u;\n value = (value ^ (value >> 16u)) * 2246822519u;\n value = (value ^ (value >> 13u)) * 3266489917u;\n value = value ^ (value >> 16u);\n return float(value & 16777215u) / 16777216.0;\n}\nvec3 precipitation_getPosition(uint identifier) {\n vec3 randomPosition = vec3(precipitation_random(identifier * 3u), precipitation_random(identifier * 3u + 1u), precipitation_random(identifier * 3u + 2u));\n vec3 volumeSize = max(precipitation.volumeSize, vec3(0.001));\n vec3 minimum = precipitation.volumeCenter - volumeSize * 0.5;\n vec3 drift = vec3(precipitation.wind, -precipitation.fallSpeed) * precipitation.time;\n vec3 position = mod(randomPosition * volumeSize + drift - minimum, volumeSize) + minimum;\n position.xy += precipitation.turbulence * vec2(sin(precipitation.time * 0.9 + randomPosition.z * 31.0), cos(precipitation.time * 0.7 + randomPosition.x * 23.0));\n return position;\n}\nfloat precipitation_getFade(vec3 position) {\n vec3 edge = 0.5 - abs((position - precipitation.volumeCenter) / max(precipitation.volumeSize, vec3(0.001)));\n return smoothstep(0.0, 0.08, min(edge.x, min(edge.y, edge.z)));\n}\n";
|
|
38
|
+
readonly source: "\nstruct precipitationUniforms {\n time: f32,\n fallSpeed: f32,\n turbulence: f32,\n seed: f32,\n volumeCenter: vec3<f32>,\n volumeSize: vec3<f32>,\n wind: vec2<f32>,\n};\n@group(3) @binding(auto) var<uniform> precipitation: precipitationUniforms;\nfn precipitation_random(identifier: u32) -> f32 {\n var value = identifier + u32(precipitation.seed) * 747796405u;\n value = (value ^ (value >> 16u)) * 2246822519u;\n value = (value ^ (value >> 13u)) * 3266489917u;\n value = value ^ (value >> 16u);\n return f32(value & 16777215u) / 16777216.0;\n}\nfn precipitation_getPosition(identifier: u32) -> vec3<f32> {\n let randomPosition = vec3<f32>(precipitation_random(identifier * 3u), precipitation_random(identifier * 3u + 1u), precipitation_random(identifier * 3u + 2u));\n let volumeSize = max(precipitation.volumeSize, vec3<f32>(0.001));\n let minimum = precipitation.volumeCenter - volumeSize * 0.5;\n let drift = vec3<f32>(precipitation.wind, -precipitation.fallSpeed) * precipitation.time;\n let unwrapped = randomPosition * volumeSize + drift - minimum;\n var position = unwrapped - floor(unwrapped / volumeSize) * volumeSize + minimum;\n position.x += precipitation.turbulence * sin(precipitation.time * 0.9 + randomPosition.z * 31.0);\n position.y += precipitation.turbulence * cos(precipitation.time * 0.7 + randomPosition.x * 23.0);\n return position;\n}\nfn precipitation_getFade(position: vec3<f32>) -> f32 {\n let edge = 0.5 - abs((position - precipitation.volumeCenter) / max(precipitation.volumeSize, vec3<f32>(0.001)));\n return smoothstep(0.0, 0.08, min(edge.x, min(edge.y, edge.z)));\n}\n";
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=precipitation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"precipitation.d.ts","sourceRoot":"","sources":["../../../../src/modules/geometry/precipitation/precipitation.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxB,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEhE,6FAA6F;AAC7F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;mCAqBL,kBAAkB;;;CAoEqC,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/** Stateless, seeded falling particles in a movable volume. Coordinates are local metres. */
|
|
5
|
+
export const precipitation = {
|
|
6
|
+
name: 'precipitation',
|
|
7
|
+
bindingLayout: [{ name: 'precipitation', group: 3 }],
|
|
8
|
+
uniformTypes: {
|
|
9
|
+
time: 'f32',
|
|
10
|
+
fallSpeed: 'f32',
|
|
11
|
+
turbulence: 'f32',
|
|
12
|
+
seed: 'f32',
|
|
13
|
+
volumeCenter: 'vec3<f32>',
|
|
14
|
+
volumeSize: 'vec3<f32>',
|
|
15
|
+
wind: 'vec2<f32>'
|
|
16
|
+
},
|
|
17
|
+
defaultUniforms: {
|
|
18
|
+
time: 0,
|
|
19
|
+
fallSpeed: 20,
|
|
20
|
+
turbulence: 0,
|
|
21
|
+
seed: 29,
|
|
22
|
+
volumeCenter: [0, 0, 150],
|
|
23
|
+
volumeSize: [1200, 1600, 300],
|
|
24
|
+
wind: [2, 0]
|
|
25
|
+
},
|
|
26
|
+
getUniforms(props = {}) {
|
|
27
|
+
return props;
|
|
28
|
+
},
|
|
29
|
+
vs: /* glsl */ `
|
|
30
|
+
layout(std140) uniform precipitationUniforms {
|
|
31
|
+
float time;
|
|
32
|
+
float fallSpeed;
|
|
33
|
+
float turbulence;
|
|
34
|
+
float seed;
|
|
35
|
+
vec3 volumeCenter;
|
|
36
|
+
vec3 volumeSize;
|
|
37
|
+
vec2 wind;
|
|
38
|
+
} precipitation;
|
|
39
|
+
float precipitation_random(uint identifier) {
|
|
40
|
+
uint value = identifier + uint(precipitation.seed) * 747796405u;
|
|
41
|
+
value = (value ^ (value >> 16u)) * 2246822519u;
|
|
42
|
+
value = (value ^ (value >> 13u)) * 3266489917u;
|
|
43
|
+
value = value ^ (value >> 16u);
|
|
44
|
+
return float(value & 16777215u) / 16777216.0;
|
|
45
|
+
}
|
|
46
|
+
vec3 precipitation_getPosition(uint identifier) {
|
|
47
|
+
vec3 randomPosition = vec3(precipitation_random(identifier * 3u), precipitation_random(identifier * 3u + 1u), precipitation_random(identifier * 3u + 2u));
|
|
48
|
+
vec3 volumeSize = max(precipitation.volumeSize, vec3(0.001));
|
|
49
|
+
vec3 minimum = precipitation.volumeCenter - volumeSize * 0.5;
|
|
50
|
+
vec3 drift = vec3(precipitation.wind, -precipitation.fallSpeed) * precipitation.time;
|
|
51
|
+
vec3 position = mod(randomPosition * volumeSize + drift - minimum, volumeSize) + minimum;
|
|
52
|
+
position.xy += precipitation.turbulence * vec2(sin(precipitation.time * 0.9 + randomPosition.z * 31.0), cos(precipitation.time * 0.7 + randomPosition.x * 23.0));
|
|
53
|
+
return position;
|
|
54
|
+
}
|
|
55
|
+
float precipitation_getFade(vec3 position) {
|
|
56
|
+
vec3 edge = 0.5 - abs((position - precipitation.volumeCenter) / max(precipitation.volumeSize, vec3(0.001)));
|
|
57
|
+
return smoothstep(0.0, 0.08, min(edge.x, min(edge.y, edge.z)));
|
|
58
|
+
}
|
|
59
|
+
`,
|
|
60
|
+
source: /* wgsl */ `
|
|
61
|
+
struct precipitationUniforms {
|
|
62
|
+
time: f32,
|
|
63
|
+
fallSpeed: f32,
|
|
64
|
+
turbulence: f32,
|
|
65
|
+
seed: f32,
|
|
66
|
+
volumeCenter: vec3<f32>,
|
|
67
|
+
volumeSize: vec3<f32>,
|
|
68
|
+
wind: vec2<f32>,
|
|
69
|
+
};
|
|
70
|
+
@group(3) @binding(auto) var<uniform> precipitation: precipitationUniforms;
|
|
71
|
+
fn precipitation_random(identifier: u32) -> f32 {
|
|
72
|
+
var value = identifier + u32(precipitation.seed) * 747796405u;
|
|
73
|
+
value = (value ^ (value >> 16u)) * 2246822519u;
|
|
74
|
+
value = (value ^ (value >> 13u)) * 3266489917u;
|
|
75
|
+
value = value ^ (value >> 16u);
|
|
76
|
+
return f32(value & 16777215u) / 16777216.0;
|
|
77
|
+
}
|
|
78
|
+
fn precipitation_getPosition(identifier: u32) -> vec3<f32> {
|
|
79
|
+
let randomPosition = vec3<f32>(precipitation_random(identifier * 3u), precipitation_random(identifier * 3u + 1u), precipitation_random(identifier * 3u + 2u));
|
|
80
|
+
let volumeSize = max(precipitation.volumeSize, vec3<f32>(0.001));
|
|
81
|
+
let minimum = precipitation.volumeCenter - volumeSize * 0.5;
|
|
82
|
+
let drift = vec3<f32>(precipitation.wind, -precipitation.fallSpeed) * precipitation.time;
|
|
83
|
+
let unwrapped = randomPosition * volumeSize + drift - minimum;
|
|
84
|
+
var position = unwrapped - floor(unwrapped / volumeSize) * volumeSize + minimum;
|
|
85
|
+
position.x += precipitation.turbulence * sin(precipitation.time * 0.9 + randomPosition.z * 31.0);
|
|
86
|
+
position.y += precipitation.turbulence * cos(precipitation.time * 0.7 + randomPosition.x * 23.0);
|
|
87
|
+
return position;
|
|
88
|
+
}
|
|
89
|
+
fn precipitation_getFade(position: vec3<f32>) -> f32 {
|
|
90
|
+
let edge = 0.5 - abs((position - precipitation.volumeCenter) / max(precipitation.volumeSize, vec3<f32>(0.001)));
|
|
91
|
+
return smoothstep(0.0, 0.08, min(edge.x, min(edge.y, edge.z)));
|
|
92
|
+
}
|
|
93
|
+
`
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=precipitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"precipitation.js","sourceRoot":"","sources":["../../../../src/modules/geometry/precipitation/precipitation.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAe5D,6FAA6F;AAC7F,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,aAAa,EAAE,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;IAClD,YAAY,EAAE;QACZ,IAAI,EAAE,KAAK;QACX,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE,KAAK;QACX,YAAY,EAAE,WAAW;QACzB,UAAU,EAAE,WAAW;QACvB,IAAI,EAAE,WAAW;KAClB;IACD,eAAe,EAAE;QACf,IAAI,EAAE,CAAC;QACP,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,CAAC;QACb,IAAI,EAAE,EAAE;QACR,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;QACzB,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;QAC7B,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KACb;IACD,WAAW,CAAC,QAA4B,EAAE;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,EAAE,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BhB;IACC,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCpB;CAC2E,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
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 sketch_stroke_exports = {};
|
|
19
|
+
__export(sketch_stroke_exports, {
|
|
20
|
+
sketchStroke: () => sketchStroke
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(sketch_stroke_exports);
|
|
23
|
+
const defaults = {
|
|
24
|
+
width: 2,
|
|
25
|
+
jitter: 0.7,
|
|
26
|
+
variation: 0.35,
|
|
27
|
+
grain: 0.45,
|
|
28
|
+
offset: 0,
|
|
29
|
+
extension: 3,
|
|
30
|
+
sketch: 1,
|
|
31
|
+
minimumAntialias: 0.7
|
|
32
|
+
};
|
|
33
|
+
const uniformBlock = `
|
|
34
|
+
layout(std140) uniform sketchStrokeUniforms {
|
|
35
|
+
float width;
|
|
36
|
+
float jitter;
|
|
37
|
+
float variation;
|
|
38
|
+
float grain;
|
|
39
|
+
float offset;
|
|
40
|
+
float extension;
|
|
41
|
+
float sketch;
|
|
42
|
+
float minimumAntialias;
|
|
43
|
+
} sketchStroke;
|
|
44
|
+
`;
|
|
45
|
+
const functions = `
|
|
46
|
+
float sketchStroke_noise(float coordinate) {
|
|
47
|
+
float cell = floor(coordinate);
|
|
48
|
+
float fraction = fract(coordinate);
|
|
49
|
+
float first = fract(sin(cell * 127.1) * 43758.5453);
|
|
50
|
+
float second = fract(sin((cell + 1.0) * 127.1) * 43758.5453);
|
|
51
|
+
return mix(first, second, fraction * fraction * (3.0 - 2.0 * fraction));
|
|
52
|
+
}
|
|
53
|
+
float sketchStroke_noise2(vec2 coordinate) {
|
|
54
|
+
vec2 cell = floor(coordinate);
|
|
55
|
+
vec2 fraction = fract(coordinate);
|
|
56
|
+
fraction = fraction * fraction * (3.0 - 2.0 * fraction);
|
|
57
|
+
float first = fract(sin(dot(cell, vec2(127.1, 311.7))) * 43758.5453);
|
|
58
|
+
float second = fract(sin(dot(cell + vec2(1.0, 0.0), vec2(127.1, 311.7))) * 43758.5453);
|
|
59
|
+
float third = fract(sin(dot(cell + vec2(0.0, 1.0), vec2(127.1, 311.7))) * 43758.5453);
|
|
60
|
+
float fourth = fract(sin(dot(cell + vec2(1.0, 1.0), vec2(127.1, 311.7))) * 43758.5453);
|
|
61
|
+
return mix(mix(first, second, fraction.x), mix(third, fourth, fraction.x), fraction.y);
|
|
62
|
+
}
|
|
63
|
+
// coordinates.x is normalized distance along a segment, y is signed transverse distance. All distances use the same units.
|
|
64
|
+
// Seeds belong to the geometry; neither camera position nor time changes the grain.
|
|
65
|
+
float sketchStroke_getCoverage(vec2 coordinates, float strokeLength, float seed) {
|
|
66
|
+
float along = coordinates.x;
|
|
67
|
+
float side = sketchStroke_noise(seed * 29.0) < 0.5 ? -1.0 : 1.0;
|
|
68
|
+
float center = (sketchStroke_noise(along * strokeLength / 36.0 + seed * 19.0) * 2.0 - 1.0) * sketchStroke.jitter * sketchStroke.sketch + side * sketchStroke.offset * sketchStroke.sketch;
|
|
69
|
+
float variation = mix(1.0, 0.55 + sketchStroke_noise(along * 31.0 + seed * 7.0) * 0.75, sketchStroke.variation * sketchStroke.sketch);
|
|
70
|
+
vec2 grainCoordinates = vec2(along * strokeLength, coordinates.y) + vec2(seed * 17.0, seed * 53.0);
|
|
71
|
+
float coarseGrain = sketchStroke_noise2(grainCoordinates * 0.55);
|
|
72
|
+
float fineGrain = sketchStroke_noise2(grainCoordinates * 2.8);
|
|
73
|
+
float toothGrain = sketchStroke_noise2(grainCoordinates * 6.5);
|
|
74
|
+
float grainTexture = coarseGrain * 0.35 + fineGrain * 0.4 + toothGrain * 0.25;
|
|
75
|
+
float edgeRoughness = (grainTexture - 0.5) * sketchStroke.grain * sketchStroke.sketch * 0.7;
|
|
76
|
+
float radius = sketchStroke.width * 0.5 * variation + edgeRoughness;
|
|
77
|
+
float endDistance = max(-along, along - 1.0) * strokeLength - sketchStroke.extension;
|
|
78
|
+
float distance = max(abs(coordinates.y - center) - radius, endDistance);
|
|
79
|
+
float antialias = max(fwidth(distance), max(sketchStroke.minimumAntialias, 0.0001));
|
|
80
|
+
float coverage = 1.0 - smoothstep(-antialias * 0.5, antialias * 0.5, distance);
|
|
81
|
+
// Keep the pigment opaque; grain changes the stroke edge so the paper does not show through as white flecks.
|
|
82
|
+
return coverage;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
const source = `
|
|
86
|
+
struct sketchStrokeUniforms {
|
|
87
|
+
width: f32,
|
|
88
|
+
jitter: f32,
|
|
89
|
+
variation: f32,
|
|
90
|
+
grain: f32,
|
|
91
|
+
offset: f32,
|
|
92
|
+
extension: f32,
|
|
93
|
+
sketch: f32,
|
|
94
|
+
minimumAntialias: f32,
|
|
95
|
+
};
|
|
96
|
+
@group(3) @binding(auto) var<uniform> sketchStroke: sketchStrokeUniforms;
|
|
97
|
+
fn sketchStroke_noise(coordinate: f32) -> f32 {
|
|
98
|
+
let cell = floor(coordinate);
|
|
99
|
+
let fraction = fract(coordinate);
|
|
100
|
+
let first = fract(sin(cell * 127.1) * 43758.5453);
|
|
101
|
+
let second = fract(sin((cell + 1.0) * 127.1) * 43758.5453);
|
|
102
|
+
return mix(first, second, fraction * fraction * (3.0 - 2.0 * fraction));
|
|
103
|
+
}
|
|
104
|
+
fn sketchStroke_noise2(coordinate: vec2<f32>) -> f32 {
|
|
105
|
+
let cell = floor(coordinate);
|
|
106
|
+
var fraction = fract(coordinate);
|
|
107
|
+
fraction = fraction * fraction * (vec2<f32>(3.0) - 2.0 * fraction);
|
|
108
|
+
let first = fract(sin(dot(cell, vec2<f32>(127.1, 311.7))) * 43758.5453);
|
|
109
|
+
let second = fract(sin(dot(cell + vec2<f32>(1.0, 0.0), vec2<f32>(127.1, 311.7))) * 43758.5453);
|
|
110
|
+
let third = fract(sin(dot(cell + vec2<f32>(0.0, 1.0), vec2<f32>(127.1, 311.7))) * 43758.5453);
|
|
111
|
+
let fourth = fract(sin(dot(cell + vec2<f32>(1.0, 1.0), vec2<f32>(127.1, 311.7))) * 43758.5453);
|
|
112
|
+
return mix(mix(first, second, fraction.x), mix(third, fourth, fraction.x), fraction.y);
|
|
113
|
+
}
|
|
114
|
+
fn sketchStroke_getCoverage(coordinates: vec2<f32>, strokeLength: f32, seed: f32) -> f32 {
|
|
115
|
+
let along = coordinates.x;
|
|
116
|
+
let side = select(1.0, -1.0, sketchStroke_noise(seed * 29.0) < 0.5);
|
|
117
|
+
let center = (sketchStroke_noise(along * strokeLength / 36.0 + seed * 19.0) * 2.0 - 1.0) * sketchStroke.jitter * sketchStroke.sketch + side * sketchStroke.offset * sketchStroke.sketch;
|
|
118
|
+
let variation = mix(1.0, 0.55 + sketchStroke_noise(along * 31.0 + seed * 7.0) * 0.75, sketchStroke.variation * sketchStroke.sketch);
|
|
119
|
+
let grainCoordinates = vec2<f32>(along * strokeLength, coordinates.y) + vec2<f32>(seed * 17.0, seed * 53.0);
|
|
120
|
+
let coarseGrain = sketchStroke_noise2(grainCoordinates * 0.55);
|
|
121
|
+
let fineGrain = sketchStroke_noise2(grainCoordinates * 2.8);
|
|
122
|
+
let toothGrain = sketchStroke_noise2(grainCoordinates * 6.5);
|
|
123
|
+
let grainTexture = coarseGrain * 0.35 + fineGrain * 0.4 + toothGrain * 0.25;
|
|
124
|
+
let edgeRoughness = (grainTexture - 0.5) * sketchStroke.grain * sketchStroke.sketch * 0.7;
|
|
125
|
+
let radius = sketchStroke.width * 0.5 * variation + edgeRoughness;
|
|
126
|
+
let endDistance = max(-along, along - 1.0) * strokeLength - sketchStroke.extension;
|
|
127
|
+
let distance = max(abs(coordinates.y - center) - radius, endDistance);
|
|
128
|
+
let antialias = max(fwidth(distance), max(sketchStroke.minimumAntialias, 0.0001));
|
|
129
|
+
let coverage = 1.0 - smoothstep(-antialias * 0.5, antialias * 0.5, distance);
|
|
130
|
+
// Keep the pigment opaque; grain changes the stroke edge so the paper does not show through as white flecks.
|
|
131
|
+
return coverage;
|
|
132
|
+
}
|
|
133
|
+
`;
|
|
134
|
+
const sketchStroke = {
|
|
135
|
+
name: "sketchStroke",
|
|
136
|
+
bindingLayout: [{ name: "sketchStroke", group: 3 }],
|
|
137
|
+
source,
|
|
138
|
+
vs: uniformBlock,
|
|
139
|
+
fs: uniformBlock + functions,
|
|
140
|
+
uniformTypes: {
|
|
141
|
+
width: "f32",
|
|
142
|
+
jitter: "f32",
|
|
143
|
+
variation: "f32",
|
|
144
|
+
grain: "f32",
|
|
145
|
+
offset: "f32",
|
|
146
|
+
extension: "f32",
|
|
147
|
+
sketch: "f32",
|
|
148
|
+
minimumAntialias: "f32"
|
|
149
|
+
},
|
|
150
|
+
defaultUniforms: defaults,
|
|
151
|
+
getUniforms(props = {}) {
|
|
152
|
+
return { ...defaults, ...props };
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
156
|
+
0 && (module.exports = {
|
|
157
|
+
sketchStroke
|
|
158
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type SketchStrokeProps = {
|
|
2
|
+
/** Full stroke width in the same units as the transverse coordinate. */
|
|
3
|
+
width?: number;
|
|
4
|
+
/** Maximum centerline displacement in transverse-coordinate units. */
|
|
5
|
+
jitter?: number;
|
|
6
|
+
/** Fractional width variation, from zero to one. */
|
|
7
|
+
variation?: number;
|
|
8
|
+
/** Strength of pencil grain, from zero to one. */
|
|
9
|
+
grain?: number;
|
|
10
|
+
/** Transverse screen-space displacement for a secondary hand-drawn pass. */
|
|
11
|
+
offset?: number;
|
|
12
|
+
/** Endpoint overshoot in stroke units; geometry must reserve this space. */
|
|
13
|
+
extension?: number;
|
|
14
|
+
/** Zero gives a solid stroke; one enables sketch shading. */
|
|
15
|
+
sketch?: number;
|
|
16
|
+
/** Minimum edge smoothing in stroke units. Defaults to 0.7 for pixel-sized strokes. */
|
|
17
|
+
minimumAntialias?: number;
|
|
18
|
+
};
|
|
19
|
+
/** Fragment coverage for geometry-anchored pencil strokes and solid architectural lines. */
|
|
20
|
+
export declare const sketchStroke: {
|
|
21
|
+
readonly name: "sketchStroke";
|
|
22
|
+
readonly bindingLayout: readonly [{
|
|
23
|
+
readonly name: "sketchStroke";
|
|
24
|
+
readonly group: 3;
|
|
25
|
+
}];
|
|
26
|
+
readonly source: "\nstruct sketchStrokeUniforms {\n width: f32,\n jitter: f32,\n variation: f32,\n grain: f32,\n offset: f32,\n extension: f32,\n sketch: f32,\n minimumAntialias: f32,\n};\n@group(3) @binding(auto) var<uniform> sketchStroke: sketchStrokeUniforms;\nfn sketchStroke_noise(coordinate: f32) -> f32 {\n let cell = floor(coordinate);\n let fraction = fract(coordinate);\n let first = fract(sin(cell * 127.1) * 43758.5453);\n let second = fract(sin((cell + 1.0) * 127.1) * 43758.5453);\n return mix(first, second, fraction * fraction * (3.0 - 2.0 * fraction));\n}\nfn sketchStroke_noise2(coordinate: vec2<f32>) -> f32 {\n let cell = floor(coordinate);\n var fraction = fract(coordinate);\n fraction = fraction * fraction * (vec2<f32>(3.0) - 2.0 * fraction);\n let first = fract(sin(dot(cell, vec2<f32>(127.1, 311.7))) * 43758.5453);\n let second = fract(sin(dot(cell + vec2<f32>(1.0, 0.0), vec2<f32>(127.1, 311.7))) * 43758.5453);\n let third = fract(sin(dot(cell + vec2<f32>(0.0, 1.0), vec2<f32>(127.1, 311.7))) * 43758.5453);\n let fourth = fract(sin(dot(cell + vec2<f32>(1.0, 1.0), vec2<f32>(127.1, 311.7))) * 43758.5453);\n return mix(mix(first, second, fraction.x), mix(third, fourth, fraction.x), fraction.y);\n}\nfn sketchStroke_getCoverage(coordinates: vec2<f32>, strokeLength: f32, seed: f32) -> f32 {\n let along = coordinates.x;\n let side = select(1.0, -1.0, sketchStroke_noise(seed * 29.0) < 0.5);\n let center = (sketchStroke_noise(along * strokeLength / 36.0 + seed * 19.0) * 2.0 - 1.0) * sketchStroke.jitter * sketchStroke.sketch + side * sketchStroke.offset * sketchStroke.sketch;\n let variation = mix(1.0, 0.55 + sketchStroke_noise(along * 31.0 + seed * 7.0) * 0.75, sketchStroke.variation * sketchStroke.sketch);\n let grainCoordinates = vec2<f32>(along * strokeLength, coordinates.y) + vec2<f32>(seed * 17.0, seed * 53.0);\n let coarseGrain = sketchStroke_noise2(grainCoordinates * 0.55);\n let fineGrain = sketchStroke_noise2(grainCoordinates * 2.8);\n let toothGrain = sketchStroke_noise2(grainCoordinates * 6.5);\n let grainTexture = coarseGrain * 0.35 + fineGrain * 0.4 + toothGrain * 0.25;\n let edgeRoughness = (grainTexture - 0.5) * sketchStroke.grain * sketchStroke.sketch * 0.7;\n let radius = sketchStroke.width * 0.5 * variation + edgeRoughness;\n let endDistance = max(-along, along - 1.0) * strokeLength - sketchStroke.extension;\n let distance = max(abs(coordinates.y - center) - radius, endDistance);\n let antialias = max(fwidth(distance), max(sketchStroke.minimumAntialias, 0.0001));\n let coverage = 1.0 - smoothstep(-antialias * 0.5, antialias * 0.5, distance);\n // Keep the pigment opaque; grain changes the stroke edge so the paper does not show through as white flecks.\n return coverage;\n}\n";
|
|
27
|
+
readonly vs: "\nlayout(std140) uniform sketchStrokeUniforms {\n float width;\n float jitter;\n float variation;\n float grain;\n float offset;\n float extension;\n float sketch;\n float minimumAntialias;\n} sketchStroke;\n";
|
|
28
|
+
readonly fs: string;
|
|
29
|
+
readonly uniformTypes: {
|
|
30
|
+
readonly width: "f32";
|
|
31
|
+
readonly jitter: "f32";
|
|
32
|
+
readonly variation: "f32";
|
|
33
|
+
readonly grain: "f32";
|
|
34
|
+
readonly offset: "f32";
|
|
35
|
+
readonly extension: "f32";
|
|
36
|
+
readonly sketch: "f32";
|
|
37
|
+
readonly minimumAntialias: "f32";
|
|
38
|
+
};
|
|
39
|
+
readonly defaultUniforms: {
|
|
40
|
+
width: number;
|
|
41
|
+
jitter: number;
|
|
42
|
+
variation: number;
|
|
43
|
+
grain: number;
|
|
44
|
+
offset: number;
|
|
45
|
+
extension: number;
|
|
46
|
+
sketch: number;
|
|
47
|
+
minimumAntialias: number;
|
|
48
|
+
};
|
|
49
|
+
readonly getUniforms: (props?: SketchStrokeProps) => {
|
|
50
|
+
width: number;
|
|
51
|
+
jitter: number;
|
|
52
|
+
variation: number;
|
|
53
|
+
grain: number;
|
|
54
|
+
offset: number;
|
|
55
|
+
extension: number;
|
|
56
|
+
sketch: number;
|
|
57
|
+
minimumAntialias: number;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=sketch-stroke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sketch-stroke.d.ts","sourceRoot":"","sources":["../../../../src/modules/geometry/sketch-stroke/sketch-stroke.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAmHF,4FAA4F;AAC5F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAiBJ,iBAAiB;eApJ5B,MAAM;gBAEL,MAAM;mBAEH,MAAM;eAEV,MAAM;gBAEL,MAAM;mBAEH,MAAM;gBAET,MAAM;0BAEI,MAAM;;CAyI4C,CAAC"}
|