varying vec3 eyeVec;

uniform vec3 view_position;

varying vec3 tangent;
varying vec3 biNormal;
varying vec3 normal;

uniform vec3 lightPos;
varying vec3 lightVec;

attribute vec3 spcVertexTangent;
void main()
{
 gl_TexCoord[0]=gl_MultiTexCoord0;
 gl_Position=ftransform();
 eyeVec = vec3(gl_ModelViewMatrix*gl_Vertex);
 
 normal = normalize(gl_Normal);
 tangent = (vec4(spcVertexTangent,0.0)).xyz;
 biNormal = normalize(cross(normal,tangent));
 
 vec3 tempLightVec = vec3(lightPos.x,lightPos.y,lightPos.z);
 tempLightVec -= (gl_Vertex).xyz;
 lightVec.x = dot( tempLightVec, tangent ); 
 lightVec.y = dot( tempLightVec, biNormal ); 
 lightVec.z = dot( tempLightVec, normal ); 
 
 vec3 tempEye = eyeVec;
 eyeVec.x = dot( tempEye, tangent ); 
 eyeVec.y = dot( tempEye, biNormal ); 
 eyeVec.z = dot( tempEye, normal ); 
 
}