uniform float InvTanHalfFOV;
uniform float ScreenWidth;
uniform float ScreenHeight;

varying vec3 eyeToScreen;

void main()
{
  // set texture coords
  gl_TexCoord[0] = gl_MultiTexCoord0; // Color Map and normal map share coords
  
  // vector to screen coord, for recovering viewspace position
  eyeToScreen.xy = 2.0 * gl_MultiTexCoord0.st - 1.0; // convert to -1 to 1 range
  eyeToScreen.x *= ( ScreenWidth / ScreenHeight );   // scale for aspect ratio
  eyeToScreen.z  = InvTanHalfFOV;

  // transform position
  gl_Position = ftransform();
}
