]> git.sesse.net Git - movit/blob - blur_effect.frag
Invert the meaning of the last_phase boolean to execute_phase().
[movit] / blur_effect.frag
1 // A simple un.directional blur.
2 // DIRECTION_VERTICAL will be #defined to 1 if we are doing a vertical blur,
3 // 0 otherwise.
4
5 // Implicit uniforms:
6 // uniform vec2 PREFIX(samples)[NUM_TAPS / 2 + 1];
7
8 vec4 FUNCNAME(vec2 tc) {
9         vec4 sum = vec4(PREFIX(samples)[0].y) * INPUT(tc);
10         for (int i = 1; i < NUM_TAPS / 2 + 1; ++i) {
11                 vec2 sample = PREFIX(samples)[i];
12                 vec2 sample1_tc = tc, sample2_tc = tc;
13 #if DIRECTION_VERTICAL
14                 sample1_tc.y -= sample.x;
15                 sample2_tc.y += sample.x;
16 #else
17                 sample1_tc.x -= sample.x;
18                 sample2_tc.x += sample.x;
19 #endif
20                 sum += vec4(sample.y) * (INPUT(sample1_tc) + INPUT(sample2_tc));
21         }
22         return sum;
23 }
24
25 #undef DIRECTION_VERTICAL