blob: 0f7c31633e1da3ea3ea0d60c4f8a6fe678bc9c75 (
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
|
#version 330
// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord;
in vec4 fragColor;
// Output fragment color
out vec4 finalColor;
void main()
{
float radius = 0.25;
vec2 distance_from_center = fragTexCoord - vec2(0.5);
// s <= 0 -> inside circle
// s > 0 -> outside circle
if (length(distance_from_center) <= 0.5) {
float s = length(distance_from_center) - radius;
if (s <= 0) {
finalColor = fragColor*1.25;
} else {
float t = 1 - (s / (0.5 - radius));
finalColor = vec4(fragColor.xyz, t);
}
} else {
finalColor = vec4(0);
}
}
|