varying vec3 ViewPos;

const float scale = 0.5;

void main()
{
  // set texture coords
  gl_TexCoord[0] = gl_MultiTexCoord0; // Color Map and normal map share coords
  
  vec4 vertex = gl_Vertex;
  vertex.y += scale * (gl_TexCoord[0].t - gl_TexCoord[0].s);
  vertex.xyz += scale * ( gl_TexCoord[0].s + gl_TexCoord[0].t - 1.0 ) * gl_MultiTexCoord3.xyz; // cam right
  
  // position
  ViewPos = (gl_ModelViewMatrix * vertex).xyz;
  //projPos = gl_ModelViewProjectionMatrix * gl_Vertex;

  // transform position
  gl_Position = gl_ModelViewProjectionMatrix * vertex;
}