float4x4 view_proj_matrix;
float4 lightPos;
float4 attenuation;

struct VS_OUTPUT
{
   float4 pos      : POSITION;
   float3 normal   : TEXCOORD0;
   float3 pos_dir  : TEXCOORD1;
   float2 texCoord : TEXCOORD2;
   float  atten    : TEXCOORD3;
};
// 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.atten.x=1.0f/(1.0f+attenuation.z* length(Out.pos_dir));
   Out.pos_dir=normalize(Out.pos_dir);
   Out.texCoord = inTex;

   return Out;
}
