#version 430 core layout(location = 0) in vec3 aPos; layout(location = 1) in vec3 aNormal; layout(location = 2) in vec2 aTex; uniform mat4 uModel; uniform mat4 uView; uniform mat4 uProjection; out vec2 vTex; out vec3 vWorldNormal; out vec3 vWorldPos; void main() { vTex = aTex; // Transform the mesh normal into world space. For uniform-scale transforms // (the common case), the upper-left 3x3 of uModel is correct. Non-uniform // scale would require the inverse transpose; we accept that as a Phase 3+ // concern. vWorldNormal = normalize(mat3(uModel) * aNormal); vec4 world = uModel * vec4(aPos, 1.0); vWorldPos = world.xyz; gl_Position = uProjection * uView * world; }