#version 330 core

layout(location = 0) in vec3 localVertex;
layout(location = 1) in vec3 dropPos;
layout(location = 2) in float dropLength;
layout(location = 3) in float dropAlpha;

uniform mat4 projection;
uniform vec3 wind;
uniform float dropWidth;

out float vertexAlpha;
out vec3 worldPos;

void main() {
    vec3 streak = vec3(-wind.x * 0.08, -dropLength, -wind.z * 0.08) * localVertex.y;

    vec3 widthOffset = localVertex.z < 0.5
        ? vec3(localVertex.x * dropWidth, 0.0, 0.0)
        : vec3(0.0, 0.0, localVertex.x * dropWidth);

    worldPos = dropPos + streak + widthOffset;
    vertexAlpha = dropAlpha;
    gl_Position = projection * vec4(worldPos, 1.0);
}
