#version 330

layout (location = 0) in vec3 a_Position;
layout (location = 1) in vec2 a_TexCoord;
layout (location = 2) in vec3 a_Normal;

uniform mat4 projection;
uniform mat4 view;
uniform mat4 model;

out vec2 v_TexCoord;

void main()
{
    // Apply model rotation, then view (without translation), then projection
    vec4 pos = projection * view * model * vec4(a_Position, 1.0);
    
    // Set z = w so the skybox is always at maximum depth
    gl_Position = pos.xyww;
    
    v_TexCoord = a_TexCoord;
}