#version 400 

uniform mat4 proj;
uniform mat4 model;

layout(location = IGLU_VERTEX)   in vec3 vertex;   // Sends vertex data from models here
layout(location = IGLU_TEXCOORD) in vec2 texcoord; // Sends texture coordinate data (if any) from models here
layout(location = IGLU_NORMAL)   in vec3 normal;   // Sends normal data (if any) from models here

out vec2  fragTexCoord;
out vec4  esFragNormal;
out vec4  esFragPos;
out vec4  ndcPos;
out float vertID;

// This is the actual code that is executed.
void main( void )
{
  fragTexCoord = texcoord;
  esFragNormal = inverse( transpose( model ) ) * vec4( normal, 0.0f );
  esFragPos    = model * vec4( vertex, 1.0f );
  vertID       = gl_VertexID;
  vec4 ndc     = proj * ( model * vec4( vertex, 1.0f ) ); 
  ndcPos       = ndc;
  
  gl_Position  = ndc; //proj * ( model * vec4( vertex, 1.0f ) ); 
}