varying vec4 ViewPos;
varying vec3 normal;
varying vec3 tangent;
varying vec3 binormal;
//varying vec3 up;
varying vec3 WorldNormal;

void main()
{
  // world pos
  vec3 WorldPosition = 0.01 * gl_Vertex.xyz;
  WorldNormal = gl_Normal;
  
  // position
  ViewPos = gl_ModelViewMatrix * gl_Vertex;

  // normal and tangent basis
  normal   = normalize(gl_NormalMatrix * gl_Normal);
  tangent  = normalize(gl_NormalMatrix * gl_MultiTexCoord1.xyz);
  binormal = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz);
  //up = normalize( gl_NormalMatrix * vec3( 0.0, 1.0, 0.0 ) );
    
  // set texture coords
  gl_TexCoord[0] = gl_MultiTexCoord0; // Color Map and normal map share coords
  gl_TexCoord[1].xyz = 8.91 * WorldPosition.yzx; gl_TexCoord[1].w = 1.0;
  gl_TexCoord[2].xyz = 8.91 * WorldPosition.xzy; gl_TexCoord[2].w = 1.0;
  gl_TexCoord[3].xyz = 8.91 * WorldPosition.yxz; gl_TexCoord[3].w = 1.0;
  
  // transform position
  gl_Position = ftransform();
}