in float r;
in float g;
in float b;
uniform float brightness;

out vec4 fragColor;

vec4 enlight(vec4 color, float rate) {
    return vec4(1.0, 1.0, 1.0, 1.0) * rate + color * (1.0 - rate);
}

void main(void)
{
    if (b < 0) {
        if (r < 0.0)
            fragColor = vec4(0.0, 0.0, 0.0, 0.0);
        else if (r > 1)
            fragColor = vec4(1.0, 0.1, 1.0, 1.0);
        else {
            fragColor = enlight(colormap(r), brightness);
        }
    }
    else {
        fragColor = vec4(r / 256, g / 256, b / 256, 1);
    }
    
}
