#version 330 core

out vec4 color;
in vec2 Texcoord;
uniform sampler2D tex;
uniform vec3 tcolor;
uniform float scale;

float smoothing = 1.0/scale;

void main()
{
    float threshold = texture(tex, Texcoord).a;
    float alpha = smoothstep(0.5 - smoothing, 0.5 + smoothing, threshold);
    color = vec4(tcolor, alpha);
}
