//varying vec3 ViewPos;
//varying vec3 up;
varying vec3 WorldNormal;
varying vec4 projPos;
varying vec3 Nscreen;

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

  // scale blending
  Nscreen = abs( normalize(WorldNormal).xyz ); 
  Nscreen = ( Nscreen - .2 ) * 7.0;
  Nscreen = max( Nscreen, 0.0 );
  Nscreen = Nscreen / ( Nscreen.x + Nscreen.y + Nscreen.z );

  // position
  //ViewPos = (gl_ModelViewMatrix * gl_Vertex).xyz;
  //up = normalize( gl_NormalMatrix * vec3( 0.0, 1.0, 0.0 ) );
  projPos = gl_ModelViewProjectionMatrix * gl_Vertex;

  // set texture coords
  gl_TexCoord[0] = gl_MultiTexCoord0; // Color Map and normal map share coords
  gl_TexCoord[1].xyz = 1.91 * WorldPosition.yzx; gl_TexCoord[1].w = 1.0;
  gl_TexCoord[2].xyz = 1.91 * WorldPosition.xzy; gl_TexCoord[2].w = 1.0;
  gl_TexCoord[3].xyz = 1.91 * WorldPosition.yxz; gl_TexCoord[3].w = 1.0;
  
  // transform position
  gl_Position = ftransform();
}