#version 330 core

in vec2 vUv;
in float vAlpha;
in vec4 vColor;
in float vKind;

out vec4 FragColor;

uniform sampler2D uFontTexture;
uniform float uAlpha;

void main()
{
    vec4 color = vColor;
    if (vKind > 0.5)
    {
        vec4 texel = texture(uFontTexture, vUv);
        color = vec4(texel.rgb * vColor.rgb, texel.a * vColor.a);
    }

    color.a *= vAlpha * uAlpha;
    if (color.a <= 0.001)
        discard;

    FragColor = color;
}
