#version 150

#moj_import <minecraft:dynamictransforms.glsl>
#moj_import <minecraft:projection.glsl>

in vec3 Position;

out vec3 pos;
flat out int vertex;

vec2[] CORNERS = vec2[](
    vec2(-1, 1),
    vec2(-1, -1),
    vec2(1, -1),
    vec2(1, 1)
);

void main() {
    int quadID = gl_VertexID / 4;
    float size = (quadID % 8 == 0) ? 1.0 : (abs(sin(float(quadID))) * 0.25 + 0.1);

    vec4 adjustedPos = ModelViewMat * vec4(Position, 1.0)
        + vec4(CORNERS[gl_VertexID % 4] * size / 3.25, 0.0, 0.0);
    gl_Position = ProjMat * adjustedPos;

    pos = Position;
    vertex = quadID;
}
