| 1 |
uniform sampler2D tex; |
| 2 |
uniform sampler2D videoTex; |
| 3 |
uniform vec4 cnst; |
| 4 |
uniform vec3 texStepX; // = vec3(vec2(1.0 / texSize.x), 0.0); |
| 5 |
|
| 6 |
varying vec2 scaled; |
| 7 |
varying vec3 misc; |
| 8 |
varying vec2 videoCoord; |
| 9 |
|
| 10 |
void main() |
| 11 |
{ |
| 12 |
float scan_a = cnst.x; |
| 13 |
float scan_b = cnst.y; |
| 14 |
float scan_c = cnst.z; |
| 15 |
float alpha = cnst.w; |
| 16 |
|
| 17 |
vec3 t = (vec3(floor(scaled.x)) + alpha * vec3(fract(scaled.x))) * texStepX + misc; |
| 18 |
vec4 col1 = texture2D(tex, t.xz); |
| 19 |
vec4 col2 = texture2D(tex, t.yz); |
| 20 |
|
| 21 |
float scan = scan_c + scan_b * abs(fract(scaled.y) - scan_a); |
| 22 |
#if SUPERIMPOSE |
| 23 |
vec4 col = (col1 + col2) / 2.0; |
| 24 |
vec4 vid = texture2D(videoTex, videoCoord); |
| 25 |
gl_FragColor = mix(vid, col, col.a) * scan; |
| 26 |
#else |
| 27 |
// optimization: in case of not-superimpose, we moved the division by 2 |
| 28 |
// '(col1 + col2) / 2' to the 'scan_b' and 'scan_c' variables. |
| 29 |
gl_FragColor = (col1 + col2) * scan; |
| 30 |
#endif |
| 31 |
} |