sampler TxBase : register(s0);
float4 emissive;
float4 FogColor;

struct PS_INPUT
{
  float2 uv0 :TEXCOORD0;
  float4 dif :TEXCOORD1;
  float3 light: TEXCOORD2;
  float fog: TEXCOORD3;
};

float4 main (PS_INPUT IN): COLOR0
{
  float4 tex=tex2D(TxBase, IN.uv0);
  float3 colorp=float3((emissive+IN.light*(IN.dif-emissive))*tex.xyz);
  return float4(float3(colorp*(1-IN.fog) + FogColor.xyz*IN.fog).xyz,IN.dif.a*tex.a);
}