#version 400 

in vec3 vertex   : IGLU_VERTEX;   // Sends vertex data from models here
in vec3 normal   : IGLU_NORMAL;   // Sends normal data (if any) from models here

uniform mat4 project;             // The projection/perspective matrix
uniform mat4 modelview;           // The modelview matrix

out vec4 fragNormal;
out vec4 fragPos;
out vec4 eyePos;

// This is the actual code that is executed.
void main( void )
{  
    vec4 ePos    = modelview * vec4( vertex, 1.0f );
	vec4 ndcPos  = project * ePos; 
	gl_Position  = ndcPos;
	fragNormal   = inverse( transpose( modelview ) ) * vec4( normalize(normal), 0.0 );
	eyePos       = ePos;
	fragPos      = ndcPos;
}