2011-01-09 20:20:36 +00:00
|
|
|
uniform sampler2D sample;
|
2008-07-15 19:21:50 +00:00
|
|
|
uniform float opacity;
|
2009-04-20 11:07:47 +00:00
|
|
|
uniform float brightness;
|
|
|
|
uniform float saturation;
|
2011-01-09 20:20:36 +00:00
|
|
|
|
|
|
|
varying vec2 varyingTexCoords;
|
2008-07-15 19:21:50 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2011-02-10 19:15:23 +00:00
|
|
|
vec4 tex = texture2D(sample, varyingTexCoords);
|
2011-01-09 20:20:36 +00:00
|
|
|
if( saturation != 1.0 )
|
2009-02-22 10:58:26 +00:00
|
|
|
{
|
2011-01-09 20:20:36 +00:00
|
|
|
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 );
|
2009-02-22 10:58:26 +00:00
|
|
|
}
|
2011-01-09 20:20:36 +00:00
|
|
|
// tex.rgb = tex.rgb * opacity * brightness;
|
|
|
|
// tex.a = tex.a * opacity;
|
|
|
|
gl_FragColor = tex;
|
2008-07-15 19:21:50 +00:00
|
|
|
}
|