sampler2D CarLight;
sampler2D CarLightFade;

struct PS_INPUT{
	float4 ShadowPos		: TEXCOORD0;

	float LightDepth		: TEXCOORD1;
	float LightW			: TEXCOORD2;
};

struct PS_OUTPUT{
    float4 Color			: COLOR;
};

PS_OUTPUT main(const PS_INPUT Input){
	//float2 BaseCoords = Input.ShadowPos.xy / Input.ShadowPos.w;
	//BaseCoords = clamp(BaseCoords, 0, 1);
	
	float4 BaseTexColor;
	if (Input.LightW > 0.0f){
		BaseTexColor = tex2Dproj(CarLight, Input.ShadowPos);
	}
	else BaseTexColor = 0;
	
	BaseTexColor *= tex2D(CarLightFade, float2(Input.LightDepth, 0));
	
	// Texturing
	float3 TexColor = 1;
	TexColor *= BaseTexColor;
		
	PS_OUTPUT Out;
	Out.Color.rgb = TexColor;
	Out.Color.a = 1.0f;
	return Out;
}
