Files
panopainter/data/shaders/texture-alpha-sep.glsl

35 lines
616 B
GLSL

[[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]]
uniform sampler2D tex;
uniform sampler2D tex_alpha;
uniform sampler2D tex_bg;
uniform highp float alpha;
uniform bool highlight;
in highp vec2 uv;
out highp vec4 frag;
void main()
{
highp vec3 rgb = texture(tex, uv).rgb;
highp float a = texture(tex_alpha, uv).a;
highp vec4 c = vec4(rgb, a);
frag = highlight ?
vec4(clamp(vec3(0.3) + c.rgb, vec3(0.0), vec3(1.0)), c.a) :
texture(tex, uv) * vec4(1.0, 1.0, 1.0, alpha);
}