Set default document res to 6K. Implement blending on canvas, mixer and export equirect.

This commit is contained in:
2019-01-07 15:32:12 +01:00
parent 006c838449
commit 7773026358
9 changed files with 144 additions and 65 deletions

View File

@@ -83,6 +83,24 @@ void App::initShaders()
"void main() {\n"
" frag = texture(tex, uv);\n"
"}\n";
static const char* shader_blend_f =
SHADER_VERSION
"uniform sampler2D tex;\n"
"uniform sampler2D tex_alpha;\n"
"uniform sampler2D tex_bg;\n"
"uniform mediump float alpha;\n"
"uniform int blend_mode;\n"
"in mediump vec2 uv;\n"
"out mediump vec4 frag;\n"
SHADER_FUNCTION_BLEND
"void main() {\n"
" mediump vec4 bg = texture(tex_bg, uv);\n"
" mediump vec4 fg = vec4(texture(tex, uv).rgb, texture(tex_alpha, uv).a);\n"
" if (fg.a == 0.0) { frag = bg; return; }\n"
" mediump float contribution = (1.0 - bg.a) * fg.a;\n"
" mediump float alpha_tot = bg.a + contribution;\n"
" frag = vec4(blend(bg, fg, alpha_tot, blend_mode), alpha_tot * alpha);\n"
"}\n";
static const char* shader_uv_f =
SHADER_VERSION
"in mediump vec2 uv;\n"
@@ -109,6 +127,7 @@ void App::initShaders()
SHADER_VERSION
"uniform sampler2D tex;\n"
"uniform sampler2D tex_alpha;\n"
"uniform sampler2D tex_bg;\n"
"uniform mediump float alpha;\n"
"uniform bool highlight;\n"
"in mediump vec2 uv;\n"
@@ -503,6 +522,8 @@ void App::initShaders()
LOG("Failed to create shader TextureAlpha");
if (!ShaderManager::create(kShader::TextureAlphaSep, shader_v, shader_alpha_sep_f))
LOG("Failed to create shader TextureAlphaSep");
if (!ShaderManager::create(kShader::TextureBlend, shader_v, shader_blend_f))
LOG("Failed to create shader TextureBlend");
if (!ShaderManager::create(kShader::StrokePreview, shader_v, shader_stroke_preview_f))
LOG("Failed to create shader StrokePreview");
if (!ShaderManager::create(kShader::CompErase, shader_v, shader_comp_erase_f))