#version 330

layout( location = 0 ) in vec2 InVertex;

out vec3 vEyeDir;

uniform mat4 uViewMatrix;
uniform mat4 uInverseProjectionMatrix;
uniform float uDepth;

void main()
{
	vec3 worldPos = ( uInverseProjectionMatrix * vec4( vec3( InVertex, 0.0 ), 1.0 ) ).xyz;
	mat3 invView = transpose( mat3( uViewMatrix ) );
	vEyeDir = invView * worldPos;
	gl_Position = vec4( vec3( InVertex, uDepth ), 1.0 );
}