attribute vec4 vPosition;
attribute vec4 vNormal;
attribute vec4 vTangent;
attribute vec2 vTexCoord;
uniform mat4 mv_matrix;
uniform mat4 p_matrix;
uniform mat4 mat4_slot_1;
varying vec3 N;
varying vec3 V;
varying vec2  v_texcoord;
varying vec3 eye_dir;
varying float eye_length; 

void main(void)  
{     
   V = vec3(vPosition);       
   N = normalize(vNormal.xyz);
   gl_Position = p_matrix * vPosition; 
   v_texcoord = vTexCoord;
   vec3 world_pos = (mv_matrix * vPosition).xyz; 
   eye_length = -world_pos.z/mat4_slot_1[3].y;
   vec3 n = normalize(mv_matrix * vNormal).xyz;
   vec3 t = normalize(mv_matrix * vTangent).xyz;
   t = normalize(t - (dot(t, n) * n));
   vec3 biTangent = cross(n, t);
   mat3 tbnMatrix = mat3(t, biTangent, n);
   eye_dir = normalize((-world_pos * tbnMatrix));
} 
