attribute vec3 normals;
attribute vec3 tangent;
attribute vec2 texCoord1;
varying vec2 texCoord;


varying vec3 varyEyeVec;
varying vec3 varyTangent;
varying vec3 varyBiNormal;
varying vec3 varyNormal;
varying vec3 varyLight;

uniform float anim;
uniform vec3 posOff;
void main()
{

 texCoord = texCoord1;
 
 float len = length(gl_NormalMatrix * gl_Vertex.xyz);
 float len2 = length(gl_Vertex.xyz);
 vec4 modPos=vec4(0.0);
 float scaler = 0.00001;
 modPos.x = sin(len*0.3 + anim)*(pow(len,2.43));
 modPos.y = sin(len*0.11 + anim)*(pow(len,2.4343));
 modPos.z = sin(len*0.2 + anim)*(pow(len,2.4323));//*/
 modPos*=scaler;
 len2*=0.001;
 modPos.x += sin(gl_Vertex.y*0.1 + anim*8.01)*(pow(len2,2.4)*320.03);
 modPos.y += cos(gl_Vertex.x*0.2 + anim*3.01)*(pow(len2,2.4)*120.03);
 modPos.z += sin(gl_Vertex.y*0.1 + anim*8.01)*(pow(len2,2.5)*320.03);
 
 modPos.w=0.0;
 
 //modPos.xyz+=posOff;
 gl_Position = gl_ProjectionMatrix * ((gl_ModelViewMatrix * (gl_Vertex + modPos)));

 varyEyeVec = vec3(gl_ModelViewMatrix*gl_Vertex);
 varyNormal = normalize(gl_NormalMatrix*normals);
 varyTangent = normalize(gl_NormalMatrix*tangent);
 varyBiNormal = normalize(cross(varyNormal,varyTangent));
 
 varyLight = -varyEyeVec;
 
 //make eyeVec in tangent space.
 vec3 tempEye = varyEyeVec;
 varyEyeVec.x = dot( tempEye, varyTangent ); 
 varyEyeVec.y = dot( tempEye, varyBiNormal ); 
 varyEyeVec.z = dot( tempEye, varyNormal ); 
 
 vec3 tempLight = varyLight;
 varyLight.x = dot( tempLight, varyTangent ); 
 varyLight.y = dot( tempLight, varyBiNormal ); 
 varyLight.z = dot( tempLight, varyNormal ); 
 
}