#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 normalVector;
layout (location = 2) in vec2 texCoords;

uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;

out vec2 TexCoords;
out vec3 FragPos;
out vec3 Normal;

void main()
{
	// NOTE: inverse() is very costly to calculate, so the normal matrix should be calculated on the CPU and sent over (just like we do with the model matrix)
	Normal = mat3(transpose(inverse(modelMatrix))) * normalVector;
	FragPos = vec3((modelMatrix) * vec4(aPos, 1.0));
	TexCoords = texCoords;
	// note that we read the multiplication from right to left
    gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(aPos, 1.0);
}
