File: text.frag

package info (click to toggle)
gource 0.55-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,392 kB
  • sloc: cpp: 19,637; sh: 4,241; makefile: 102
file content (15 lines) | stat: -rw-r--r-- 468 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
uniform sampler2D tex;
uniform float shadow_strength;
uniform float texel_size;

void main(void)
{
    float colour_alpha = texture2D(tex,gl_TexCoord[0].xy).w;
    float shadow_alpha = texture2D(tex,gl_TexCoord[0].xy - vec2(texel_size)).w * shadow_strength;

    float combined_alpha = 1.0 - (1.0-shadow_alpha)*(1.0-colour_alpha);

    if(combined_alpha > 0.0) colour_alpha /= combined_alpha;

    gl_FragColor = gl_Color * vec4(vec3(colour_alpha), combined_alpha);
}