#include <bnb/glsl.frag>

BNB_IN(0)
vec2 var_uv;
BNB_IN(1)
vec2 var_uv_alpha;

BNB_DECLARE_SAMPLER_VIDEO(0, 1, bnb_VIDEO);
BNB_DECLARE_SAMPLER_VIDEO(2, 3, bnb_ALPHA);

void main()
{
    vec3 rgb = BNB_TEXTURE_2D(BNB_SAMPLER_2D(bnb_VIDEO), var_uv).xyz;
    float a = 0.f;
    if (use_alpha.x == 1.0f) {
        a = BNB_TEXTURE_2D(BNB_SAMPLER_2D(bnb_VIDEO), var_uv_alpha).x;
    } else {
        a = BNB_TEXTURE_2D(BNB_SAMPLER_2D(bnb_ALPHA), var_uv_alpha).x;
    }
    bnb_FragColor = vec4(rgb, a);
}
