#version 460 core
// layout (location = 0) in vec3 a_position;

struct PositionData {
    float x;
    float y;
    float z;
};

layout (binding = 0, std430) restrict readonly buffer _positions {
    PositionData pos_data[];
};

vec4 getPosition(int index) {
    return vec4(
        pos_data[index].x,
        pos_data[index].y,
        pos_data[index].z,
        1
    );
}

layout (binding = 0, std140) uniform SharedMatrices {
    mat4 projection;
    mat4 cam_matrix;
};

out vec3 v_texcoord;

void main() {
    vec4 a_position = getPosition(gl_VertexID);
    vec4 WVP_position = projection * mat4(mat3(cam_matrix)) * a_position;
    gl_Position = WVP_position.xyww;
    v_texcoord   = a_position.xyz;
}