@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,334 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {ShaderBinding as Binding} from '../../types';
|
|
6
|
+
import {ShaderModule} from '../../lib/shader-module/shader-module';
|
|
7
|
+
|
|
8
|
+
/** Props for semantic color normalization helpers. */
|
|
9
|
+
export type ColorsProps = {
|
|
10
|
+
/**
|
|
11
|
+
* When true, semantic colors are interpreted as 0-255 byte-style values and normalized in shader code.
|
|
12
|
+
* When false, semantic colors are interpreted directly as floats.
|
|
13
|
+
*/
|
|
14
|
+
useByteColors?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** Uniforms consumed by semantic color normalization helpers. */
|
|
18
|
+
export type ColorsUniforms = {
|
|
19
|
+
/** Controls whether shader helpers normalize semantic colors from byte space. */
|
|
20
|
+
useByteColors: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** Backward-compatible props alias for shaders that import `floatColors`. */
|
|
24
|
+
export type FloatColorsProps = ColorsProps;
|
|
25
|
+
/** Backward-compatible uniform alias for shaders that import `floatColors`. */
|
|
26
|
+
export type FloatColorsUniforms = ColorsUniforms;
|
|
27
|
+
|
|
28
|
+
/** Packed storage color formats decoded by `storageColors`. */
|
|
29
|
+
export type StorageColorFormat = 'rgba8unorm' | 'rgba16float' | 'rgba32float';
|
|
30
|
+
|
|
31
|
+
/** Numeric WGSL tags written to `storageColors.format`. */
|
|
32
|
+
export const STORAGE_COLOR_FORMAT = {
|
|
33
|
+
RGBA8UNORM: 0,
|
|
34
|
+
RGBA16FLOAT: 1,
|
|
35
|
+
RGBA32FLOAT: 2
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
/** Numeric WGSL tag for one packed storage color format. */
|
|
39
|
+
export type StorageColorFormatValue =
|
|
40
|
+
(typeof STORAGE_COLOR_FORMAT)[keyof typeof STORAGE_COLOR_FORMAT];
|
|
41
|
+
|
|
42
|
+
/** Bytes occupied by one tightly packed storage color row. */
|
|
43
|
+
export const STORAGE_COLOR_FORMAT_BYTE_LENGTHS: Record<StorageColorFormat, number> = {
|
|
44
|
+
rgba8unorm: 4,
|
|
45
|
+
rgba16float: 8,
|
|
46
|
+
rgba32float: 16
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** Default byte stride for one tightly packed storage color row. */
|
|
50
|
+
export const STORAGE_COLOR_DEFAULT_BYTE_STRIDES: Record<StorageColorFormat, number> = {
|
|
51
|
+
...STORAGE_COLOR_FORMAT_BYTE_LENGTHS
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** Props for reading packed color rows from a read-only storage buffer. */
|
|
55
|
+
export type StorageColorsProps = {
|
|
56
|
+
/** Storage buffer containing raw packed color words. */
|
|
57
|
+
colorBuffer?: Binding;
|
|
58
|
+
/** Per-row storage color representation. Defaults to `rgba8unorm`. */
|
|
59
|
+
format?: StorageColorFormat | StorageColorFormatValue;
|
|
60
|
+
/** Byte offset to the first color. Must be 4-byte aligned. Defaults to `0`. */
|
|
61
|
+
byteOffset?: number;
|
|
62
|
+
/** Bytes between color rows. Must be 4-byte aligned. Defaults to the packed format size. */
|
|
63
|
+
byteStride?: number;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** Uniforms consumed by the packed storage color reader. */
|
|
67
|
+
export type StorageColorsUniforms = {
|
|
68
|
+
/** Numeric `STORAGE_COLOR_FORMAT` tag used by WGSL. */
|
|
69
|
+
format: StorageColorFormatValue;
|
|
70
|
+
/** Uint32 words between storage color rows. */
|
|
71
|
+
wordStride: number;
|
|
72
|
+
/** Uint32 word offset to the first storage color row. */
|
|
73
|
+
wordOffset: number;
|
|
74
|
+
/** Reserved field retaining a 16-byte uniform block. */
|
|
75
|
+
_padding: number;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** Bindings consumed by the packed storage color reader. */
|
|
79
|
+
export type StorageColorsBindings = {
|
|
80
|
+
/** Raw packed storage color buffer exposed as `array<u32>`. */
|
|
81
|
+
storageColorsBuffer?: Binding;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const STORAGE_COLOR_FORMAT_BY_NAME: Record<StorageColorFormat, StorageColorFormatValue> = {
|
|
85
|
+
rgba8unorm: STORAGE_COLOR_FORMAT.RGBA8UNORM,
|
|
86
|
+
rgba16float: STORAGE_COLOR_FORMAT.RGBA16FLOAT,
|
|
87
|
+
rgba32float: STORAGE_COLOR_FORMAT.RGBA32FLOAT
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const STORAGE_COLOR_FORMAT_NAME_BY_VALUE: Record<StorageColorFormatValue, StorageColorFormat> = {
|
|
91
|
+
[STORAGE_COLOR_FORMAT.RGBA8UNORM]: 'rgba8unorm',
|
|
92
|
+
[STORAGE_COLOR_FORMAT.RGBA16FLOAT]: 'rgba16float',
|
|
93
|
+
[STORAGE_COLOR_FORMAT.RGBA32FLOAT]: 'rgba32float'
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const COLORS_UNIFORM_TYPES = {
|
|
97
|
+
useByteColors: 'f32'
|
|
98
|
+
} as const;
|
|
99
|
+
|
|
100
|
+
const COLORS_DEFAULT_UNIFORMS = {
|
|
101
|
+
useByteColors: true
|
|
102
|
+
} as const;
|
|
103
|
+
|
|
104
|
+
const STORAGE_COLORS_UNIFORM_TYPES = {
|
|
105
|
+
format: 'u32',
|
|
106
|
+
wordStride: 'u32',
|
|
107
|
+
wordOffset: 'u32',
|
|
108
|
+
_padding: 'u32'
|
|
109
|
+
} as const;
|
|
110
|
+
|
|
111
|
+
const STORAGE_COLORS_DEFAULT_UNIFORMS = {
|
|
112
|
+
format: STORAGE_COLOR_FORMAT.RGBA8UNORM,
|
|
113
|
+
wordStride: STORAGE_COLOR_DEFAULT_BYTE_STRIDES.rgba8unorm / Uint32Array.BYTES_PER_ELEMENT,
|
|
114
|
+
wordOffset: 0,
|
|
115
|
+
_padding: 0
|
|
116
|
+
} as const satisfies StorageColorsUniforms;
|
|
117
|
+
|
|
118
|
+
const COLORS_GLSL = buildGLSLColorModuleSource('colors');
|
|
119
|
+
const FLOAT_COLORS_GLSL = buildGLSLColorModuleSource('floatColors');
|
|
120
|
+
const COLORS_WGSL = buildWGSLColorModuleSource('colors');
|
|
121
|
+
const FLOAT_COLORS_WGSL = buildWGSLColorModuleSource('floatColors');
|
|
122
|
+
|
|
123
|
+
const STORAGE_COLORS_WGSL = /* wgsl */ `\
|
|
124
|
+
struct storageColorsUniforms {
|
|
125
|
+
format: u32,
|
|
126
|
+
wordStride: u32,
|
|
127
|
+
wordOffset: u32,
|
|
128
|
+
_padding: u32
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
@group(0) @binding(auto) var<uniform> storageColors : storageColorsUniforms;
|
|
132
|
+
@group(0) @binding(auto) var<storage, read> storageColorsBuffer : array<u32>;
|
|
133
|
+
|
|
134
|
+
const STORAGE_COLOR_FORMAT_RGBA8UNORM : u32 = ${STORAGE_COLOR_FORMAT.RGBA8UNORM}u;
|
|
135
|
+
const STORAGE_COLOR_FORMAT_RGBA16FLOAT : u32 = ${STORAGE_COLOR_FORMAT.RGBA16FLOAT}u;
|
|
136
|
+
|
|
137
|
+
fn storageColors_getWordIndex(rowIndex: u32) -> u32 {
|
|
138
|
+
return storageColors.wordOffset + rowIndex * storageColors.wordStride;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
fn storageColors_readRgba8UnormColor(wordIndex: u32) -> vec4<f32> {
|
|
142
|
+
return unpack4x8unorm(storageColorsBuffer[wordIndex]);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
fn storageColors_readRgba16FloatColor(wordIndex: u32) -> vec4<f32> {
|
|
146
|
+
let redGreen = unpack2x16float(storageColorsBuffer[wordIndex]);
|
|
147
|
+
let blueAlpha = unpack2x16float(storageColorsBuffer[wordIndex + 1u]);
|
|
148
|
+
return vec4<f32>(redGreen.x, redGreen.y, blueAlpha.x, blueAlpha.y);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
fn storageColors_readRgba32FloatColor(wordIndex: u32) -> vec4<f32> {
|
|
152
|
+
return vec4<f32>(
|
|
153
|
+
bitcast<f32>(storageColorsBuffer[wordIndex]),
|
|
154
|
+
bitcast<f32>(storageColorsBuffer[wordIndex + 1u]),
|
|
155
|
+
bitcast<f32>(storageColorsBuffer[wordIndex + 2u]),
|
|
156
|
+
bitcast<f32>(storageColorsBuffer[wordIndex + 3u])
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
fn storageColors_readColor(rowIndex: u32) -> vec4<f32> {
|
|
161
|
+
let wordIndex = storageColors_getWordIndex(rowIndex);
|
|
162
|
+
if (storageColors.format == STORAGE_COLOR_FORMAT_RGBA8UNORM) {
|
|
163
|
+
return storageColors_readRgba8UnormColor(wordIndex);
|
|
164
|
+
}
|
|
165
|
+
if (storageColors.format == STORAGE_COLOR_FORMAT_RGBA16FLOAT) {
|
|
166
|
+
return storageColors_readRgba16FloatColor(wordIndex);
|
|
167
|
+
}
|
|
168
|
+
return storageColors_readRgba32FloatColor(wordIndex);
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
171
|
+
|
|
172
|
+
function buildGLSLColorModuleSource(primaryPrefix: string): string {
|
|
173
|
+
return /* glsl */ `\
|
|
174
|
+
layout(std140) uniform ${primaryPrefix}Uniforms {
|
|
175
|
+
float useByteColors;
|
|
176
|
+
} ${primaryPrefix};
|
|
177
|
+
|
|
178
|
+
vec3 ${primaryPrefix}_normalize(vec3 inputColor) {
|
|
179
|
+
return ${primaryPrefix}.useByteColors > 0.5 ? inputColor / 255.0 : inputColor;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
vec4 ${primaryPrefix}_normalize(vec4 inputColor) {
|
|
183
|
+
return ${primaryPrefix}.useByteColors > 0.5 ? inputColor / 255.0 : inputColor;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
vec4 ${primaryPrefix}_premultiplyAlpha(vec4 inputColor) {
|
|
187
|
+
return vec4(inputColor.rgb * inputColor.a, inputColor.a);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
vec4 ${primaryPrefix}_unpremultiplyAlpha(vec4 inputColor) {
|
|
191
|
+
return inputColor.a > 0.0 ? vec4(inputColor.rgb / inputColor.a, inputColor.a) : vec4(0.0);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
vec4 ${primaryPrefix}_premultiply_alpha(vec4 inputColor) {
|
|
195
|
+
return ${primaryPrefix}_premultiplyAlpha(inputColor);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
vec4 ${primaryPrefix}_unpremultiply_alpha(vec4 inputColor) {
|
|
199
|
+
return ${primaryPrefix}_unpremultiplyAlpha(inputColor);
|
|
200
|
+
}
|
|
201
|
+
`;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function buildWGSLColorModuleSource(primaryPrefix: string): string {
|
|
205
|
+
return /* wgsl */ `\
|
|
206
|
+
struct ${primaryPrefix}Uniforms {
|
|
207
|
+
useByteColors: f32
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
@group(0) @binding(auto) var<uniform> ${primaryPrefix} : ${primaryPrefix}Uniforms;
|
|
211
|
+
|
|
212
|
+
fn ${primaryPrefix}_normalize(inputColor: vec3<f32>) -> vec3<f32> {
|
|
213
|
+
return select(inputColor, inputColor / 255.0, ${primaryPrefix}.useByteColors > 0.5);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
fn ${primaryPrefix}_normalize4(inputColor: vec4<f32>) -> vec4<f32> {
|
|
217
|
+
return select(inputColor, inputColor / 255.0, ${primaryPrefix}.useByteColors > 0.5);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
fn ${primaryPrefix}_premultiplyAlpha(inputColor: vec4<f32>) -> vec4<f32> {
|
|
221
|
+
return vec4<f32>(inputColor.rgb * inputColor.a, inputColor.a);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
fn ${primaryPrefix}_unpremultiplyAlpha(inputColor: vec4<f32>) -> vec4<f32> {
|
|
225
|
+
return select(
|
|
226
|
+
vec4<f32>(0.0),
|
|
227
|
+
vec4<f32>(inputColor.rgb / inputColor.a, inputColor.a),
|
|
228
|
+
inputColor.a > 0.0
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
fn ${primaryPrefix}_premultiply_alpha(inputColor: vec4<f32>) -> vec4<f32> {
|
|
233
|
+
return ${primaryPrefix}_premultiplyAlpha(inputColor);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
fn ${primaryPrefix}_unpremultiply_alpha(inputColor: vec4<f32>) -> vec4<f32> {
|
|
237
|
+
return ${primaryPrefix}_unpremultiplyAlpha(inputColor);
|
|
238
|
+
}
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function getStorageColorsUniforms(props: StorageColorsProps = {}): StorageColorsUniforms {
|
|
243
|
+
const format = resolveStorageColorFormat(props.format);
|
|
244
|
+
const formatName = STORAGE_COLOR_FORMAT_NAME_BY_VALUE[format];
|
|
245
|
+
const byteStride = props.byteStride ?? STORAGE_COLOR_DEFAULT_BYTE_STRIDES[formatName];
|
|
246
|
+
const byteOffset = props.byteOffset ?? 0;
|
|
247
|
+
const minimumByteStride = STORAGE_COLOR_FORMAT_BYTE_LENGTHS[formatName];
|
|
248
|
+
|
|
249
|
+
validateStorageColorByteAlignment('byteStride', byteStride);
|
|
250
|
+
validateStorageColorByteAlignment('byteOffset', byteOffset);
|
|
251
|
+
if (byteStride < minimumByteStride) {
|
|
252
|
+
throw new Error(
|
|
253
|
+
`storageColors byteStride must be at least ${minimumByteStride} for ${formatName}`
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return {
|
|
258
|
+
format,
|
|
259
|
+
wordStride: byteStride / Uint32Array.BYTES_PER_ELEMENT,
|
|
260
|
+
wordOffset: byteOffset / Uint32Array.BYTES_PER_ELEMENT,
|
|
261
|
+
_padding: 0
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function resolveStorageColorFormat(
|
|
266
|
+
format: StorageColorsProps['format'] = 'rgba8unorm'
|
|
267
|
+
): StorageColorFormatValue {
|
|
268
|
+
if (typeof format === 'number') {
|
|
269
|
+
if (format in STORAGE_COLOR_FORMAT_NAME_BY_VALUE) {
|
|
270
|
+
return format as StorageColorFormatValue;
|
|
271
|
+
}
|
|
272
|
+
} else if (format in STORAGE_COLOR_FORMAT_BY_NAME) {
|
|
273
|
+
return STORAGE_COLOR_FORMAT_BY_NAME[format];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
throw new Error(
|
|
277
|
+
`storageColors format must be one of ${Object.keys(STORAGE_COLOR_FORMAT_BY_NAME).join(', ')}`
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function validateStorageColorByteAlignment(name: string, value: number): void {
|
|
282
|
+
if (!Number.isInteger(value) || value < 0 || value % Uint32Array.BYTES_PER_ELEMENT !== 0) {
|
|
283
|
+
throw new Error(`storageColors ${name} must be a non-negative 4-byte aligned integer`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** Semantic color normalization helpers named `colors_*`. */
|
|
288
|
+
export const colors = {
|
|
289
|
+
name: 'colors',
|
|
290
|
+
props: {} as ColorsProps,
|
|
291
|
+
uniforms: {} as ColorsUniforms,
|
|
292
|
+
vs: COLORS_GLSL,
|
|
293
|
+
fs: COLORS_GLSL,
|
|
294
|
+
source: COLORS_WGSL,
|
|
295
|
+
uniformTypes: COLORS_UNIFORM_TYPES,
|
|
296
|
+
defaultUniforms: COLORS_DEFAULT_UNIFORMS
|
|
297
|
+
} as const satisfies ShaderModule<ColorsProps, ColorsUniforms>;
|
|
298
|
+
|
|
299
|
+
/** Legacy semantic color normalization helpers named `floatColors_*`. */
|
|
300
|
+
export const floatColors = {
|
|
301
|
+
name: 'floatColors',
|
|
302
|
+
props: {} as FloatColorsProps,
|
|
303
|
+
uniforms: {} as FloatColorsUniforms,
|
|
304
|
+
vs: FLOAT_COLORS_GLSL,
|
|
305
|
+
fs: FLOAT_COLORS_GLSL,
|
|
306
|
+
source: FLOAT_COLORS_WGSL,
|
|
307
|
+
uniformTypes: COLORS_UNIFORM_TYPES,
|
|
308
|
+
defaultUniforms: COLORS_DEFAULT_UNIFORMS
|
|
309
|
+
} as const satisfies ShaderModule<FloatColorsProps, FloatColorsUniforms>;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* WGSL reader for packed RGBA storage rows.
|
|
313
|
+
*
|
|
314
|
+
* Include {@link colors} separately when semantic color normalization helpers are also needed.
|
|
315
|
+
*/
|
|
316
|
+
export const storageColors = {
|
|
317
|
+
name: 'storageColors',
|
|
318
|
+
props: {} as StorageColorsProps,
|
|
319
|
+
uniforms: {} as StorageColorsUniforms,
|
|
320
|
+
bindings: {} as StorageColorsBindings,
|
|
321
|
+
source: STORAGE_COLORS_WGSL,
|
|
322
|
+
uniformTypes: STORAGE_COLORS_UNIFORM_TYPES,
|
|
323
|
+
defaultUniforms: STORAGE_COLORS_DEFAULT_UNIFORMS,
|
|
324
|
+
bindingLayout: [
|
|
325
|
+
{name: 'storageColors', group: 0},
|
|
326
|
+
{name: 'storageColorsBuffer', group: 0}
|
|
327
|
+
],
|
|
328
|
+
getUniforms(props: StorageColorsProps = {}) {
|
|
329
|
+
return {
|
|
330
|
+
...getStorageColorsUniforms(props),
|
|
331
|
+
...(props.colorBuffer ? {storageColorsBuffer: props.colorBuffer} : {})
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
} as const satisfies ShaderModule<StorageColorsProps, StorageColorsUniforms, StorageColorsBindings>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {ShaderModule} from '../../../lib/shader-module/shader-module';
|
|
6
|
+
import type {ShaderPlugin} from '../../../lib/shader-plugin';
|
|
7
|
+
|
|
8
|
+
export type ClipShaderPluginProps = {
|
|
9
|
+
/** Enables clipping. Defaults to true. */
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/** Inclusive lower and exclusive upper bounds. Defaults to [0, 0, 1, 1]. */
|
|
12
|
+
bounds?: readonly [number, number, number, number];
|
|
13
|
+
/** Clips whole instances by their anchor or individual fragments. Defaults to geometry. */
|
|
14
|
+
mode?: 'instance' | 'geometry';
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type ClipUniforms = {
|
|
18
|
+
enabled: number;
|
|
19
|
+
mode: number;
|
|
20
|
+
bounds: readonly [number, number, number, number];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const CLIP_MODE_GEOMETRY = 0;
|
|
24
|
+
const CLIP_MODE_INSTANCE = 1;
|
|
25
|
+
|
|
26
|
+
const clipShaderModule = {
|
|
27
|
+
name: 'clip',
|
|
28
|
+
props: {} as ClipShaderPluginProps,
|
|
29
|
+
uniforms: {} as ClipUniforms,
|
|
30
|
+
bindingLayout: [{name: 'clip', group: 2}],
|
|
31
|
+
uniformTypes: {
|
|
32
|
+
enabled: 'i32',
|
|
33
|
+
mode: 'i32',
|
|
34
|
+
bounds: 'vec4<f32>'
|
|
35
|
+
},
|
|
36
|
+
defaultUniforms: {
|
|
37
|
+
enabled: 1,
|
|
38
|
+
mode: CLIP_MODE_GEOMETRY,
|
|
39
|
+
bounds: [0, 0, 1, 1]
|
|
40
|
+
},
|
|
41
|
+
vs: /* glsl */ `\
|
|
42
|
+
layout(std140) uniform clipUniforms {
|
|
43
|
+
highp int enabled;
|
|
44
|
+
highp int mode;
|
|
45
|
+
highp vec4 bounds;
|
|
46
|
+
} clipState;
|
|
47
|
+
|
|
48
|
+
bool clip_isInBounds(vec2 coordinates) {
|
|
49
|
+
return coordinates.x >= clipState.bounds.x &&
|
|
50
|
+
coordinates.y >= clipState.bounds.y &&
|
|
51
|
+
coordinates.x < clipState.bounds.z &&
|
|
52
|
+
coordinates.y < clipState.bounds.w;
|
|
53
|
+
}
|
|
54
|
+
`,
|
|
55
|
+
fs: /* glsl */ `\
|
|
56
|
+
layout(std140) uniform clipUniforms {
|
|
57
|
+
highp int enabled;
|
|
58
|
+
highp int mode;
|
|
59
|
+
highp vec4 bounds;
|
|
60
|
+
} clipState;
|
|
61
|
+
|
|
62
|
+
bool clip_isInBounds(vec2 coordinates) {
|
|
63
|
+
return coordinates.x >= clipState.bounds.x &&
|
|
64
|
+
coordinates.y >= clipState.bounds.y &&
|
|
65
|
+
coordinates.x < clipState.bounds.z &&
|
|
66
|
+
coordinates.y < clipState.bounds.w;
|
|
67
|
+
}
|
|
68
|
+
`,
|
|
69
|
+
source: /* wgsl */ `\
|
|
70
|
+
struct ClipUniforms {
|
|
71
|
+
enabled: i32,
|
|
72
|
+
mode: i32,
|
|
73
|
+
bounds: vec4<f32>,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
@group(2) @binding(auto) var<uniform> clipUniforms: ClipUniforms;
|
|
77
|
+
|
|
78
|
+
fn clip_isInBounds(coordinates: vec2<f32>) -> bool {
|
|
79
|
+
return coordinates.x >= clipUniforms.bounds.x &&
|
|
80
|
+
coordinates.y >= clipUniforms.bounds.y &&
|
|
81
|
+
coordinates.x < clipUniforms.bounds.z &&
|
|
82
|
+
coordinates.y < clipUniforms.bounds.w;
|
|
83
|
+
}
|
|
84
|
+
`,
|
|
85
|
+
getUniforms(props: ClipShaderPluginProps = {}): Partial<ClipUniforms> {
|
|
86
|
+
const uniforms: Partial<ClipUniforms> = {};
|
|
87
|
+
if (props.enabled !== undefined) {
|
|
88
|
+
uniforms.enabled = Number(props.enabled);
|
|
89
|
+
}
|
|
90
|
+
if (props.mode !== undefined) {
|
|
91
|
+
uniforms.mode = props.mode === 'instance' ? CLIP_MODE_INSTANCE : CLIP_MODE_GEOMETRY;
|
|
92
|
+
}
|
|
93
|
+
if (props.bounds !== undefined) {
|
|
94
|
+
uniforms.bounds = props.bounds;
|
|
95
|
+
}
|
|
96
|
+
return uniforms;
|
|
97
|
+
}
|
|
98
|
+
} as const satisfies ShaderModule<ClipShaderPluginProps, ClipUniforms, {}>;
|
|
99
|
+
|
|
100
|
+
/** Coordinate-system-neutral instance and geometry clipping. */
|
|
101
|
+
export const clipShaderPlugin: ShaderPlugin = {
|
|
102
|
+
name: 'clip',
|
|
103
|
+
modules: [clipShaderModule],
|
|
104
|
+
varyings: {
|
|
105
|
+
clipCoordinates: {type: 'vec2<f32>', interpolation: 'smooth'}
|
|
106
|
+
},
|
|
107
|
+
glsl: {
|
|
108
|
+
injections: [
|
|
109
|
+
{
|
|
110
|
+
target: 'vs:CLIP_POSITION',
|
|
111
|
+
injection: `\
|
|
112
|
+
clipCoordinates = geometryCoordinates;
|
|
113
|
+
if (clipState.enabled != 0 && clipState.mode == ${CLIP_MODE_INSTANCE} &&
|
|
114
|
+
!clip_isInBounds(instanceCoordinates)) {
|
|
115
|
+
position = vec4(2.0, 2.0, 2.0, 1.0);
|
|
116
|
+
}`
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
target: 'fs:CLIP_COLOR',
|
|
120
|
+
injection: `\
|
|
121
|
+
if (clipState.enabled != 0 && clipState.mode == ${CLIP_MODE_GEOMETRY} &&
|
|
122
|
+
!clip_isInBounds(clipCoordinates)) {
|
|
123
|
+
discard;
|
|
124
|
+
}`
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
wgsl: {
|
|
129
|
+
injections: [
|
|
130
|
+
{
|
|
131
|
+
target: 'vs:CLIP_POSITION',
|
|
132
|
+
injection: `\
|
|
133
|
+
clipCoordinates = geometryCoordinates;
|
|
134
|
+
if (clipUniforms.enabled != 0 && clipUniforms.mode == ${CLIP_MODE_INSTANCE} &&
|
|
135
|
+
!clip_isInBounds(instanceCoordinates)) {
|
|
136
|
+
*position = vec4<f32>(2.0, 2.0, 2.0, 1.0);
|
|
137
|
+
}`
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
target: 'fs:CLIP_COLOR',
|
|
141
|
+
injection: `\
|
|
142
|
+
if (clipUniforms.enabled != 0 && clipUniforms.mode == ${CLIP_MODE_GEOMETRY} &&
|
|
143
|
+
!clip_isInBounds(clipCoordinates)) {
|
|
144
|
+
discard;
|
|
145
|
+
}`
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {ShaderModule} from '../../../lib/shader-module/shader-module';
|
|
6
|
+
import type {ShaderPlugin} from '../../../lib/shader-plugin';
|
|
7
|
+
|
|
8
|
+
export type FilterShaderPluginProps = {
|
|
9
|
+
/** Enables range filtering. Defaults to true. */
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/** Inclusive minimum accepted value. Defaults to 0. */
|
|
12
|
+
min?: number;
|
|
13
|
+
/** Inclusive maximum accepted value. Defaults to 1. */
|
|
14
|
+
max?: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type FilterUniforms = {
|
|
18
|
+
enabled: number;
|
|
19
|
+
min: number;
|
|
20
|
+
max: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const filterShaderModule = {
|
|
24
|
+
name: 'filter',
|
|
25
|
+
props: {} as FilterShaderPluginProps,
|
|
26
|
+
uniforms: {} as FilterUniforms,
|
|
27
|
+
bindingLayout: [{name: 'filter', group: 2}],
|
|
28
|
+
uniformTypes: {
|
|
29
|
+
enabled: 'i32',
|
|
30
|
+
min: 'f32',
|
|
31
|
+
max: 'f32'
|
|
32
|
+
},
|
|
33
|
+
defaultUniforms: {
|
|
34
|
+
enabled: 1,
|
|
35
|
+
min: 0,
|
|
36
|
+
max: 1
|
|
37
|
+
},
|
|
38
|
+
vs: /* glsl */ `\
|
|
39
|
+
layout(std140) uniform filterUniforms {
|
|
40
|
+
int enabled;
|
|
41
|
+
float min;
|
|
42
|
+
float max;
|
|
43
|
+
} filterState;
|
|
44
|
+
|
|
45
|
+
bool filter_isVisible(float value) {
|
|
46
|
+
return filterState.enabled == 0 || (value >= filterState.min && value <= filterState.max);
|
|
47
|
+
}
|
|
48
|
+
`,
|
|
49
|
+
source: /* wgsl */ `\
|
|
50
|
+
struct FilterUniforms {
|
|
51
|
+
enabled: i32,
|
|
52
|
+
min: f32,
|
|
53
|
+
max: f32,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
@group(2) @binding(auto) var<uniform> filterUniforms: FilterUniforms;
|
|
57
|
+
|
|
58
|
+
fn filter_isVisible(value: f32) -> bool {
|
|
59
|
+
return filterUniforms.enabled == 0 ||
|
|
60
|
+
(value >= filterUniforms.min && value <= filterUniforms.max);
|
|
61
|
+
}
|
|
62
|
+
`,
|
|
63
|
+
getUniforms(props: FilterShaderPluginProps = {}): Partial<FilterUniforms> {
|
|
64
|
+
const uniforms: Partial<FilterUniforms> = {};
|
|
65
|
+
if (props.enabled !== undefined) {
|
|
66
|
+
uniforms.enabled = Number(props.enabled);
|
|
67
|
+
}
|
|
68
|
+
if (props.min !== undefined) {
|
|
69
|
+
uniforms.min = props.min;
|
|
70
|
+
}
|
|
71
|
+
if (props.max !== undefined) {
|
|
72
|
+
uniforms.max = props.max;
|
|
73
|
+
}
|
|
74
|
+
return uniforms;
|
|
75
|
+
}
|
|
76
|
+
} as const satisfies ShaderModule<FilterShaderPluginProps, FilterUniforms>;
|
|
77
|
+
|
|
78
|
+
/** Scalar inclusive-range filtering for shaders that expose the `FILTER_POSITION` vertex hook. */
|
|
79
|
+
export const filterShaderPlugin: ShaderPlugin = {
|
|
80
|
+
name: 'filter',
|
|
81
|
+
modules: [filterShaderModule],
|
|
82
|
+
vertexInputs: {
|
|
83
|
+
filterValues: 'f32'
|
|
84
|
+
},
|
|
85
|
+
glsl: {
|
|
86
|
+
injections: [
|
|
87
|
+
{
|
|
88
|
+
target: 'vs:FILTER_POSITION',
|
|
89
|
+
injection: `\
|
|
90
|
+
if (!filter_isVisible(filterValues)) {
|
|
91
|
+
position = vec4(2.0, 2.0, 2.0, 1.0);
|
|
92
|
+
}`
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
wgsl: {
|
|
97
|
+
injections: [
|
|
98
|
+
{
|
|
99
|
+
target: 'vs:FILTER_POSITION',
|
|
100
|
+
injection: `\
|
|
101
|
+
if (!filter_isVisible(filterValues)) {
|
|
102
|
+
*position = vec4<f32>(2.0, 2.0, 2.0, 1.0);
|
|
103
|
+
}`
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
// import {ShaderModule} from '../../types';
|
|
6
|
+
|
|
7
|
+
// TODO - reuse normal from geometry module
|
|
8
|
+
const vs = /* glsl */ `\
|
|
9
|
+
varying vec4 geometry_vPosition;
|
|
10
|
+
varying vec3 geometry_vNormal;
|
|
11
|
+
|
|
12
|
+
void geometry_setNormal(vec3 normal) {
|
|
13
|
+
geometry_vNormal = normal;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
void geometry_setPosition(vec4 position) {
|
|
17
|
+
geometry_vPosition = position;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void geometry_setPosition(vec3 position) {
|
|
21
|
+
geometry_vPosition = vec4(position, 1.);
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const fs = /* glsl */ `\
|
|
26
|
+
varying vec4 geometry_vPosition;
|
|
27
|
+
varying vec3 geometry_vNormal;
|
|
28
|
+
|
|
29
|
+
vec4 geometry_getPosition() {
|
|
30
|
+
return geometry_vPosition;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
vec3 geometry_getNormal() {
|
|
34
|
+
return geometry_vNormal;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Geometry varyings
|
|
40
|
+
*/
|
|
41
|
+
export const geometry = {
|
|
42
|
+
name: 'geometry',
|
|
43
|
+
vs,
|
|
44
|
+
fs
|
|
45
|
+
};
|