2010-07-10 21:12:17 +00:00
|
|
|
/*
|
|
|
|
* simulate scanlines by darkening every other line.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-02-03 02:37:12 +00:00
|
|
|
kernel vec4 scanline(sampler image, float l, float d)
|
2010-07-10 21:12:17 +00:00
|
|
|
{
|
2011-02-03 02:37:12 +00:00
|
|
|
vec4 light, dark;
|
2011-01-20 23:24:03 +00:00
|
|
|
|
|
|
|
vec2 coord = samplerCoord(image);
|
2010-07-10 21:12:17 +00:00
|
|
|
vec4 pixel = sample(image, coord);
|
2011-02-03 02:37:12 +00:00
|
|
|
pixel = unpremultiply(pixel);
|
2010-07-10 21:12:17 +00:00
|
|
|
|
2011-02-03 02:37:12 +00:00
|
|
|
light = dark = pixel;
|
2011-01-20 23:24:03 +00:00
|
|
|
|
2011-02-03 02:37:12 +00:00
|
|
|
|
|
|
|
dark.rgb = pixel.rgb * (1.0 - d);
|
|
|
|
light.rgb = pixel.rgb * (1.0 - l) + l;
|
2011-01-20 23:24:03 +00:00
|
|
|
|
2011-02-03 02:37:12 +00:00
|
|
|
pixel.rgb = mod(coord.y, 2.0) < 1.0 ? light.rgb : dark.rgb;
|
2011-01-20 23:24:03 +00:00
|
|
|
|
|
|
|
|
2011-02-03 02:37:12 +00:00
|
|
|
return premultiply(pixel);
|
2010-07-10 21:12:17 +00:00
|
|
|
}
|