#version 140

varying vec4 fColor;
varying vec2 fUV;
varying vec4 fTextColor;
varying vec2 fTextUV;

uniform sampler2D uTexture;
uniform sampler2D uTextTexture;

void main() {
    float alpha = texture2D(uTextTexture, fTextUV).r;
    vec4 color = mix(texture2D(uTexture, fUV) * fColor, fTextColor, alpha);
    gl_FragColor = vec4(color.rgb * color.a, color.a);
}
