#version 330 core
layout (points) in;
layout (triangle_strip, max_vertices = 36) out;

uniform mat4 projection;


void main() {
    vec4 position = gl_in[0].gl_Position;

    float hsize = 0.5;

    vec4 vertices[12*3] = vec4[12*3](
        //1
        vec4(-hsize, -hsize, -hsize, 0.0),
        vec4(hsize, -hsize, -hsize, 0.0),
        vec4(hsize, hsize, -hsize, 0.0),

        //2
        vec4(hsize, hsize, -hsize, 0.0),
        vec4(-hsize, hsize, -hsize, 0.0),
        vec4(-hsize, -hsize, -hsize, 0.0),

        //3
        vec4(-hsize, -hsize, hsize, 0.0),
        vec4(hsize, -hsize, hsize, 0.0),
        vec4(hsize, hsize, hsize, 0.0),

        //4
        vec4(hsize, hsize, hsize, 0.0),
        vec4(-hsize, hsize, hsize, 0.0),
        vec4(-hsize, -hsize, hsize, 0.0),

        //5
        vec4(-hsize, hsize, hsize, 0.0),
        vec4(-hsize, hsize, -hsize, 0.0),
        vec4(-hsize, -hsize, -hsize, 0.0),

        //6
        vec4(-hsize, -hsize, -hsize, 0.0),
        vec4(-hsize, -hsize, hsize, 0.0),
        vec4(-hsize, hsize, hsize, 0.0),

        //7
        vec4(hsize, hsize, hsize, 0.0),
        vec4(hsize, hsize, -hsize, 0.0),
        vec4(hsize, -hsize, -hsize, 0.0),

        //8
        vec4(hsize, -hsize, -hsize, 0.0),
        vec4(hsize, -hsize, hsize, 0.0),
        vec4(hsize, hsize, hsize, 0.0),

        //9
        vec4(-hsize, -hsize, -hsize, 0.0),
        vec4(hsize, -hsize, -hsize, 0.0),
        vec4(hsize, -hsize, hsize, 0.0),

        //10
        vec4(hsize, -hsize, hsize, 0.0),
        vec4(-hsize, -hsize, hsize, 0.0),
        vec4(-hsize, -hsize, -hsize, 0.0),

        //11
        vec4(-hsize, hsize, -hsize, 0.0),
        vec4(hsize, hsize, -hsize, 0.0),
        vec4(hsize, hsize, hsize, 0.0),

        //12
        vec4(hsize, hsize, hsize, 0.0),
        vec4(-hsize, hsize, hsize, 0.0),
        vec4(-hsize, hsize, -hsize, 0.0)
    );

    for(int i = 0; i < 12*3; i++) {
        gl_Position = position + vertices[i] * projection;
        EmitVertex();
    }

    EndPrimitive();
}

