//float4 addColor(float4 color : COLOR, uniform float4 colorToAdd) : COLOR
//{
//	return color;// + colorToAdd;
//	//return colorToAdd;
//}

float4 addColor(float4 color : COLOR, uniform sampler2D texture, uniform float4 colorToAdd, float2 uv : TEXCOORD0) : COLOR
{
	return ((tex2D(texture, uv) + colorToAdd) * color);
}

struct SetAlpha_Output {
  float4 position : POSITION;
  //float4 color    : COLOR;
};

SetAlpha_Output setAlpha(uniform float alpha, float4 position : POSITION, float4 color : COLOR)
{
	SetAlpha_Output OUT;
	OUT.position = position;
	//OUT.color = color;
	//OUT.color.a = alpha;
	//OUT.color = color;// float4(1,1,1,1);
	return OUT;
}

float4 redToGreen(uniform sampler2D texture, float2 uv : TEXCOORD0) : COLOR
{
	float4 color = tex2D(texture, uv);
	if (color.g + color.b < color.r)
	{
		float temp = color.r;
		color.r = color.g;
		color.g = temp;
	}
	return color;
}


// Classic shaders
float4 player1BoardIconClassic(float4 vertColor : COLOR, uniform sampler2D texture, float2 uv : TEXCOORD0) : COLOR
{
	float4 pixelColor = tex2D(texture, uv);

	pixelColor.b = 0.0f;
	pixelColor.r -= 0.2f;
	pixelColor.g -= 0.25f;

	pixelColor *= vertColor;

	return pixelColor;
}

float4 player2BoardIconClassic(float4 vertColor : COLOR, uniform sampler2D texture, float2 uv : TEXCOORD0) : COLOR
{
	float4 pixelColor = tex2D(texture, uv);

	pixelColor.r = 0.15f;
	pixelColor.g -= 0.2;
	pixelColor.b = 0.15f;

	pixelColor *= vertColor;

	return pixelColor;
}

float4 player3BoardIconClassic(float4 vertColor : COLOR, uniform sampler2D texture, float2 uv : TEXCOORD0) : COLOR
{
	float4 pixelColor = tex2D(texture, uv);

	pixelColor.r = 0.10f;
	pixelColor.g = 0.25f;
	//pixelColor.b -= 0.2f;

	pixelColor *= vertColor;

	return pixelColor;
}

float4 player4BoardIconClassic(float4 vertColor : COLOR, uniform sampler2D texture, float2 uv : TEXCOORD0) : COLOR
{
	float4 pixelColor = tex2D(texture, uv);

//	if (pixelColor.r > 0.05f)
//	{
//		pixelColor.r += 0.85f - 0.098039215686274509803921568627451;
//		pixelColor.g += 0.15f - 0.43921568627450980392156862745098;
//		pixelColor.b += 0.15f - 0.7921568627450980392156862745098;
//	}
//	else
//	{
//		pixelColor.r = 0.55f;
//		pixelColor.g = 0.05f;
//		pixelColor.b = 0.05f;
//	}

	pixelColor.r -= 0.2f;
	pixelColor.g = 0.1f;
	pixelColor.b = 0.1f;

	pixelColor *= vertColor;

	return pixelColor;
}
// End classic shaders


// Modern shaders
float4 player1BoardIconModern(float4 vertColor : COLOR, uniform sampler2D texture, float2 uv : TEXCOORD0) : COLOR
{
	float4 pixelColor = tex2D(texture, uv);

	if (pixelColor.r > (pixelColor.g + pixelColor.b))
	{
		//pixelColor.r *= 0.75f;
		pixelColor.g = pixelColor.r * 0.75f;
	}

	pixelColor *= vertColor;

	return pixelColor;
}

float4 player2BoardIconModern(float4 vertColor : COLOR, uniform sampler2D texture, float2 uv : TEXCOORD0) : COLOR
{
	float4 pixelColor = tex2D(texture, uv);

	//pixelColor.g += 0.2f;
	//pixelColor.b -= 0.2f;
	//pixelColor.r -= 0.1f;

	if (pixelColor.r > (pixelColor.g + pixelColor.b))
	{
		float temp = pixelColor.g;
		pixelColor.g = pixelColor.r * 0.5f;
		pixelColor.r = temp;
	}

	pixelColor *= vertColor;

	return pixelColor;
}

float4 player3BoardIconModern(float4 vertColor : COLOR, uniform sampler2D texture, float2 uv : TEXCOORD0) : COLOR
{
	float4 pixelColor = tex2D(texture, uv);

	if (pixelColor.r > (pixelColor.g + pixelColor.b))
	{
		float temp = pixelColor.r;
		pixelColor.r = pixelColor.b;
		pixelColor.b = temp;

		//pixelColor.b -= 0.3f;
		//pixelColor.r += 0.1f;
		//pixelColor.g += 0.1f;

		if (pixelColor.r > 0.2f)
		{
			pixelColor.r *= 1.0f;
		}
		else
		{
			
		}

		if (pixelColor.g > 0.2f)
		{
			pixelColor.g *= 1.0f;
		}
	}

	pixelColor *= vertColor;

	return pixelColor;
}

float4 player4BoardIconModern(float4 vertColor : COLOR, uniform sampler2D texture, float2 uv : TEXCOORD0) : COLOR
{
	float4 pixelColor = tex2D(texture, uv);

	//if (pixelColor.g + pixelColor.b < pixelColor.r)
	//{
	//	float temp = pixelColor.r;
	//	pixelColor.r = pixelColor.g;
	//	pixelColor.g = temp;
	//}

	//if (pixelColor.g + pixelColor.b > pixelColor.r)
	//{
	//	pixelColor.r += 0.2f;
	//}

	if (pixelColor.r > (pixelColor.g + pixelColor.b))
	{
		pixelColor.r *= 0.75f;
	}

	pixelColor *= vertColor;

	return pixelColor;
}
// End modern shaders
