[[vertex]]

uniform mat4 mvp;

in vec4 pos;
in vec2 uvs;
out vec2 uv;

void main()
{
    uv = uvs;
    gl_Position = mvp * vec4(pos.xyz, 1.0);
}

[[fragment]]

#include "include/blur.glsl"

uniform sampler2D tex;
uniform sampler2D tex_stroke;
uniform sampler2D tex_mask;
uniform mediump float alpha;
uniform mediump vec2 resolution;
uniform bool mask;

in highp vec2 uv;
out highp vec4 frag;

void main()
{
    highp vec4 base = texture(tex, uv);
    highp vec4 stroke = texture(tex_stroke, uv);
    stroke.a = mask ? stroke.a * blur(tex_mask, uv).r : stroke.a;
    frag = vec4(base.rgb, clamp((base.a - stroke.a) * alpha, 0.0, 1.0));
}
