2008-08-27 12:20:34 +00:00
|
|
|
uniform sampler2D winTexture;
|
2007-07-04 09:59:07 +00:00
|
|
|
uniform float textureWidth;
|
|
|
|
uniform float textureHeight;
|
2008-08-27 12:20:34 +00:00
|
|
|
uniform float opacity;
|
|
|
|
uniform float brightness;
|
|
|
|
uniform float saturation;
|
2007-07-04 09:59:07 +00:00
|
|
|
|
|
|
|
// Converts pixel coordinates to texture coordinates
|
2008-08-27 12:20:34 +00:00
|
|
|
vec2 pix2tex( vec2 pix )
|
2007-07-04 09:59:07 +00:00
|
|
|
{
|
2008-08-27 12:20:34 +00:00
|
|
|
return vec2( pix.s / textureWidth, pix.t / textureHeight );
|
2007-07-04 09:59:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2008-08-27 12:20:34 +00:00
|
|
|
vec4 tex = texture2D( winTexture, pix2tex( gl_TexCoord[0].st ));
|
2009-10-30 01:34:03 +00:00
|
|
|
tex = vec4(( vec3( 1.0 ) - tex.rgb / vec3( tex.a )) * vec3( tex.a * opacity ), tex.a * opacity );
|
2008-08-27 12:20:34 +00:00
|
|
|
if( saturation != 1.0 )
|
|
|
|
{
|
|
|
|
vec3 desaturated = tex.rgb * vec3( 0.30, 0.59, 0.11 );
|
|
|
|
desaturated = vec3( dot( desaturated, tex.rgb ));
|
|
|
|
tex.rgb = tex.rgb * vec3( saturation ) + desaturated * vec3( 1.0 - saturation );
|
|
|
|
}
|
|
|
|
tex.rgb = tex.rgb * vec3( brightness );
|
2007-07-04 09:59:07 +00:00
|
|
|
|
2008-08-27 12:20:34 +00:00
|
|
|
gl_FragColor = tex;
|
2007-07-04 09:59:07 +00:00
|
|
|
}
|