@luma.gl/shaders 0.0.0-stage → 10.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +38 -0
- package/README.md +25 -2
- package/dist/dist.dev.js +19880 -0
- package/dist/dist.min.js +12192 -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 +128 -0
- package/dist/lib/preprocessor/preprocessor.d.ts +15 -0
- package/dist/lib/preprocessor/preprocessor.d.ts.map +1 -0
- package/dist/lib/preprocessor/preprocessor.js +120 -0
- package/dist/lib/preprocessor/preprocessor.js.map +1 -0
- package/dist/lib/shader-assembler-base.cjs +132 -0
- package/dist/lib/shader-assembler-base.d.ts +51 -0
- package/dist/lib/shader-assembler-base.d.ts.map +1 -0
- package/dist/lib/shader-assembler-base.js +127 -0
- package/dist/lib/shader-assembler-base.js.map +1 -0
- package/dist/lib/shader-assembler.cjs +33 -0
- package/dist/lib/shader-assembler.d.ts +4 -0
- package/dist/lib/shader-assembler.d.ts.map +1 -0
- package/dist/lib/shader-assembler.js +7 -0
- package/dist/lib/shader-assembler.js.map +1 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.cjs +181 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts +70 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.js +208 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.js.map +1 -0
- package/dist/lib/shader-assembly/assemble-shaders.cjs +42 -0
- package/dist/lib/shader-assembly/assemble-shaders.d.ts +10 -0
- package/dist/lib/shader-assembly/assemble-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-shaders.js +10 -0
- package/dist/lib/shader-assembly/assemble-shaders.js.map +1 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.cjs +498 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts +70 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.js +480 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.js.map +1 -0
- package/dist/lib/shader-assembly/platform-defines.cjs +79 -0
- package/dist/lib/shader-assembly/platform-defines.d.ts +4 -0
- package/dist/lib/shader-assembly/platform-defines.d.ts.map +1 -0
- package/dist/lib/shader-assembly/platform-defines.js +52 -0
- package/dist/lib/shader-assembly/platform-defines.js.map +1 -0
- package/dist/lib/shader-assembly/platform-info.cjs +15 -0
- package/dist/lib/shader-assembly/platform-info.d.ts +20 -0
- package/dist/lib/shader-assembly/platform-info.d.ts.map +1 -0
- package/dist/lib/shader-assembly/platform-info.js +5 -0
- package/dist/lib/shader-assembly/platform-info.js.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.cjs +96 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.d.ts +16 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.js +79 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.js.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-types.cjs +15 -0
- package/dist/lib/shader-assembly/shader-assembly-types.d.ts +132 -0
- package/dist/lib/shader-assembly/shader-assembly-types.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-types.js +5 -0
- package/dist/lib/shader-assembly/shader-assembly-types.js.map +1 -0
- package/dist/lib/shader-assembly/shader-injection-targets.cjs +103 -0
- package/dist/lib/shader-assembly/shader-injection-targets.d.ts +46 -0
- package/dist/lib/shader-assembly/shader-injection-targets.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-injection-targets.js +83 -0
- package/dist/lib/shader-assembly/shader-injection-targets.js.map +1 -0
- package/dist/lib/shader-assembly/shader-injections.cjs +204 -0
- package/dist/lib/shader-assembly/shader-injections.d.ts +49 -0
- package/dist/lib/shader-assembly/shader-injections.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-injections.js +207 -0
- package/dist/lib/shader-assembly/shader-injections.js.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.cjs +434 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts +15 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.js +438 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.js.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.cjs +254 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.d.ts +12 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.js +237 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.cjs +166 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.d.ts +37 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.js +144 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.cjs +184 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.d.ts +19 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.js +151 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.cjs +163 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.d.ts +8 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.js +145 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.cjs +502 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.d.ts +14 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.js +498 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.js.map +1 -0
- package/dist/lib/shader-generator/generate-shader.cjs +36 -0
- package/dist/lib/shader-generator/generate-shader.d.ts +8 -0
- package/dist/lib/shader-generator/generate-shader.d.ts.map +1 -0
- package/dist/lib/shader-generator/generate-shader.js +15 -0
- package/dist/lib/shader-generator/generate-shader.js.map +1 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.cjs +94 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.d.ts +7 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.d.ts.map +1 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.js +79 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.js.map +1 -0
- package/dist/lib/shader-generator/utils/capitalize.cjs +29 -0
- package/dist/lib/shader-generator/utils/capitalize.d.ts +7 -0
- package/dist/lib/shader-generator/utils/capitalize.d.ts.map +1 -0
- package/dist/lib/shader-generator/utils/capitalize.js +12 -0
- package/dist/lib/shader-generator/utils/capitalize.js.map +1 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.cjs +46 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts +7 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts.map +1 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.js +23 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.js.map +1 -0
- package/dist/lib/shader-module/composite-shader-pass.cjs +15 -0
- package/dist/lib/shader-module/composite-shader-pass.d.ts +41 -0
- package/dist/lib/shader-module/composite-shader-pass.d.ts.map +1 -0
- package/dist/lib/shader-module/composite-shader-pass.js +5 -0
- package/dist/lib/shader-module/composite-shader-pass.js.map +1 -0
- package/dist/lib/shader-module/shader-module-dependencies.cjs +83 -0
- package/dist/lib/shader-module/shader-module-dependencies.d.ts +39 -0
- package/dist/lib/shader-module/shader-module-dependencies.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module-dependencies.js +103 -0
- package/dist/lib/shader-module/shader-module-dependencies.js.map +1 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.cjs +224 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.d.ts +91 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.js +253 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.js.map +1 -0
- package/dist/lib/shader-module/shader-module.cjs +99 -0
- package/dist/lib/shader-module/shader-module.d.ts +94 -0
- package/dist/lib/shader-module/shader-module.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module.js +101 -0
- package/dist/lib/shader-module/shader-module.js.map +1 -0
- package/dist/lib/shader-module/shader-pass.cjs +15 -0
- package/dist/lib/shader-module/shader-pass.d.ts +48 -0
- package/dist/lib/shader-module/shader-pass.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-pass.js +5 -0
- package/dist/lib/shader-module/shader-pass.js.map +1 -0
- package/dist/lib/shader-plugin.cjs +156 -0
- package/dist/lib/shader-plugin.d.ts +61 -0
- package/dist/lib/shader-plugin.d.ts.map +1 -0
- package/dist/lib/shader-plugin.js +147 -0
- package/dist/lib/shader-plugin.js.map +1 -0
- package/dist/lib/shader-transpiler/shader-transpiler.cjs +15 -0
- package/dist/lib/shader-transpiler/shader-transpiler.d.ts +27 -0
- package/dist/lib/shader-transpiler/shader-transpiler.d.ts.map +1 -0
- package/dist/lib/shader-transpiler/shader-transpiler.js +5 -0
- package/dist/lib/shader-transpiler/shader-transpiler.js.map +1 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.cjs +71 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.d.ts +9 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.d.ts.map +1 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.js +69 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.js.map +1 -0
- package/dist/lib/utils/assert.cjs +34 -0
- package/dist/lib/utils/assert.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts.map +1 -0
- package/dist/lib/utils/assert.js +13 -0
- package/dist/lib/utils/assert.js.map +1 -0
- package/dist/lib/utils/uniform-types.cjs +15 -0
- package/dist/lib/utils/uniform-types.d.ts +18 -0
- package/dist/lib/utils/uniform-types.d.ts.map +1 -0
- package/dist/lib/utils/uniform-types.js +5 -0
- package/dist/lib/utils/uniform-types.js.map +1 -0
- package/dist/lib/wgsl-shader-assembler.cjs +99 -0
- package/dist/lib/wgsl-shader-assembler.d.ts +34 -0
- package/dist/lib/wgsl-shader-assembler.d.ts.map +1 -0
- package/dist/lib/wgsl-shader-assembler.js +84 -0
- package/dist/lib/wgsl-shader-assembler.js.map +1 -0
- package/dist/module-injectors.cjs +59 -0
- package/dist/module-injectors.d.ts +3 -0
- package/dist/module-injectors.d.ts.map +1 -0
- package/dist/module-injectors.js +31 -0
- package/dist/module-injectors.js.map +1 -0
- package/dist/modules/color/float-colors.cjs +275 -0
- package/dist/modules/color/float-colors.d.ts +132 -0
- package/dist/modules/color/float-colors.d.ts.map +1 -0
- package/dist/modules/color/float-colors.js +248 -0
- package/dist/modules/color/float-colors.js.map +1 -0
- package/dist/modules/engine/clip/clip.cjs +142 -0
- package/dist/modules/engine/clip/clip.d.ts +12 -0
- package/dist/modules/engine/clip/clip.d.ts.map +1 -0
- package/dist/modules/engine/clip/clip.js +119 -0
- package/dist/modules/engine/clip/clip.js.map +1 -0
- package/dist/modules/engine/filter/filter.cjs +103 -0
- package/dist/modules/engine/filter/filter.d.ts +12 -0
- package/dist/modules/engine/filter/filter.d.ts.map +1 -0
- package/dist/modules/engine/filter/filter.js +80 -0
- package/dist/modules/engine/filter/filter.js.map +1 -0
- package/dist/modules/engine/geometry/geometry.cjs +63 -0
- package/dist/modules/engine/geometry/geometry.d.ts +9 -0
- package/dist/modules/engine/geometry/geometry.d.ts.map +1 -0
- package/dist/modules/engine/geometry/geometry.js +42 -0
- package/dist/modules/engine/geometry/geometry.js.map +1 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.cjs +255 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.d.ts +34 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.d.ts.map +1 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.js +228 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.js.map +1 -0
- package/dist/modules/engine/picking/picking.cjs +210 -0
- package/dist/modules/engine/picking/picking.d.ts +77 -0
- package/dist/modules/engine/picking/picking.d.ts.map +1 -0
- package/dist/modules/engine/picking/picking.js +198 -0
- package/dist/modules/engine/picking/picking.js.map +1 -0
- package/dist/modules/engine/project/project.cjs +138 -0
- package/dist/modules/engine/project/project.d.ts +39 -0
- package/dist/modules/engine/project/project.d.ts.map +1 -0
- package/dist/modules/engine/project/project.js +129 -0
- package/dist/modules/engine/project/project.js.map +1 -0
- package/dist/modules/engine/skin/skin.cjs +212 -0
- package/dist/modules/engine/skin/skin.d.ts +52 -0
- package/dist/modules/engine/skin/skin.d.ts.map +1 -0
- package/dist/modules/engine/skin/skin.js +179 -0
- package/dist/modules/engine/skin/skin.js.map +1 -0
- package/dist/modules/engine/transform/transform.cjs +72 -0
- package/dist/modules/engine/transform/transform.d.ts +6 -0
- package/dist/modules/engine/transform/transform.d.ts.map +1 -0
- package/dist/modules/engine/transform/transform.js +49 -0
- package/dist/modules/engine/transform/transform.js.map +1 -0
- package/dist/modules/geometry/path-dash/path-dash.cjs +93 -0
- package/dist/modules/geometry/path-dash/path-dash.d.ts +10 -0
- package/dist/modules/geometry/path-dash/path-dash.d.ts.map +1 -0
- package/dist/modules/geometry/path-dash/path-dash.js +66 -0
- package/dist/modules/geometry/path-dash/path-dash.js.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.cjs +117 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.d.ts +3 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.d.ts.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.js +87 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.js.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.cjs +64 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.d.ts +14 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.d.ts.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.js +43 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.js.map +1 -0
- package/dist/modules/geometry/point-glow/point-glow.cjs +104 -0
- package/dist/modules/geometry/point-glow/point-glow.d.ts +11 -0
- package/dist/modules/geometry/point-glow/point-glow.d.ts.map +1 -0
- package/dist/modules/geometry/point-glow/point-glow.js +77 -0
- package/dist/modules/geometry/point-glow/point-glow.js.map +1 -0
- package/dist/modules/geometry/precipitation/precipitation.cjs +122 -0
- package/dist/modules/geometry/precipitation/precipitation.d.ts +40 -0
- package/dist/modules/geometry/precipitation/precipitation.d.ts.map +1 -0
- package/dist/modules/geometry/precipitation/precipitation.js +95 -0
- package/dist/modules/geometry/precipitation/precipitation.js.map +1 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.cjs +158 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.d.ts +60 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.d.ts.map +1 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.js +137 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.js.map +1 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.cjs +2304 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.d.ts +3 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.d.ts.map +1 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.js +2283 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.js.map +1 -0
- package/dist/modules/geospatial/dggs/dggs.cjs +31 -0
- package/dist/modules/geospatial/dggs/dggs.d.ts +6 -0
- package/dist/modules/geospatial/dggs/dggs.d.ts.map +1 -0
- package/dist/modules/geospatial/dggs/dggs.js +10 -0
- package/dist/modules/geospatial/dggs/dggs.js.map +1 -0
- package/dist/modules/lighting/area-lighting/area-light-types.cjs +68 -0
- package/dist/modules/lighting/area-lighting/area-light-types.d.ts +34 -0
- package/dist/modules/lighting/area-lighting/area-light-types.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/area-light-types.js +40 -0
- package/dist/modules/lighting/area-lighting/area-light-types.js.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.cjs +101 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.d.ts +3 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.js +71 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.js.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting.cjs +62 -0
- package/dist/modules/lighting/area-lighting/area-lighting.d.ts +89 -0
- package/dist/modules/lighting/area-lighting/area-lighting.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting.js +41 -0
- package/dist/modules/lighting/area-lighting/area-lighting.js.map +1 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.cjs +192 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.d.ts +3 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.js +162 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.js.map +1 -0
- package/dist/modules/lighting/atmosphere/atmosphere.cjs +253 -0
- package/dist/modules/lighting/atmosphere/atmosphere.d.ts +45 -0
- package/dist/modules/lighting/atmosphere/atmosphere.d.ts.map +1 -0
- package/dist/modules/lighting/atmosphere/atmosphere.js +228 -0
- package/dist/modules/lighting/atmosphere/atmosphere.js.map +1 -0
- package/dist/modules/lighting/clouds/clouds.cjs +216 -0
- package/dist/modules/lighting/clouds/clouds.d.ts +58 -0
- package/dist/modules/lighting/clouds/clouds.d.ts.map +1 -0
- package/dist/modules/lighting/clouds/clouds.js +192 -0
- package/dist/modules/lighting/clouds/clouds.js.map +1 -0
- package/dist/modules/lighting/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 +53 -0
- package/dist/types.cjs.map +6 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/wgsl.cjs +55 -0
- package/dist/wgsl.cjs.map +6 -0
- package/dist/wgsl.d.ts +8 -0
- package/dist/wgsl.d.ts.map +1 -0
- package/dist/wgsl.js +9 -0
- package/dist/wgsl.js.map +1 -0
- package/package.json +65 -4
- package/src/glsl.ts +13 -0
- package/src/index.ts +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 +157 -0
- package/src/lib/shader-assembler-base.ts +169 -0
- package/src/lib/shader-assembler.ts +7 -0
- package/src/lib/shader-assembly/assemble-glsl-shaders.ts +305 -0
- package/src/lib/shader-assembly/assemble-shaders.ts +13 -0
- package/src/lib/shader-assembly/assemble-wgsl-shaders.ts +830 -0
- package/src/lib/shader-assembly/platform-defines.ts +58 -0
- package/src/lib/shader-assembly/platform-info.ts +23 -0
- package/src/lib/shader-assembly/shader-assembly-shared.ts +95 -0
- package/src/lib/shader-assembly/shader-assembly-types.ts +146 -0
- package/src/lib/shader-assembly/shader-injection-targets.ts +148 -0
- package/src/lib/shader-assembly/shader-injections.ts +298 -0
- package/src/lib/shader-assembly/shader-plugin-varyings.ts +555 -0
- package/src/lib/shader-assembly/shader-plugin-vertex-inputs.ts +279 -0
- package/src/lib/shader-assembly/wgsl-binding-debug.ts +227 -0
- package/src/lib/shader-assembly/wgsl-binding-scan.ts +228 -0
- package/src/lib/shader-assembly/wgsl-injection-target-names.ts +180 -0
- package/src/lib/shader-assembly/wgsl-interface-scan.ts +676 -0
- package/src/lib/shader-generator/generate-shader.ts +27 -0
- package/src/lib/shader-generator/glsl/generate-glsl.ts +101 -0
- package/src/lib/shader-generator/utils/capitalize.ts +12 -0
- package/src/lib/shader-generator/wgsl/generate-wgsl.ts +40 -0
- package/src/lib/shader-module/composite-shader-pass.ts +47 -0
- package/src/lib/shader-module/shader-module-dependencies.ts +128 -0
- package/src/lib/shader-module/shader-module-uniform-layout.ts +420 -0
- package/src/lib/shader-module/shader-module.ts +237 -0
- package/src/lib/shader-module/shader-pass.ts +69 -0
- package/src/lib/shader-plugin.ts +236 -0
- package/src/lib/shader-transpiler/shader-transpiler.ts +34 -0
- package/src/lib/shader-transpiler/transpile-glsl-shader.ts +78 -0
- package/src/lib/utils/assert.ts +13 -0
- package/src/lib/utils/uniform-types.ts +89 -0
- package/src/lib/wgsl-shader-assembler.ts +122 -0
- package/src/module-injectors.ts +32 -0
- package/src/modules/color/float-colors.ts +334 -0
- package/src/modules/engine/clip/clip.ts +139 -0
- package/src/modules/engine/filter/filter.ts +99 -0
- package/src/modules/engine/geometry/geometry.ts +45 -0
- package/src/modules/engine/gpu-animation/gpu-animation.ts +244 -0
- package/src/modules/engine/picking/README.md +88 -0
- package/src/modules/engine/picking/picking.ts +252 -0
- package/src/modules/engine/project/project.ts +166 -0
- package/src/modules/engine/skin/skin.ts +233 -0
- package/src/modules/engine/transform/transform.ts +50 -0
- package/src/modules/geometry/path-dash/path-dash.ts +68 -0
- package/src/modules/geometry/pattern-fill/pattern-fill-shaders.ts +88 -0
- package/src/modules/geometry/pattern-fill/pattern-fill.ts +54 -0
- package/src/modules/geometry/point-glow/point-glow.ts +87 -0
- package/src/modules/geometry/precipitation/README.md +19 -0
- package/src/modules/geometry/precipitation/precipitation.ts +108 -0
- package/src/modules/geometry/sketch-stroke/sketch-stroke.ts +160 -0
- package/src/modules/geospatial/dggs/dggs-wgsl.ts +2284 -0
- package/src/modules/geospatial/dggs/dggs.ts +12 -0
- package/src/modules/lighting/area-lighting/area-light-types.ts +71 -0
- package/src/modules/lighting/area-lighting/area-lighting-shaders.ts +72 -0
- package/src/modules/lighting/area-lighting/area-lighting.ts +63 -0
- package/src/modules/lighting/area-lighting/ltc-shaders.ts +163 -0
- package/src/modules/lighting/atmosphere/README.md +25 -0
- package/src/modules/lighting/atmosphere/atmosphere.ts +246 -0
- package/src/modules/lighting/clouds/README.md +24 -0
- package/src/modules/lighting/clouds/clouds.ts +216 -0
- package/src/modules/lighting/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 +157 -0
- package/src/types.ts +116 -0
- package/src/wgsl.ts +34 -0
|
@@ -0,0 +1,99 @@
|
|
|
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 shader_module_exports = {};
|
|
19
|
+
__export(shader_module_exports, {
|
|
20
|
+
checkShaderModuleDeprecations: () => checkShaderModuleDeprecations,
|
|
21
|
+
getShaderModuleUniforms: () => getShaderModuleUniforms,
|
|
22
|
+
initializeShaderModule: () => initializeShaderModule,
|
|
23
|
+
initializeShaderModules: () => initializeShaderModules
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(shader_module_exports);
|
|
26
|
+
var import_prop_types = require("../filters/prop-types.cjs");
|
|
27
|
+
function initializeShaderModules(modules) {
|
|
28
|
+
modules.map((module2) => initializeShaderModule(module2));
|
|
29
|
+
}
|
|
30
|
+
function initializeShaderModule(module2) {
|
|
31
|
+
if (module2.instance) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
initializeShaderModules(module2.dependencies || []);
|
|
35
|
+
const { propTypes = {}, deprecations = [] } = module2;
|
|
36
|
+
const instance = {
|
|
37
|
+
parsedDeprecations: parseDeprecationDefinitions(deprecations),
|
|
38
|
+
normalizedInjections: { vertex: {}, fragment: {} }
|
|
39
|
+
};
|
|
40
|
+
if (propTypes) {
|
|
41
|
+
instance.propValidators = (0, import_prop_types.makePropValidators)(propTypes);
|
|
42
|
+
}
|
|
43
|
+
module2.instance = instance;
|
|
44
|
+
let defaultProps = {};
|
|
45
|
+
if (propTypes) {
|
|
46
|
+
defaultProps = Object.entries(propTypes).reduce((obj, [key, propType]) => {
|
|
47
|
+
const value = propType == null ? void 0 : propType.value;
|
|
48
|
+
if (value) {
|
|
49
|
+
obj[key] = value;
|
|
50
|
+
}
|
|
51
|
+
return obj;
|
|
52
|
+
}, {});
|
|
53
|
+
}
|
|
54
|
+
module2.defaultUniforms = {
|
|
55
|
+
...module2.defaultUniforms,
|
|
56
|
+
...defaultProps
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function getShaderModuleUniforms(module2, props, oldUniforms) {
|
|
60
|
+
var _a;
|
|
61
|
+
initializeShaderModule(module2);
|
|
62
|
+
const uniforms = oldUniforms || { ...module2.defaultUniforms };
|
|
63
|
+
if (props && module2.getUniforms) {
|
|
64
|
+
return module2.getUniforms(props, uniforms);
|
|
65
|
+
}
|
|
66
|
+
return (0, import_prop_types.getValidatedProperties)(props, (_a = module2.instance) == null ? void 0 : _a.propValidators, module2.name);
|
|
67
|
+
}
|
|
68
|
+
function checkShaderModuleDeprecations(shaderModule, shaderSource, log) {
|
|
69
|
+
var _a;
|
|
70
|
+
(_a = shaderModule.deprecations) == null ? void 0 : _a.forEach((def) => {
|
|
71
|
+
var _a2;
|
|
72
|
+
if ((_a2 = def.regex) == null ? void 0 : _a2.test(shaderSource)) {
|
|
73
|
+
if (def.deprecated) {
|
|
74
|
+
log.deprecated(def.old, def.new)();
|
|
75
|
+
} else {
|
|
76
|
+
log.removed(def.old, def.new)();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function parseDeprecationDefinitions(deprecations) {
|
|
82
|
+
deprecations.forEach((def) => {
|
|
83
|
+
switch (def.type) {
|
|
84
|
+
case "function":
|
|
85
|
+
def.regex = new RegExp(`\\b${def.old}\\(`);
|
|
86
|
+
break;
|
|
87
|
+
default:
|
|
88
|
+
def.regex = new RegExp(`${def.type} ${def.old};`);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return deprecations;
|
|
92
|
+
}
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
checkShaderModuleDeprecations,
|
|
96
|
+
getShaderModuleUniforms,
|
|
97
|
+
initializeShaderModule,
|
|
98
|
+
initializeShaderModules
|
|
99
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { UniformFormat } from "../../types.js";
|
|
2
|
+
import { PropType, PropValidator } from "../filters/prop-types.js";
|
|
3
|
+
import type { ShaderModuleUniformValue, UniformTypes, UniformValue } from "../utils/uniform-types.js";
|
|
4
|
+
import type { ResolvedShaderInjection } from "../shader-assembly/shader-injections.js";
|
|
5
|
+
import type { ShaderBinding as Binding } from "../../types.js";
|
|
6
|
+
export type UniformInfo = {
|
|
7
|
+
format?: UniformFormat;
|
|
8
|
+
} & PropType;
|
|
9
|
+
export type ShaderModuleBindingLayout = {
|
|
10
|
+
name: string;
|
|
11
|
+
group: number;
|
|
12
|
+
/** Which shader stages can access this binding. Uses GPUShaderStage bit flags. */
|
|
13
|
+
visibility?: number;
|
|
14
|
+
};
|
|
15
|
+
type BindingKeys<T> = {
|
|
16
|
+
[K in keyof T]: T[K] extends UniformValue ? never : K;
|
|
17
|
+
}[keyof T];
|
|
18
|
+
type UniformKeys<T> = {
|
|
19
|
+
[K in keyof T]: T[K] extends UniformValue ? K : never;
|
|
20
|
+
}[keyof T];
|
|
21
|
+
export type PickBindings<T> = {
|
|
22
|
+
[K in BindingKeys<Required<T>>]: T[K];
|
|
23
|
+
};
|
|
24
|
+
export type PickUniforms<T> = {
|
|
25
|
+
[K in UniformKeys<Required<T>>]: T[K];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A shader module definition object
|
|
29
|
+
*
|
|
30
|
+
* @note Needs to be initialized with `initializeShaderModules`
|
|
31
|
+
* @note `UniformsT` & `BindingsT` are deduced from `PropsT` by default. If
|
|
32
|
+
* a custom type for `UniformsT` is used, `BindingsT` should be also be provided.
|
|
33
|
+
*/
|
|
34
|
+
export type ShaderModule<PropsT extends Record<string, any> = Record<string, any>, UniformsT extends Record<string, ShaderModuleUniformValue> = PickUniforms<PropsT>, BindingsT extends Record<string, Binding> = PickBindings<PropsT>> = {
|
|
35
|
+
/** Used for type inference not for values */
|
|
36
|
+
props?: PropsT;
|
|
37
|
+
/** Used for type inference, not currently used for values */
|
|
38
|
+
uniforms?: UniformsT;
|
|
39
|
+
/** Used for type inference, not currently used for values */
|
|
40
|
+
bindings?: BindingsT;
|
|
41
|
+
/** Logical bind-group assignment for bindings declared by this module */
|
|
42
|
+
bindingLayout?: readonly ShaderModuleBindingLayout[];
|
|
43
|
+
/** Preferred starting binding slot for this module's WGSL `@binding(auto)` declarations. */
|
|
44
|
+
firstBindingSlot?: number;
|
|
45
|
+
name: string;
|
|
46
|
+
/** Exclusive named shader interface provided by this module. */
|
|
47
|
+
implements?: string;
|
|
48
|
+
/** Language of source when an application-owned transpiler is required. */
|
|
49
|
+
sourceLanguage?: string;
|
|
50
|
+
/** WGSL code, or reusable code in sourceLanguage combined with the application source. */
|
|
51
|
+
source?: string;
|
|
52
|
+
/** GLSL fragment shader code */
|
|
53
|
+
fs?: string;
|
|
54
|
+
/** GLSL vertex shader code */
|
|
55
|
+
vs?: string;
|
|
56
|
+
/** Uniform shader types @note: Both order and types MUST match uniform block declarations in shader */
|
|
57
|
+
uniformTypes?: Required<UniformTypes<UniformsT>>;
|
|
58
|
+
/** Uniform JS prop types */
|
|
59
|
+
propTypes?: Record<keyof UniformsT, UniformInfo>;
|
|
60
|
+
/** Default uniform values */
|
|
61
|
+
defaultUniforms?: Required<UniformsT>;
|
|
62
|
+
/** Function that maps props to uniforms & bindings */
|
|
63
|
+
getUniforms?: (props: Partial<PropsT>, prevUniforms?: UniformsT) => Partial<UniformsT & BindingsT>;
|
|
64
|
+
/** Boolean or numeric preprocessor defines contributed by this shader module. */
|
|
65
|
+
defines?: Record<string, boolean | number>;
|
|
66
|
+
dependencies?: ShaderModule<any, any>[];
|
|
67
|
+
/** Information on deprecated properties */
|
|
68
|
+
deprecations?: ShaderModuleDeprecation[];
|
|
69
|
+
/** The instance field contains information that is generated at run-time */
|
|
70
|
+
instance?: {
|
|
71
|
+
propValidators?: Record<string, PropValidator>;
|
|
72
|
+
parsedDeprecations: ShaderModuleDeprecation[];
|
|
73
|
+
/** Empty compatibility value for consumers using older shadertools assembly. */
|
|
74
|
+
normalizedInjections: {
|
|
75
|
+
vertex: Record<string, ResolvedShaderInjection>;
|
|
76
|
+
fragment: Record<string, ResolvedShaderInjection>;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/** Use to generate deprecations when shader module is used */
|
|
81
|
+
export type ShaderModuleDeprecation = {
|
|
82
|
+
type: string;
|
|
83
|
+
regex?: RegExp;
|
|
84
|
+
new: string;
|
|
85
|
+
old: string;
|
|
86
|
+
deprecated?: boolean;
|
|
87
|
+
};
|
|
88
|
+
export declare function initializeShaderModules(modules: ShaderModule[]): void;
|
|
89
|
+
export declare function initializeShaderModule(module: ShaderModule): void;
|
|
90
|
+
/** Convert module props to uniforms */
|
|
91
|
+
export declare function getShaderModuleUniforms<ShaderModuleT extends ShaderModule<Record<string, unknown>, Record<string, ShaderModuleUniformValue>>>(module: ShaderModuleT, props?: ShaderModuleT['props'], oldUniforms?: ShaderModuleT['uniforms']): Record<string, Binding | ShaderModuleUniformValue>;
|
|
92
|
+
export declare function checkShaderModuleDeprecations(shaderModule: ShaderModule, shaderSource: string, log: any): void;
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=shader-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-module.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-module/shader-module.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,aAAa,EAAC,uBAAoB;AAC1C,OAAO,EACL,QAAQ,EACR,aAAa,EAGd,iCAA8B;AAC/B,OAAO,KAAK,EAAC,wBAAwB,EAAE,YAAY,EAAE,YAAY,EAAC,kCAA+B;AACjG,OAAO,KAAK,EAAC,uBAAuB,EAAC,gDAA6C;AAElF,OAAO,KAAK,EAAC,aAAa,IAAI,OAAO,EAAC,uBAAoB;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,GAAG,QAAQ,CAAC;AAEb,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE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;YAChD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;SACnD,CAAC;KACH,CAAC;CACH,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAIF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAErE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CA0CjE;AAED,uCAAuC;AACvC,wBAAgB,uBAAuB,CACrC,aAAa,SAAS,YAAY,CAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CACzC,EAED,MAAM,EAAE,aAAa,EACrB,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,WAAW,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,GACtC,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,wBAAwB,CAAC,CAYpD;AAwBD,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,GAAG,GACP,IAAI,CAUN"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { makePropValidators, getValidatedProperties } from "../filters/prop-types.js";
|
|
5
|
+
// SHNDER MODULE API
|
|
6
|
+
export function initializeShaderModules(modules) {
|
|
7
|
+
modules.map((module) => initializeShaderModule(module));
|
|
8
|
+
}
|
|
9
|
+
export function initializeShaderModule(module) {
|
|
10
|
+
if (module.instance) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
initializeShaderModules(module.dependencies || []);
|
|
14
|
+
const { propTypes = {}, deprecations = [] } = module;
|
|
15
|
+
const instance = {
|
|
16
|
+
parsedDeprecations: parseDeprecationDefinitions(deprecations),
|
|
17
|
+
normalizedInjections: { vertex: {}, fragment: {} }
|
|
18
|
+
};
|
|
19
|
+
if (propTypes) {
|
|
20
|
+
instance.propValidators = makePropValidators(propTypes);
|
|
21
|
+
}
|
|
22
|
+
module.instance = instance;
|
|
23
|
+
// TODO(ib) - we need to apply the original prop types to the default uniforms
|
|
24
|
+
let defaultProps = {};
|
|
25
|
+
if (propTypes) {
|
|
26
|
+
defaultProps = Object.entries(propTypes).reduce((obj, [key, propType]) => {
|
|
27
|
+
// @ts-expect-error
|
|
28
|
+
const value = propType?.value;
|
|
29
|
+
if (value) {
|
|
30
|
+
// @ts-expect-error
|
|
31
|
+
obj[key] = value;
|
|
32
|
+
}
|
|
33
|
+
return obj;
|
|
34
|
+
}, {});
|
|
35
|
+
}
|
|
36
|
+
// Merge validated default props with existing uniforms. Type assertion needed due to complex generics.
|
|
37
|
+
module.defaultUniforms = {
|
|
38
|
+
...module.defaultUniforms,
|
|
39
|
+
...defaultProps
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Convert module props to uniforms */
|
|
43
|
+
export function getShaderModuleUniforms(module, props, oldUniforms) {
|
|
44
|
+
initializeShaderModule(module);
|
|
45
|
+
const uniforms = oldUniforms || { ...module.defaultUniforms };
|
|
46
|
+
// If module has a getUniforms function, use it
|
|
47
|
+
if (props && module.getUniforms) {
|
|
48
|
+
return module.getUniforms(props, uniforms);
|
|
49
|
+
}
|
|
50
|
+
// Build uniforms from the uniforms array
|
|
51
|
+
// @ts-expect-error
|
|
52
|
+
return getValidatedProperties(props, module.instance?.propValidators, module.name);
|
|
53
|
+
}
|
|
54
|
+
/* TODO this looks like it was unused code
|
|
55
|
+
_defaultGetUniforms(opts: Record<string, any> = {}): Record<string, any> {
|
|
56
|
+
const uniforms: Record<string, any> = {};
|
|
57
|
+
const propTypes = this.uniforms;
|
|
58
|
+
|
|
59
|
+
for (const key in propTypes) {
|
|
60
|
+
const propDef = propTypes[key];
|
|
61
|
+
if (key in opts && !propDef.private) {
|
|
62
|
+
if (propDef.validate) {
|
|
63
|
+
assert(propDef.validate(opts[key], propDef), `${this.name}: invalid ${key}`);
|
|
64
|
+
}
|
|
65
|
+
uniforms[key] = opts[key];
|
|
66
|
+
} else {
|
|
67
|
+
uniforms[key] = propDef.value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return uniforms;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
*/
|
|
75
|
+
// Warn about deprecated uniforms or functions
|
|
76
|
+
export function checkShaderModuleDeprecations(shaderModule, shaderSource, log) {
|
|
77
|
+
shaderModule.deprecations?.forEach(def => {
|
|
78
|
+
if (def.regex?.test(shaderSource)) {
|
|
79
|
+
if (def.deprecated) {
|
|
80
|
+
log.deprecated(def.old, def.new)();
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
log.removed(def.old, def.new)();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// HELPERS
|
|
89
|
+
function parseDeprecationDefinitions(deprecations) {
|
|
90
|
+
deprecations.forEach(def => {
|
|
91
|
+
switch (def.type) {
|
|
92
|
+
case 'function':
|
|
93
|
+
def.regex = new RegExp(`\\b${def.old}\\(`);
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
def.regex = new RegExp(`${def.type} ${def.old};`);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return deprecations;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=shader-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-module.js","sourceRoot":"","sources":["../../../src/lib/shader-module/shader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CAAC,CAAC;AACL,CAAC;AAED,UAAU;AAEV,SAAS,2BAA2B,CAAC,YAAuC;IAC1E,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACzB,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;YACjB,KAAK,UAAU;gBACb,GAAG,CAAC,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;gBAC3C,MAAM;YACR;gBACE,GAAG,CAAC,KAAK,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var shader_pass_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(shader_pass_exports);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ShaderBinding as Binding, SamplerProps, TextureFormat } from "../../types.js";
|
|
2
|
+
import type { PickBindings, PickUniforms, ShaderModule } from "./shader-module.js";
|
|
3
|
+
import type { UniformValue } from "../utils/uniform-types.js";
|
|
4
|
+
export type ShaderPassRenderTarget = {
|
|
5
|
+
/** Width and height scale relative to the renderer output size. */
|
|
6
|
+
scale?: [number, number];
|
|
7
|
+
/** Render target format. Defaults to the device preferred color format. */
|
|
8
|
+
format?: TextureFormat;
|
|
9
|
+
/** Optional sampling behavior when later passes read this target. */
|
|
10
|
+
sampler?: SamplerProps;
|
|
11
|
+
/** Reuse an earlier transient target with an identical size, format, and sampler. */
|
|
12
|
+
aliasFor?: string;
|
|
13
|
+
/** Allow WebGPU compute shaders to write this target as a storage texture. */
|
|
14
|
+
storage?: boolean;
|
|
15
|
+
/** Resource lifetime. History targets retain their last successfully rendered value. */
|
|
16
|
+
lifetime?: 'transient' | 'history';
|
|
17
|
+
/** Initial value used after construction, resize, or an explicit history reset. */
|
|
18
|
+
initialize?: 'original' | {
|
|
19
|
+
clearColor: [number, number, number, number];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type ShaderPassInputSource<TargetNameT extends string = string> = 'original' | 'previous' | TargetNameT;
|
|
23
|
+
/**
|
|
24
|
+
* A ShaderPass is a ShaderModule that can be run "standalone" (e.g. post processing effects)
|
|
25
|
+
* It adds additional information on how to run the module.
|
|
26
|
+
* A ShaderPass can require one or more sub passes.
|
|
27
|
+
*/
|
|
28
|
+
export type ShaderPass<PropsT extends Record<string, any> = Record<string, any>, UniformsT extends Record<string, UniformValue> = PickUniforms<PropsT>, BindingsT extends Record<string, Binding> = PickBindings<PropsT>, RenderTargetNameT extends string = never> = ShaderModule<PropsT, UniformsT, BindingsT> & {
|
|
29
|
+
/** A shader pass can run multiple sub passes */
|
|
30
|
+
passes?: ShaderSubPass<UniformsT, Extract<keyof BindingsT, string>, RenderTargetNameT>[];
|
|
31
|
+
};
|
|
32
|
+
/** Information on how to run a specific sub pass */
|
|
33
|
+
export type ShaderSubPass<UniformsT extends Record<string, UniformValue> = Record<string, UniformValue>, BindingNameT extends string = string, RenderTargetNameT extends string = string> = {
|
|
34
|
+
/**
|
|
35
|
+
* Action indicates whether this pass:
|
|
36
|
+
* - filters the color in each pixel (provides a `<pass.name>_filterColor()` shader function)
|
|
37
|
+
* - performs its own sampling (provides a `<pass.name>_sampleColor()` shader function)
|
|
38
|
+
*/
|
|
39
|
+
action?: 'filter' | 'sample';
|
|
40
|
+
sampler?: boolean;
|
|
41
|
+
filter?: boolean;
|
|
42
|
+
uniforms?: UniformsT;
|
|
43
|
+
/** Mapping from shader binding name to the logical texture source. */
|
|
44
|
+
inputs?: Partial<Record<BindingNameT | 'sourceTexture', ShaderPassInputSource<RenderTargetNameT>>>;
|
|
45
|
+
/** Output target for this sub pass. Defaults to the shared "previous" chain. */
|
|
46
|
+
output?: 'previous' | RenderTargetNameT;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=shader-pass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-pass.d.ts","sourceRoot":"","sources":["../../../src/lib/shader-module/shader-pass.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,aAAa,IAAI,OAAO,EAAE,YAAY,EAAE,aAAa,EAAC,uBAAoB;AACvF,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAC,2BAAwB;AAC9E,OAAO,KAAK,EAAC,YAAY,EAAC,kCAA+B;AAEzD,MAAM,MAAM,sBAAsB,GAAG;IACnC,mEAAmE;IACnE,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,qEAAqE;IACrE,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACnC,mFAAmF;IACnF,UAAU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CAAC,YAAY,GAAG,eAAe,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,CACjF,CAAC;IACF,gFAAgF;IAChF,MAAM,CAAC,EAAE,UAAU,GAAG,iBAAiB,CAAC;CACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-pass.js","sourceRoot":"","sources":["../../../src/lib/shader-module/shader-pass.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D"}
|
|
@@ -0,0 +1,156 @@
|
|
|
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 shader_plugin_exports = {};
|
|
19
|
+
__export(shader_plugin_exports, {
|
|
20
|
+
mergeShaderPluginModules: () => mergeShaderPluginModules,
|
|
21
|
+
resolveShaderPlugins: () => resolveShaderPlugins
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(shader_plugin_exports);
|
|
24
|
+
var import_shader_injections = require("./shader-assembly/shader-injections.cjs");
|
|
25
|
+
var import_types = require("../types.cjs");
|
|
26
|
+
function resolveShaderPlugins(plugins = [], shaderLanguage) {
|
|
27
|
+
const resolved = {
|
|
28
|
+
modules: [],
|
|
29
|
+
injectionTargets: [],
|
|
30
|
+
defines: {},
|
|
31
|
+
injections: {},
|
|
32
|
+
vertexInputs: {},
|
|
33
|
+
interStageVariables: {}
|
|
34
|
+
};
|
|
35
|
+
for (const plugin of plugins) {
|
|
36
|
+
appendShaderPlugin(resolved, plugin, shaderLanguage);
|
|
37
|
+
}
|
|
38
|
+
const { vertexInputs, interStageVariables } = resolved;
|
|
39
|
+
for (const name of Object.keys(interStageVariables)) {
|
|
40
|
+
if (vertexInputs[name]) {
|
|
41
|
+
throw new Error(`ShaderPlugin name "${name}" cannot be both a vertex input and a varying`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return resolved;
|
|
45
|
+
}
|
|
46
|
+
function mergeShaderPluginModules(modules = [], pluginModules = [], options = {}) {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const mergedModules = [...modules];
|
|
49
|
+
const selectedModules = /* @__PURE__ */ new Map();
|
|
50
|
+
for (const module2 of mergedModules) {
|
|
51
|
+
const selected = selectedModules.get(module2.name);
|
|
52
|
+
if (selected && selected !== module2)
|
|
53
|
+
(_a = options.onConflict) == null ? void 0 : _a.call(options, module2.name, selected, module2);
|
|
54
|
+
if (!selected)
|
|
55
|
+
selectedModules.set(module2.name, module2);
|
|
56
|
+
}
|
|
57
|
+
for (const pluginModule of pluginModules) {
|
|
58
|
+
const selected = selectedModules.get(pluginModule.name);
|
|
59
|
+
if (selected && selected !== pluginModule) {
|
|
60
|
+
(_b = options.onConflict) == null ? void 0 : _b.call(options, pluginModule.name, selected, pluginModule);
|
|
61
|
+
}
|
|
62
|
+
if (!selected) {
|
|
63
|
+
mergedModules.push(pluginModule);
|
|
64
|
+
selectedModules.set(pluginModule.name, pluginModule);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return mergedModules;
|
|
68
|
+
}
|
|
69
|
+
function appendShaderPlugin(resolved, plugin, shaderLanguage) {
|
|
70
|
+
if (plugin.module) {
|
|
71
|
+
resolved.modules.push(plugin.module);
|
|
72
|
+
}
|
|
73
|
+
if (plugin.defines) {
|
|
74
|
+
Object.assign(resolved.defines, plugin.defines);
|
|
75
|
+
}
|
|
76
|
+
for (const [name, type] of Object.entries(plugin.vertexInputs || {})) {
|
|
77
|
+
assertShaderPluginInterfaceName(name, "vertex input");
|
|
78
|
+
const existingType = resolved.vertexInputs[name];
|
|
79
|
+
if (existingType && existingType !== type) {
|
|
80
|
+
throw new Error(`ShaderPlugin vertex input "${name}" has conflicting types "${existingType}" and "${type}"`);
|
|
81
|
+
}
|
|
82
|
+
resolved.vertexInputs[name] = type;
|
|
83
|
+
}
|
|
84
|
+
for (const [name, varying] of Object.entries(plugin.interStageVariables || {})) {
|
|
85
|
+
assertShaderPluginInterfaceName(name, "varying");
|
|
86
|
+
const normalizedVarying = normalizeShaderPluginInterStageVariable(name, varying);
|
|
87
|
+
const existingVarying = resolved.interStageVariables[name];
|
|
88
|
+
if (existingVarying && (existingVarying.type !== normalizedVarying.type || existingVarying.interpolation !== normalizedVarying.interpolation)) {
|
|
89
|
+
throw new Error(`ShaderPlugin varying "${name}" has conflicting declarations "${existingVarying.type}/${existingVarying.interpolation}" and "${normalizedVarying.type}/${normalizedVarying.interpolation}"`);
|
|
90
|
+
}
|
|
91
|
+
resolved.interStageVariables[name] = normalizedVarying;
|
|
92
|
+
}
|
|
93
|
+
for (const injectionTarget of plugin.injectionTargets || []) {
|
|
94
|
+
const implementation = injectionTarget[shaderLanguage];
|
|
95
|
+
if (!implementation)
|
|
96
|
+
continue;
|
|
97
|
+
const target = `${injectionTarget.stage === "vertex" ? "vs" : "fs"}:${injectionTarget.name}`;
|
|
98
|
+
if (!/^(vs|fs):[A-Za-z_][A-Za-z0-9_]*$/.test(target)) {
|
|
99
|
+
throw new Error(`Invalid ShaderPlugin injection target ${target}`);
|
|
100
|
+
}
|
|
101
|
+
const existing = resolved.injectionTargets.find((value) => value.stage === injectionTarget.stage && value.name === injectionTarget.name);
|
|
102
|
+
const previous = existing == null ? void 0 : existing[shaderLanguage];
|
|
103
|
+
if (previous && (previous.parameters !== implementation.parameters || (previous.returnType || "void") !== (implementation.returnType || "void") || previous.header !== implementation.header || previous.footer !== implementation.footer)) {
|
|
104
|
+
throw new Error(`Conflicting ShaderPlugin injection target ${target}`);
|
|
105
|
+
}
|
|
106
|
+
if (!existing)
|
|
107
|
+
resolved.injectionTargets.push({
|
|
108
|
+
name: injectionTarget.name,
|
|
109
|
+
stage: injectionTarget.stage,
|
|
110
|
+
[shaderLanguage]: implementation
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const pluginInjections = Array.isArray(plugin.injections) ? plugin.injections : Object.entries(plugin.injections || {}).flatMap(([key, source]) => {
|
|
114
|
+
const target = selectShaderLanguage(key, shaderLanguage);
|
|
115
|
+
if (target === void 0)
|
|
116
|
+
return [];
|
|
117
|
+
const [stage, ...name] = target.split(":");
|
|
118
|
+
if (stage !== "vs" && stage !== "fs")
|
|
119
|
+
throw new Error(`Invalid ShaderPlugin injection ${key}`);
|
|
120
|
+
return [
|
|
121
|
+
{
|
|
122
|
+
stage: stage === "vs" ? "vertex" : "fragment",
|
|
123
|
+
target: name.join(":"),
|
|
124
|
+
[shaderLanguage]: source
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
});
|
|
128
|
+
const selectedInjections = (0, import_shader_injections.resolveShaderInjections)(pluginInjections, shaderLanguage, plugin.name);
|
|
129
|
+
for (const [target, injections] of Object.entries(selectedInjections)) {
|
|
130
|
+
resolved.injections[target] ||= [];
|
|
131
|
+
resolved.injections[target].push(...injections);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function assertShaderPluginInterfaceName(name, kind) {
|
|
135
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name) || name.startsWith("_luma_")) {
|
|
136
|
+
throw new Error(`ShaderPlugin ${kind} "${name}" must be a valid non-reserved identifier`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function normalizeShaderPluginInterStageVariable(name, varying) {
|
|
140
|
+
const { primitiveType } = import_types.shaderTypeDecoder.getAttributeShaderTypeInfo(varying.type);
|
|
141
|
+
const integerType = primitiveType === "i32" || primitiveType === "u32";
|
|
142
|
+
const interpolation = varying.interpolation || (integerType ? "flat" : "smooth");
|
|
143
|
+
if (integerType && interpolation === "smooth") {
|
|
144
|
+
throw new Error(`ShaderPlugin integer varying "${name}" must use flat interpolation`);
|
|
145
|
+
}
|
|
146
|
+
return { type: varying.type, interpolation };
|
|
147
|
+
}
|
|
148
|
+
function selectShaderLanguage(value, language) {
|
|
149
|
+
const match = /^(glsl|wgsl):([\s\S]+)$/.exec(value);
|
|
150
|
+
return match ? match[1] === language ? match[2] : void 0 : value;
|
|
151
|
+
}
|
|
152
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
153
|
+
0 && (module.exports = {
|
|
154
|
+
mergeShaderPluginModules,
|
|
155
|
+
resolveShaderPlugins
|
|
156
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ShaderInjectionTarget } from "./shader-assembly/shader-injection-targets.js";
|
|
2
|
+
import { type ShaderInjection, type ResolvedShaderInjection } from "./shader-assembly/shader-injections.js";
|
|
3
|
+
import type { ShaderModule } from "./shader-module/shader-module.js";
|
|
4
|
+
import { type AttributeShaderType } from "../types.js";
|
|
5
|
+
/** Portable interpolation modes for ShaderPlugin inter-stage variables. */
|
|
6
|
+
export type ShaderPluginInterStageVariableInterpolation = 'smooth' | 'flat';
|
|
7
|
+
/** Cross-stage value contributed by a ShaderPlugin. */
|
|
8
|
+
export type ShaderPluginInterStageVariable = {
|
|
9
|
+
/** Portable scalar or vector shader type. */
|
|
10
|
+
type: AttributeShaderType;
|
|
11
|
+
/** Defaults to smooth for floating-point types and flat for integer types. */
|
|
12
|
+
interpolation?: ShaderPluginInterStageVariableInterpolation;
|
|
13
|
+
};
|
|
14
|
+
/** Fully normalized ShaderPlugin inter-stage variable declaration. */
|
|
15
|
+
export type ResolvedShaderPluginInterStageVariable = {
|
|
16
|
+
type: AttributeShaderType;
|
|
17
|
+
interpolation: ShaderPluginInterStageVariableInterpolation;
|
|
18
|
+
};
|
|
19
|
+
/** Reusable shader assembly descriptor with one portable interface and language-specific source. */
|
|
20
|
+
export type ShaderPlugin = {
|
|
21
|
+
/** Stable plugin identifier. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Primary shader module. Supporting modules belong in its dependencies; omit for injection-only plugins. */
|
|
24
|
+
module?: ShaderModule<any, any, any>;
|
|
25
|
+
/** Boolean or numeric preprocessor defines added to shader assembly. */
|
|
26
|
+
defines?: Record<string, boolean | number>;
|
|
27
|
+
/** Named injections as explicit-stage objects or optionally language-qualified string keys. */
|
|
28
|
+
injections?: ShaderInjection[] | Record<string, string>;
|
|
29
|
+
/** Callable extension points with a shared name and language-specific source. */
|
|
30
|
+
injectionTargets?: ShaderInjectionTarget[];
|
|
31
|
+
/** Shader-facing vertex inputs added by this plugin. Buffer ownership remains with the caller. */
|
|
32
|
+
vertexInputs?: Record<string, AttributeShaderType>;
|
|
33
|
+
/** Values transported from the selected vertex entry point to the fragment entry point. */
|
|
34
|
+
interStageVariables?: Record<string, ShaderPluginInterStageVariable>;
|
|
35
|
+
};
|
|
36
|
+
/** ShaderPlugin contributions resolved for one shader language. */
|
|
37
|
+
export type ResolvedShaderPlugins = {
|
|
38
|
+
/** Resolved shader modules in plugin declaration order. */
|
|
39
|
+
modules: ShaderModule[];
|
|
40
|
+
/** Language-selected callable injection target declarations. */
|
|
41
|
+
injectionTargets: ShaderInjectionTarget[];
|
|
42
|
+
/** Resolved boolean or numeric preprocessor defines. */
|
|
43
|
+
defines: Record<string, boolean | number>;
|
|
44
|
+
/** Resolved named code injections grouped by target. */
|
|
45
|
+
injections: Record<string, ResolvedShaderInjection[]>;
|
|
46
|
+
/** Resolved shader-facing vertex inputs in plugin declaration order. */
|
|
47
|
+
vertexInputs: Record<string, AttributeShaderType>;
|
|
48
|
+
/** Resolved inter-stage variables in plugin declaration order. */
|
|
49
|
+
interStageVariables: Record<string, ResolvedShaderPluginInterStageVariable>;
|
|
50
|
+
};
|
|
51
|
+
/** Resolve plugin interfaces and select injection source for one shader language. */
|
|
52
|
+
export declare function resolveShaderPlugins(plugins: readonly ShaderPlugin[] | undefined, shaderLanguage: 'glsl' | 'wgsl'): ResolvedShaderPlugins;
|
|
53
|
+
/**
|
|
54
|
+
* Preserve explicit module inputs while appending plugin modules by first-seen name.
|
|
55
|
+
* Optional diagnostics report distinct descriptors sharing a name, without changing selection.
|
|
56
|
+
* Descriptor identity is checked; equivalent independently-created descriptors also report a conflict.
|
|
57
|
+
*/
|
|
58
|
+
export declare function mergeShaderPluginModules(modules?: readonly ShaderModule[], pluginModules?: readonly ShaderModule[], options?: {
|
|
59
|
+
onConflict?: (name: string, selected: ShaderModule, ignored: ShaderModule) => void;
|
|
60
|
+
}): ShaderModule[];
|
|
61
|
+
//# sourceMappingURL=shader-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-plugin.d.ts","sourceRoot":"","sources":["../../src/lib/shader-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,qBAAqB,EAAC,sDAAmD;AACtF,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC7B,+CAA4C;AAC7C,OAAO,KAAK,EAAC,YAAY,EAAC,yCAAsC;AAChE,OAAO,EAAoB,KAAK,mBAAmB,EAAC,oBAAiB;AAErE,2EAA2E;AAC3E,MAAM,MAAM,2CAA2C,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE5E,uDAAuD;AACvD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,6CAA6C;IAC7C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,8EAA8E;IAC9E,aAAa,CAAC,EAAE,2CAA2C,CAAC;CAC7D,CAAC;AAEF,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