#version 330

in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec3 vertexNormal;
in vec4 vertexColor;

out vec2 fragTexCoord;
out vec3 fragNormal;
out vec3 fragFragPos;
out vec4 fragColor;

uniform mat4 mvp;
uniform mat4 matModel;
uniform mat4 matNormal;

void main() {
    fragTexCoord = vertexTexCoord;
    fragColor = vertexColor;
    
    // Transform normal and position to world space for lighting
    fragNormal = normalize(vec3(matNormal * vec4(vertexNormal, 0.0)));
    fragFragPos = vec3(matModel * vec4(vertexPosition, 1.0));
    
    gl_Position = mvp * vec4(vertexPosition, 1.0);
}
