#version 450

layout(location = 0) in vec2 iFragTexCoord;
layout(location = 1) in vec4 iColor;
layout(location = 2) in vec4 iConfig;

layout(set = 0, binding = 0) uniform sampler2D uTexture;

layout(location = 0) out vec4 oFragColor;

void main() {
    vec4 color = iColor;
    vec4 texColor = texture(uTexture, iFragTexCoord);
    texColor.rgb *= texColor.a;

    if (iConfig.x > 0) color *= texColor;
    if (iConfig.y > 0) color.a = texColor.r;

    oFragColor = color;
}
