#version 330

in vec2 fragTexCoord;
uniform sampler2D texture0;
uniform float texelH;
uniform float intensity;

out vec4 finalColor;

void main() {
    vec3 bloom = vec3(0.0);
    float total = 0.0;
    for (int i = -24; i <= 24; i++) {
        float w = exp(-float(i * i) * 0.004);
        bloom += texture(texture0, fragTexCoord + vec2(0.0, float(i) * texelH)).rgb * w;
        total += w;
    }
    bloom /= total;
    finalColor = vec4(bloom * intensity, 1.0);
}
