add wet parameter, fix selection mask modes

This commit is contained in:
2017-10-27 00:47:48 +01:00
parent b40a5b656b
commit c8e115774f
12 changed files with 336 additions and 156 deletions

View File

@@ -249,6 +249,7 @@ void App::initShaders()
"uniform mediump float alpha;\n"
"uniform mediump vec2 stencil_offset;\n"
"uniform mediump float stencil_alpha;\n"
"uniform mediump float wet;\n"
"in mediump vec2 uv;\n"
"in mediump float q;\n"
#ifdef __IOS__
@@ -270,7 +271,9 @@ void App::initShaders()
" mediump float contribution = max((1.0 - bg.a) * fg.a, 1.0/255.0) * stencil;\n"
" mediump float alpha_tot = bg.a + contribution;"
" mediump vec3 rgb = mix(bg.rgb, fg.rgb, fg.a / alpha_tot);\n"
" frag = vec4(rgb, clamp(alpha_tot, 0.0, 1.0));\n"
" mediump vec4 frag_wet = vec4(rgb, mix(bg.a, max(bg.a, fg.a * stencil), fg.a));\n"
" mediump vec4 frag_dry = vec4(rgb, clamp(alpha_tot, 0.0, 1.0));\n"
" frag = mix(frag_dry, frag_wet, wet);\n"
"}\n";
static const char* shader_checkerboard_v =