#version 450

layout (location = 0) in vec3 vertexPosition;
layout (location = 1) in vec2 vertexTexCoords;
layout (location = 2) in vec3 vertexNormal;

layout (location = 0) out vec3 vertexWorldSpacePosition;
layout (location = 1) out vec3 vertexViewSpacePosition;
layout (location = 2) out vec2 vertexTexCoordsOut;
layout (location = 3) out vec3 vertexViewSpaceNormal;


//uniform mat4 modelMatrix;
//uniform mat4 viewMatrix;
uniform mat4 modelViewMatrix;
//uniform mat4 projectionMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat3 normalMatrix;

void main() {    
    // Handle position
    vertexWorldSpacePosition = vertexPosition;
    vertexViewSpacePosition = vec3((modelViewMatrix * vec4(vertexPosition, 1.0)).xyz);  
    gl_Position = modelViewProjectionMatrix * vec4(vertexPosition, 1.0);
    
  	// Handle texCoords
    vertexTexCoordsOut = vertexTexCoords;
	
	// Handle normal
    vertexViewSpaceNormal = normalize(normalMatrix * vertexNormal);
}
