float4x4 view_proj_matrix;
float4 lightPos;
float4 lightPos2;
float4 lightPos3;
float4 lightPos4;
float4 attenuation;
float4 attenuation2;
float4 attenuation3;
float4 attenuation4;

struct VS_OUTPUT
{
   float4 pos      : POSITION;
   float3 normal   : TEXCOORD0;
   float3 pos_dir  : TEXCOORD1;
   float3 pos_dir2 : TEXCOORD2;
   float3 pos_dir3 : TEXCOORD3;
   float3 pos_dir4 : TEXCOORD4;
   float2 texCoord : TEXCOORD5;
   float4 atten    : TEXCOORD6;
};
// attenuation.z -> ogre's linear attenuation
VS_OUTPUT main(float4 inPos  : POSITION,float3 inNorm : NORMAL,float2 inTex : TEXCOORD0)
{
   VS_OUTPUT Out = (VS_OUTPUT) 0; 
   Out.pos = mul( view_proj_matrix, inPos ); 
   Out.normal = inNorm;
   Out.pos_dir = ( lightPos-inPos );
   Out.pos_dir2 = ( lightPos2-inPos );
   Out.pos_dir3 = ( lightPos3-inPos );
   Out.pos_dir4 = ( lightPos4-inPos );
   Out.atten.x=1.0f/(1.0f+attenuation.z* length(Out.pos_dir));
   Out.atten.y=1.0f/(1.0f+attenuation2.z*length(Out.pos_dir2));
   Out.atten.z=1.0f/(1.0f+attenuation3.z*length(Out.pos_dir3));
   Out.atten.w=1.0f/(1.0f+attenuation4.z*length(Out.pos_dir4));
   Out.pos_dir=normalize(Out.pos_dir);
   Out.pos_dir2=normalize(Out.pos_dir2);
   Out.pos_dir3=normalize(Out.pos_dir3);
   Out.pos_dir4=normalize(Out.pos_dir4);
   Out.texCoord = inTex;

   return Out;
}
