#version 150

uniform sampler2D DiffuseSampler;
uniform sampler2D LUTSampler;

in vec2 texCoord;

out vec4 fragColor;

void main(){
    vec4 oldColor = texture(DiffuseSampler, texCoord);
    float x = (mod((oldColor.b * 255.0), 16) * 256.0) + (oldColor.r * 255.0);
    float y = (floor((oldColor.b * 255.0) / 16.0) * 256.0) + (oldColor.g * 255.0);
    vec2 uv = vec2(x, y);
    vec4 newColor = vec4(texture(LUTSampler, uv / 4096.0).rgb, oldColor.a);
    fragColor = newColor;
}
