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;
|
|
|
|
|
|
|
|
vec4 hard_color(float sq_radius)
|
|
|
|
{
|
|
|
|
if ((sq_radius < 0.005625) || (sq_radius > 0.180625))
|
|
|
|
return vec4(0.5 * uniform_color, 1.0);
|
|
|
|
else
|
|
|
|
return vec4(uniform_color, 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
vec4 custom_color(float sq_radius)
|
|
|
|
{
|
|
|
|
float in_radius = 0.5 * percent_center_radius;
|
|
|
|
float out_radius = 0.5 * (1.0 - percent_outline_radius);
|
|
|
|
if ((sq_radius < in_radius * in_radius) || (sq_radius > out_radius * out_radius))
|
|
|
|
return vec4(0.5 * uniform_color, 1.0);
|
|
|
|
else
|
|
|
|
return vec4(uniform_color, 1.0);
|
|
|
|
}
|
2020-05-22 11:21:43 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
vec2 pos = gl_PointCoord - vec2(0.5, 0.5);
|
2020-05-25 08:48:53 +00:00
|
|
|
float sq_radius = dot(pos, pos);
|
2020-05-22 11:21:43 +00:00
|
|
|
if (sq_radius > 0.25)
|
|
|
|
discard;
|
2020-05-26 06:16:08 +00:00
|
|
|
|
|
|
|
gl_FragColor = custom_color(sq_radius);
|
2020-05-22 11:21:43 +00:00
|
|
|
}
|