float ComputeCameraDepth(vec4 worldSpacePos)
{
  vec4 viewPos = gl_ModelViewMatrix *  worldSpacePos;
  return viewPos.z;
}




//varying vec3 dir;
varying vec4 dir;

void main(void)
{
  //  dir = normalize(gl_Vertex.xyz);
  //  dir = gl_Vertex.xyz;
  dir = gl_Vertex;

  //  gl_Position = ftransform();

  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

  gl_TexCoord[4].q = ComputeCameraDepth(gl_Vertex);
}

  
