#version 400 core

flat in float v2f_face_index;

layout (location = 0) out vec4 out_color;

void main()
{
    // Pack integer (32 bit) in the 4 8bit channels
    int faceIndexI = int(floor(v2f_face_index));

    int p1 = (faceIndexI >> 0)  & 0xff;
    int p2 = (faceIndexI >> 8)  & 0xff;
    int p3 = (faceIndexI >> 16) & 0xff;
    int p4 = (faceIndexI >> 24) & 0xff;

    out_color = vec4(
        float(p1) / 255.0,
        float(p2) / 255.0,
        float(p3) / 255.0,
        float(p4) / 255.0
    );
}
