2020-05-25 09:16:40 +00:00
|
|
|
// version 120 is needed for gl_PointCoord
|
2020-05-22 11:21:43 +00:00
|
|
|
#version 120
|
|
|
|
|
|
|
|
uniform vec3 uniform_color;
|
2020-05-26 06:16:08 +00:00
|
|
|
uniform float percent_outline_radius;
|
|
|
|
uniform float percent_center_radius;
|
|
|
|
|
2020-06-01 06:55:44 +00:00
|
|
|
vec4 hardcoded_color(float radius, vec3 color)
|
2020-05-26 06:16:08 +00:00
|
|
|
{
|
2020-06-01 06:55:44 +00:00
|
|
|
return ((radius < 0.15) || (radius > 0.85)) ? vec4(0.5 * color, 1.0) : vec4(color, 1.0);
|
2020-05-26 06:16:08 +00:00
|
|
|
}
|
|
|
|
|
2020-06-01 06:55:44 +00:00
|
|
|
vec4 customizable_color(float radius, vec3 color)
|
2020-05-26 06:16:08 +00:00
|
|
|
{
|
2020-06-01 06:55:44 +00:00
|
|
|
return ((radius < percent_center_radius) || (radius > 1.0 - percent_outline_radius)) ?
|
|
|
|
vec4(0.5 * color, 1.0) : vec4(color, 1.0);
|
2020-05-26 06:16:08 +00:00
|
|
|
}
|
2020-05-22 11:21:43 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2020-06-01 06:55:44 +00:00
|
|
|
vec2 pos = (gl_PointCoord - 0.5) * 2.0;
|
|
|
|
float radius = length(pos);
|
|
|
|
if (radius > 1.0)
|
2020-05-22 11:21:43 +00:00
|
|
|
discard;
|
2020-05-29 10:29:04 +00:00
|
|
|
|
2020-06-01 06:55:44 +00:00
|
|
|
gl_FragColor = customizable_color(radius, uniform_color);
|
2020-05-22 11:21:43 +00:00
|
|
|
}
|