#version 450
layout(location = 0) in vec4 aData;
layout(location = 0) out float vV; // xz box pos, y seed, w = end (0 bottom, 1 top)

layout(std140, binding = 0) uniform Globals {
    mat4  uVP;
    vec3  uCam;
    float uTime;
    float uRain;
};

void main() {
    vV = aData.w;
    float H = 26.0, speed = 22.0, streak = 1.4;
    float fall = mod(aData.y - uTime * speed, H);
    float y = uCam.y + (H * 0.5 - fall) + aData.w * streak;
    vec3 w = vec3(floor(uCam.x) + aData.x, y, floor(uCam.z) + aData.z);
    gl_Position = uVP * vec4(w, 1.0);
}
