@luma.gl/shadertools 9.1.0-alpha.1 → 9.1.0-alpha.12
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/dist/dist.dev.js +1005 -487
- package/dist/dist.min.js +2489 -1625
- package/dist/index.cjs +2864 -1817
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +29 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -12
- package/dist/lib/glsl-utils/shader-utils.d.ts.map +1 -1
- package/dist/lib/glsl-utils/shader-utils.js +2 -3
- package/dist/lib/shader-assembler.d.ts +3 -4
- package/dist/lib/shader-assembler.d.ts.map +1 -1
- package/dist/lib/shader-assembler.js +3 -2
- package/dist/lib/shader-assembly/assemble-shaders.d.ts +4 -3
- package/dist/lib/shader-assembly/assemble-shaders.d.ts.map +1 -1
- package/dist/lib/shader-assembly/assemble-shaders.js +46 -18
- package/dist/lib/shader-assembly/platform-defines.d.ts.map +1 -1
- package/dist/lib/shader-assembly/platform-defines.js +14 -6
- package/dist/lib/shader-module/shader-module-dependencies.d.ts +53 -0
- package/dist/lib/shader-module/shader-module-dependencies.d.ts.map +1 -0
- package/dist/lib/{shader-assembly/resolve-modules.js → shader-module/shader-module-dependencies.js} +38 -14
- package/dist/lib/shader-module/shader-module.d.ts +30 -12
- package/dist/lib/shader-module/shader-module.d.ts.map +1 -1
- package/dist/lib/shader-module/shader-module.js +76 -6
- package/dist/lib/shader-module/shader-pass.d.ts +3 -2
- package/dist/lib/shader-module/shader-pass.d.ts.map +1 -1
- package/dist/module-injectors.d.ts +2 -2
- package/dist/module-injectors.d.ts.map +1 -1
- package/dist/module-injectors.js +13 -10
- package/dist/modules/engine/geometry/geometry.d.ts.map +1 -1
- package/dist/modules/engine/geometry/geometry.js +12 -8
- package/dist/modules/engine/picking/picking.d.ts +9 -9
- package/dist/modules/engine/picking/picking.d.ts.map +1 -1
- package/dist/modules/engine/picking/picking.js +103 -66
- package/dist/modules/engine/project/project.d.ts +2 -2
- package/dist/modules/engine/project/project.d.ts.map +1 -1
- package/dist/modules/engine/project/project.js +36 -22
- package/dist/modules/engine/transform/transform.d.ts.map +1 -1
- package/dist/modules/engine/transform/transform.js +28 -16
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +10 -7
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-material.js +2 -0
- package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts +2 -2
- package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.js +79 -53
- package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts +1 -1
- package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/lights/lighting-uniforms-glsl.js +38 -23
- package/dist/modules/lighting/lights/lighting-uniforms-wgsl.d.ts +2 -0
- package/dist/modules/lighting/lights/lighting-uniforms-wgsl.d.ts.map +1 -0
- package/dist/modules/lighting/lights/lighting-uniforms-wgsl.js +56 -0
- package/dist/modules/lighting/lights/lighting.d.ts +5 -4
- package/dist/modules/lighting/lights/lighting.d.ts.map +1 -1
- package/dist/modules/lighting/lights/lighting.js +7 -5
- package/dist/modules/lighting/no-material/dirlight.d.ts +8 -8
- package/dist/modules/lighting/no-material/dirlight.d.ts.map +1 -1
- package/dist/modules/lighting/no-material/dirlight.js +34 -20
- package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts +1 -1
- package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.js +304 -181
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts +72 -69
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-material.js +4 -2
- package/dist/modules/lighting/pbr-material/pbr-uniforms-glsl.d.ts +1 -1
- package/dist/modules/lighting/pbr-material/pbr-uniforms-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-uniforms-glsl.js +38 -20
- package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts +1 -1
- package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.js +21 -16
- package/dist/modules/lighting/phong-material/phong-material.d.ts +14 -12
- package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -1
- package/dist/modules/lighting/phong-material/phong-material.js +5 -3
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +2 -2
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +82 -54
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts +41 -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 +130 -0
- package/dist/modules/math/fp32/fp32.d.ts.map +1 -1
- package/dist/modules/math/fp32/fp32.js +127 -100
- package/dist/modules/math/fp64/fp64-utils.d.ts +3 -3
- package/dist/modules/math/fp64/fp64-utils.d.ts.map +1 -1
- package/dist/modules/math/random/random.d.ts +1 -1
- package/dist/modules/math/random/random.d.ts.map +1 -1
- package/dist/modules/math/random/random.js +3 -3
- package/dist/modules/module-injectors.d.ts +2 -2
- package/dist/modules/module-injectors.d.ts.map +1 -1
- package/dist/modules/module-injectors.js +13 -10
- package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +4 -1
- package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.js +16 -12
- package/dist/modules/postprocessing/image-adjust-filters/denoise.d.ts +4 -1
- package/dist/modules/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/denoise.js +21 -17
- package/dist/modules/postprocessing/image-adjust-filters/huesaturation.d.ts +5 -2
- package/dist/modules/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/huesaturation.js +29 -22
- package/dist/modules/postprocessing/image-adjust-filters/noise.d.ts +4 -1
- package/dist/modules/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/noise.js +14 -10
- package/dist/modules/postprocessing/image-adjust-filters/sepia.d.ts +4 -1
- package/dist/modules/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/sepia.js +17 -12
- package/dist/modules/postprocessing/image-adjust-filters/vibrance.d.ts +4 -1
- package/dist/modules/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/vibrance.js +12 -9
- package/dist/modules/postprocessing/image-adjust-filters/vignette.d.ts +4 -1
- package/dist/modules/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-adjust-filters/vignette.js +13 -10
- package/dist/modules/postprocessing/image-blur-filters/tiltshift.d.ts +5 -2
- package/dist/modules/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-blur-filters/tiltshift.js +40 -26
- package/dist/modules/postprocessing/image-blur-filters/triangleblur.d.ts +5 -2
- package/dist/modules/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-blur-filters/triangleblur.js +32 -19
- package/dist/modules/postprocessing/image-blur-filters/zoomblur.d.ts +4 -1
- package/dist/modules/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-blur-filters/zoomblur.js +2 -0
- package/dist/modules/postprocessing/image-fun-filters/colorhalftone.d.ts +4 -1
- package/dist/modules/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/colorhalftone.js +31 -27
- package/dist/modules/postprocessing/image-fun-filters/dotscreen.d.ts +4 -1
- package/dist/modules/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/dotscreen.js +19 -15
- package/dist/modules/postprocessing/image-fun-filters/edgework.d.ts +8 -5
- package/dist/modules/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/edgework.js +53 -42
- package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +4 -1
- package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.js +41 -33
- package/dist/modules/postprocessing/image-fun-filters/ink.d.ts +4 -1
- package/dist/modules/postprocessing/image-fun-filters/ink.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/ink.js +27 -25
- package/dist/modules/postprocessing/image-fun-filters/magnify.d.ts +2 -1
- package/dist/modules/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-fun-filters/magnify.js +17 -16
- package/dist/modules/postprocessing/image-warp-filters/bulgepinch.d.ts +5 -2
- package/dist/modules/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-warp-filters/bulgepinch.js +24 -20
- package/dist/modules/postprocessing/image-warp-filters/swirl.d.ts +5 -2
- package/dist/modules/postprocessing/image-warp-filters/swirl.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-warp-filters/swirl.js +26 -22
- package/dist/modules/postprocessing/image-warp-filters/warp.d.ts +2 -1
- package/dist/modules/postprocessing/image-warp-filters/warp.d.ts.map +1 -1
- package/dist/modules/postprocessing/image-warp-filters/warp.js +9 -8
- package/dist/modules-webgl1/geometry/geometry.d.ts.map +1 -1
- package/dist/modules-webgl1/geometry/geometry.js +12 -8
- package/dist/modules-webgl1/lighting/dirlight/dirlight.d.ts +2 -2
- package/dist/modules-webgl1/lighting/dirlight/dirlight.d.ts.map +1 -1
- package/dist/modules-webgl1/lighting/dirlight/dirlight.js +8 -5
- package/dist/modules-webgl1/lighting/lights/lights-glsl.d.ts +1 -1
- package/dist/modules-webgl1/lighting/lights/lights-glsl.d.ts.map +1 -1
- package/dist/modules-webgl1/lighting/lights/lights-glsl.js +19 -11
- package/dist/modules-webgl1/lighting/pbr/pbr-fragment-glsl.d.ts +1 -1
- package/dist/modules-webgl1/lighting/pbr/pbr-fragment-glsl.d.ts.map +1 -1
- package/dist/modules-webgl1/lighting/pbr/pbr-fragment-glsl.js +268 -157
- package/dist/modules-webgl1/lighting/pbr/pbr-vertex-glsl.d.ts +1 -1
- package/dist/modules-webgl1/lighting/pbr/pbr-vertex-glsl.d.ts.map +1 -1
- package/dist/modules-webgl1/lighting/pbr/pbr-vertex-glsl.js +16 -12
- package/dist/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.d.ts +1 -1
- package/dist/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.d.ts.map +1 -1
- package/dist/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.js +64 -55
- package/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.d.ts +1 -1
- package/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.d.ts.map +1 -1
- package/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.js +113 -81
- package/dist/modules-webgl1/math/fp64/fp64-functions-glsl.d.ts +1 -1
- package/dist/modules-webgl1/math/fp64/fp64-functions-glsl.d.ts.map +1 -1
- package/dist/modules-webgl1/math/fp64/fp64-functions-glsl.js +588 -433
- package/dist/modules-webgl1/project/project.d.ts +2 -2
- package/dist/modules-webgl1/project/project.d.ts.map +1 -1
- package/dist/modules-webgl1/project/project.js +5 -4
- package/package.json +5 -5
- package/src/index.ts +78 -32
- package/src/lib/glsl-utils/shader-utils.ts +1 -3
- package/src/lib/shader-assembler.ts +7 -8
- package/src/lib/shader-assembly/assemble-shaders.ts +55 -22
- package/src/lib/shader-assembly/platform-defines.ts +5 -6
- package/src/lib/shader-module/shader-module-dependencies.ts +111 -0
- package/src/lib/shader-module/shader-module.ts +134 -19
- package/src/lib/shader-module/shader-pass.ts +3 -2
- package/src/module-injectors.ts +2 -4
- package/src/modules/engine/geometry/geometry.ts +2 -3
- package/src/modules/engine/picking/picking.ts +12 -10
- package/src/modules/engine/project/project.ts +2 -3
- package/src/modules/engine/transform/transform.ts +1 -3
- package/src/modules/lighting/gouraud-material/gouraud-material.ts +4 -0
- package/src/modules/lighting/gouraud-material/gouraud-shaders-glsl.ts +2 -4
- package/src/modules/lighting/lights/lighting-uniforms-glsl.ts +1 -3
- package/src/modules/lighting/lights/lighting-uniforms-wgsl.ts +57 -0
- package/src/modules/lighting/lights/lighting.ts +9 -5
- package/src/modules/lighting/no-material/dirlight.ts +30 -19
- package/src/modules/lighting/pbr-material/pbr-fragment-glsl.ts +1 -2
- package/src/modules/lighting/pbr-material/pbr-material.ts +44 -38
- package/src/modules/lighting/pbr-material/pbr-uniforms-glsl.ts +1 -3
- package/src/modules/lighting/pbr-material/pbr-vertex-glsl.ts +1 -3
- package/src/modules/lighting/phong-material/phong-material.ts +6 -3
- package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +2 -4
- package/src/modules/lighting/phong-material/phong-shaders-wgsl.ts +132 -0
- package/src/modules/math/fp32/fp32.ts +1 -2
- package/src/modules/math/fp64/fp64-utils.ts +3 -3
- package/src/modules/math/random/random.ts +1 -2
- package/src/modules/module-injectors.ts +2 -4
- package/src/modules/postprocessing/image-adjust-filters/brightnesscontrast.ts +6 -2
- package/src/modules/postprocessing/image-adjust-filters/denoise.ts +7 -3
- package/src/modules/postprocessing/image-adjust-filters/huesaturation.ts +9 -4
- package/src/modules/postprocessing/image-adjust-filters/noise.ts +6 -2
- package/src/modules/postprocessing/image-adjust-filters/sepia.ts +6 -2
- package/src/modules/postprocessing/image-adjust-filters/vibrance.ts +5 -2
- package/src/modules/postprocessing/image-adjust-filters/vignette.ts +11 -4
- package/src/modules/postprocessing/image-blur-filters/tiltshift.ts +6 -2
- package/src/modules/postprocessing/image-blur-filters/triangleblur.ts +6 -2
- package/src/modules/postprocessing/image-blur-filters/zoomblur.ts +5 -0
- package/src/modules/postprocessing/image-fun-filters/colorhalftone.ts +6 -2
- package/src/modules/postprocessing/image-fun-filters/dotscreen.ts +6 -2
- package/src/modules/postprocessing/image-fun-filters/edgework.ts +10 -4
- package/src/modules/postprocessing/image-fun-filters/hexagonalpixelate.ts +6 -2
- package/src/modules/postprocessing/image-fun-filters/ink.ts +8 -3
- package/src/modules/postprocessing/image-fun-filters/magnify.ts +3 -2
- package/src/modules/postprocessing/image-warp-filters/bulgepinch.ts +6 -2
- package/src/modules/postprocessing/image-warp-filters/swirl.ts +8 -2
- package/src/modules/postprocessing/image-warp-filters/warp.ts +3 -2
- package/src/modules-webgl1/geometry/geometry.ts +2 -3
- package/src/modules-webgl1/lighting/dirlight/dirlight.ts +3 -4
- package/src/modules-webgl1/lighting/lights/lights-glsl.ts +1 -3
- package/src/modules-webgl1/lighting/pbr/pbr-fragment-glsl.ts +1 -2
- package/src/modules-webgl1/lighting/pbr/pbr-vertex-glsl.ts +1 -3
- package/src/modules-webgl1/lighting/phong-lighting/phong-lighting-glsl.ts +1 -3
- package/src/modules-webgl1/math/fp64/fp64-arithmetic-glsl.ts +1 -3
- package/src/modules-webgl1/math/fp64/fp64-functions-glsl.ts +1 -3
- package/src/modules-webgl1/project/project.ts +1 -2
- package/dist/lib/glsl-utils/highlight.d.ts +0 -6
- package/dist/lib/glsl-utils/highlight.d.ts.map +0 -1
- package/dist/lib/glsl-utils/highlight.js +0 -9
- package/dist/lib/shader-assembly/resolve-modules.d.ts +0 -40
- package/dist/lib/shader-assembly/resolve-modules.d.ts.map +0 -1
- package/dist/lib/shader-module/normalize-shader-module.d.ts +0 -3
- package/dist/lib/shader-module/normalize-shader-module.d.ts.map +0 -1
- package/dist/lib/shader-module/normalize-shader-module.js +0 -14
- package/dist/lib/shader-module/shader-module-instance.d.ts +0 -28
- package/dist/lib/shader-module/shader-module-instance.d.ts.map +0 -1
- package/dist/lib/shader-module/shader-module-instance.js +0 -126
- package/src/lib/glsl-utils/highlight.ts +0 -11
- package/src/lib/shader-assembly/resolve-modules.ts +0 -81
- package/src/lib/shader-module/normalize-shader-module.ts +0 -17
- package/src/lib/shader-module/shader-module-instance.ts +0 -167
|
@@ -15,35 +15,35 @@ import {vs} from './pbr-vertex-glsl';
|
|
|
15
15
|
import {fs} from './pbr-fragment-glsl';
|
|
16
16
|
|
|
17
17
|
export type PBRMaterialProps = PBRMaterialBindings & {
|
|
18
|
-
unlit
|
|
18
|
+
unlit?: boolean;
|
|
19
19
|
|
|
20
20
|
// Base color map
|
|
21
|
-
baseColorMapEnabled
|
|
22
|
-
baseColorFactor
|
|
21
|
+
baseColorMapEnabled?: boolean;
|
|
22
|
+
baseColorFactor?: Readonly<Vector4 | NumberArray>;
|
|
23
23
|
|
|
24
|
-
normalMapEnabled
|
|
25
|
-
normalScale
|
|
24
|
+
normalMapEnabled?: boolean;
|
|
25
|
+
normalScale?: number; // #ifdef HAS_NORMALMAP
|
|
26
26
|
|
|
27
|
-
emissiveMapEnabled
|
|
28
|
-
emissiveFactor
|
|
27
|
+
emissiveMapEnabled?: boolean;
|
|
28
|
+
emissiveFactor?: Readonly<Vector3 | NumberArray>; // #ifdef HAS_EMISSIVEMAP
|
|
29
29
|
|
|
30
|
-
metallicRoughnessValues
|
|
31
|
-
metallicRoughnessMapEnabled
|
|
30
|
+
metallicRoughnessValues?: Readonly<Vector2 | NumberArray>;
|
|
31
|
+
metallicRoughnessMapEnabled?: boolean;
|
|
32
32
|
|
|
33
|
-
occlusionMapEnabled
|
|
34
|
-
occlusionStrength
|
|
33
|
+
occlusionMapEnabled?: boolean;
|
|
34
|
+
occlusionStrength?: number; // #ifdef HAS_OCCLUSIONMAP
|
|
35
35
|
|
|
36
|
-
alphaCutoffEnabled
|
|
37
|
-
alphaCutoff
|
|
36
|
+
alphaCutoffEnabled?: boolean;
|
|
37
|
+
alphaCutoff?: number; // #ifdef ALPHA_CUTOFF
|
|
38
38
|
|
|
39
39
|
// IBL
|
|
40
|
-
IBLenabled
|
|
41
|
-
scaleIBLAmbient
|
|
40
|
+
IBLenabled?: boolean;
|
|
41
|
+
scaleIBLAmbient?: Readonly<Vector2 | NumberArray>; // #ifdef USE_IBL
|
|
42
42
|
|
|
43
43
|
// debugging flags used for shader output of intermediate PBR variables
|
|
44
44
|
// #ifdef PBR_DEBUG
|
|
45
|
-
scaleDiffBaseMR
|
|
46
|
-
scaleFGDSpec
|
|
45
|
+
scaleDiffBaseMR?: Readonly<Vector4 | NumberArray>;
|
|
46
|
+
scaleFGDSpec?: Readonly<Vector4 | NumberArray>;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
/** Non-uniform block bindings for pbr module */
|
|
@@ -56,41 +56,41 @@ type PBRMaterialBindings = {
|
|
|
56
56
|
occlusionSampler?: Texture | null; // #ifdef HAS_OCCLUSIONMAP
|
|
57
57
|
|
|
58
58
|
// IBL Samplers
|
|
59
|
-
diffuseEnvSampler
|
|
60
|
-
specularEnvSampler
|
|
59
|
+
diffuseEnvSampler?: Texture | null; // #ifdef USE_IBL (samplerCube)
|
|
60
|
+
specularEnvSampler?: Texture | null; // #ifdef USE_IBL (samplerCube)
|
|
61
61
|
brdfLUT?: Texture | null; // #ifdef USE_IBL
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
export type PBRMaterialUniforms = {
|
|
65
|
-
unlit
|
|
65
|
+
unlit?: boolean;
|
|
66
66
|
|
|
67
67
|
// Base color map
|
|
68
|
-
baseColorMapEnabled
|
|
69
|
-
baseColorFactor
|
|
68
|
+
baseColorMapEnabled?: boolean;
|
|
69
|
+
baseColorFactor?: Readonly<Vector4 | NumberArray>;
|
|
70
70
|
|
|
71
|
-
normalMapEnabled
|
|
72
|
-
normalScale
|
|
71
|
+
normalMapEnabled?: boolean;
|
|
72
|
+
normalScale?: number; // #ifdef HAS_NORMALMAP
|
|
73
73
|
|
|
74
|
-
emissiveMapEnabled
|
|
75
|
-
emissiveFactor
|
|
74
|
+
emissiveMapEnabled?: boolean;
|
|
75
|
+
emissiveFactor?: Readonly<Vector3 | NumberArray>; // #ifdef HAS_EMISSIVEMAP
|
|
76
76
|
|
|
77
|
-
metallicRoughnessValues
|
|
78
|
-
metallicRoughnessMapEnabled
|
|
77
|
+
metallicRoughnessValues?: Readonly<Vector2 | NumberArray>;
|
|
78
|
+
metallicRoughnessMapEnabled?: boolean;
|
|
79
79
|
|
|
80
|
-
occlusionMapEnabled
|
|
81
|
-
occlusionStrength
|
|
80
|
+
occlusionMapEnabled?: boolean;
|
|
81
|
+
occlusionStrength?: number; // #ifdef HAS_OCCLUSIONMAP
|
|
82
82
|
|
|
83
|
-
alphaCutoffEnabled
|
|
84
|
-
alphaCutoff
|
|
83
|
+
alphaCutoffEnabled?: boolean;
|
|
84
|
+
alphaCutoff?: number; // #ifdef ALPHA_CUTOFF
|
|
85
85
|
|
|
86
86
|
// IBL
|
|
87
|
-
IBLenabled
|
|
88
|
-
scaleIBLAmbient
|
|
87
|
+
IBLenabled?: boolean;
|
|
88
|
+
scaleIBLAmbient?: Readonly<Vector2 | NumberArray>; // #ifdef USE_IBL
|
|
89
89
|
|
|
90
90
|
// debugging flags used for shader output of intermediate PBR variables
|
|
91
91
|
// #ifdef PBR_DEBUG
|
|
92
|
-
scaleDiffBaseMR
|
|
93
|
-
scaleFGDSpec
|
|
92
|
+
scaleDiffBaseMR?: Readonly<Vector4 | NumberArray>;
|
|
93
|
+
scaleFGDSpec?: Readonly<Vector4 | NumberArray>;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
/**
|
|
@@ -98,9 +98,14 @@ export type PBRMaterialUniforms = {
|
|
|
98
98
|
* Physically Based Shading of a microfacet surface defined by a glTF material.
|
|
99
99
|
*/
|
|
100
100
|
export const pbrMaterial = {
|
|
101
|
+
props: {} as PBRMaterialProps,
|
|
102
|
+
uniforms: {} as PBRMaterialUniforms,
|
|
103
|
+
|
|
101
104
|
name: 'pbr',
|
|
105
|
+
dependencies: [lighting],
|
|
102
106
|
vs,
|
|
103
107
|
fs,
|
|
108
|
+
|
|
104
109
|
defines: {
|
|
105
110
|
LIGHTING_FRAGMENT: 1,
|
|
106
111
|
HAS_NORMALMAP: 0,
|
|
@@ -112,6 +117,7 @@ export const pbrMaterial = {
|
|
|
112
117
|
USE_IBL: 0,
|
|
113
118
|
PBR_DEBUG: 0
|
|
114
119
|
},
|
|
120
|
+
|
|
115
121
|
uniformTypes: {
|
|
116
122
|
// Material is unlit
|
|
117
123
|
unlit: 'i32',
|
|
@@ -144,6 +150,7 @@ export const pbrMaterial = {
|
|
|
144
150
|
scaleDiffBaseMR: 'vec4<f32>',
|
|
145
151
|
scaleFGDSpec: 'vec4<f32>'
|
|
146
152
|
},
|
|
153
|
+
|
|
147
154
|
bindings: {
|
|
148
155
|
baseColorSampler: {type: 'texture', location: 8}, // #ifdef HAS_BASECOLORMAP
|
|
149
156
|
normalSampler: {type: 'texture', location: 9}, // #ifdef HAS_NORMALMAP
|
|
@@ -154,6 +161,5 @@ export const pbrMaterial = {
|
|
|
154
161
|
diffuseEnvSampler: {type: 'texture', location: 13}, // #ifdef USE_IBL (samplerCube)
|
|
155
162
|
specularEnvSampler: {type: 'texture', location: 14}, // #ifdef USE_IBL (samplerCube)
|
|
156
163
|
brdfLUT: {type: 'texture', location: 15} // #ifdef USE_IBL
|
|
157
|
-
}
|
|
158
|
-
dependencies: [lighting]
|
|
164
|
+
}
|
|
159
165
|
} as const satisfies ShaderModule<PBRMaterialProps, PBRMaterialUniforms>;
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const pbrMaterialUniforms = glsl`\
|
|
5
|
+
export const pbrMaterialUniforms = /* glsl */ `\
|
|
8
6
|
uniform Projection {
|
|
9
7
|
// Projection
|
|
10
8
|
vec3 u_Camera;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import {ShaderModule} from '../../../lib/shader-module/shader-module';
|
|
6
6
|
import {lighting} from '../lights/lighting';
|
|
7
|
+
import {PHONG_WGSL} from './phong-shaders-wgsl';
|
|
7
8
|
import {PHONG_VS, PHONG_FS} from './phong-shaders-glsl';
|
|
8
9
|
|
|
9
10
|
export type PhongMaterialProps = PhongMaterialUniforms;
|
|
@@ -18,14 +19,18 @@ export type PhongMaterialUniforms = {
|
|
|
18
19
|
|
|
19
20
|
/** In Phong shading, the normal vector is linearly interpolated across the surface of the polygon from the polygon's vertex normals. */
|
|
20
21
|
export const phongMaterial = {
|
|
22
|
+
props: {} as PhongMaterialProps,
|
|
23
|
+
uniforms: {} as PhongMaterialUniforms,
|
|
24
|
+
|
|
21
25
|
name: 'phong-lighting',
|
|
26
|
+
dependencies: [lighting],
|
|
22
27
|
// Note these are switched between phong and gouraud
|
|
28
|
+
source: PHONG_WGSL,
|
|
23
29
|
vs: PHONG_VS,
|
|
24
30
|
fs: PHONG_FS,
|
|
25
31
|
defines: {
|
|
26
32
|
LIGHTING_FRAGMENT: 1
|
|
27
33
|
},
|
|
28
|
-
dependencies: [lighting],
|
|
29
34
|
uniformTypes: {
|
|
30
35
|
ambient: 'f32',
|
|
31
36
|
diffuse: 'f32',
|
|
@@ -38,8 +43,6 @@ export const phongMaterial = {
|
|
|
38
43
|
shininess: 32,
|
|
39
44
|
specularColor: [0.15, 0.15, 0.15]
|
|
40
45
|
},
|
|
41
|
-
props: {} as Required<PhongMaterialProps>,
|
|
42
|
-
uniforms: {} as PhongMaterialUniforms,
|
|
43
46
|
getUniforms(props?: PhongMaterialProps): PhongMaterialUniforms {
|
|
44
47
|
return {...phongMaterial.defaultUniforms, ...props};
|
|
45
48
|
}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const PHONG_VS = glsl`\
|
|
5
|
+
export const PHONG_VS = /* glsl */ `\
|
|
8
6
|
uniform phongMaterialUniforms {
|
|
9
7
|
uniform float ambient;
|
|
10
8
|
uniform float diffuse;
|
|
@@ -13,7 +11,7 @@ uniform phongMaterialUniforms {
|
|
|
13
11
|
} material;
|
|
14
12
|
`;
|
|
15
13
|
|
|
16
|
-
export const PHONG_FS = glsl`\
|
|
14
|
+
export const PHONG_FS = /* glsl */ `\
|
|
17
15
|
uniform phongMaterialUniforms {
|
|
18
16
|
uniform float ambient;
|
|
19
17
|
uniform float diffuse;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
export const PHONG_WGSL = /* wgsl */ `\
|
|
6
|
+
struct phongMaterialUniforms {
|
|
7
|
+
ambient: f32,
|
|
8
|
+
diffuse: f32,
|
|
9
|
+
shininess: f32,
|
|
10
|
+
specularColor: vec3<f32>,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
@binding(2) @group(0) var<uniform> material : phongMaterialUniforms;
|
|
14
|
+
|
|
15
|
+
fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, view_direction: vec3<f32>, normal_worldspace: vec3<f32>, color: vec3<f32>) -> vec3<f32> {
|
|
16
|
+
let halfway_direction: vec3<f32> = normalize(light_direction + view_direction);
|
|
17
|
+
var lambertian: f32 = dot(light_direction, normal_worldspace);
|
|
18
|
+
var specular: f32 = 0.0;
|
|
19
|
+
if (lambertian > 0.0) {
|
|
20
|
+
let specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
|
|
21
|
+
specular = pow(specular_angle, material.shininess);
|
|
22
|
+
}
|
|
23
|
+
lambertian = max(lambertian, 0.0);
|
|
24
|
+
return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32> {
|
|
28
|
+
var lightColor: vec3<f32> = surfaceColor;
|
|
29
|
+
|
|
30
|
+
if (lighting.enabled == 0) {
|
|
31
|
+
return lightColor;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let view_direction: vec3<f32> = normalize(cameraPosition - position_worldspace);
|
|
35
|
+
lightColor = material.ambient * surfaceColor * lighting.ambientColor;
|
|
36
|
+
|
|
37
|
+
if (lighting.lightType == 0) {
|
|
38
|
+
let pointLight: PointLight = lighting_getPointLight(0);
|
|
39
|
+
let light_position_worldspace: vec3<f32> = pointLight.position;
|
|
40
|
+
let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace);
|
|
41
|
+
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
42
|
+
} else if (lighting.lightType == 1) {
|
|
43
|
+
var directionalLight: DirectionalLight = lighting_getDirectionalLight(0);
|
|
44
|
+
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return lightColor;
|
|
48
|
+
/*
|
|
49
|
+
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
50
|
+
if (i >= lighting.pointLightCount) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
PointLight pointLight = lighting.pointLight[i];
|
|
54
|
+
vec3 light_position_worldspace = pointLight.position;
|
|
55
|
+
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
56
|
+
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
60
|
+
if (i >= lighting.directionalLightCount) {
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
DirectionalLight directionalLight = lighting.directionalLight[i];
|
|
64
|
+
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
65
|
+
}
|
|
66
|
+
*/
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32>{
|
|
70
|
+
var lightColor = vec3<f32>(0, 0, 0);
|
|
71
|
+
let surfaceColor = vec3<f32>(0, 0, 0);
|
|
72
|
+
|
|
73
|
+
if (lighting.enabled == 0) {
|
|
74
|
+
let view_direction = normalize(cameraPosition - position_worldspace);
|
|
75
|
+
|
|
76
|
+
switch (lighting.lightType) {
|
|
77
|
+
case 0, default: {
|
|
78
|
+
let pointLight: PointLight = lighting_getPointLight(0);
|
|
79
|
+
let light_position_worldspace: vec3<f32> = pointLight.position;
|
|
80
|
+
let light_direction: vec3<f32> = normalize(light_position_worldspace - position_worldspace);
|
|
81
|
+
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
82
|
+
}
|
|
83
|
+
case 1: {
|
|
84
|
+
let directionalLight: DirectionalLight = lighting_getDirectionalLight(0);
|
|
85
|
+
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return lightColor;
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
// TODO - handle multiple lights
|
|
94
|
+
/**
|
|
95
|
+
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
96
|
+
if (i >= lighting.pointLightCount) {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
PointLight pointLight = lighting_getPointLight(i);
|
|
100
|
+
vec3 light_position_worldspace = pointLight.position;
|
|
101
|
+
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
102
|
+
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
106
|
+
if (i >= lighting.directionalLightCount) {
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
PointLight pointLight = lighting_getDirectionalLight(i);
|
|
110
|
+
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
115
|
+
if (i >= lighting.pointLightCount) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
PointLight pointLight = lighting_getPointLight(i);
|
|
119
|
+
vec3 light_position_worldspace = pointLight.position;
|
|
120
|
+
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
121
|
+
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
125
|
+
if (i >= lighting.directionalLightCount) {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
PointLight pointLight = lighting_getDirectionalLight(i);
|
|
129
|
+
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
*/
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {glsl} from '../../../lib/glsl-utils/highlight';
|
|
6
5
|
// import {ShaderModule} from '../../types';
|
|
7
6
|
|
|
8
|
-
const fp32shader = glsl`\
|
|
7
|
+
const fp32shader = /* glsl */ `\
|
|
9
8
|
#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
|
|
10
9
|
|
|
11
10
|
// All these functions are for substituting tan() function from Intel GPU only
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {NumericArray} from '@math.gl/types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Calculate WebGL 64 bit float
|
|
@@ -11,7 +11,7 @@ import type {NumberArray} from '@math.gl/types';
|
|
|
11
11
|
* @param startIndex - the index in the output array to fill from. Default 0.
|
|
12
12
|
* @returns - the fp64 representation of the input number
|
|
13
13
|
*/
|
|
14
|
-
export function fp64ify(a: number, out:
|
|
14
|
+
export function fp64ify(a: number, out: NumericArray = [], startIndex: number = 0): NumericArray {
|
|
15
15
|
const hiPart = Math.fround(a);
|
|
16
16
|
const loPart = a - hiPart;
|
|
17
17
|
out[startIndex] = hiPart;
|
|
@@ -33,7 +33,7 @@ export function fp64LowPart(a: number): number {
|
|
|
33
33
|
* @param matrix the input matrix
|
|
34
34
|
* @returns the fp64 representation of the input matrix
|
|
35
35
|
*/
|
|
36
|
-
export function fp64ifyMatrix4(matrix:
|
|
36
|
+
export function fp64ifyMatrix4(matrix: NumericArray): Float32Array {
|
|
37
37
|
// Transpose the projection matrix to column major for GLSL.
|
|
38
38
|
const matrixFP64 = new Float32Array(32);
|
|
39
39
|
for (let i = 0; i < 4; ++i) {
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {glsl} from '../../../lib/glsl-utils/highlight';
|
|
6
5
|
import {ShaderModule} from '../../../lib/shader-module/shader-module';
|
|
7
6
|
|
|
8
|
-
const fs = glsl`\
|
|
7
|
+
const fs = /* glsl */ `\
|
|
9
8
|
float random(vec3 scale, float seed) {
|
|
10
9
|
/* use the fragment position for a different seed per-pixel */
|
|
11
10
|
return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const MODULE_INJECTORS_VS = glsl`\
|
|
5
|
+
export const MODULE_INJECTORS_VS = /* glsl */ `\
|
|
8
6
|
#ifdef MODULE_LOGDEPTH
|
|
9
7
|
logdepth_adjustPosition(gl_Position);
|
|
10
8
|
#endif
|
|
11
9
|
`;
|
|
12
10
|
|
|
13
|
-
export const MODULE_INJECTORS_FS = glsl`\
|
|
11
|
+
export const MODULE_INJECTORS_FS = /* glsl */ `\
|
|
14
12
|
#ifdef MODULE_MATERIAL
|
|
15
13
|
gl_FragColor = material_filterColor(gl_FragColor);
|
|
16
14
|
#endif
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ShaderPass} from '../../../lib/shader-module/shader-pass';
|
|
6
|
-
import {glsl} from '../../../lib/glsl-utils/highlight';
|
|
7
6
|
|
|
8
|
-
const fs = glsl`\
|
|
7
|
+
const fs = /* glsl */ `\
|
|
9
8
|
|
|
10
9
|
uniform brightnessContrastUniforms {
|
|
11
10
|
float brightness;
|
|
@@ -32,6 +31,8 @@ export type BrightnessContrastProps = {
|
|
|
32
31
|
contrast?: number;
|
|
33
32
|
};
|
|
34
33
|
|
|
34
|
+
export type BrightnessContrastUniforms = BrightnessContrastProps;
|
|
35
|
+
|
|
35
36
|
/**
|
|
36
37
|
* Brightness / Contrast -
|
|
37
38
|
* Provides additive brightness and multiplicative contrast control.
|
|
@@ -39,6 +40,9 @@ export type BrightnessContrastProps = {
|
|
|
39
40
|
* @param contrast -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
|
|
40
41
|
*/
|
|
41
42
|
export const brightnessContrast = {
|
|
43
|
+
props: {} as BrightnessContrastProps,
|
|
44
|
+
uniforms: {} as BrightnessContrastUniforms,
|
|
45
|
+
|
|
42
46
|
name: 'brightnessContrast',
|
|
43
47
|
uniformTypes: {
|
|
44
48
|
brightness: 'f32',
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ShaderPass} from '../../../lib/shader-module/shader-pass';
|
|
6
|
-
import {glsl} from '../../../lib/glsl-utils/highlight';
|
|
7
6
|
|
|
8
7
|
// Do a 9x9 bilateral box filter
|
|
9
|
-
const fs = glsl`\
|
|
8
|
+
const fs = /* glsl */ `\
|
|
10
9
|
uniform denoiseUniforms {
|
|
11
10
|
float strength;
|
|
12
11
|
} noise;
|
|
@@ -45,12 +44,17 @@ export type DenoiseProps = {
|
|
|
45
44
|
strength?: number;
|
|
46
45
|
};
|
|
47
46
|
|
|
47
|
+
export type DenoiseUniforms = DenoiseProps;
|
|
48
|
+
|
|
48
49
|
/**
|
|
49
50
|
* Denoise -
|
|
50
51
|
* Smooths over grainy noise in dark images using an 9x9 box filter
|
|
51
52
|
* weighted by color intensity, similar to a bilateral filter.
|
|
52
53
|
*/
|
|
53
54
|
export const denoise = {
|
|
55
|
+
props: {} as DenoiseProps,
|
|
56
|
+
uniforms: {} as DenoiseUniforms,
|
|
57
|
+
|
|
54
58
|
name: 'denoise',
|
|
55
59
|
uniformTypes: {
|
|
56
60
|
strength: 'f32'
|
|
@@ -61,4 +65,4 @@ export const denoise = {
|
|
|
61
65
|
},
|
|
62
66
|
fs,
|
|
63
67
|
passes: [{sampler: true}, {sampler: true}]
|
|
64
|
-
} as const satisfies ShaderPass<DenoiseProps>;
|
|
68
|
+
} as const satisfies ShaderPass<DenoiseProps, DenoiseUniforms>;
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ShaderPass} from '../../../lib/shader-module/shader-pass';
|
|
6
|
-
import {glsl} from '../../../lib/glsl-utils/highlight';
|
|
7
6
|
|
|
8
|
-
const fs = glsl`\
|
|
7
|
+
const fs = /* glsl */ `\
|
|
9
8
|
uniform hueSaturationUniforms {
|
|
10
9
|
float hue;
|
|
11
10
|
float saturation;
|
|
@@ -46,10 +45,12 @@ export type HueSaturationProps = {
|
|
|
46
45
|
/** -1 to 1 (-1 is 180 degree rotation in the negative direction, 0 is no change,
|
|
47
46
|
* and 1 is 180 degree rotation in the positive direction) */
|
|
48
47
|
hue?: number;
|
|
49
|
-
/**
|
|
48
|
+
/** -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) */
|
|
50
49
|
saturation?: number;
|
|
51
50
|
};
|
|
52
51
|
|
|
52
|
+
export type HueSaturationUniforms = HueSaturationProps;
|
|
53
|
+
|
|
53
54
|
/**
|
|
54
55
|
* Hue / Saturation
|
|
55
56
|
* Provides rotational hue and multiplicative saturation control. RGB color space
|
|
@@ -60,7 +61,12 @@ export type HueSaturationProps = {
|
|
|
60
61
|
* or away from the average color channel value.
|
|
61
62
|
*/
|
|
62
63
|
export const hueSaturation = {
|
|
64
|
+
props: {} as HueSaturationProps,
|
|
65
|
+
uniforms: {} as HueSaturationUniforms,
|
|
66
|
+
|
|
63
67
|
name: 'hueSaturation',
|
|
68
|
+
fs,
|
|
69
|
+
|
|
64
70
|
uniformTypes: {
|
|
65
71
|
hue: 'f32',
|
|
66
72
|
saturation: 'f32'
|
|
@@ -69,6 +75,5 @@ export const hueSaturation = {
|
|
|
69
75
|
hue: {value: 0, min: -1, max: 1},
|
|
70
76
|
saturation: {value: 0, min: -1, max: 1}
|
|
71
77
|
},
|
|
72
|
-
fs,
|
|
73
78
|
passes: [{filter: true}]
|
|
74
79
|
} as const satisfies ShaderPass<HueSaturationProps>;
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ShaderPass} from '../../../lib/shader-module/shader-pass';
|
|
6
|
-
import {glsl} from '../../../lib/glsl-utils/highlight';
|
|
7
6
|
|
|
8
|
-
const fs = glsl`\
|
|
7
|
+
const fs = /* glsl */ `\
|
|
9
8
|
uniform noiseUniforms {
|
|
10
9
|
float amount;
|
|
11
10
|
} noise;
|
|
@@ -35,11 +34,16 @@ export type NoiseProps = {
|
|
|
35
34
|
amount?: number;
|
|
36
35
|
};
|
|
37
36
|
|
|
37
|
+
export type NoiseUniforms = NoiseProps;
|
|
38
|
+
|
|
38
39
|
/**
|
|
39
40
|
* Noise
|
|
40
41
|
* Adds black and white noise to the image.
|
|
41
42
|
*/
|
|
42
43
|
export const noise = {
|
|
44
|
+
props: {} as NoiseProps,
|
|
45
|
+
uniforms: {} as NoiseUniforms,
|
|
46
|
+
|
|
43
47
|
name: 'noise',
|
|
44
48
|
uniformTypes: {
|
|
45
49
|
amount: 'f32'
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ShaderPass} from '../../../lib/shader-module/shader-pass';
|
|
6
|
-
import {glsl} from '../../../lib/glsl-utils/highlight';
|
|
7
6
|
|
|
8
|
-
const fs = glsl`\
|
|
7
|
+
const fs = /* glsl */ `\
|
|
9
8
|
uniform sepiaUniforms {
|
|
10
9
|
float amount;
|
|
11
10
|
} sepia;
|
|
@@ -32,12 +31,17 @@ export type SepiaProps = {
|
|
|
32
31
|
amount?: number;
|
|
33
32
|
};
|
|
34
33
|
|
|
34
|
+
export type SepiaUniforms = SepiaProps;
|
|
35
|
+
|
|
35
36
|
/**
|
|
36
37
|
* @filter Sepia
|
|
37
38
|
* @description Gives the image a reddish-brown monochrome tint that imitates an old photograph.
|
|
38
39
|
* @param amount 0 to 1 (0 for no effect, 1 for full sepia coloring)
|
|
39
40
|
*/
|
|
40
41
|
export const sepia = {
|
|
42
|
+
props: {} as SepiaProps,
|
|
43
|
+
uniforms: {} as SepiaUniforms,
|
|
44
|
+
|
|
41
45
|
name: 'sepia',
|
|
42
46
|
uniformTypes: {
|
|
43
47
|
amount: 'f32'
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ShaderPass} from '../../../lib/shader-module/shader-pass';
|
|
6
|
-
import {glsl} from '../../../lib/glsl-utils/highlight';
|
|
7
6
|
|
|
8
|
-
const fs = glsl`\
|
|
7
|
+
const fs = /* glsl */ `\
|
|
9
8
|
uniform vibranceUniforms {
|
|
10
9
|
float amount;
|
|
11
10
|
} vibrance;
|
|
@@ -31,8 +30,12 @@ export type VibranceProps = {
|
|
|
31
30
|
amount?: number;
|
|
32
31
|
};
|
|
33
32
|
|
|
33
|
+
export type VibranceUniforms = VibranceProps;
|
|
34
|
+
|
|
34
35
|
/** Vibrance - Modifies the saturation of desaturated colors, leaving saturated colors unmodified. */
|
|
35
36
|
export const vibrance = {
|
|
37
|
+
props: {} as VibranceProps,
|
|
38
|
+
uniforms: {} as VibranceUniforms,
|
|
36
39
|
name: 'vibrance',
|
|
37
40
|
uniformPropTypes: {
|
|
38
41
|
amount: {value: 0, min: -1, max: 1}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ShaderPass} from '../../../lib/shader-module/shader-pass';
|
|
6
|
-
import {glsl} from '../../../lib/glsl-utils/highlight';
|
|
7
6
|
|
|
8
|
-
const fs = glsl`\
|
|
7
|
+
const fs = /* glsl */ `\
|
|
9
8
|
uniform vignetteUniforms {
|
|
10
9
|
float radius;
|
|
11
10
|
float amount;
|
|
@@ -32,13 +31,18 @@ export type VignetteProps = {
|
|
|
32
31
|
amount?: number;
|
|
33
32
|
};
|
|
34
33
|
|
|
34
|
+
export type VignetteUniforms = VignetteProps;
|
|
35
|
+
|
|
35
36
|
/**
|
|
36
37
|
* Vignette -
|
|
37
38
|
* Adds a simulated lens edge darkening effect.
|
|
38
39
|
*/
|
|
39
40
|
export const vignette = {
|
|
41
|
+
props: {} as VignetteProps,
|
|
42
|
+
uniforms: {} as VignetteUniforms,
|
|
43
|
+
|
|
40
44
|
name: 'vignette',
|
|
41
|
-
|
|
45
|
+
|
|
42
46
|
uniformTypes: {
|
|
43
47
|
radius: 'f32',
|
|
44
48
|
amount: 'f32'
|
|
@@ -47,5 +51,8 @@ export const vignette = {
|
|
|
47
51
|
radius: {value: 0.5, min: 0, max: 1},
|
|
48
52
|
amount: {value: 0.5, min: 0, max: 1}
|
|
49
53
|
},
|
|
50
|
-
|
|
54
|
+
|
|
55
|
+
passes: [{filter: true}],
|
|
56
|
+
|
|
57
|
+
fs
|
|
51
58
|
} as const satisfies ShaderPass<VignetteProps, VignetteProps>;
|