My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
uniform sampler2D Texture;
uniform vec4 GlyphColor;
uniform vec4 GlowColor;
uniform vec4 OutlineColor;

uniform bool Outline;
uniform bool Glow;
uniform bool Shadow;

const float AlphaCenter = 0.5;
const float DistanceScale = 25.0;

uniform float OutlineCenter;
uniform float GlowCenter;

void main()
{
vec4 color = texture2D(Texture, gl_TexCoord[0].xy);
float alpha = color.a;
float width = min(length(fwidth(gl_TexCoord[0])), 1.0) * DistanceScale;

vec4 finalColor = GlyphColor;

float ma = smoothstep(AlphaCenter - width, AlphaCenter + width, alpha);
finalColor.a = ma;

if(Outline)
{
float mo = smoothstep(OutlineCenter - width, OutlineCenter + width, alpha);
finalColor = mix(OutlineColor, finalColor, ma);
finalColor.a = mo;
}

if(Glow && alpha >= finalColor.a - 0.5)
{
float mg = smoothstep(AlphaCenter, GlowCenter, sqrt(alpha));
finalColor = mix(GlowColor, finalColor, ma);
finalColor.a = mg;
}

gl_FragColor = finalColor * GlyphColor.a;
}

Change log

r4188 by unodgs on Nov 22, 2011   Diff
WinGL: Added automatic atlas textures,
fixed some bugs
Go to: 
Project members, sign in to write a code review

Older revisions

r3915 by unodgs on Sep 26, 2011   Diff
Rainbow: WinGL..
r3711 by unodgs on Jul 24, 2011   Diff
Rainbow: WinGL..
All revisions of this file

File info

Size: 976 bytes, 42 lines

File properties

svn:eol-style
native
Powered by Google Project Hosting