#version 410 core
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec3 aColor;
layout(location = 2) in vec3 aNormal;
layout(location = 6) in mat4 aInstanceModel;

uniform mat4 uView;
uniform mat4 uProjection;

out vec3 FragPos;
out vec3 Normal;
out vec3 Color;

void main() {
    vec4 worldPos = aInstanceModel * vec4(aPos, 1.0);
    FragPos = worldPos.xyz;
    
    // Transform normal to world space (assuming uniform scaling)
    Normal = mat3(transpose(inverse(aInstanceModel))) * aNormal;
    
    Color = aColor;
    gl_Position = uProjection * uView * worldPos;
}
