#version 450 core

layout(location=0) in vec3 aPos;
layout(location=1) in vec3 aNormal;
layout(location=2) in vec2 aUv;

uniform mat4 uModel;
uniform mat4 uMvp;

out vec3 vWorldPos;
out vec3 vWorldNormal;
out vec2 vUv;

void main()
{
    vec4 worldPos = uModel * vec4(aPos, 1.0);
    vWorldPos = worldPos.xyz;

    mat3 normalMat = mat3(transpose(inverse(uModel)));
    vWorldNormal = normalize(normalMat * aNormal);

    vUv = aUv;

    gl_Position = uMvp * vec4(aPos, 1.0);
}
