// loopit 2006 - loopit.dk

struct v2f {
	float4 position  : POSITION;
	float2 texcoords : TEXCOORD0;
};

void main( in v2f IN,
					 in uniform float3 intensities,
					 in uniform float3 lightmap_col,
					 in uniform sampler2D colormap : TEXUNIT0,
					 in uniform sampler2D lightmap_base : TEXUNIT4,
					 in uniform sampler2D lightmap_add1 : TEXUNIT5,
					 in uniform sampler2D lightmap_add2 : TEXUNIT6,
					 out float4 colOut : COLOR0)
{
	const float3 col = tex2D( colormap, IN.texcoords ).rgb;

	const float3 t1 = tex2D( lightmap_base, IN.texcoords ).rgb;
	const float3 t2 = tex2D( lightmap_add1, IN.texcoords ).rgb;
	const float3 t3 = tex2D( lightmap_add2, IN.texcoords ).rgb;

	colOut.rgb = col * t1*intensities.x + col * lightmap_col * ( t2*intensities.y + t3*intensities.z);
	colOut.a = 1.0f;
}
