
#include "/lib/config/master.glsl"

#ifdef FRAGMENT_SHADER

in vec2 texCoord;
in vec4 glColor;

#ifdef COLOR_CODED_PROGRAMS
    #include "/lib/fx/unified.glsl"
#endif

void main() {

    vec4 color = texture2D(tex, texCoord) * glColor;

    #ifdef LU_IPBR
        if (lu_CheckForColor(color.rgb, vec3(224, 121, 250))) {
            color.rgb = vec3(0.8, 0.25, 0.8);
        }
    #endif

    color.rgb *= 1.0 - 0.6 * lu_pow2(lu_pow2(lu_min1(lu_GetLuminance(color.rgb) * 1.2)));

    color.rgb = lu_pow1_5(color.rgb);

    color.rgb *= lu_pow2(1.0 + color.b + 0.5 * color.g) * 1.5;

    #ifdef COLOR_CODED_PROGRAMS
        lu_ColorCodeProgram(color, -1);
    #endif

    /* DRAWBUFFERS:0 */
    gl_FragData[0] = color;
}

#endif

#ifdef VERTEX_SHADER

out vec2 texCoord;
out vec4 glColor;

void main() {

    gl_Position = ftransform();

    texCoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;

    glColor = gl_Color;
}

#endif
