#include "version.sh"

in highp vec2 texCoord_f;
in highp vec2 texCoord1_f;

uniform highp vec2 uvOffset;
uniform highp float cutHeadProgress;
uniform highp float cutTailProgress;

uniform lowp vec4 mixColor;
uniform lowp vec4 mixColor1;


uniform sampler2D texUnit;
uniform sampler2D texUnit1;

layout(location = 0) out vec4 fragColor;

void main()
{
    highp vec4 color0 = texture(texUnit, texCoord_f) * mixColor;
    highp vec2 uv = texCoord1_f + uvOffset;
    highp vec4 color1 = texture(texUnit1, uv) * mixColor1;
    highp vec4 outColor = vec4(color1.xyz + color0.xyz * (1.0 - color1.w), color0.w);
    if(texCoord1_f.y < cutHeadProgress) 
        discard;
    if(texCoord1_f.y > cutTailProgress) 
        discard;
    fragColor = outColor;
}
