File: blur2.frag

package info (click to toggle)
slop 7.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 568 kB
  • sloc: cpp: 3,371; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 1,014 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#version 120

uniform sampler2D texture;
uniform vec2 screenSize;

varying vec2 uvCoord;

// Stolen from https://github.com/Jam3/glsl-fast-gaussian-blur kinda
void main()
{
    float radius = 1;
    vec4 color = vec4(0.0);
    vec2 off1 = vec2(1.411764705882353) * vec2( 0, radius );
    vec2 off2 = vec2(3.2941176470588234) * vec2( 0, radius );
    vec2 off3 = vec2(5.176470588235294) * vec2( 0, radius );
    color += texture2D(texture, uvCoord) * 0.1964825501511404;
    color += texture2D(texture, uvCoord + (off1 / screenSize)) * 0.2969069646728344;
    color += texture2D(texture, uvCoord - (off1 / screenSize)) * 0.2969069646728344;
    color += texture2D(texture, uvCoord + (off2 / screenSize)) * 0.09447039785044732;
    color += texture2D(texture, uvCoord - (off2 / screenSize)) * 0.09447039785044732;
    color += texture2D(texture, uvCoord + (off3 / screenSize)) * 0.010381362401148057;
    color += texture2D(texture, uvCoord - (off3 / screenSize)) * 0.010381362401148057;
    gl_FragColor = color;
}