#version 450 core

#pragma include ./shared.glsl
#pragma include ../misc/glow.glsl
#pragma include ../misc/global.glsl

const float GLOW_ALPHA = 0.20;
const GlowArgs GLOW_ARGS = {
    /* step0      */ 0.100,
    /* step1      */ 1.900,
    /* pulseSize0 */ 0.050,
    /* pulseSize1 */ 0.200,
    /* pulseTime  */ 2.000,
};

in FragmentData fragmentData;

uniform vec4 uGlowColor;
uniform sampler2D uTexture;

out vec4 outColor;

void main() {
    float alpha = glow(GLOW_ARGS, fragmentData.texCoords - vec2(0.5), uGlobal.time);
    vec4 glow = vec4(uGlowColor.rgb, uGlowColor.a * alpha * GLOW_ALPHA);
    vec4 tex = texture(uTexture, fragmentData.texCoords);

    outColor = tex * tex.a + glow * (1.0 - tex.a);
}
