
in vec3 v_rel_position;
in vec4 v_color;
flat in ivec4 v_style;

out vec4 frag_color;

void main() {
    switch (v_style.x) {
        case 0: // Solid
            frag_color = v_color;
            break;
        case 1: // Dotted
            frag_color = v_color;
            vec2 pos = mod(v_rel_position.xy, vec2(v_rel_position.z * 2.0));
            vec2 center = vec2(v_rel_position.z * 0.5);
            float dist = distance(pos, center) / v_rel_position.z;
            frag_color.a *= min(1.0, step(dist, 0.45) + step(dist, 0.46) * 0.6);
            break;
        case 2: // Inset
            frag_color = v_color;
            frag_color.rgb *= 1.0 - float(any(greaterThan(v_style.yz, vec2(0.0)))) * 0.3;
            break;
        case 3: // Outset
            frag_color = v_color;
            frag_color.rgb *= 1.0 - float(any(lessThan(v_style.yz, vec2(0.0)))) * 0.3;
            break;
    }

}
