#version 100
uniform sampler2D TEXTURE_0;
uniform vec4 OVERLAY_COLOR;

varying vec4 color;
varying vec2 uv;

void main()
{
	vec4 diffuse = texture2D( TEXTURE_0,  uv );

#ifdef ALPHA_TEST
	if(diffuse.a < 0.5)
	 	discard;
#endif

#ifdef USE_OVERLAY
	//use either the diffuse or the OVERLAY_COLOR
	diffuse.rgb = mix(diffuse, OVERLAY_COLOR, OVERLAY_COLOR.a).rgb;
#endif

	gl_FragColor = diffuse * color;
}
