#ifdef GL_ES
precision mediump float;
#endif

uniform bool		color_blend_additive;
uniform sampler2D	texture_unit;
varying	vec2		texture_uv;		// when passed from vertex shader to fragment shader stage, this gets interpolated
									// so the frag shader's tex uv will be the position of an actual pixel
varying vec4		vertex_color;	

void main()
{
	vec4 col = texture2D(texture_unit, texture_uv.st);
	if (color_blend_additive)
		gl_FragColor = col + vec4(vertex_color.rgb, 0.0);
	else
	{
		if (col.a == 0.0)
			discard;
		gl_FragColor = col * vertex_color;
	}
}