//varying vec3 eyeVec;
varying vec2 texCoord;
varying vec3 lightVec[]; 
varying vec3 spotDirVec[];
varying vec3 tNormal;

uniform float spotCount;
uniform vec3 spotDir[];
uniform vec3 spotPos[];

void main(void)
{
   gl_Position = ftransform();
   texCoord = gl_MultiTexCoord0.xy;
   
   tNormal = normalize(gl_NormalMatrix * gl_Normal);   
   vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);

   //eyeVec = -normalize(vVertex);
   
   vec3 ltPos = vec3(gl_ModelViewMatrix * vec4(spotPos[0], 1.0));
   lightVec[0] = ltPos - vVertex;
   spotDirVec[0] = vec3(gl_ModelViewMatrix * vec4(spotDir[0], 0.0));
   
   if(spotCount >= 2.0) {
       vec3 ltPos = vec3(gl_ModelViewMatrix * vec4(spotPos[1], 1.0));
       lightVec[1] = ltPos - vVertex;
       spotDirVec[1] = vec3(gl_ModelViewMatrix * vec4(spotDir[1], 0.0));
   }
   
   if(spotCount >= 3.0) {
       vec3 ltPos = vec3(gl_ModelViewMatrix * vec4(spotPos[2], 1.0));
       lightVec[2] = ltPos - vVertex;
       spotDirVec[2] = vec3(gl_ModelViewMatrix * vec4(spotDir[2], 0.0));
   }
}