stk-code_catmod/data/shaders/penumbrav.frag
vincentlj fa068d7810 OGL32CTX: Ask #version 130 for all our shaders
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14919 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2014-01-05 00:08:00 +00:00

54 lines
1.1 KiB
GLSL

#version 130
uniform sampler2D tex;
uniform vec2 pixel;
// Separated penumbra, vertical
void main()
{
float sum = 0.0;
vec4 tmp;
float X = gl_TexCoord[0].x;
float Y = gl_TexCoord[0].y;
float width = 0.0;
float zsum = 0.00001;
tmp = texture2D(tex, vec2(X, Y - 5.13333 * pixel.y));
sum += tmp.x * 0.00640869;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y - 3.26667 * pixel.y));
sum += tmp.x * 0.083313;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y - 1.4 * pixel.y));
sum += tmp.x * 0.305481;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y));
sum += tmp.x * 0.209473;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y + 1.4 * pixel.y));
sum += tmp.x * 0.305481;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y + 3.26667 * pixel.y));
sum += tmp.x * 0.083313;
zsum += tmp.z;
width += tmp.y;
tmp = texture2D(tex, vec2(X, Y + 5.13333 * pixel.y));
sum += tmp.x * 0.00640869;
zsum += tmp.z;
width += tmp.y;
float hasz = step(0.7, zsum);
gl_FragColor = vec4(sum, (width / zsum) * hasz, hasz, 1.0);
}