dual-brush blend modes

This commit is contained in:
2019-02-15 02:17:04 +01:00
parent 6aca330db3
commit 945c51aa25
6 changed files with 29 additions and 14 deletions

View File

@@ -562,8 +562,12 @@ void Canvas::stroke_draw()
if (P.size() < 3)
continue;
m_tmp_dual[i].bindFramebuffer();
stroke_draw_samples(i, P);
auto rect = stroke_draw_samples(i, P);
m_tmp_dual[i].unbindFramebuffer();
// this mode overflows the main brush boundries
if (brush->m_dual_blend_mode == 0)
m_dirty_box[i] = glm::clamp(box_union(m_dirty_box[i], rect), glm::vec4(0), glm::vec4(m_width));
}
}
glActiveTexture(GL_TEXTURE2);
@@ -791,8 +795,8 @@ void Canvas::stroke_commit()
ShaderManager::u_int(kShaderUniform::BlendMode, m_current_stroke->m_brush->m_blend_mode);
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
ShaderManager::u_int(kShaderUniform::TexDual, 3);
ShaderManager::u_int(kShaderUniform::UseDual, true);
ShaderManager::u_int(kShaderUniform::DualBlendMode, 1);
ShaderManager::u_int(kShaderUniform::UseDual, m_current_stroke->m_brush->m_dual_enabled);
ShaderManager::u_int(kShaderUniform::DualBlendMode, m_current_stroke->m_brush->m_dual_blend_mode);
glActiveTexture(GL_TEXTURE0);
m_tex2[i].bind();