Release Movit 1.1.1.
[movit] / vignette_effect.frag
index c7e1d61..60d4b33 100644 (file)
@@ -1,15 +1,17 @@
 // A simple, circular vignette, with a cosĀ² falloff.
        
-uniform float PREFIX(inv_radius);
-varying vec2 PREFIX(normalized_pos);
+uniform float PREFIX(pihalf_div_radius);
+uniform vec2 PREFIX(aspect_correction);
+uniform vec2 PREFIX(flipped_center);
 
 vec4 FUNCNAME(vec2 tc) {
-       vec4 x = LAST_INPUT(tc);
+       vec4 x = INPUT(tc);
 
        const float pihalf = 0.5 * 3.14159265358979324;
 
-       float dist = (length(PREFIX(normalized_pos)) - PREFIX(inner_radius)) * PREFIX(inv_radius);
-       float linear_falloff = clamp(dist, 0.0, 1.0) * pihalf;
+       vec2 normalized_pos = (tc - PREFIX(flipped_center)) * PREFIX(aspect_correction);
+       float dist = (length(normalized_pos) - PREFIX(inner_radius)) * PREFIX(pihalf_div_radius);
+       float linear_falloff = clamp(dist, 0.0, pihalf);
        float falloff = cos(linear_falloff) * cos(linear_falloff);
        x.rgb *= vec3(falloff);