add color burn, fragment early discard

This commit is contained in:
2019-02-22 14:52:01 +01:00
parent 099b1bddc5
commit edc2bacc90
4 changed files with 34 additions and 14 deletions

View File

@@ -59,6 +59,10 @@ void main()
mediump float brush_alpha = ( 1.0 - texture(tex, uv/q).r ) * alpha;
mediump vec4 fg = vec4(col.rgb, brush_alpha);
// early discard
if (fg.a == 0.0)
discard;
if (use_pattern)
{
mediump vec2 rscale = resolution / vec2(512.0);
@@ -84,7 +88,7 @@ void main()
fg.a *= 1.0-rand(uv2+uv)*noise;
// no need to go further
if (fg.a == 0.0)
if (fg.a <= 0.0)
discard;
if (mix_alpha > 0.0)