implement brush outline

This commit is contained in:
2019-01-18 11:11:00 +01:00
parent 580fab77c6
commit 8315b32550
4 changed files with 18 additions and 2 deletions

View File

@@ -161,7 +161,15 @@ void App::initShaders()
"out mediump vec4 frag;\n"
"void main() {\n"
" mediump float stroke = 1.0 - texture(tex, uv).r;\n"
" frag = vec4(col.rgb, stroke * alpha);\n"
" int zero_count = 0;\n"
" for (int x = -1; x <= 1; x++){\n"
" for (int y = -1; y <= 1; y++){\n"
" if (textureOffset(tex, uv, ivec2(x, y)).r == 1.0) \n"
" zero_count++;\n"
" }\n"
" }\n"
" float edge = (zero_count > 1 && zero_count < 9) ? 0.75 : 0.0;\n"
" frag = vec4(col.rgb, edge);\n"
"}\n";
// TEXTURE COMP ERASE
static const char* shader_comp_erase_f =