prosperon/source/shaders/circlefrag.glsl

34 lines
637 B
Plaintext
Raw Normal View History

2022-06-21 23:16:14 -05:00
#version 330
in vec2 coords;
out vec4 color;
uniform float radius;
uniform int thickness;
2023-01-16 02:16:39 -06:00
uniform vec3 dbgColor;
uniform bool fill;
2022-06-21 23:16:14 -05:00
void main()
{
2022-06-21 23:16:14 -05:00
// int tt = thickness + 1;
float R1 = 1.f;
float R2 = 1.f - (thickness / radius);
float dist = sqrt(dot(coords, coords));
2023-01-16 02:16:39 -06:00
if (dist >= R2 && dist <= R1)
color = vec4(dbgColor, 1.f);
else if (dist < R2)
color = vec4(dbgColor, 0.1f);
else
2022-06-21 23:16:14 -05:00
discard;
2023-01-16 02:16:39 -06:00
2022-06-21 23:16:14 -05:00
/*
float smoother = 0.01f - (radius * 0.00003f);
float sm = smoothstep(R1, R1-smoother, dist);
float sm2 = smoothstep(R2, R2+smoother, dist);
float alpha = sm*sm2;
*/
2023-01-16 02:16:39 -06:00
2022-06-21 23:16:14 -05:00
}