#version 330 core

in vec4 vColor;
in vec2 vUV;
in float vRoundness;

out vec4 FragColor;

void main()
{
    vec2 pos = vUV * 2.0 - 1.0;
    vec2 absPos = abs(pos);

    bool insideSquare = all(lessThanEqual(absPos, vec2(1.0)));

    bool insideCircle = length(pos) <= 1.0;

    bool inside = mix(float(insideSquare), float(insideCircle), vRoundness) >= 0.5;

    if (!inside)
        discard;

    FragColor = vColor;
}
