varying vec2 v_vTexcoord;

uniform vec3 u_vNewBlack;
uniform vec3 u_vNewDkGray;
uniform vec3 u_vNewGray;
uniform vec3 u_vNewWhite;

void main()
{
	vec3 OldColor = vec3(texture2D(gm_BaseTexture, v_vTexcoord));
	vec3 NewColor = OldColor;
	
	if (OldColor.r < 0.2) {
		NewColor = u_vNewBlack;
	}
	else if (OldColor.r < 0.4) {
		NewColor = u_vNewDkGray;
	}
	else if (OldColor.r < 0.6) {
		NewColor = u_vNewGray;
	}
	else {
		NewColor = u_vNewWhite;
	}
	/*
	if (OldColor.r >= 0.) {
		NewColor = u_vNewBlack;
	}
	else if (OldColor.r >= 0.2) {
		NewColor = u_vNewDkGray;
	}
	else if (OldColor.r >= 0.4) {
		NewColor = u_vNewGray;
	}
	else if (OldColor.r >= 0.8) {
		NewColor = u_vNewWhite;
	}*/
	
	gl_FragColor = vec4(vec3(NewColor), 1.);
}
