#version 410 core

out vec4 FragColor;

in vec4 color;
in vec2 fragCoord;
in vec2 texCoord;

uniform sampler2D texture1;
uniform float time;

void main(){

    vec4 flash;

    flash = sin(flash + time * 15);
    flash = mix(flash, color, 0.5f);
    flash.a = 1f;

    vec4 tex = texture(texture1, texCoord);
    if (tex.a == 0.0 || (flash.x+ flash.y + flash.z)/3 <= (tex.x+ tex.y + tex.z)/3){
        FragColor = tex;
    } else{
        FragColor = mix(tex, flash, 0.3f);
    }
}