mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2024-12-22 07:30:40 +00:00
20 lines
396 B
Plaintext
20 lines
396 B
Plaintext
/*
|
|
* simulate scanlines by darkening every other line.
|
|
*
|
|
*/
|
|
|
|
kernel vec4 scanline(sampler image, float opacity)
|
|
{
|
|
vec2 coord = samplerCoord(image);
|
|
vec4 pixel = sample(image, coord);
|
|
|
|
float isOdd = mod(floor(coord.y), 2.0);
|
|
|
|
// isOdd == 0 --> return pixel
|
|
// isOdd == 1 --> return pixel * opacity
|
|
|
|
float multiplier = compare(isOdd - 1.0, 1.0, opacity);
|
|
|
|
return pixel * multiplier;
|
|
}
|