#version 330

layout( location = 0 ) in vec3 InVertex;
layout( location = 1 ) in vec3 InNormal;

out vec3 vNormal;
out vec3 vEye;
out vec3 vPos;

uniform mat4 uViewMatrix;
uniform mat4 uProjectionMatrix;
uniform mat4 uModelMatrix;

void main()
{
	vEye = vec3( uViewMatrix * uModelMatrix * vec4( InVertex, 1.0 ) );
	vPos = vec3( uModelMatrix * vec4( InVertex, 1.0 ) );
	vNormal = -normalize( transpose( inverse( mat3( uViewMatrix * uModelMatrix ) ) ) * InNormal );
	gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4( InVertex, 1.0 );
}