uniform float4x4 	matWorld;
uniform float4x4 	matWorldViewProj;
uniform float3		msCamPos;

static const int  NUM_LIGHTS = 2;

struct VS_INPUT 
{
	float4 position		: POSITION0;
	float2 uv			: TEXCOORD0;
	float3 normal 		: NORMAL0;
};

struct VS_OUTPUT 
{
	float4 position 	: POSITION0;
	float2 uv		 	: TEXCOORD0;
	float3 wsPos		: TEXCOORD1;
	float3 wsPosCam		: TEXCOORD2;
	float4 color		: COLOR0;
};

uniform float3 wsLightDir[NUM_LIGHTS];
uniform float3 lightAmbient[NUM_LIGHTS];
uniform float3 lightDiffuse[NUM_LIGHTS];

VS_OUTPUT main_vs( VS_INPUT input )
{
	VS_OUTPUT output;

	output.position = mul( matWorldViewProj, input.position );
	output.uv = input.uv;
	output.wsPos = input.position.xyz;
	output.wsPosCam = msCamPos;

	float3 l = float3( 0, 0, 0 ); 
	
	for( int i = 0; i < NUM_LIGHTS; i ++ )
	{
		float nDotL = dot(input.normal, wsLightDir[i]);
		l += lightAmbient[i] + lightDiffuse[i] * max( 0, nDotL );
	}
	
	output.color.rgb = saturate(l + l);
	output.color.a = 1;
	
	return output;
}
