Debian Codegraph @

shaders/Curvature.shader/curvature.fs

raw
1 #version 150
2 #define distortion 0.2
3
4 uniform sampler2D source[];
5 uniform vec4 sourceSize[];
6
7 in Vertex {
8 vec2 texCoord;
9 };
10
11 out vec4 fragColor;
12
13 vec2 radialDistortion(vec2 coord) {
14 vec2 cc = coord - vec2(0.5);
15 float dist = dot(cc, cc) * distortion;
16 return coord + cc * (1.0 - dist) * dist;
17 }
18
19 void main() {
20 fragColor = texture(source[0], radialDistortion(texCoord));
21 }