@luma.gl/shaders 0.0.0-stage → 10.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +38 -0
- package/README.md +25 -2
- package/dist/dist.dev.js +21598 -0
- package/dist/dist.min.js +13439 -0
- package/dist/glsl.cjs +33 -0
- package/dist/glsl.cjs.map +6 -0
- package/dist/glsl.d.ts +6 -0
- package/dist/glsl.d.ts.map +1 -0
- package/dist/glsl.js +7 -0
- package/dist/glsl.js.map +1 -0
- package/dist/index.cjs +278 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/color/normalize-byte-colors.cjs +50 -0
- package/dist/lib/color/normalize-byte-colors.d.ts +23 -0
- package/dist/lib/color/normalize-byte-colors.d.ts.map +1 -0
- package/dist/lib/color/normalize-byte-colors.js +42 -0
- package/dist/lib/color/normalize-byte-colors.js.map +1 -0
- package/dist/lib/filters/prop-types.cjs +90 -0
- package/dist/lib/filters/prop-types.d.ts +44 -0
- package/dist/lib/filters/prop-types.d.ts.map +1 -0
- package/dist/lib/filters/prop-types.js +96 -0
- package/dist/lib/filters/prop-types.js.map +1 -0
- package/dist/lib/glsl-shader-assembler.cjs +50 -0
- package/dist/lib/glsl-shader-assembler.d.ts +19 -0
- package/dist/lib/glsl-shader-assembler.d.ts.map +1 -0
- package/dist/lib/glsl-shader-assembler.js +29 -0
- package/dist/lib/glsl-shader-assembler.js.map +1 -0
- package/dist/lib/glsl-utils/get-shader-info.cjs +52 -0
- package/dist/lib/glsl-utils/get-shader-info.d.ts +9 -0
- package/dist/lib/glsl-utils/get-shader-info.d.ts.map +1 -0
- package/dist/lib/glsl-utils/get-shader-info.js +33 -0
- package/dist/lib/glsl-utils/get-shader-info.js.map +1 -0
- package/dist/lib/glsl-utils/shader-utils.cjs +126 -0
- package/dist/lib/glsl-utils/shader-utils.d.ts +23 -0
- package/dist/lib/glsl-utils/shader-utils.d.ts.map +1 -0
- package/dist/lib/glsl-utils/shader-utils.js +92 -0
- package/dist/lib/glsl-utils/shader-utils.js.map +1 -0
- package/dist/lib/preprocessor/preprocessor.cjs +128 -0
- package/dist/lib/preprocessor/preprocessor.d.ts +15 -0
- package/dist/lib/preprocessor/preprocessor.d.ts.map +1 -0
- package/dist/lib/preprocessor/preprocessor.js +120 -0
- package/dist/lib/preprocessor/preprocessor.js.map +1 -0
- package/dist/lib/shader-assembler-base.cjs +132 -0
- package/dist/lib/shader-assembler-base.d.ts +51 -0
- package/dist/lib/shader-assembler-base.d.ts.map +1 -0
- package/dist/lib/shader-assembler-base.js +127 -0
- package/dist/lib/shader-assembler-base.js.map +1 -0
- package/dist/lib/shader-assembler.cjs +33 -0
- package/dist/lib/shader-assembler.d.ts +4 -0
- package/dist/lib/shader-assembler.d.ts.map +1 -0
- package/dist/lib/shader-assembler.js +7 -0
- package/dist/lib/shader-assembler.js.map +1 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.cjs +181 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts +70 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.js +208 -0
- package/dist/lib/shader-assembly/assemble-glsl-shaders.js.map +1 -0
- package/dist/lib/shader-assembly/assemble-shaders.cjs +42 -0
- package/dist/lib/shader-assembly/assemble-shaders.d.ts +10 -0
- package/dist/lib/shader-assembly/assemble-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-shaders.js +10 -0
- package/dist/lib/shader-assembly/assemble-shaders.js.map +1 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.cjs +498 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts +70 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.d.ts.map +1 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.js +480 -0
- package/dist/lib/shader-assembly/assemble-wgsl-shaders.js.map +1 -0
- package/dist/lib/shader-assembly/platform-defines.cjs +79 -0
- package/dist/lib/shader-assembly/platform-defines.d.ts +4 -0
- package/dist/lib/shader-assembly/platform-defines.d.ts.map +1 -0
- package/dist/lib/shader-assembly/platform-defines.js +52 -0
- package/dist/lib/shader-assembly/platform-defines.js.map +1 -0
- package/dist/lib/shader-assembly/platform-info.cjs +15 -0
- package/dist/lib/shader-assembly/platform-info.d.ts +20 -0
- package/dist/lib/shader-assembly/platform-info.d.ts.map +1 -0
- package/dist/lib/shader-assembly/platform-info.js +5 -0
- package/dist/lib/shader-assembly/platform-info.js.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.cjs +96 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.d.ts +16 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.js +79 -0
- package/dist/lib/shader-assembly/shader-assembly-shared.js.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-types.cjs +15 -0
- package/dist/lib/shader-assembly/shader-assembly-types.d.ts +132 -0
- package/dist/lib/shader-assembly/shader-assembly-types.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-assembly-types.js +5 -0
- package/dist/lib/shader-assembly/shader-assembly-types.js.map +1 -0
- package/dist/lib/shader-assembly/shader-injection-targets.cjs +103 -0
- package/dist/lib/shader-assembly/shader-injection-targets.d.ts +46 -0
- package/dist/lib/shader-assembly/shader-injection-targets.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-injection-targets.js +83 -0
- package/dist/lib/shader-assembly/shader-injection-targets.js.map +1 -0
- package/dist/lib/shader-assembly/shader-injections.cjs +204 -0
- package/dist/lib/shader-assembly/shader-injections.d.ts +49 -0
- package/dist/lib/shader-assembly/shader-injections.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-injections.js +207 -0
- package/dist/lib/shader-assembly/shader-injections.js.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.cjs +434 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts +15 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.js +438 -0
- package/dist/lib/shader-assembly/shader-plugin-varyings.js.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.cjs +254 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.d.ts +12 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.d.ts.map +1 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.js +237 -0
- package/dist/lib/shader-assembly/shader-plugin-vertex-inputs.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.cjs +166 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.d.ts +37 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.js +144 -0
- package/dist/lib/shader-assembly/wgsl-binding-debug.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.cjs +184 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.d.ts +19 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.js +151 -0
- package/dist/lib/shader-assembly/wgsl-binding-scan.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.cjs +163 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.d.ts +8 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.js +145 -0
- package/dist/lib/shader-assembly/wgsl-injection-target-names.js.map +1 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.cjs +502 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.d.ts +14 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.d.ts.map +1 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.js +498 -0
- package/dist/lib/shader-assembly/wgsl-interface-scan.js.map +1 -0
- package/dist/lib/shader-generator/generate-shader.cjs +36 -0
- package/dist/lib/shader-generator/generate-shader.d.ts +8 -0
- package/dist/lib/shader-generator/generate-shader.d.ts.map +1 -0
- package/dist/lib/shader-generator/generate-shader.js +15 -0
- package/dist/lib/shader-generator/generate-shader.js.map +1 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.cjs +94 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.d.ts +7 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.d.ts.map +1 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.js +79 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.js.map +1 -0
- package/dist/lib/shader-generator/utils/capitalize.cjs +29 -0
- package/dist/lib/shader-generator/utils/capitalize.d.ts +7 -0
- package/dist/lib/shader-generator/utils/capitalize.d.ts.map +1 -0
- package/dist/lib/shader-generator/utils/capitalize.js +12 -0
- package/dist/lib/shader-generator/utils/capitalize.js.map +1 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.cjs +46 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts +7 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts.map +1 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.js +23 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.js.map +1 -0
- package/dist/lib/shader-module/composite-shader-pass.cjs +15 -0
- package/dist/lib/shader-module/composite-shader-pass.d.ts +41 -0
- package/dist/lib/shader-module/composite-shader-pass.d.ts.map +1 -0
- package/dist/lib/shader-module/composite-shader-pass.js +5 -0
- package/dist/lib/shader-module/composite-shader-pass.js.map +1 -0
- package/dist/lib/shader-module/shader-module-dependencies.cjs +83 -0
- package/dist/lib/shader-module/shader-module-dependencies.d.ts +39 -0
- package/dist/lib/shader-module/shader-module-dependencies.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module-dependencies.js +103 -0
- package/dist/lib/shader-module/shader-module-dependencies.js.map +1 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.cjs +224 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.d.ts +91 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.js +253 -0
- package/dist/lib/shader-module/shader-module-uniform-layout.js.map +1 -0
- package/dist/lib/shader-module/shader-module.cjs +99 -0
- package/dist/lib/shader-module/shader-module.d.ts +94 -0
- package/dist/lib/shader-module/shader-module.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-module.js +101 -0
- package/dist/lib/shader-module/shader-module.js.map +1 -0
- package/dist/lib/shader-module/shader-pass.cjs +15 -0
- package/dist/lib/shader-module/shader-pass.d.ts +48 -0
- package/dist/lib/shader-module/shader-pass.d.ts.map +1 -0
- package/dist/lib/shader-module/shader-pass.js +5 -0
- package/dist/lib/shader-module/shader-pass.js.map +1 -0
- package/dist/lib/shader-plugin.cjs +156 -0
- package/dist/lib/shader-plugin.d.ts +61 -0
- package/dist/lib/shader-plugin.d.ts.map +1 -0
- package/dist/lib/shader-plugin.js +147 -0
- package/dist/lib/shader-plugin.js.map +1 -0
- package/dist/lib/shader-transpiler/shader-transpiler.cjs +15 -0
- package/dist/lib/shader-transpiler/shader-transpiler.d.ts +27 -0
- package/dist/lib/shader-transpiler/shader-transpiler.d.ts.map +1 -0
- package/dist/lib/shader-transpiler/shader-transpiler.js +5 -0
- package/dist/lib/shader-transpiler/shader-transpiler.js.map +1 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.cjs +71 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.d.ts +9 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.d.ts.map +1 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.js +69 -0
- package/dist/lib/shader-transpiler/transpile-glsl-shader.js.map +1 -0
- package/dist/lib/utils/assert.cjs +34 -0
- package/dist/lib/utils/assert.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts.map +1 -0
- package/dist/lib/utils/assert.js +13 -0
- package/dist/lib/utils/assert.js.map +1 -0
- package/dist/lib/utils/uniform-types.cjs +15 -0
- package/dist/lib/utils/uniform-types.d.ts +18 -0
- package/dist/lib/utils/uniform-types.d.ts.map +1 -0
- package/dist/lib/utils/uniform-types.js +5 -0
- package/dist/lib/utils/uniform-types.js.map +1 -0
- package/dist/lib/wgsl-shader-assembler.cjs +99 -0
- package/dist/lib/wgsl-shader-assembler.d.ts +34 -0
- package/dist/lib/wgsl-shader-assembler.d.ts.map +1 -0
- package/dist/lib/wgsl-shader-assembler.js +84 -0
- package/dist/lib/wgsl-shader-assembler.js.map +1 -0
- package/dist/module-injectors.cjs +59 -0
- package/dist/module-injectors.d.ts +3 -0
- package/dist/module-injectors.d.ts.map +1 -0
- package/dist/module-injectors.js +31 -0
- package/dist/module-injectors.js.map +1 -0
- package/dist/modules/color/float-colors.cjs +275 -0
- package/dist/modules/color/float-colors.d.ts +132 -0
- package/dist/modules/color/float-colors.d.ts.map +1 -0
- package/dist/modules/color/float-colors.js +248 -0
- package/dist/modules/color/float-colors.js.map +1 -0
- package/dist/modules/engine/clip/clip.cjs +142 -0
- package/dist/modules/engine/clip/clip.d.ts +12 -0
- package/dist/modules/engine/clip/clip.d.ts.map +1 -0
- package/dist/modules/engine/clip/clip.js +119 -0
- package/dist/modules/engine/clip/clip.js.map +1 -0
- package/dist/modules/engine/filter/filter.cjs +103 -0
- package/dist/modules/engine/filter/filter.d.ts +12 -0
- package/dist/modules/engine/filter/filter.d.ts.map +1 -0
- package/dist/modules/engine/filter/filter.js +80 -0
- package/dist/modules/engine/filter/filter.js.map +1 -0
- package/dist/modules/engine/geometry/geometry.cjs +63 -0
- package/dist/modules/engine/geometry/geometry.d.ts +9 -0
- package/dist/modules/engine/geometry/geometry.d.ts.map +1 -0
- package/dist/modules/engine/geometry/geometry.js +42 -0
- package/dist/modules/engine/geometry/geometry.js.map +1 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.cjs +255 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.d.ts +34 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.d.ts.map +1 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.js +228 -0
- package/dist/modules/engine/gpu-animation/gpu-animation.js.map +1 -0
- package/dist/modules/engine/picking/picking.cjs +210 -0
- package/dist/modules/engine/picking/picking.d.ts +77 -0
- package/dist/modules/engine/picking/picking.d.ts.map +1 -0
- package/dist/modules/engine/picking/picking.js +198 -0
- package/dist/modules/engine/picking/picking.js.map +1 -0
- package/dist/modules/engine/project/project.cjs +138 -0
- package/dist/modules/engine/project/project.d.ts +39 -0
- package/dist/modules/engine/project/project.d.ts.map +1 -0
- package/dist/modules/engine/project/project.js +129 -0
- package/dist/modules/engine/project/project.js.map +1 -0
- package/dist/modules/engine/skin/skin.cjs +212 -0
- package/dist/modules/engine/skin/skin.d.ts +52 -0
- package/dist/modules/engine/skin/skin.d.ts.map +1 -0
- package/dist/modules/engine/skin/skin.js +179 -0
- package/dist/modules/engine/skin/skin.js.map +1 -0
- package/dist/modules/engine/transform/transform.cjs +72 -0
- package/dist/modules/engine/transform/transform.d.ts +6 -0
- package/dist/modules/engine/transform/transform.d.ts.map +1 -0
- package/dist/modules/engine/transform/transform.js +49 -0
- package/dist/modules/engine/transform/transform.js.map +1 -0
- package/dist/modules/geometry/path-dash/path-dash.cjs +93 -0
- package/dist/modules/geometry/path-dash/path-dash.d.ts +10 -0
- package/dist/modules/geometry/path-dash/path-dash.d.ts.map +1 -0
- package/dist/modules/geometry/path-dash/path-dash.js +66 -0
- package/dist/modules/geometry/path-dash/path-dash.js.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.cjs +117 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.d.ts +3 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.d.ts.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.js +87 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill-shaders.js.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.cjs +64 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.d.ts +14 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.d.ts.map +1 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.js +43 -0
- package/dist/modules/geometry/pattern-fill/pattern-fill.js.map +1 -0
- package/dist/modules/geometry/point-glow/point-glow.cjs +104 -0
- package/dist/modules/geometry/point-glow/point-glow.d.ts +11 -0
- package/dist/modules/geometry/point-glow/point-glow.d.ts.map +1 -0
- package/dist/modules/geometry/point-glow/point-glow.js +77 -0
- package/dist/modules/geometry/point-glow/point-glow.js.map +1 -0
- package/dist/modules/geometry/precipitation/precipitation.cjs +122 -0
- package/dist/modules/geometry/precipitation/precipitation.d.ts +40 -0
- package/dist/modules/geometry/precipitation/precipitation.d.ts.map +1 -0
- package/dist/modules/geometry/precipitation/precipitation.js +95 -0
- package/dist/modules/geometry/precipitation/precipitation.js.map +1 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.cjs +158 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.d.ts +60 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.d.ts.map +1 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.js +137 -0
- package/dist/modules/geometry/sketch-stroke/sketch-stroke.js.map +1 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.cjs +2304 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.d.ts +3 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.d.ts.map +1 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.js +2283 -0
- package/dist/modules/geospatial/dggs/dggs-wgsl.js.map +1 -0
- package/dist/modules/geospatial/dggs/dggs.cjs +31 -0
- package/dist/modules/geospatial/dggs/dggs.d.ts +6 -0
- package/dist/modules/geospatial/dggs/dggs.d.ts.map +1 -0
- package/dist/modules/geospatial/dggs/dggs.js +10 -0
- package/dist/modules/geospatial/dggs/dggs.js.map +1 -0
- package/dist/modules/lighting/area-lighting/area-light-types.cjs +68 -0
- package/dist/modules/lighting/area-lighting/area-light-types.d.ts +34 -0
- package/dist/modules/lighting/area-lighting/area-light-types.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/area-light-types.js +40 -0
- package/dist/modules/lighting/area-lighting/area-light-types.js.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.cjs +101 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.d.ts +3 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.js +71 -0
- package/dist/modules/lighting/area-lighting/area-lighting-shaders.js.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting.cjs +62 -0
- package/dist/modules/lighting/area-lighting/area-lighting.d.ts +89 -0
- package/dist/modules/lighting/area-lighting/area-lighting.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/area-lighting.js +41 -0
- package/dist/modules/lighting/area-lighting/area-lighting.js.map +1 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.cjs +192 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.d.ts +3 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.d.ts.map +1 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.js +162 -0
- package/dist/modules/lighting/area-lighting/ltc-shaders.js.map +1 -0
- package/dist/modules/lighting/atmosphere/atmosphere.cjs +253 -0
- package/dist/modules/lighting/atmosphere/atmosphere.d.ts +45 -0
- package/dist/modules/lighting/atmosphere/atmosphere.d.ts.map +1 -0
- package/dist/modules/lighting/atmosphere/atmosphere.js +228 -0
- package/dist/modules/lighting/atmosphere/atmosphere.js.map +1 -0
- package/dist/modules/lighting/clouds/clouds.cjs +216 -0
- package/dist/modules/lighting/clouds/clouds.d.ts +58 -0
- package/dist/modules/lighting/clouds/clouds.d.ts.map +1 -0
- package/dist/modules/lighting/clouds/clouds.js +192 -0
- package/dist/modules/lighting/clouds/clouds.js.map +1 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.cjs +40 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.d.ts +6 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.d.ts.map +1 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.js +15 -0
- package/dist/modules/lighting/clustered-light-grid/clustered-light-grid.js.map +1 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.cjs +348 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.d.ts +188 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.d.ts.map +1 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.js +307 -0
- package/dist/modules/lighting/contact-shadow/contact-shadow.js.map +1 -0
- package/dist/modules/lighting/firefly/firefly.cjs +74 -0
- package/dist/modules/lighting/firefly/firefly.d.ts +36 -0
- package/dist/modules/lighting/firefly/firefly.d.ts.map +1 -0
- package/dist/modules/lighting/firefly/firefly.js +53 -0
- package/dist/modules/lighting/firefly/firefly.js.map +1 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.cjs +143 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.d.ts +53 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.d.ts.map +1 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.js +119 -0
- package/dist/modules/lighting/globe-clouds/globe-clouds.js.map +1 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.cjs +61 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +12 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.js +40 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.js.map +1 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.cjs +139 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.d.ts +14 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.d.ts.map +1 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.js +114 -0
- package/dist/modules/lighting/height-fog/height-fog-functions.js.map +1 -0
- package/dist/modules/lighting/height-fog/height-fog.cjs +104 -0
- package/dist/modules/lighting/height-fog/height-fog.d.ts +60 -0
- package/dist/modules/lighting/height-fog/height-fog.d.ts.map +1 -0
- package/dist/modules/lighting/height-fog/height-fog.js +77 -0
- package/dist/modules/lighting/height-fog/height-fog.js.map +1 -0
- package/dist/modules/lighting/ibl/ibl.cjs +63 -0
- package/dist/modules/lighting/ibl/ibl.d.ts +25 -0
- package/dist/modules/lighting/ibl/ibl.d.ts.map +1 -0
- package/dist/modules/lighting/ibl/ibl.js +33 -0
- package/dist/modules/lighting/ibl/ibl.js.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-material.cjs +54 -0
- package/dist/modules/lighting/lambert-material/lambert-material.d.ts +10 -0
- package/dist/modules/lighting/lambert-material/lambert-material.d.ts.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-material.js +33 -0
- package/dist/modules/lighting/lambert-material/lambert-material.js.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.cjs +88 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.d.ts +3 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.js +60 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-glsl.js.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.cjs +97 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.d.ts +2 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.js +73 -0
- package/dist/modules/lighting/lambert-material/lambert-shaders-wgsl.js.map +1 -0
- package/dist/modules/lighting/lights/lighting-glsl.cjs +116 -0
- package/dist/modules/lighting/lights/lighting-glsl.d.ts +2 -0
- package/dist/modules/lighting/lights/lighting-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/lights/lighting-glsl.js +92 -0
- package/dist/modules/lighting/lights/lighting-glsl.js.map +1 -0
- package/dist/modules/lighting/lights/lighting-wgsl.cjs +115 -0
- package/dist/modules/lighting/lights/lighting-wgsl.d.ts +2 -0
- package/dist/modules/lighting/lights/lighting-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/lights/lighting-wgsl.js +91 -0
- package/dist/modules/lighting/lights/lighting-wgsl.js.map +1 -0
- package/dist/modules/lighting/lights/lighting.cjs +210 -0
- package/dist/modules/lighting/lights/lighting.d.ts +163 -0
- package/dist/modules/lighting/lights/lighting.d.ts.map +1 -0
- package/dist/modules/lighting/lights/lighting.js +208 -0
- package/dist/modules/lighting/lights/lighting.js.map +1 -0
- package/dist/modules/lighting/no-material/dirlight.cjs +112 -0
- package/dist/modules/lighting/no-material/dirlight.d.ts +33 -0
- package/dist/modules/lighting/no-material/dirlight.d.ts.map +1 -0
- package/dist/modules/lighting/no-material/dirlight.js +86 -0
- package/dist/modules/lighting/no-material/dirlight.js.map +1 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.cjs +87 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.d.ts +21 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js +61 -0
- package/dist/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.js.map +1 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.cjs +87 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.d.ts +21 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js +61 -0
- package/dist/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.cjs +1789 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts +3 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.js +1767 -0
- package/dist/modules/lighting/pbr-material/pbr-material-glsl.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.cjs +2084 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts +3 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js +2062 -0
- package/dist/modules/lighting/pbr-material/pbr-material-wgsl.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material.cjs +315 -0
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts +516 -0
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-material.js +292 -0
- package/dist/modules/lighting/pbr-material/pbr-material.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.cjs +63 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.d.ts +10 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.js +37 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.js.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.cjs +109 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.d.ts +52 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.js +83 -0
- package/dist/modules/lighting/pbr-material/pbr-scene.js.map +1 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.cjs +97 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.d.ts +15 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.js +69 -0
- package/dist/modules/lighting/pbr-shadow/pbr-shadow.js.map +1 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.cjs +114 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.d.ts +15 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.js +88 -0
- package/dist/modules/lighting/pbr-surface/pbr-surface.js.map +1 -0
- package/dist/modules/lighting/phong-material/phong-material.cjs +61 -0
- package/dist/modules/lighting/phong-material/phong-material.d.ts +13 -0
- package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -0
- package/dist/modules/lighting/phong-material/phong-material.js +40 -0
- package/dist/modules/lighting/phong-material/phong-material.js.map +1 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.cjs +100 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +3 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +72 -0
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.js.map +1 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.cjs +153 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts +2 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js +129 -0
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js.map +1 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.cjs +379 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.d.ts +41 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.d.ts.map +1 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.js +345 -0
- package/dist/modules/lighting/prefiltered-environment/prefiltered-environment.js.map +1 -0
- package/dist/modules/lighting/shadow/shadow-glsl.cjs +228 -0
- package/dist/modules/lighting/shadow/shadow-glsl.d.ts +3 -0
- package/dist/modules/lighting/shadow/shadow-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/shadow/shadow-glsl.js +204 -0
- package/dist/modules/lighting/shadow/shadow-glsl.js.map +1 -0
- package/dist/modules/lighting/shadow/shadow-types.cjs +15 -0
- package/dist/modules/lighting/shadow/shadow-types.d.ts +63 -0
- package/dist/modules/lighting/shadow/shadow-types.d.ts.map +1 -0
- package/dist/modules/lighting/shadow/shadow-types.js +5 -0
- package/dist/modules/lighting/shadow/shadow-types.js.map +1 -0
- package/dist/modules/lighting/shadow/shadow.cjs +458 -0
- package/dist/modules/lighting/shadow/shadow.d.ts +117 -0
- package/dist/modules/lighting/shadow/shadow.d.ts.map +1 -0
- package/dist/modules/lighting/shadow/shadow.js +450 -0
- package/dist/modules/lighting/shadow/shadow.js.map +1 -0
- package/dist/modules/lighting/surface-weather/surface-weather.cjs +199 -0
- package/dist/modules/lighting/surface-weather/surface-weather.d.ts +54 -0
- package/dist/modules/lighting/surface-weather/surface-weather.d.ts.map +1 -0
- package/dist/modules/lighting/surface-weather/surface-weather.js +175 -0
- package/dist/modules/lighting/surface-weather/surface-weather.js.map +1 -0
- package/dist/modules/lighting/unlit-material/unlit-material.cjs +60 -0
- package/dist/modules/lighting/unlit-material/unlit-material.d.ts +9 -0
- package/dist/modules/lighting/unlit-material/unlit-material.d.ts.map +1 -0
- package/dist/modules/lighting/unlit-material/unlit-material.js +40 -0
- package/dist/modules/lighting/unlit-material/unlit-material.js.map +1 -0
- package/dist/modules/lighting/water-material/river-water-material.cjs +56 -0
- package/dist/modules/lighting/water-material/river-water-material.d.ts +21 -0
- package/dist/modules/lighting/water-material/river-water-material.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/river-water-material.js +36 -0
- package/dist/modules/lighting/water-material/river-water-material.js.map +1 -0
- package/dist/modules/lighting/water-material/river-water-shaders.cjs +261 -0
- package/dist/modules/lighting/water-material/river-water-shaders.d.ts +3 -0
- package/dist/modules/lighting/water-material/river-water-shaders.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/river-water-shaders.js +233 -0
- package/dist/modules/lighting/water-material/river-water-shaders.js.map +1 -0
- package/dist/modules/lighting/water-material/water-material.cjs +188 -0
- package/dist/modules/lighting/water-material/water-material.d.ts +28 -0
- package/dist/modules/lighting/water-material/water-material.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/water-material.js +179 -0
- package/dist/modules/lighting/water-material/water-material.js.map +1 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.cjs +260 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.d.ts +3 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.js +232 -0
- package/dist/modules/lighting/water-material/water-shaders-glsl.js.map +1 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.cjs +254 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.d.ts +2 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.js +230 -0
- package/dist/modules/lighting/water-material/water-shaders-wgsl.js.map +1 -0
- package/dist/modules/math/fp16/fp16-utils.cjs +112 -0
- package/dist/modules/math/fp16/fp16-utils.d.ts +13 -0
- package/dist/modules/math/fp16/fp16-utils.d.ts.map +1 -0
- package/dist/modules/math/fp16/fp16-utils.js +118 -0
- package/dist/modules/math/fp16/fp16-utils.js.map +1 -0
- package/dist/modules/math/fp32/fp32.cjs +310 -0
- package/dist/modules/math/fp32/fp32.d.ts +9 -0
- package/dist/modules/math/fp32/fp32.d.ts.map +1 -0
- package/dist/modules/math/fp32/fp32.js +288 -0
- package/dist/modules/math/fp32/fp32.js.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.cjs +229 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.d.ts +2 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.js +205 -0
- package/dist/modules/math/fp64/fp64-arithmetic-glsl.js.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.cjs +144 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.d.ts +10 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.js +128 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.js.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.cjs +583 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.d.ts +11 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.js +563 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl-integer.js.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.cjs +946 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.d.ts +3 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.js +923 -0
- package/dist/modules/math/fp64/fp64-arithmetic-wgsl.js.map +1 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.cjs +699 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.d.ts +2 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.js +675 -0
- package/dist/modules/math/fp64/fp64-functions-glsl.js.map +1 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.cjs +180 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.d.ts +3 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.js +157 -0
- package/dist/modules/math/fp64/fp64-functions-wgsl.js.map +1 -0
- package/dist/modules/math/fp64/fp64-utils.cjs +50 -0
- package/dist/modules/math/fp64/fp64-utils.d.ts +22 -0
- package/dist/modules/math/fp64/fp64-utils.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64-utils.js +42 -0
- package/dist/modules/math/fp64/fp64-utils.js.map +1 -0
- package/dist/modules/math/fp64/fp64.cjs +68 -0
- package/dist/modules/math/fp64/fp64.d.ts +24 -0
- package/dist/modules/math/fp64/fp64.d.ts.map +1 -0
- package/dist/modules/math/fp64/fp64.js +46 -0
- package/dist/modules/math/fp64/fp64.js.map +1 -0
- package/dist/modules/math/random/random.cjs +46 -0
- package/dist/modules/math/random/random.d.ts +7 -0
- package/dist/modules/math/random/random.d.ts.map +1 -0
- package/dist/modules/math/random/random.js +21 -0
- package/dist/modules/math/random/random.js.map +1 -0
- package/dist/modules/math/value-noise/value-noise.cjs +95 -0
- package/dist/modules/math/value-noise/value-noise.d.ts +7 -0
- package/dist/modules/math/value-noise/value-noise.d.ts.map +1 -0
- package/dist/modules/math/value-noise/value-noise.js +68 -0
- package/dist/modules/math/value-noise/value-noise.js.map +1 -0
- package/dist/modules/volume/volume-raymarch.cjs +107 -0
- package/dist/modules/volume/volume-raymarch.d.ts +6 -0
- package/dist/modules/volume/volume-raymarch.d.ts.map +1 -0
- package/dist/modules/volume/volume-raymarch.js +84 -0
- package/dist/modules/volume/volume-raymarch.js.map +1 -0
- package/dist/types/align-to.cjs +38 -0
- package/dist/types/align-to.d.ts +3 -0
- package/dist/types/align-to.d.ts.map +1 -0
- package/dist/types/align-to.js +13 -0
- package/dist/types/align-to.js.map +1 -0
- package/dist/types/primitive-data-types.cjs +15 -0
- package/dist/types/primitive-data-types.d.ts +7 -0
- package/dist/types/primitive-data-types.d.ts.map +1 -0
- package/dist/types/primitive-data-types.js +5 -0
- package/dist/types/primitive-data-types.js.map +1 -0
- package/dist/types/sampler-props.cjs +15 -0
- package/dist/types/sampler-props.d.ts +26 -0
- package/dist/types/sampler-props.d.ts.map +1 -0
- package/dist/types/sampler-props.js +5 -0
- package/dist/types/sampler-props.js.map +1 -0
- package/dist/types/shader-block-layout.cjs +184 -0
- package/dist/types/shader-block-layout.d.ts +72 -0
- package/dist/types/shader-block-layout.d.ts.map +1 -0
- package/dist/types/shader-block-layout.js +209 -0
- package/dist/types/shader-block-layout.js.map +1 -0
- package/dist/types/shader-layout.cjs +15 -0
- package/dist/types/shader-layout.d.ts +178 -0
- package/dist/types/shader-layout.d.ts.map +1 -0
- package/dist/types/shader-layout.js +5 -0
- package/dist/types/shader-layout.js.map +1 -0
- package/dist/types/shader-type-decoder.cjs +240 -0
- package/dist/types/shader-type-decoder.d.ts +41 -0
- package/dist/types/shader-type-decoder.d.ts.map +1 -0
- package/dist/types/shader-type-decoder.js +210 -0
- package/dist/types/shader-type-decoder.js.map +1 -0
- package/dist/types/shader-types.cjs +15 -0
- package/dist/types/shader-types.d.ts +101 -0
- package/dist/types/shader-types.d.ts.map +1 -0
- package/dist/types/shader-types.js +30 -0
- package/dist/types/shader-types.js.map +1 -0
- package/dist/types/texture-formats.cjs +15 -0
- package/dist/types/texture-formats.d.ts +24 -0
- package/dist/types/texture-formats.d.ts.map +1 -0
- package/dist/types/texture-formats.js +5 -0
- package/dist/types/texture-formats.js.map +1 -0
- package/dist/types.cjs +53 -0
- package/dist/types.cjs.map +6 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/wgsl.cjs +55 -0
- package/dist/wgsl.cjs.map +6 -0
- package/dist/wgsl.d.ts +8 -0
- package/dist/wgsl.d.ts.map +1 -0
- package/dist/wgsl.js +9 -0
- package/dist/wgsl.js.map +1 -0
- package/package.json +65 -4
- package/src/glsl.ts +13 -0
- package/src/index.ts +307 -0
- package/src/lib/color/normalize-byte-colors.ts +57 -0
- package/src/lib/filters/prop-types.ts +150 -0
- package/src/lib/glsl-shader-assembler.ts +39 -0
- package/src/lib/glsl-utils/get-shader-info.ts +42 -0
- package/src/lib/glsl-utils/shader-utils.ts +110 -0
- package/src/lib/preprocessor/preprocessor.ts +157 -0
- package/src/lib/shader-assembler-base.ts +169 -0
- package/src/lib/shader-assembler.ts +7 -0
- package/src/lib/shader-assembly/assemble-glsl-shaders.ts +305 -0
- package/src/lib/shader-assembly/assemble-shaders.ts +13 -0
- package/src/lib/shader-assembly/assemble-wgsl-shaders.ts +830 -0
- package/src/lib/shader-assembly/platform-defines.ts +58 -0
- package/src/lib/shader-assembly/platform-info.ts +23 -0
- package/src/lib/shader-assembly/shader-assembly-shared.ts +95 -0
- package/src/lib/shader-assembly/shader-assembly-types.ts +146 -0
- package/src/lib/shader-assembly/shader-injection-targets.ts +148 -0
- package/src/lib/shader-assembly/shader-injections.ts +298 -0
- package/src/lib/shader-assembly/shader-plugin-varyings.ts +555 -0
- package/src/lib/shader-assembly/shader-plugin-vertex-inputs.ts +279 -0
- package/src/lib/shader-assembly/wgsl-binding-debug.ts +227 -0
- package/src/lib/shader-assembly/wgsl-binding-scan.ts +228 -0
- package/src/lib/shader-assembly/wgsl-injection-target-names.ts +180 -0
- package/src/lib/shader-assembly/wgsl-interface-scan.ts +676 -0
- package/src/lib/shader-generator/generate-shader.ts +27 -0
- package/src/lib/shader-generator/glsl/generate-glsl.ts +101 -0
- package/src/lib/shader-generator/utils/capitalize.ts +12 -0
- package/src/lib/shader-generator/wgsl/generate-wgsl.ts +40 -0
- package/src/lib/shader-module/composite-shader-pass.ts +47 -0
- package/src/lib/shader-module/shader-module-dependencies.ts +128 -0
- package/src/lib/shader-module/shader-module-uniform-layout.ts +420 -0
- package/src/lib/shader-module/shader-module.ts +237 -0
- package/src/lib/shader-module/shader-pass.ts +69 -0
- package/src/lib/shader-plugin.ts +236 -0
- package/src/lib/shader-transpiler/shader-transpiler.ts +34 -0
- package/src/lib/shader-transpiler/transpile-glsl-shader.ts +78 -0
- package/src/lib/utils/assert.ts +13 -0
- package/src/lib/utils/uniform-types.ts +89 -0
- package/src/lib/wgsl-shader-assembler.ts +122 -0
- package/src/module-injectors.ts +32 -0
- package/src/modules/color/float-colors.ts +334 -0
- package/src/modules/engine/clip/clip.ts +139 -0
- package/src/modules/engine/filter/filter.ts +99 -0
- package/src/modules/engine/geometry/geometry.ts +45 -0
- package/src/modules/engine/gpu-animation/gpu-animation.ts +244 -0
- package/src/modules/engine/picking/README.md +88 -0
- package/src/modules/engine/picking/picking.ts +252 -0
- package/src/modules/engine/project/project.ts +166 -0
- package/src/modules/engine/skin/skin.ts +233 -0
- package/src/modules/engine/transform/transform.ts +50 -0
- package/src/modules/geometry/path-dash/path-dash.ts +68 -0
- package/src/modules/geometry/pattern-fill/pattern-fill-shaders.ts +88 -0
- package/src/modules/geometry/pattern-fill/pattern-fill.ts +54 -0
- package/src/modules/geometry/point-glow/point-glow.ts +87 -0
- package/src/modules/geometry/precipitation/README.md +19 -0
- package/src/modules/geometry/precipitation/precipitation.ts +108 -0
- package/src/modules/geometry/sketch-stroke/sketch-stroke.ts +160 -0
- package/src/modules/geospatial/dggs/dggs-wgsl.ts +2284 -0
- package/src/modules/geospatial/dggs/dggs.ts +12 -0
- package/src/modules/lighting/area-lighting/area-light-types.ts +71 -0
- package/src/modules/lighting/area-lighting/area-lighting-shaders.ts +72 -0
- package/src/modules/lighting/area-lighting/area-lighting.ts +63 -0
- package/src/modules/lighting/area-lighting/ltc-shaders.ts +163 -0
- package/src/modules/lighting/atmosphere/README.md +25 -0
- package/src/modules/lighting/atmosphere/atmosphere.ts +246 -0
- package/src/modules/lighting/clouds/README.md +24 -0
- package/src/modules/lighting/clouds/clouds.ts +216 -0
- package/src/modules/lighting/clustered-light-grid/clustered-light-grid.ts +17 -0
- package/src/modules/lighting/contact-shadow/contact-shadow.ts +365 -0
- package/src/modules/lighting/firefly/firefly.ts +64 -0
- package/src/modules/lighting/globe-clouds/globe-clouds.ts +124 -0
- package/src/modules/lighting/gouraud-material/gouraud-material.ts +55 -0
- package/src/modules/lighting/height-fog/README.md +36 -0
- package/src/modules/lighting/height-fog/height-fog-functions.ts +116 -0
- package/src/modules/lighting/height-fog/height-fog.ts +96 -0
- package/src/modules/lighting/ibl/ibl.ts +43 -0
- package/src/modules/lighting/lambert-material/lambert-material.ts +42 -0
- package/src/modules/lighting/lambert-material/lambert-shaders-glsl.ts +61 -0
- package/src/modules/lighting/lambert-material/lambert-shaders-wgsl.ts +73 -0
- package/src/modules/lighting/lights/lighting-glsl.ts +92 -0
- package/src/modules/lighting/lights/lighting-wgsl.ts +91 -0
- package/src/modules/lighting/lights/lighting.ts +385 -0
- package/src/modules/lighting/no-material/dirlight.ts +101 -0
- package/src/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.ts +78 -0
- package/src/modules/lighting/pbr-contact-shadow/pbr-contact-shadow.ts +78 -0
- package/src/modules/lighting/pbr-material/pbr-material-glsl.ts +1770 -0
- package/src/modules/lighting/pbr-material/pbr-material-wgsl.ts +2065 -0
- package/src/modules/lighting/pbr-material/pbr-material.ts +517 -0
- package/src/modules/lighting/pbr-material/pbr-projection.ts +50 -0
- package/src/modules/lighting/pbr-material/pbr-scene.ts +112 -0
- package/src/modules/lighting/pbr-shadow/pbr-shadow.ts +85 -0
- package/src/modules/lighting/pbr-surface/pbr-surface.ts +103 -0
- package/src/modules/lighting/phong-material/phong-material.ts +53 -0
- package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +73 -0
- package/src/modules/lighting/phong-material/phong-shaders-wgsl.ts +129 -0
- package/src/modules/lighting/prefiltered-environment/prefiltered-environment.ts +370 -0
- package/src/modules/lighting/shadow/shadow-glsl.ts +204 -0
- package/src/modules/lighting/shadow/shadow-types.ts +68 -0
- package/src/modules/lighting/shadow/shadow.ts +536 -0
- package/src/modules/lighting/surface-weather/README.md +28 -0
- package/src/modules/lighting/surface-weather/surface-weather.ts +198 -0
- package/src/modules/lighting/unlit-material/unlit-material.ts +44 -0
- package/src/modules/lighting/water-material/river-water-material.ts +58 -0
- package/src/modules/lighting/water-material/river-water-shaders.ts +234 -0
- package/src/modules/lighting/water-material/water-material.ts +234 -0
- package/src/modules/lighting/water-material/water-shaders-glsl.ts +233 -0
- package/src/modules/lighting/water-material/water-shaders-wgsl.ts +230 -0
- package/src/modules/math/fp16/fp16-utils.ts +156 -0
- package/src/modules/math/fp32/fp32.ts +291 -0
- package/src/modules/math/fp64/fp64-arithmetic-glsl.ts +205 -0
- package/src/modules/math/fp64/fp64-arithmetic-wgsl-hybrid.ts +129 -0
- package/src/modules/math/fp64/fp64-arithmetic-wgsl-integer.ts +564 -0
- package/src/modules/math/fp64/fp64-arithmetic-wgsl.ts +924 -0
- package/src/modules/math/fp64/fp64-functions-glsl.ts +675 -0
- package/src/modules/math/fp64/fp64-functions-wgsl.ts +157 -0
- package/src/modules/math/fp64/fp64-utils.ts +46 -0
- package/src/modules/math/fp64/fp64.ts +64 -0
- package/src/modules/math/random/random.ts +25 -0
- package/src/modules/math/value-noise/value-noise.ts +70 -0
- package/src/modules/volume/volume-raymarch.ts +87 -0
- package/src/types/align-to.ts +13 -0
- package/src/types/primitive-data-types.ts +10 -0
- package/src/types/sampler-props.ts +39 -0
- package/src/types/shader-block-layout.ts +340 -0
- package/src/types/shader-layout.ts +208 -0
- package/src/types/shader-type-decoder.ts +285 -0
- package/src/types/shader-types.ts +207 -0
- package/src/types/texture-formats.ts +157 -0
- package/src/types.ts +116 -0
- package/src/wgsl.ts +34 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { AREA_LIGHT_UNIFORM_TYPE, MAX_AREA_LIGHTS, packAreaLights } from "../area-lighting/area-light-types.js";
|
|
5
|
+
import { lightingUniformsGLSL } from "./lighting-glsl.js";
|
|
6
|
+
import { lightingUniformsWGSL } from "./lighting-wgsl.js";
|
|
7
|
+
import { normalizeByteColor3, resolveUseByteColors } from "../../../lib/color/normalize-byte-colors.js";
|
|
8
|
+
/** Max number of supported lights (in addition to ambient light */
|
|
9
|
+
const MAX_LIGHTS = 5;
|
|
10
|
+
const LIGHT_UNIFORM_TYPE = {
|
|
11
|
+
color: 'vec3<f32>',
|
|
12
|
+
position: 'vec3<f32>',
|
|
13
|
+
direction: 'vec3<f32>',
|
|
14
|
+
attenuation: 'vec3<f32>',
|
|
15
|
+
coneCos: 'vec2<f32>'
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Portable lighting shader module shared by the Phong, Gouraud, and PBR material modules.
|
|
19
|
+
*
|
|
20
|
+
* The public JavaScript API accepts `lights: Light[]`, while the uniform buffer packs
|
|
21
|
+
* non-ambient lights into a fixed-size trailing array for portability across WebGL2 and WebGPU.
|
|
22
|
+
*/
|
|
23
|
+
export const lighting = {
|
|
24
|
+
props: {},
|
|
25
|
+
uniforms: {},
|
|
26
|
+
name: 'lighting',
|
|
27
|
+
defines: {
|
|
28
|
+
// MAX_LIGHTS
|
|
29
|
+
},
|
|
30
|
+
uniformTypes: {
|
|
31
|
+
enabled: 'i32',
|
|
32
|
+
directionalLightCount: 'i32',
|
|
33
|
+
pointLightCount: 'i32',
|
|
34
|
+
spotLightCount: 'i32',
|
|
35
|
+
ambientColor: 'vec3<f32>',
|
|
36
|
+
lights: [LIGHT_UNIFORM_TYPE, MAX_LIGHTS],
|
|
37
|
+
areaLightCount: 'i32',
|
|
38
|
+
areaLights: [AREA_LIGHT_UNIFORM_TYPE, MAX_AREA_LIGHTS]
|
|
39
|
+
},
|
|
40
|
+
defaultUniforms: createDefaultLightingUniforms(),
|
|
41
|
+
bindingLayout: [{ name: 'lighting', group: 2 }],
|
|
42
|
+
firstBindingSlot: 0,
|
|
43
|
+
source: lightingUniformsWGSL,
|
|
44
|
+
vs: lightingUniformsGLSL,
|
|
45
|
+
fs: lightingUniformsGLSL,
|
|
46
|
+
getUniforms
|
|
47
|
+
};
|
|
48
|
+
function getUniforms(props, _prevUniforms = {}) {
|
|
49
|
+
// Copy props so we can modify
|
|
50
|
+
props = props ? { ...props } : props;
|
|
51
|
+
const areaLights = (props?.lights || []).filter((light) => light.type === 'rect' || light.type === 'disk');
|
|
52
|
+
// TODO legacy
|
|
53
|
+
if (!props) {
|
|
54
|
+
return createDefaultLightingUniforms();
|
|
55
|
+
}
|
|
56
|
+
// Support for array of lights. Type of light is detected by type field
|
|
57
|
+
if (props.lights) {
|
|
58
|
+
props = { ...props, ...extractLightTypes(props.lights), lights: undefined };
|
|
59
|
+
}
|
|
60
|
+
// Specify lights separately
|
|
61
|
+
const { useByteColors, ambientLight, pointLights, spotLights, directionalLights } = props || {};
|
|
62
|
+
const hasLights = ambientLight ||
|
|
63
|
+
(pointLights && pointLights.length > 0) ||
|
|
64
|
+
(spotLights && spotLights.length > 0) ||
|
|
65
|
+
(directionalLights && directionalLights.length > 0);
|
|
66
|
+
// TODO - this may not be the correct decision
|
|
67
|
+
if (!hasLights && areaLights.length === 0) {
|
|
68
|
+
return {
|
|
69
|
+
...createDefaultLightingUniforms(),
|
|
70
|
+
enabled: 0
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const uniforms = {
|
|
74
|
+
...createDefaultLightingUniforms(),
|
|
75
|
+
...getLightSourceUniforms({
|
|
76
|
+
useByteColors,
|
|
77
|
+
ambientLight,
|
|
78
|
+
pointLights,
|
|
79
|
+
spotLights,
|
|
80
|
+
directionalLights
|
|
81
|
+
})
|
|
82
|
+
};
|
|
83
|
+
uniforms.areaLightCount = Math.min(areaLights.length, MAX_AREA_LIGHTS);
|
|
84
|
+
uniforms.areaLights = packAreaLights(areaLights, resolveUseByteColors(props.useByteColors, true));
|
|
85
|
+
if (props.enabled !== undefined) {
|
|
86
|
+
uniforms.enabled = props.enabled ? 1 : 0;
|
|
87
|
+
}
|
|
88
|
+
return uniforms;
|
|
89
|
+
}
|
|
90
|
+
function getLightSourceUniforms({ useByteColors, ambientLight, pointLights = [], spotLights = [], directionalLights = [] }) {
|
|
91
|
+
const lights = createDefaultLightUniforms();
|
|
92
|
+
let currentLight = 0;
|
|
93
|
+
let pointLightCount = 0;
|
|
94
|
+
let spotLightCount = 0;
|
|
95
|
+
let directionalLightCount = 0;
|
|
96
|
+
for (const pointLight of pointLights) {
|
|
97
|
+
if (currentLight >= MAX_LIGHTS) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
lights[currentLight] = {
|
|
101
|
+
...lights[currentLight],
|
|
102
|
+
color: convertColor(pointLight, useByteColors),
|
|
103
|
+
position: pointLight.position,
|
|
104
|
+
attenuation: pointLight.attenuation || [1, 0, 0]
|
|
105
|
+
};
|
|
106
|
+
currentLight++;
|
|
107
|
+
pointLightCount++;
|
|
108
|
+
}
|
|
109
|
+
for (const spotLight of spotLights) {
|
|
110
|
+
if (currentLight >= MAX_LIGHTS) {
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
lights[currentLight] = {
|
|
114
|
+
...lights[currentLight],
|
|
115
|
+
color: convertColor(spotLight, useByteColors),
|
|
116
|
+
position: spotLight.position,
|
|
117
|
+
direction: spotLight.direction,
|
|
118
|
+
attenuation: spotLight.attenuation || [1, 0, 0],
|
|
119
|
+
coneCos: getSpotConeCos(spotLight)
|
|
120
|
+
};
|
|
121
|
+
currentLight++;
|
|
122
|
+
spotLightCount++;
|
|
123
|
+
}
|
|
124
|
+
for (const directionalLight of directionalLights) {
|
|
125
|
+
if (currentLight >= MAX_LIGHTS) {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
lights[currentLight] = {
|
|
129
|
+
...lights[currentLight],
|
|
130
|
+
color: convertColor(directionalLight, useByteColors),
|
|
131
|
+
direction: directionalLight.direction
|
|
132
|
+
};
|
|
133
|
+
currentLight++;
|
|
134
|
+
directionalLightCount++;
|
|
135
|
+
}
|
|
136
|
+
if (pointLights.length + spotLights.length + directionalLights.length > MAX_LIGHTS) {
|
|
137
|
+
// biome-ignore lint/suspicious/noConsole: preserve the standalone module warning without a core logger.
|
|
138
|
+
console.warn(`MAX_LIGHTS exceeded, truncating to ${MAX_LIGHTS}`);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
ambientColor: convertColor(ambientLight, useByteColors),
|
|
142
|
+
directionalLightCount,
|
|
143
|
+
pointLightCount,
|
|
144
|
+
spotLightCount,
|
|
145
|
+
lights
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function extractLightTypes(lights) {
|
|
149
|
+
const lightSources = { pointLights: [], spotLights: [], directionalLights: [] };
|
|
150
|
+
for (const light of lights || []) {
|
|
151
|
+
switch (light.type) {
|
|
152
|
+
case 'ambient':
|
|
153
|
+
// Note: Only uses last ambient light
|
|
154
|
+
// TODO - add ambient light sources on CPU?
|
|
155
|
+
lightSources.ambientLight = light;
|
|
156
|
+
break;
|
|
157
|
+
case 'directional':
|
|
158
|
+
lightSources.directionalLights?.push(light);
|
|
159
|
+
break;
|
|
160
|
+
case 'point':
|
|
161
|
+
lightSources.pointLights?.push(light);
|
|
162
|
+
break;
|
|
163
|
+
case 'spot':
|
|
164
|
+
lightSources.spotLights?.push(light);
|
|
165
|
+
break;
|
|
166
|
+
default:
|
|
167
|
+
// eslint-disable-next-line
|
|
168
|
+
// console.warn(light.type);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return lightSources;
|
|
172
|
+
}
|
|
173
|
+
/** Take color 0-255 and intensity as input and output 0.0-1.0 range */
|
|
174
|
+
function convertColor(colorDef = {}, useByteColors) {
|
|
175
|
+
const { color = [0, 0, 0], intensity = 1.0 } = colorDef;
|
|
176
|
+
const normalizedColor = normalizeByteColor3(color, resolveUseByteColors(useByteColors, true));
|
|
177
|
+
return normalizedColor.map(component => component * intensity);
|
|
178
|
+
}
|
|
179
|
+
function createDefaultLightingUniforms() {
|
|
180
|
+
return {
|
|
181
|
+
enabled: 1,
|
|
182
|
+
directionalLightCount: 0,
|
|
183
|
+
pointLightCount: 0,
|
|
184
|
+
spotLightCount: 0,
|
|
185
|
+
ambientColor: [0.1, 0.1, 0.1],
|
|
186
|
+
lights: createDefaultLightUniforms(),
|
|
187
|
+
areaLightCount: 0,
|
|
188
|
+
areaLights: packAreaLights([])
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function createDefaultLightUniforms() {
|
|
192
|
+
return Array.from({ length: MAX_LIGHTS }, () => createDefaultLightUniform());
|
|
193
|
+
}
|
|
194
|
+
function createDefaultLightUniform() {
|
|
195
|
+
return {
|
|
196
|
+
color: [1, 1, 1],
|
|
197
|
+
position: [1, 1, 2],
|
|
198
|
+
direction: [1, 1, 1],
|
|
199
|
+
attenuation: [1, 0, 0],
|
|
200
|
+
coneCos: [1, 0]
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function getSpotConeCos(spotLight) {
|
|
204
|
+
const innerConeAngle = spotLight.innerConeAngle ?? 0;
|
|
205
|
+
const outerConeAngle = spotLight.outerConeAngle ?? Math.PI / 4;
|
|
206
|
+
return [Math.cos(innerConeAngle), Math.cos(outerConeAngle)];
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=lighting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lighting.js","sourceRoot":"","sources":["../../../../src/modules/lighting/lights/lighting.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAGL,uBAAuB,EACvB,eAAe,EACf,cAAc,EACf,6CAA0C;AAE3C,OAAO,EAAC,oBAAoB,EAAC,2BA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AAO,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,UAAU,EAAC,EAAE,GAAG,EAAE,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,yBAAyB;IAChC,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACnB,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACpB,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACtB,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAChB,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,SAAoB;IAC1C,MAAM,cAAc,GAAG,SAAS,CAAC,cAAc,IAAI,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,cAAc,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/D,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 dirlight_exports = {};
|
|
19
|
+
__export(dirlight_exports, {
|
|
20
|
+
SOURCE_WGSL: () => SOURCE_WGSL,
|
|
21
|
+
dirlight: () => dirlight
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(dirlight_exports);
|
|
24
|
+
const SOURCE_WGSL = (
|
|
25
|
+
/* WGSL */
|
|
26
|
+
`struct dirlightUniforms {
|
|
27
|
+
lightDirection: vec3<f32>,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
alias DirlightNormal = vec3<f32>;
|
|
31
|
+
|
|
32
|
+
struct DirlightInputs {
|
|
33
|
+
normal: DirlightNormal,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
@group(2) @binding(auto) var<uniform> dirlight : dirlightUniforms;
|
|
37
|
+
|
|
38
|
+
// For vertex
|
|
39
|
+
fn dirlight_setNormal(normal: vec3<f32>) -> DirlightNormal {
|
|
40
|
+
return normalize(normal);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Returns color attenuated by angle from light source
|
|
44
|
+
fn dirlight_filterColor(color: vec4<f32>, inputs: DirlightInputs) -> vec4<f32> {
|
|
45
|
+
// TODO - fix default light direction
|
|
46
|
+
// let lightDirection = dirlight.lightDirection;
|
|
47
|
+
let lightDirection = vec3<f32>(1, 1, 1);
|
|
48
|
+
let d: f32 = abs(dot(inputs.normal, normalize(lightDirection)));
|
|
49
|
+
return vec4<f32>(color.rgb * d, color.a);
|
|
50
|
+
}
|
|
51
|
+
`
|
|
52
|
+
);
|
|
53
|
+
const VS_GLSL = (
|
|
54
|
+
/* glsl */
|
|
55
|
+
`out vec3 dirlight_vNormal;
|
|
56
|
+
|
|
57
|
+
void dirlight_setNormal(vec3 normal) {
|
|
58
|
+
dirlight_vNormal = normalize(normal);
|
|
59
|
+
}
|
|
60
|
+
`
|
|
61
|
+
);
|
|
62
|
+
const FS_GLSL = (
|
|
63
|
+
/* glsl */
|
|
64
|
+
`layout(std140) uniform dirlightUniforms {
|
|
65
|
+
vec3 lightDirection;
|
|
66
|
+
} dirlight;
|
|
67
|
+
|
|
68
|
+
in vec3 dirlight_vNormal;
|
|
69
|
+
|
|
70
|
+
// Returns color attenuated by angle from light source
|
|
71
|
+
vec4 dirlight_filterColor(vec4 color) {
|
|
72
|
+
float d = abs(dot(dirlight_vNormal, normalize(dirlight.lightDirection)));
|
|
73
|
+
return vec4(color.rgb * d, color.a);
|
|
74
|
+
}
|
|
75
|
+
`
|
|
76
|
+
);
|
|
77
|
+
const dirlight = {
|
|
78
|
+
props: {},
|
|
79
|
+
uniforms: {},
|
|
80
|
+
name: "dirlight",
|
|
81
|
+
bindingLayout: [{ name: "dirlight", group: 2 }],
|
|
82
|
+
firstBindingSlot: 16,
|
|
83
|
+
dependencies: [],
|
|
84
|
+
source: SOURCE_WGSL,
|
|
85
|
+
vs: VS_GLSL,
|
|
86
|
+
fs: FS_GLSL,
|
|
87
|
+
// fragmentInputs: [
|
|
88
|
+
// {
|
|
89
|
+
// name: 'dirlight_vNormal',
|
|
90
|
+
// type: 'vec3<f32>'
|
|
91
|
+
// }
|
|
92
|
+
// ],
|
|
93
|
+
uniformTypes: {
|
|
94
|
+
lightDirection: "vec3<f32>"
|
|
95
|
+
},
|
|
96
|
+
defaultUniforms: {
|
|
97
|
+
lightDirection: [1, 1, 2]
|
|
98
|
+
},
|
|
99
|
+
getUniforms
|
|
100
|
+
};
|
|
101
|
+
function getUniforms(opts = dirlight.defaultUniforms) {
|
|
102
|
+
const uniforms = {};
|
|
103
|
+
if (opts.lightDirection) {
|
|
104
|
+
uniforms.lightDirection = opts.lightDirection;
|
|
105
|
+
}
|
|
106
|
+
return uniforms;
|
|
107
|
+
}
|
|
108
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
109
|
+
0 && (module.exports = {
|
|
110
|
+
SOURCE_WGSL,
|
|
111
|
+
dirlight
|
|
112
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { NumberArray3 } from '@math.gl/core';
|
|
2
|
+
export type DirlightProps = {
|
|
3
|
+
lightDirection?: NumberArray3;
|
|
4
|
+
};
|
|
5
|
+
export type DirlightUniforms = DirlightProps;
|
|
6
|
+
export declare const SOURCE_WGSL = "struct dirlightUniforms {\n lightDirection: vec3<f32>,\n};\n\nalias DirlightNormal = vec3<f32>;\n\nstruct DirlightInputs {\n normal: DirlightNormal,\n};\n\n@group(2) @binding(auto) var<uniform> dirlight : dirlightUniforms;\n\n// For vertex\nfn dirlight_setNormal(normal: vec3<f32>) -> DirlightNormal {\n return normalize(normal);\n}\n\n// Returns color attenuated by angle from light source\nfn dirlight_filterColor(color: vec4<f32>, inputs: DirlightInputs) -> vec4<f32> {\n // TODO - fix default light direction\n // let lightDirection = dirlight.lightDirection;\n let lightDirection = vec3<f32>(1, 1, 1);\n let d: f32 = abs(dot(inputs.normal, normalize(lightDirection)));\n return vec4<f32>(color.rgb * d, color.a);\n}\n";
|
|
7
|
+
/**
|
|
8
|
+
* Cheap lighting - single directional light, single dot product, one uniform
|
|
9
|
+
*/
|
|
10
|
+
export declare const dirlight: {
|
|
11
|
+
readonly props: DirlightProps;
|
|
12
|
+
readonly uniforms: DirlightUniforms;
|
|
13
|
+
readonly name: "dirlight";
|
|
14
|
+
readonly bindingLayout: readonly [{
|
|
15
|
+
readonly name: "dirlight";
|
|
16
|
+
readonly group: 2;
|
|
17
|
+
}];
|
|
18
|
+
readonly firstBindingSlot: 16;
|
|
19
|
+
readonly dependencies: [];
|
|
20
|
+
readonly source: "struct dirlightUniforms {\n lightDirection: vec3<f32>,\n};\n\nalias DirlightNormal = vec3<f32>;\n\nstruct DirlightInputs {\n normal: DirlightNormal,\n};\n\n@group(2) @binding(auto) var<uniform> dirlight : dirlightUniforms;\n\n// For vertex\nfn dirlight_setNormal(normal: vec3<f32>) -> DirlightNormal {\n return normalize(normal);\n}\n\n// Returns color attenuated by angle from light source\nfn dirlight_filterColor(color: vec4<f32>, inputs: DirlightInputs) -> vec4<f32> {\n // TODO - fix default light direction\n // let lightDirection = dirlight.lightDirection;\n let lightDirection = vec3<f32>(1, 1, 1);\n let d: f32 = abs(dot(inputs.normal, normalize(lightDirection)));\n return vec4<f32>(color.rgb * d, color.a);\n}\n";
|
|
21
|
+
readonly vs: "out vec3 dirlight_vNormal;\n\nvoid dirlight_setNormal(vec3 normal) {\n dirlight_vNormal = normalize(normal);\n}\n";
|
|
22
|
+
readonly fs: "layout(std140) uniform dirlightUniforms {\n vec3 lightDirection;\n} dirlight;\n\nin vec3 dirlight_vNormal;\n\n// Returns color attenuated by angle from light source\nvec4 dirlight_filterColor(vec4 color) {\n float d = abs(dot(dirlight_vNormal, normalize(dirlight.lightDirection)));\n return vec4(color.rgb * d, color.a);\n}\n";
|
|
23
|
+
readonly uniformTypes: {
|
|
24
|
+
readonly lightDirection: "vec3<f32>";
|
|
25
|
+
};
|
|
26
|
+
readonly defaultUniforms: {
|
|
27
|
+
readonly lightDirection: [1, 1, 2];
|
|
28
|
+
};
|
|
29
|
+
readonly getUniforms: typeof getUniforms;
|
|
30
|
+
};
|
|
31
|
+
declare function getUniforms(opts?: DirlightProps): DirlightUniforms;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=dirlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dirlight.d.ts","sourceRoot":"","sources":["../../../../src/modules/lighting/no-material/dirlight.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAGhD,MAAM,MAAM,aAAa,GAAG;IAC1B,cAAc,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAG7C,eAAO,MAAM,WAAW,+tBA0BvB,CAAC;AAwBF;;GAEG;AACH,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,gBAAgB;;;;;;;;;;;;;;;;;;CAuBgC,CAAC;AAEnE,iBAAS,WAAW,CAAC,IAAI,GAAE,aAAwC,GAAG,gBAAgB,CAMrF"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
// TODO
|
|
5
|
+
export const SOURCE_WGSL = /* WGSL */ `\
|
|
6
|
+
struct dirlightUniforms {
|
|
7
|
+
lightDirection: vec3<f32>,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
alias DirlightNormal = vec3<f32>;
|
|
11
|
+
|
|
12
|
+
struct DirlightInputs {
|
|
13
|
+
normal: DirlightNormal,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
@group(2) @binding(auto) var<uniform> dirlight : dirlightUniforms;
|
|
17
|
+
|
|
18
|
+
// For vertex
|
|
19
|
+
fn dirlight_setNormal(normal: vec3<f32>) -> DirlightNormal {
|
|
20
|
+
return normalize(normal);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Returns color attenuated by angle from light source
|
|
24
|
+
fn dirlight_filterColor(color: vec4<f32>, inputs: DirlightInputs) -> vec4<f32> {
|
|
25
|
+
// TODO - fix default light direction
|
|
26
|
+
// let lightDirection = dirlight.lightDirection;
|
|
27
|
+
let lightDirection = vec3<f32>(1, 1, 1);
|
|
28
|
+
let d: f32 = abs(dot(inputs.normal, normalize(lightDirection)));
|
|
29
|
+
return vec4<f32>(color.rgb * d, color.a);
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const VS_GLSL = /* glsl */ `\
|
|
33
|
+
out vec3 dirlight_vNormal;
|
|
34
|
+
|
|
35
|
+
void dirlight_setNormal(vec3 normal) {
|
|
36
|
+
dirlight_vNormal = normalize(normal);
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
const FS_GLSL = /* glsl */ `\
|
|
40
|
+
layout(std140) uniform dirlightUniforms {
|
|
41
|
+
vec3 lightDirection;
|
|
42
|
+
} dirlight;
|
|
43
|
+
|
|
44
|
+
in vec3 dirlight_vNormal;
|
|
45
|
+
|
|
46
|
+
// Returns color attenuated by angle from light source
|
|
47
|
+
vec4 dirlight_filterColor(vec4 color) {
|
|
48
|
+
float d = abs(dot(dirlight_vNormal, normalize(dirlight.lightDirection)));
|
|
49
|
+
return vec4(color.rgb * d, color.a);
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
/**
|
|
53
|
+
* Cheap lighting - single directional light, single dot product, one uniform
|
|
54
|
+
*/
|
|
55
|
+
export const dirlight = {
|
|
56
|
+
props: {},
|
|
57
|
+
uniforms: {},
|
|
58
|
+
name: 'dirlight',
|
|
59
|
+
bindingLayout: [{ name: 'dirlight', group: 2 }],
|
|
60
|
+
firstBindingSlot: 16,
|
|
61
|
+
dependencies: [],
|
|
62
|
+
source: SOURCE_WGSL,
|
|
63
|
+
vs: VS_GLSL,
|
|
64
|
+
fs: FS_GLSL,
|
|
65
|
+
// fragmentInputs: [
|
|
66
|
+
// {
|
|
67
|
+
// name: 'dirlight_vNormal',
|
|
68
|
+
// type: 'vec3<f32>'
|
|
69
|
+
// }
|
|
70
|
+
// ],
|
|
71
|
+
uniformTypes: {
|
|
72
|
+
lightDirection: 'vec3<f32>'
|
|
73
|
+
},
|
|
74
|
+
defaultUniforms: {
|
|
75
|
+
lightDirection: [1, 1, 2]
|
|
76
|
+
},
|
|
77
|
+
getUniforms
|
|
78
|
+
};
|
|
79
|
+
function getUniforms(opts = dirlight.defaultUniforms) {
|
|
80
|
+
const uniforms = {};
|
|
81
|
+
if (opts.lightDirection) {
|
|
82
|
+
uniforms.lightDirection = opts.lightDirection;
|
|
83
|
+
}
|
|
84
|
+
return uniforms;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=dirlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dirlight.js","sourceRoot":"","sources":["../../../../src/modules/lighting/no-material/dirlight.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAW5D,OAAO;AACP,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BrC,CAAC;AAEF,MAAM,OAAO,GAAG,UAAU,CAAC;;;;;;CAM1B,CAAC;AAEF,MAAM,OAAO,GAAG,UAAU,CAAC;;;;;;;;;;;;CAY1B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,KAAK,EAAE,EAAmB;IAC1B,QAAQ,EAAE,EAAsB;IAEhC,IAAI,EAAE,UAAU;IAChB,aAAa,EAAE,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;IAC7C,gBAAgB,EAAE,EAAE;IACpB,YAAY,EAAE,EAAE;IAChB,MAAM,EAAE,WAAW;IACnB,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IAEX,oBAAoB;IACpB,MAAM;IACN,gCAAgC;IAChC,wBAAwB;IACxB,MAAM;IACN,KAAK;IACL,YAAY,EAAE;QACZ,cAAc,EAAE,WAAW;KAC5B;IACD,eAAe,EAAE;QACf,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;KAC1B;IACD,WAAW;CACqD,CAAC;AAEnE,SAAS,WAAW,CAAC,OAAsB,QAAQ,CAAC,eAAe;IACjE,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAChD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
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 pbr_ambient_occlusion_exports = {};
|
|
19
|
+
__export(pbr_ambient_occlusion_exports, {
|
|
20
|
+
pbrAmbientOcclusion: () => pbrAmbientOcclusion
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(pbr_ambient_occlusion_exports);
|
|
23
|
+
var import_pbr_material = require("../pbr-material/pbr-material.cjs");
|
|
24
|
+
const pbrAmbientOcclusion = {
|
|
25
|
+
name: "pbrAmbientOcclusion",
|
|
26
|
+
dependencies: [import_pbr_material.pbrMaterial],
|
|
27
|
+
bindingLayout: [
|
|
28
|
+
{ name: "pbrAmbientOcclusion", group: 0 },
|
|
29
|
+
{ name: "ambientOcclusionTexture", group: 2 }
|
|
30
|
+
],
|
|
31
|
+
uniformTypes: { viewport: "vec4<f32>", strength: "f32", enabled: "i32" },
|
|
32
|
+
defaultUniforms: { viewport: [0, 0, 1, 1], strength: 1, enabled: 1 },
|
|
33
|
+
getUniforms(properties = {}) {
|
|
34
|
+
return {
|
|
35
|
+
...properties.viewport ? { viewport: properties.viewport } : {},
|
|
36
|
+
...properties.strength === void 0 ? {} : { strength: properties.strength },
|
|
37
|
+
...properties.enabled === void 0 ? {} : { enabled: Number(properties.enabled) },
|
|
38
|
+
...properties.ambientOcclusionTexture ? { ambientOcclusionTexture: properties.ambientOcclusionTexture } : {}
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
source: (
|
|
42
|
+
/* wgsl */
|
|
43
|
+
`
|
|
44
|
+
struct PBRAmbientOcclusionUniforms {
|
|
45
|
+
viewport: vec4f,
|
|
46
|
+
strength: f32,
|
|
47
|
+
enabled: i32,
|
|
48
|
+
};
|
|
49
|
+
@group(0) @binding(auto) var<uniform> pbrAmbientOcclusion: PBRAmbientOcclusionUniforms;
|
|
50
|
+
@group(2) @binding(auto) var ambientOcclusionTexture: texture_2d<f32>;
|
|
51
|
+
@group(2) @binding(auto) var ambientOcclusionTextureSampler: sampler;
|
|
52
|
+
fn pbrAmbientOcclusion_getFactor(pixelPosition:vec2f)->f32 {
|
|
53
|
+
if(pbrAmbientOcclusion.enabled==0){return 1.0;}
|
|
54
|
+
let coordinates=(pixelPosition-pbrAmbientOcclusion.viewport.xy)/pbrAmbientOcclusion.viewport.zw;
|
|
55
|
+
if(any(coordinates<vec2f(0.0))||any(coordinates>vec2f(1.0))){return 1.0;}
|
|
56
|
+
let visibility=textureSampleLevel(ambientOcclusionTexture,ambientOcclusionTextureSampler,coordinates,0.0).r;
|
|
57
|
+
return mix(1.0,clamp(visibility,0.0,1.0),clamp(pbrAmbientOcclusion.strength,0.0,1.0));
|
|
58
|
+
}
|
|
59
|
+
fn pbrAmbientOcclusion_setFactor(pixelPosition:vec2f) {
|
|
60
|
+
pbr_ambientVisibility = pbrAmbientOcclusion_getFactor(pixelPosition);
|
|
61
|
+
}`
|
|
62
|
+
),
|
|
63
|
+
fs: (
|
|
64
|
+
/* glsl */
|
|
65
|
+
`
|
|
66
|
+
layout(std140) uniform pbrAmbientOcclusionUniforms {
|
|
67
|
+
vec4 viewport;
|
|
68
|
+
float strength;
|
|
69
|
+
int enabled;
|
|
70
|
+
} pbrAmbientOcclusion;
|
|
71
|
+
uniform sampler2D ambientOcclusionTexture;
|
|
72
|
+
float pbrAmbientOcclusion_getFactor(vec2 pixelPosition) {
|
|
73
|
+
if(pbrAmbientOcclusion.enabled==0)return 1.0;
|
|
74
|
+
vec2 coordinates=(pixelPosition-pbrAmbientOcclusion.viewport.xy)/pbrAmbientOcclusion.viewport.zw;
|
|
75
|
+
if(any(lessThan(coordinates,vec2(0.0)))||any(greaterThan(coordinates,vec2(1.0))))return 1.0;
|
|
76
|
+
float visibility=texture(ambientOcclusionTexture,coordinates).r;
|
|
77
|
+
return mix(1.0,clamp(visibility,0.0,1.0),clamp(pbrAmbientOcclusion.strength,0.0,1.0));
|
|
78
|
+
}
|
|
79
|
+
void pbrAmbientOcclusion_setFactor(vec2 pixelPosition) {
|
|
80
|
+
pbr_ambientVisibility = pbrAmbientOcclusion_getFactor(pixelPosition);
|
|
81
|
+
}`
|
|
82
|
+
)
|
|
83
|
+
};
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
pbrAmbientOcclusion
|
|
87
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { NumberArray4 } from '@math.gl/core';
|
|
2
|
+
import type { ShaderModule } from "../../../lib/shader-module/shader-module.js";
|
|
3
|
+
export type PBRAmbientOcclusionProps<TextureT = unknown> = {
|
|
4
|
+
ambientOcclusionTexture?: TextureT;
|
|
5
|
+
/** Origin and dimensions of the receiver viewport, in physical pixels. */
|
|
6
|
+
viewport?: Readonly<NumberArray4>;
|
|
7
|
+
strength?: number;
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
type AmbientUniforms = {
|
|
11
|
+
viewport: Readonly<NumberArray4>;
|
|
12
|
+
strength: number;
|
|
13
|
+
enabled: number;
|
|
14
|
+
};
|
|
15
|
+
type AmbientBindings<TextureT = unknown> = {
|
|
16
|
+
ambientOcclusionTexture?: TextureT;
|
|
17
|
+
};
|
|
18
|
+
/** Sets ambient visibility for the canonical PBR material; direct lighting and emission remain independent. */
|
|
19
|
+
export declare const pbrAmbientOcclusion: ShaderModule<PBRAmbientOcclusionProps, AmbientUniforms, AmbientBindings>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=pbr-ambient-occlusion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pbr-ambient-occlusion.d.ts","sourceRoot":"","sources":["../../../../src/modules/lighting/pbr-ambient-occlusion/pbr-ambient-occlusion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAC,YAAY,EAAC,oDAAiD;AAG3E,MAAM,MAAM,wBAAwB,CAAC,QAAQ,GAAG,OAAO,IAAI;IACzD,uBAAuB,CAAC,EAAE,QAAQ,CAAC;IACnC,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AACF,KAAK,eAAe,GAAG;IAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAAC;AAC7F,KAAK,eAAe,CAAC,QAAQ,GAAG,OAAO,IAAI;IAAC,uBAAuB,CAAC,EAAE,QAAQ,CAAA;CAAC,CAAC;AAEhF,+GAA+G;AAC/G,eAAO,MAAM,mBAAmB,EAAE,YAAY,CAC5C,wBAAwB,EACxB,eAAe,EACf,eAAe,CAwDhB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
3
|
+
import { pbrMaterial } from "../pbr-material/pbr-material.js";
|
|
4
|
+
/** Sets ambient visibility for the canonical PBR material; direct lighting and emission remain independent. */
|
|
5
|
+
export const pbrAmbientOcclusion = {
|
|
6
|
+
name: 'pbrAmbientOcclusion',
|
|
7
|
+
dependencies: [pbrMaterial],
|
|
8
|
+
bindingLayout: [
|
|
9
|
+
{ name: 'pbrAmbientOcclusion', group: 0 },
|
|
10
|
+
{ name: 'ambientOcclusionTexture', group: 2 }
|
|
11
|
+
],
|
|
12
|
+
uniformTypes: { viewport: 'vec4<f32>', strength: 'f32', enabled: 'i32' },
|
|
13
|
+
defaultUniforms: { viewport: [0, 0, 1, 1], strength: 1, enabled: 1 },
|
|
14
|
+
getUniforms(properties = {}) {
|
|
15
|
+
return {
|
|
16
|
+
...(properties.viewport ? { viewport: properties.viewport } : {}),
|
|
17
|
+
...(properties.strength === undefined ? {} : { strength: properties.strength }),
|
|
18
|
+
...(properties.enabled === undefined ? {} : { enabled: Number(properties.enabled) }),
|
|
19
|
+
...(properties.ambientOcclusionTexture
|
|
20
|
+
? { ambientOcclusionTexture: properties.ambientOcclusionTexture }
|
|
21
|
+
: {})
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
source: /* wgsl */ `
|
|
25
|
+
struct PBRAmbientOcclusionUniforms {
|
|
26
|
+
viewport: vec4f,
|
|
27
|
+
strength: f32,
|
|
28
|
+
enabled: i32,
|
|
29
|
+
};
|
|
30
|
+
@group(0) @binding(auto) var<uniform> pbrAmbientOcclusion: PBRAmbientOcclusionUniforms;
|
|
31
|
+
@group(2) @binding(auto) var ambientOcclusionTexture: texture_2d<f32>;
|
|
32
|
+
@group(2) @binding(auto) var ambientOcclusionTextureSampler: sampler;
|
|
33
|
+
fn pbrAmbientOcclusion_getFactor(pixelPosition:vec2f)->f32 {
|
|
34
|
+
if(pbrAmbientOcclusion.enabled==0){return 1.0;}
|
|
35
|
+
let coordinates=(pixelPosition-pbrAmbientOcclusion.viewport.xy)/pbrAmbientOcclusion.viewport.zw;
|
|
36
|
+
if(any(coordinates<vec2f(0.0))||any(coordinates>vec2f(1.0))){return 1.0;}
|
|
37
|
+
let visibility=textureSampleLevel(ambientOcclusionTexture,ambientOcclusionTextureSampler,coordinates,0.0).r;
|
|
38
|
+
return mix(1.0,clamp(visibility,0.0,1.0),clamp(pbrAmbientOcclusion.strength,0.0,1.0));
|
|
39
|
+
}
|
|
40
|
+
fn pbrAmbientOcclusion_setFactor(pixelPosition:vec2f) {
|
|
41
|
+
pbr_ambientVisibility = pbrAmbientOcclusion_getFactor(pixelPosition);
|
|
42
|
+
}`,
|
|
43
|
+
fs: /* glsl */ `
|
|
44
|
+
layout(std140) uniform pbrAmbientOcclusionUniforms {
|
|
45
|
+
vec4 viewport;
|
|
46
|
+
float strength;
|
|
47
|
+
int enabled;
|
|
48
|
+
} pbrAmbientOcclusion;
|
|
49
|
+
uniform sampler2D ambientOcclusionTexture;
|
|
50
|
+
float pbrAmbientOcclusion_getFactor(vec2 pixelPosition) {
|
|
51
|
+
if(pbrAmbientOcclusion.enabled==0)return 1.0;
|
|
52
|
+
vec2 coordinates=(pixelPosition-pbrAmbientOcclusion.viewport.xy)/pbrAmbientOcclusion.viewport.zw;
|
|
53
|
+
if(any(lessThan(coordinates,vec2(0.0)))||any(greaterThan(coordinates,vec2(1.0))))return 1.0;
|
|
54
|
+
float visibility=texture(ambientOcclusionTexture,coordinates).r;
|
|
55
|
+
return mix(1.0,clamp(visibility,0.0,1.0),clamp(pbrAmbientOcclusion.strength,0.0,1.0));
|
|
56
|
+
}
|
|
57
|
+
void pbrAmbientOcclusion_setFactor(vec2 pixelPosition) {
|
|
58
|
+
pbr_ambientVisibility = pbrAmbientOcclusion_getFactor(pixelPosition);
|
|
59
|
+
}`
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=pbr-ambient-occlusion.js.map
|
|
@@ -0,0 +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