blob: 2b6f33bac466b49c8e0c5dc22d47ca253c54cd22 (
plain)
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
|
#version 330
in vec2 pass_textureCoords;
out vec4 out_color;
uniform vec3 color;
uniform sampler2D fontAtlas;
const float width = 0.5;
const float edge = 0.1;
const float borderWidth = 0.0;
const float borderEdge = 0.5;
const vec2 offset = vec2(0, 0.0);
const vec3 outlineColour = vec3(1.0,0.0,0.0);
void main(void){
float distance = 1.0 - texture(fontAtlas, pass_textureCoords).a;
float alpha = 1.0 - smoothstep(width, width + edge, distance);
float distance2 = 1.0 - texture(fontAtlas, pass_textureCoords + offset).a;
float outlineAlpha = 1.0 - smoothstep(borderWidth, borderWidth + borderEdge, distance2);
float overallAlpha = alpha + (1.0 - alpha) * outlineAlpha;
vec3 overallColor = mix(outlineColour, color, alpha / overallAlpha);
out_color = vec4(overallColor, overallAlpha);
}
|