uniform sampler2D texture;
uniform vec4 teamColour;
uniform vec4 minMatchColour;

void main()
{
	vec4 useMinMatchColour;

	if (minMatchColour == vec4(0.0, 0.0, 0.0, 1.0))
	{
		useMinMatchColour = vec4(0.88, 0.88, 0.88, 0.0);
	}
	else
	{
		useMinMatchColour = minMatchColour;
	}

	vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);

	if(all(greaterThanEqual(pixel, useMinMatchColour - 0.000001f)))
	{
		gl_FragColor = teamColour * pixel;
	}
	else
	{
		gl_FragColor = pixel;
	}
}


