| e8555c89 Andy McCall |
1 |
uniform sampler2D edgeTex; |
| 2 |
uniform sampler2D colorTex; |
| 3 |
uniform sampler2D offsetTex; |
| 4 |
uniform sampler2D weightTex; |
| 5 |
uniform sampler2D videoTex; |
| 6 |
|
| 7 |
varying vec2 mid; |
| 8 |
varying vec2 leftTop; |
| 9 |
varying vec2 edgePos; |
| 10 |
varying vec2 weightPos; |
| 11 |
varying vec2 texStep2; // could be uniform |
| 12 |
varying vec2 videoCoord; |
| 13 |
|
| 14 |
void main() |
| 15 |
{ |
| 16 |
// 12-bit edge information encoded as 64x64 texture-coordinate |
| 17 |
vec2 xy = texture2D(edgeTex, edgePos).ra; |
| 18 |
|
| 19 |
// extend to (64N x 64N) texture-coordinate |
| 20 |
xy = (floor(64.0 * xy) + fract(weightPos)) / 64.0; |
| 21 |
vec4 offsets = texture2D(offsetTex, xy); |
| 22 |
vec3 weights = texture2D(weightTex, xy).xyz; |
| 23 |
|
| 24 |
vec4 c5 = texture2D(colorTex, mid); |
| 25 |
vec4 cx = texture2D(colorTex, leftTop + texStep2 * offsets.xy); |
| 26 |
vec4 cy = texture2D(colorTex, leftTop + texStep2 * offsets.zw); |
| 27 |
|
| 28 |
vec4 col = cx * weights.x + cy * weights.y + c5 * weights.z; |
| 29 |
|
| 30 |
#if SUPERIMPOSE |
| 31 |
vec4 vid = texture2D(videoTex, videoCoord); |
| 32 |
gl_FragColor = mix(vid, col, col.a); |
| 33 |
#else |
| 34 |
gl_FragColor = col; |
| 35 |
#endif |
| 36 |
} |