@luma.gl/shadertools 9.1.0-alpha.15 → 9.1.0-alpha.17
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 +322 -389
- package/dist/dist.min.js +229 -336
- package/dist/index.cjs +321 -391
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/lib/shader-module/shader-module.d.ts +25 -15
- package/dist/lib/shader-module/shader-module.d.ts.map +1 -1
- package/dist/lib/shader-module/shader-module.js +18 -4
- package/dist/lib/shader-module/shader-pass.d.ts +4 -2
- package/dist/lib/shader-module/shader-pass.d.ts.map +1 -1
- package/dist/lib/utils/uniform-types.d.ts +11 -0
- package/dist/lib/utils/uniform-types.d.ts.map +1 -0
- package/dist/lib/utils/uniform-types.js +1 -0
- package/dist/module-injectors.d.ts +1 -1
- package/dist/module-injectors.d.ts.map +1 -1
- package/dist/module-injectors.js +5 -5
- package/dist/modules/engine/picking/picking.d.ts +7 -7
- package/dist/modules/engine/picking/picking.d.ts.map +1 -1
- package/dist/modules/engine/picking/picking.js +2 -2
- package/dist/modules/engine/project/project.d.ts +9 -8
- package/dist/modules/engine/project/project.d.ts.map +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +3 -57
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-material.js +9 -6
- 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 +35 -12
- package/dist/modules/lighting/lights/lighting.d.ts +55 -29
- package/dist/modules/lighting/lights/lighting.d.ts.map +1 -1
- package/dist/modules/lighting/lights/lighting.js +47 -35
- package/dist/modules/lighting/no-material/dirlight.d.ts +3 -3
- package/dist/modules/lighting/no-material/dirlight.d.ts.map +1 -1
- package/dist/modules/lighting/no-material/dirlight.js +1 -1
- 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 +56 -60
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts +56 -98
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-material.js +14 -22
- 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 +24 -0
- 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 +8 -16
- package/dist/modules/lighting/phong-material/phong-material.d.ts +5 -59
- package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -1
- package/dist/modules/lighting/phong-material/phong-material.js +6 -4
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +1 -40
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +8 -87
- package/dist/modules/module-injectors.d.ts +1 -1
- package/dist/modules/module-injectors.d.ts.map +1 -1
- package/dist/modules/module-injectors.js +5 -5
- package/dist/modules-webgl1/project/project.d.ts +6 -4
- package/dist/modules-webgl1/project/project.d.ts.map +1 -1
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts +2 -2
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
- package/dist/passes/postprocessing/fxaa/fxaa.js +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +7 -4
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +7 -4
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/denoise.js +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +2 -3
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +2 -3
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/noise.js +2 -6
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/sepia.js +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +5 -2
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +5 -2
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +6 -2
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js +6 -6
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +3 -3
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +1 -1
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +2 -2
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.js +1 -1
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +2 -2
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +1 -1
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +3 -3
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js +2 -2
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +3 -3
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.js +2 -2
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +16 -12
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/edgework.js +25 -13
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +2 -2
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +1 -1
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts +1 -1
- package/dist/passes/postprocessing/image-fun-filters/ink.js +1 -1
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +3 -3
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/magnify.js +1 -1
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +2 -2
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js +1 -1
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts +1 -1
- package/dist/passes/postprocessing/image-warp-filters/swirl.js +1 -1
- package/package.json +3 -3
- package/src/index.ts +9 -3
- package/src/lib/shader-module/shader-module.ts +51 -21
- package/src/lib/shader-module/shader-pass.ts +7 -4
- package/src/lib/utils/uniform-types.ts +66 -0
- package/src/module-injectors.ts +5 -5
- package/src/modules/engine/picking/README.md +9 -9
- package/src/modules/engine/picking/picking.ts +9 -9
- package/src/modules/engine/project/project.ts +10 -9
- package/src/modules/lighting/gouraud-material/gouraud-material.ts +14 -12
- package/src/modules/lighting/lights/lighting-uniforms-glsl.ts +35 -12
- package/src/modules/lighting/lights/lighting.ts +84 -54
- package/src/modules/lighting/no-material/dirlight.ts +3 -3
- package/src/modules/lighting/pbr-material/pbr-fragment-glsl.ts +56 -60
- package/src/modules/lighting/pbr-material/pbr-material.ts +40 -74
- package/src/modules/lighting/pbr-material/pbr-projection.ts +39 -0
- package/src/modules/lighting/pbr-material/pbr-vertex-glsl.ts +8 -16
- package/src/modules/lighting/phong-material/phong-material.ts +12 -12
- package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +8 -88
- package/src/modules/module-injectors.ts +5 -5
- package/src/modules-webgl1/project/project.ts +8 -7
- package/src/passes/postprocessing/fxaa/fxaa.ts +3 -3
- package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +7 -4
- package/src/passes/postprocessing/image-adjust-filters/denoise.ts +1 -1
- package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +2 -3
- package/src/passes/postprocessing/image-adjust-filters/noise.ts +2 -6
- package/src/passes/postprocessing/image-adjust-filters/sepia.ts +2 -2
- package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +5 -2
- package/src/passes/postprocessing/image-adjust-filters/vignette.ts +6 -6
- package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +3 -3
- package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +2 -2
- package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +2 -2
- package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +3 -3
- package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +3 -3
- package/src/passes/postprocessing/image-fun-filters/edgework.ts +27 -16
- package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +2 -2
- package/src/passes/postprocessing/image-fun-filters/ink.ts +1 -1
- package/src/passes/postprocessing/image-fun-filters/magnify.ts +3 -3
- package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +2 -2
- package/src/passes/postprocessing/image-warp-filters/swirl.ts +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts +0 -42
- package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts.map +0 -1
- package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.js +0 -134
- package/src/modules/lighting/gouraud-material/gouraud-shaders-glsl.ts +0 -137
|
@@ -38,7 +38,7 @@ export const denoise = {
|
|
|
38
38
|
uniformTypes: {
|
|
39
39
|
strength: 'f32'
|
|
40
40
|
},
|
|
41
|
-
|
|
41
|
+
propTypes: {
|
|
42
42
|
strength: { format: 'f32', value: 0.5, min: 0, max: 1 }
|
|
43
43
|
// strength: {..., adjust: (strength: number): number => 0.53 + 200 * Math.pow(1 - strength, 4) // TODO - JS preprocessing
|
|
44
44
|
},
|
|
@@ -20,14 +20,13 @@ export type HueSaturationUniforms = HueSaturationProps;
|
|
|
20
20
|
*/
|
|
21
21
|
export declare const hueSaturation: {
|
|
22
22
|
readonly props: HueSaturationProps;
|
|
23
|
-
readonly uniforms: HueSaturationUniforms;
|
|
24
23
|
readonly name: "hueSaturation";
|
|
25
|
-
readonly fs: "uniform hueSaturationUniforms {\n float hue;\n float saturation;\n} hueSaturation;\n\nvec4 hueSaturation_filterColor(vec4 color) {\n // hue adjustment, wolfram alpha: RotationTransform[angle, {1, 1, 1}][{x, y, z}]\n float angle = hueSaturation.hue * 3.14159265;\n float s = sin(angle), c = cos(angle);\n vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\n float len = length(color.rgb);\n color.rgb = vec3(\n dot(color.rgb, weights.xyz),\n dot(color.rgb, weights.zxy),\n dot(color.rgb, weights.yzx)\n );\n\n // saturation adjustment\n float average = (color.r + color.g + color.b) / 3.0;\n if (hueSaturation.saturation > 0.0) {\n color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));\n } else {\n color.rgb += (average - color.rgb) * (-hueSaturation.saturation);\n }\n\n return color;\n}\n\nvec4
|
|
24
|
+
readonly fs: "uniform hueSaturationUniforms {\n float hue;\n float saturation;\n} hueSaturation;\n\nvec4 hueSaturation_filterColor(vec4 color) {\n // hue adjustment, wolfram alpha: RotationTransform[angle, {1, 1, 1}][{x, y, z}]\n float angle = hueSaturation.hue * 3.14159265;\n float s = sin(angle), c = cos(angle);\n vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\n float len = length(color.rgb);\n color.rgb = vec3(\n dot(color.rgb, weights.xyz),\n dot(color.rgb, weights.zxy),\n dot(color.rgb, weights.yzx)\n );\n\n // saturation adjustment\n float average = (color.r + color.g + color.b) / 3.0;\n if (hueSaturation.saturation > 0.0) {\n color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));\n } else {\n color.rgb += (average - color.rgb) * (-hueSaturation.saturation);\n }\n\n return color;\n}\n\nvec4 hueSaturation_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return hueSaturation_filterColor(color);\n}\n";
|
|
26
25
|
readonly uniformTypes: {
|
|
27
26
|
readonly hue: "f32";
|
|
28
27
|
readonly saturation: "f32";
|
|
29
28
|
};
|
|
30
|
-
readonly
|
|
29
|
+
readonly propTypes: {
|
|
31
30
|
readonly hue: {
|
|
32
31
|
readonly value: 0;
|
|
33
32
|
readonly min: -1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"huesaturation.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/huesaturation.ts"],"names":[],"mappings":"AAwCA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;iEAC6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;oBACX,kBAAkB
|
|
1
|
+
{"version":3,"file":"huesaturation.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/huesaturation.ts"],"names":[],"mappings":"AAwCA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;iEAC6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;oBACX,kBAAkB;;;;;;;;;;;;;;;;;;;;;;CAckB,CAAC"}
|
|
@@ -30,7 +30,7 @@ vec4 hueSaturation_filterColor(vec4 color) {
|
|
|
30
30
|
return color;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
vec4
|
|
33
|
+
vec4 hueSaturation_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
34
34
|
return hueSaturation_filterColor(color);
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
@@ -45,14 +45,13 @@ vec4 hueSaturation_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
45
45
|
*/
|
|
46
46
|
export const hueSaturation = {
|
|
47
47
|
props: {},
|
|
48
|
-
uniforms: {},
|
|
49
48
|
name: 'hueSaturation',
|
|
50
49
|
fs,
|
|
51
50
|
uniformTypes: {
|
|
52
51
|
hue: 'f32',
|
|
53
52
|
saturation: 'f32'
|
|
54
53
|
},
|
|
55
|
-
|
|
54
|
+
propTypes: {
|
|
56
55
|
hue: { value: 0, min: -1, max: 1 },
|
|
57
56
|
saturation: { value: 0, min: -1, max: 1 }
|
|
58
57
|
},
|
|
@@ -17,14 +17,14 @@ export declare const noise: {
|
|
|
17
17
|
readonly uniformTypes: {
|
|
18
18
|
readonly amount: "f32";
|
|
19
19
|
};
|
|
20
|
-
readonly
|
|
20
|
+
readonly propTypes: {
|
|
21
21
|
readonly amount: {
|
|
22
22
|
readonly value: 0.5;
|
|
23
23
|
readonly min: 0;
|
|
24
24
|
readonly max: 1;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
readonly fs: "uniform noiseUniforms {\n float amount;\n} noise;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\nvec4
|
|
27
|
+
readonly fs: "uniform noiseUniforms {\n float amount;\n} noise;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\nvec4 noise_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float diff = (rand(texCoord) - 0.5) * noise.amount;\n color.r += diff;\n color.g += diff;\n color.b += diff;\n return color;\n}\n";
|
|
28
28
|
readonly passes: [{
|
|
29
29
|
readonly filter: true;
|
|
30
30
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noise.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/noise.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"noise.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/noise.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,KAAK;oBACH,UAAU;uBACP,aAAa;;;;;;;;;;;;;;;;CAWwB,CAAC"}
|
|
@@ -10,17 +10,13 @@ float rand(vec2 co) {
|
|
|
10
10
|
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
vec4
|
|
13
|
+
vec4 noise_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
14
14
|
float diff = (rand(texCoord) - 0.5) * noise.amount;
|
|
15
15
|
color.r += diff;
|
|
16
16
|
color.g += diff;
|
|
17
17
|
color.b += diff;
|
|
18
18
|
return color;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
vec4 noise_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
22
|
-
return noise_filterColor(color, texCoord);
|
|
23
|
-
}
|
|
24
20
|
`;
|
|
25
21
|
/**
|
|
26
22
|
* Noise
|
|
@@ -33,7 +29,7 @@ export const noise = {
|
|
|
33
29
|
uniformTypes: {
|
|
34
30
|
amount: 'f32'
|
|
35
31
|
},
|
|
36
|
-
|
|
32
|
+
propTypes: {
|
|
37
33
|
amount: { value: 0.5, min: 0, max: 1 }
|
|
38
34
|
},
|
|
39
35
|
fs,
|
|
@@ -14,14 +14,14 @@ export declare const sepia: {
|
|
|
14
14
|
readonly uniformTypes: {
|
|
15
15
|
readonly amount: "f32";
|
|
16
16
|
};
|
|
17
|
-
readonly
|
|
17
|
+
readonly propTypes: {
|
|
18
18
|
readonly amount: {
|
|
19
19
|
readonly value: 0.5;
|
|
20
20
|
readonly min: 0;
|
|
21
21
|
readonly max: 1;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
readonly fs: "uniform sepiaUniforms {\n float amount;\n} sepia;\n\nvec4 sepia_filterColor(vec4 color) {\n float r = color.r;\n float g = color.g;\n float b = color.b;\n\n color.r =\n min(1.0, (r * (1.0 - (0.607 * sepia.amount))) + (g * (0.769 * sepia.amount)) + (b * (0.189 * sepia.amount)));\n color.g = min(1.0, (r * 0.349 * sepia.amount) + (g * (1.0 - (0.314 * sepia.amount))) + (b * 0.168 * sepia.amount));\n color.b = min(1.0, (r * 0.272 * sepia.amount) + (g * 0.534 * sepia.amount) + (b * (1.0 - (0.869 * sepia.amount))));\n\n return color;\n}\n\nvec4
|
|
24
|
+
readonly fs: "uniform sepiaUniforms {\n float amount;\n} sepia;\n\nvec4 sepia_filterColor(vec4 color) {\n float r = color.r;\n float g = color.g;\n float b = color.b;\n\n color.r =\n min(1.0, (r * (1.0 - (0.607 * sepia.amount))) + (g * (0.769 * sepia.amount)) + (b * (0.189 * sepia.amount)));\n color.g = min(1.0, (r * 0.349 * sepia.amount) + (g * (1.0 - (0.314 * sepia.amount))) + (b * 0.168 * sepia.amount));\n color.b = min(1.0, (r * 0.272 * sepia.amount) + (g * 0.534 * sepia.amount) + (b * (1.0 - (0.869 * sepia.amount))));\n\n return color;\n}\n\nvec4 sepia_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return sepia_filterColor(color);\n}\n";
|
|
25
25
|
readonly passes: [{
|
|
26
26
|
readonly filter: true;
|
|
27
27
|
}];
|
|
@@ -19,7 +19,7 @@ vec4 sepia_filterColor(vec4 color) {
|
|
|
19
19
|
return color;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
vec4
|
|
22
|
+
vec4 sepia_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
23
23
|
return sepia_filterColor(color);
|
|
24
24
|
}
|
|
25
25
|
`;
|
|
@@ -35,7 +35,7 @@ export const sepia = {
|
|
|
35
35
|
uniformTypes: {
|
|
36
36
|
amount: 'f32'
|
|
37
37
|
},
|
|
38
|
-
|
|
38
|
+
propTypes: {
|
|
39
39
|
amount: { value: 0.5, min: 0, max: 1 }
|
|
40
40
|
},
|
|
41
41
|
fs,
|
|
@@ -11,14 +11,17 @@ export declare const vibrance: {
|
|
|
11
11
|
readonly props: VibranceProps;
|
|
12
12
|
readonly uniforms: VibranceUniforms;
|
|
13
13
|
readonly name: "vibrance";
|
|
14
|
-
readonly
|
|
14
|
+
readonly uniformTypes: {
|
|
15
|
+
readonly amount: "f32";
|
|
16
|
+
};
|
|
17
|
+
readonly propTypes: {
|
|
15
18
|
readonly amount: {
|
|
16
19
|
readonly value: 0;
|
|
17
20
|
readonly min: -1;
|
|
18
21
|
readonly max: 1;
|
|
19
22
|
};
|
|
20
23
|
};
|
|
21
|
-
readonly fs: "uniform vibranceUniforms {\n float amount;\n} vibrance;\n\nvec4 vibrance_filterColor(vec4 color) {\n float average = (color.r + color.g + color.b) / 3.0;\n float mx = max(color.r, max(color.g, color.b));\n float amt = (mx - average) * (-vibrance.amount * 3.0);\n color.rgb = mix(color.rgb, vec3(mx), amt);\n return color;\n}\n\nvec4
|
|
24
|
+
readonly fs: "uniform vibranceUniforms {\n float amount;\n} vibrance;\n\nvec4 vibrance_filterColor(vec4 color) {\n float average = (color.r + color.g + color.b) / 3.0;\n float mx = max(color.r, max(color.g, color.b));\n float amt = (mx - average) * (-vibrance.amount * 3.0);\n color.rgb = mix(color.rgb, vec3(mx), amt);\n return color;\n}\n\nvec4 vibrance_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return vibrance_filterColor(color);\n}\n";
|
|
22
25
|
readonly passes: [{
|
|
23
26
|
readonly filter: true;
|
|
24
27
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vibrance.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/vibrance.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C,qGAAqG;AACrG,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,gBAAgB
|
|
1
|
+
{"version":3,"file":"vibrance.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/vibrance.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C,qGAAqG;AACrG,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,gBAAgB;;;;;;;;;;;;;;;;CAU2B,CAAC"}
|
|
@@ -14,7 +14,7 @@ vec4 vibrance_filterColor(vec4 color) {
|
|
|
14
14
|
return color;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
vec4
|
|
17
|
+
vec4 vibrance_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
18
18
|
return vibrance_filterColor(color);
|
|
19
19
|
}
|
|
20
20
|
`;
|
|
@@ -23,7 +23,10 @@ export const vibrance = {
|
|
|
23
23
|
props: {},
|
|
24
24
|
uniforms: {},
|
|
25
25
|
name: 'vibrance',
|
|
26
|
-
|
|
26
|
+
uniformTypes: {
|
|
27
|
+
amount: 'f32'
|
|
28
|
+
},
|
|
29
|
+
propTypes: {
|
|
27
30
|
amount: { value: 0, min: -1, max: 1 }
|
|
28
31
|
},
|
|
29
32
|
fs,
|
|
@@ -20,7 +20,11 @@ export declare const vignette: {
|
|
|
20
20
|
readonly radius: "f32";
|
|
21
21
|
readonly amount: "f32";
|
|
22
22
|
};
|
|
23
|
-
readonly
|
|
23
|
+
readonly defaultUniforms: {
|
|
24
|
+
readonly radius: 0.5;
|
|
25
|
+
readonly amount: 0.5;
|
|
26
|
+
};
|
|
27
|
+
readonly propTypes: {
|
|
24
28
|
readonly radius: {
|
|
25
29
|
readonly value: 0.5;
|
|
26
30
|
readonly min: 0;
|
|
@@ -35,6 +39,6 @@ export declare const vignette: {
|
|
|
35
39
|
readonly passes: [{
|
|
36
40
|
readonly filter: true;
|
|
37
41
|
}];
|
|
38
|
-
readonly fs: "uniform vignetteUniforms {\n float radius;\n float amount;\n} vignette;\n\nvec4
|
|
42
|
+
readonly fs: "uniform vignetteUniforms {\n float radius;\n float amount;\n} vignette;\n\nvec4 vignette_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float dist = distance(texCoord, vec2(0.5, 0.5));\n float ratio = smoothstep(0.8, vignette.radius * 0.799, dist * (vignette.amount + vignette.radius));\n return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);\n}\n";
|
|
39
43
|
};
|
|
40
44
|
//# sourceMappingURL=vignette.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vignette.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/vignette.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vignette.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/vignette.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;CAoB2B,CAAC"}
|
|
@@ -7,15 +7,11 @@ uniform vignetteUniforms {
|
|
|
7
7
|
float amount;
|
|
8
8
|
} vignette;
|
|
9
9
|
|
|
10
|
-
vec4
|
|
10
|
+
vec4 vignette_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
11
11
|
float dist = distance(texCoord, vec2(0.5, 0.5));
|
|
12
12
|
float ratio = smoothstep(0.8, vignette.radius * 0.799, dist * (vignette.amount + vignette.radius));
|
|
13
13
|
return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
vec4 vignette_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
17
|
-
return vignette_filterColor(color, texCoord);
|
|
18
|
-
}
|
|
19
15
|
`;
|
|
20
16
|
/**
|
|
21
17
|
* Vignette -
|
|
@@ -29,7 +25,11 @@ export const vignette = {
|
|
|
29
25
|
radius: 'f32',
|
|
30
26
|
amount: 'f32'
|
|
31
27
|
},
|
|
32
|
-
|
|
28
|
+
defaultUniforms: {
|
|
29
|
+
radius: 0.5,
|
|
30
|
+
amount: 0.5
|
|
31
|
+
},
|
|
32
|
+
propTypes: {
|
|
33
33
|
radius: { value: 0.5, min: 0, max: 1 },
|
|
34
34
|
amount: { value: 0.5, min: 0, max: 1 }
|
|
35
35
|
},
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export type TiltShiftProps = {
|
|
6
6
|
/** The x,y coordinate of the start of the line segment. */
|
|
7
|
-
start?: number
|
|
7
|
+
start?: [number, number];
|
|
8
8
|
/** The xm y coordinate of the end of the line segment. */
|
|
9
|
-
end?: number
|
|
9
|
+
end?: [number, number];
|
|
10
10
|
/** The maximum radius of the pyramid blur. */
|
|
11
11
|
blurRadius?: number;
|
|
12
12
|
/** The distance from the line at which the maximum blur radius is reached. */
|
|
@@ -41,7 +41,7 @@ export declare const tiltShift: {
|
|
|
41
41
|
readonly end: "vec2<f32>";
|
|
42
42
|
readonly invert: "i32";
|
|
43
43
|
};
|
|
44
|
-
readonly
|
|
44
|
+
readonly propTypes: {
|
|
45
45
|
readonly blurRadius: {
|
|
46
46
|
readonly value: 15;
|
|
47
47
|
readonly min: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiltshift.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/tiltshift.ts"],"names":[],"mappings":"AAqDA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"tiltshift.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/tiltshift.ts"],"names":[],"mappings":"AAqDA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;oBACP,cAAc;uBACX,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB4B,CAAC"}
|
|
@@ -8,7 +8,7 @@ export type TriangleBlurProps = {
|
|
|
8
8
|
/** The radius of the pyramid convolved with the image. */
|
|
9
9
|
radius?: number;
|
|
10
10
|
/** @deprecated internal property */
|
|
11
|
-
delta?: number
|
|
11
|
+
delta?: [number, number];
|
|
12
12
|
};
|
|
13
13
|
export type TriangleBlurUniforms = TriangleBlurProps;
|
|
14
14
|
/**
|
|
@@ -25,7 +25,7 @@ export declare const triangleBlur: {
|
|
|
25
25
|
readonly radius: "f32";
|
|
26
26
|
readonly delta: "vec2<f32>";
|
|
27
27
|
};
|
|
28
|
-
readonly
|
|
28
|
+
readonly propTypes: {
|
|
29
29
|
readonly radius: {
|
|
30
30
|
readonly value: 20;
|
|
31
31
|
readonly min: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triangleblur.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/triangleblur.ts"],"names":[],"mappings":"AA2CA;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"triangleblur.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/triangleblur.ts"],"names":[],"mappings":"AA2CA;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,YAAY;oBACV,iBAAiB;uBACd,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiB+B,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export type ZoomBlurProps = {
|
|
5
5
|
/** - The x, y coordinate of the blur origin. */
|
|
6
|
-
center?: number
|
|
6
|
+
center?: [number, number];
|
|
7
7
|
/** - The strength of the blur. Values in the range 0 to 1 are usually sufficient, where 0 doesn't change the image and 1 creates a highly blurred image. */
|
|
8
8
|
strength?: number;
|
|
9
9
|
};
|
|
@@ -20,7 +20,7 @@ export declare const zoomBlur: {
|
|
|
20
20
|
readonly center: "vec2<f32>";
|
|
21
21
|
readonly strength: "f32";
|
|
22
22
|
};
|
|
23
|
-
readonly
|
|
23
|
+
readonly propTypes: {
|
|
24
24
|
readonly center: {
|
|
25
25
|
readonly value: readonly [0.5, 0.5];
|
|
26
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoomblur.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/zoomblur.ts"],"names":[],"mappings":"AA0CA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"zoomblur.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/zoomblur.ts"],"names":[],"mappings":"AA0CA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,gDAAgD;IAChD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,4JAA4J;IAC5J,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;CAc2B,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type ColorHalftoneProps = {
|
|
8
8
|
/** The x,y coordinate of the pattern origin. */
|
|
9
|
-
center?: number
|
|
9
|
+
center?: [number, number];
|
|
10
10
|
/** The rotation of the pattern in radians. */
|
|
11
11
|
angle?: number;
|
|
12
12
|
/** The diameter of a dot in pixels. */
|
|
@@ -28,7 +28,7 @@ export declare const colorHalftone: {
|
|
|
28
28
|
readonly angle: "f32";
|
|
29
29
|
readonly size: "f32";
|
|
30
30
|
};
|
|
31
|
-
readonly
|
|
31
|
+
readonly propTypes: {
|
|
32
32
|
readonly center: {
|
|
33
33
|
readonly value: readonly [0.5, 0.5];
|
|
34
34
|
};
|
|
@@ -44,7 +44,7 @@ export declare const colorHalftone: {
|
|
|
44
44
|
readonly softMax: 20;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
readonly fs: "uniform colorHalftoneUniforms {\n vec2 center;\n float angle;\n float size;\n} colorHalftone;\n\nfloat pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {\n float s = sin(angle), c = cos(angle);\n vec2 tex = texCoord * texSize - colorHalftone.center * texSize;\n vec2 point = vec2(\n\tc * tex.x - s * tex.y,\n\ts * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4
|
|
47
|
+
readonly fs: "uniform colorHalftoneUniforms {\n vec2 center;\n float angle;\n float size;\n} colorHalftone;\n\nfloat pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {\n float s = sin(angle), c = cos(angle);\n vec2 tex = texCoord * texSize - colorHalftone.center * texSize;\n vec2 point = vec2(\n\tc * tex.x - s * tex.y,\n\ts * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 colorHalftone_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float scale = 3.1514 / colorHalftone.size;\n vec3 cmy = 1.0 - color.rgb;\n float k = min(cmy.x, min(cmy.y, cmy.z));\n\n cmy = (cmy - k) / (1.0 - k);\n cmy = clamp(\n\t cmy * 10.0 - 3.0 + vec3(\n pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),\n\t pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),\n pattern(colorHalftone.angle, scale, texSize, texCoord)\n ),\n\t 0.0,\n\t 1.0\n );\n k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);\n return vec4(1.0 - cmy - k, color.a);\n}\n";
|
|
48
48
|
readonly passes: [{
|
|
49
49
|
readonly filter: true;
|
|
50
50
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorhalftone.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/colorhalftone.ts"],"names":[],"mappings":"AA4CA;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"colorhalftone.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/colorhalftone.ts"],"names":[],"mappings":"AA4CA;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gDAAgD;IAChD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,aAAa;oBACX,kBAAkB;uBACf,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAegC,CAAC"}
|
|
@@ -19,7 +19,7 @@ float pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {
|
|
|
19
19
|
return (sin(point.x) * sin(point.y)) * 4.0;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
vec4
|
|
22
|
+
vec4 colorHalftone_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
23
23
|
float scale = 3.1514 / colorHalftone.size;
|
|
24
24
|
vec3 cmy = 1.0 - color.rgb;
|
|
25
25
|
float k = min(cmy.x, min(cmy.y, cmy.z));
|
|
@@ -53,7 +53,7 @@ export const colorHalftone = {
|
|
|
53
53
|
angle: 'f32',
|
|
54
54
|
size: 'f32'
|
|
55
55
|
},
|
|
56
|
-
|
|
56
|
+
propTypes: {
|
|
57
57
|
center: { value: [0.5, 0.5] },
|
|
58
58
|
angle: { value: 1.1, softMin: 0, softMax: Math.PI / 2 },
|
|
59
59
|
size: { value: 4, min: 1, softMin: 3, softMax: 20 }
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type DotScreenProps = {
|
|
7
7
|
/** The x, y coordinate of the pattern origin. */
|
|
8
|
-
center?: number
|
|
8
|
+
center?: [number, number];
|
|
9
9
|
/** The rotation of the pattern in radians. */
|
|
10
10
|
angle?: number;
|
|
11
11
|
/** The diameter of a dot in pixels. */
|
|
@@ -26,7 +26,7 @@ export declare const dotScreen: {
|
|
|
26
26
|
readonly angle: "f32";
|
|
27
27
|
readonly size: "f32";
|
|
28
28
|
};
|
|
29
|
-
readonly
|
|
29
|
+
readonly propTypes: {
|
|
30
30
|
readonly center: {
|
|
31
31
|
readonly value: readonly [0.5, 0.5];
|
|
32
32
|
};
|
|
@@ -42,7 +42,7 @@ export declare const dotScreen: {
|
|
|
42
42
|
readonly softMax: 20;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
-
readonly fs: "uniform dotScreenUniforms {\n vec2 center;\n float angle;\n float size;\n} dotScreen;\n\nfloat pattern(vec2 texSize, vec2 texCoord) {\n float scale = 3.1415 / dotScreen.size;\n\n float s = sin(dotScreen.angle), c = cos(dotScreen.angle);\n vec2 tex = texCoord * texSize - dotScreen.center * texSize;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4
|
|
45
|
+
readonly fs: "uniform dotScreenUniforms {\n vec2 center;\n float angle;\n float size;\n} dotScreen;\n\nfloat pattern(vec2 texSize, vec2 texCoord) {\n float scale = 3.1415 / dotScreen.size;\n\n float s = sin(dotScreen.angle), c = cos(dotScreen.angle);\n vec2 tex = texCoord * texSize - dotScreen.center * texSize;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 dotScreen_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float average = (color.r + color.g + color.b) / 3.0;\n return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n";
|
|
46
46
|
readonly passes: [{
|
|
47
47
|
readonly filter: true;
|
|
48
48
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotscreen.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/dotscreen.ts"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"dotscreen.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/dotscreen.ts"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iDAAiD;IACjD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,SAAS;oBACP,cAAc;uBACX,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAe4B,CAAC"}
|
|
@@ -20,7 +20,7 @@ float pattern(vec2 texSize, vec2 texCoord) {
|
|
|
20
20
|
return (sin(point.x) * sin(point.y)) * 4.0;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
vec4
|
|
23
|
+
vec4 dotScreen_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
24
24
|
float average = (color.r + color.g + color.b) / 3.0;
|
|
25
25
|
return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);
|
|
26
26
|
}
|
|
@@ -39,7 +39,7 @@ export const dotScreen = {
|
|
|
39
39
|
angle: 'f32',
|
|
40
40
|
size: 'f32'
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
propTypes: {
|
|
43
43
|
center: { value: [0.5, 0.5] },
|
|
44
44
|
angle: { value: 1.1, softMin: 0, softMax: Math.PI / 2 },
|
|
45
45
|
size: { value: 3, min: 1, softMin: 3, softMax: 20 }
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
export type EdgeWorkProps = {
|
|
7
7
|
/** radius The radius of the effect in pixels. */
|
|
8
8
|
radius?: number;
|
|
9
|
-
/** @deprecated
|
|
10
|
-
|
|
9
|
+
/** @deprecated xy or RGB */
|
|
10
|
+
mode?: 0 | 1;
|
|
11
11
|
};
|
|
12
12
|
export type EdgeWorkUniforms = EdgeWorkProps;
|
|
13
13
|
/**
|
|
@@ -23,27 +23,31 @@ export declare const edgeWork: {
|
|
|
23
23
|
readonly name: "random";
|
|
24
24
|
readonly fs: "float random(vec3 scale, float seed) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n";
|
|
25
25
|
}];
|
|
26
|
-
readonly fs: "uniform edgeWorkUniforms {\n float radius;\n
|
|
27
|
-
readonly
|
|
26
|
+
readonly fs: "uniform edgeWorkUniforms {\n float radius;\n int mode;\n} edgeWork;\n\nvec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;\n float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4(color / total, 0.0, 1.0);\n}\n\nvec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4(c, c, c, 1.0);\n}\n\nvec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n switch (edgeWork.mode) {\n case 0: \n return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));\n case 1: \n default:\n return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));\n }\n}\n";
|
|
27
|
+
readonly uniformTypes: {
|
|
28
|
+
readonly radius: "f32";
|
|
29
|
+
readonly mode: "i32";
|
|
30
|
+
};
|
|
31
|
+
readonly propTypes: {
|
|
28
32
|
readonly radius: {
|
|
29
33
|
readonly value: 2;
|
|
30
34
|
readonly min: 1;
|
|
31
35
|
readonly softMax: 50;
|
|
32
36
|
};
|
|
33
|
-
readonly
|
|
34
|
-
readonly value:
|
|
37
|
+
readonly mode: {
|
|
38
|
+
readonly value: 0;
|
|
35
39
|
readonly private: true;
|
|
36
40
|
};
|
|
37
41
|
};
|
|
38
42
|
readonly passes: [{
|
|
39
|
-
readonly sampler:
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
43
|
+
readonly sampler: true;
|
|
44
|
+
readonly uniforms: {
|
|
45
|
+
readonly mode: 0;
|
|
42
46
|
};
|
|
43
47
|
}, {
|
|
44
|
-
readonly sampler:
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
48
|
+
readonly sampler: true;
|
|
49
|
+
readonly uniforms: {
|
|
50
|
+
readonly mode: 1;
|
|
47
51
|
};
|
|
48
52
|
}];
|
|
49
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edgework.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/edgework.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edgework.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/edgework.ts"],"names":[],"mappings":"AA0EA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwB8B,CAAC"}
|
|
@@ -5,11 +5,11 @@ import { random } from "../../../modules/math/random/random.js";
|
|
|
5
5
|
const fs = /* glsl */ `\
|
|
6
6
|
uniform edgeWorkUniforms {
|
|
7
7
|
float radius;
|
|
8
|
-
|
|
8
|
+
int mode;
|
|
9
9
|
} edgeWork;
|
|
10
10
|
|
|
11
|
-
vec4
|
|
12
|
-
vec2 relativeDelta = edgeWork.radius *
|
|
11
|
+
vec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {
|
|
12
|
+
vec2 relativeDelta = edgeWork.radius * delta / texSize;
|
|
13
13
|
|
|
14
14
|
vec2 color = vec2(0.0);
|
|
15
15
|
vec2 total = vec2(0.0);
|
|
@@ -33,8 +33,8 @@ vec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
33
33
|
return vec4(color / total, 0.0, 1.0);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
vec4
|
|
37
|
-
vec2 relativeDelta = edgeWork.radius *
|
|
36
|
+
vec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {
|
|
37
|
+
vec2 relativeDelta = edgeWork.radius * delta / texSize;
|
|
38
38
|
|
|
39
39
|
vec2 color = vec2(0.0);
|
|
40
40
|
vec2 total = vec2(0.0);
|
|
@@ -57,6 +57,16 @@ vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
57
57
|
float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);
|
|
58
58
|
return vec4(c, c, c, 1.0);
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
vec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
62
|
+
switch (edgeWork.mode) {
|
|
63
|
+
case 0:
|
|
64
|
+
return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));
|
|
65
|
+
case 1:
|
|
66
|
+
default:
|
|
67
|
+
return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
60
70
|
`;
|
|
61
71
|
/**
|
|
62
72
|
* Edge Work -
|
|
@@ -69,20 +79,22 @@ export const edgeWork = {
|
|
|
69
79
|
name: 'edgeWork',
|
|
70
80
|
dependencies: [random],
|
|
71
81
|
fs,
|
|
72
|
-
|
|
82
|
+
uniformTypes: {
|
|
83
|
+
radius: 'f32',
|
|
84
|
+
mode: 'i32'
|
|
85
|
+
},
|
|
86
|
+
propTypes: {
|
|
73
87
|
radius: { value: 2, min: 1, softMax: 50 },
|
|
74
|
-
|
|
88
|
+
mode: { value: 0, private: true }
|
|
75
89
|
},
|
|
76
90
|
passes: [
|
|
77
91
|
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
uniformPropTypes: { delta: [1, 0] }
|
|
92
|
+
sampler: true,
|
|
93
|
+
uniforms: { mode: 0 }
|
|
81
94
|
},
|
|
82
95
|
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
uniformPropTypes: { delta: [0, 1] }
|
|
96
|
+
sampler: true,
|
|
97
|
+
uniforms: { mode: 1 }
|
|
86
98
|
}
|
|
87
99
|
]
|
|
88
100
|
};
|