fix stroke preview mixer render, add curve to mixer slider

This commit is contained in:
2019-11-16 17:33:59 +01:00
parent 3dae95023f
commit cdd5f1a7ae
2 changed files with 18 additions and 12 deletions

View File

@@ -32,6 +32,7 @@ void NodePanelStroke::update_controls()
m_tip_opacity->m_value = b->m_tip_opacity;
m_tip_angle->m_value = b->m_tip_angle;
m_tip_angle_smooth->m_value = b->m_tip_angle_smooth;
m_tip_mix->m_value = m_curves[m_tip_mix].to_slider(b->m_tip_mix);
m_tip_wet->m_value = b->m_tip_wet;
m_tip_noise->m_value = b->m_tip_noise;
m_jitter_scale->m_value = b->m_jitter_scale;
@@ -405,6 +406,10 @@ void NodePanelStroke::init_controls()
[](float v) { return glm::pow(v, 2.f); },
[](float v) { return glm::pow(v, 1.f / 2.f); },
};
SliderCurve curve_mix {
[](float v) { return glm::pow(v, 1.f / 10.f); },
[](float v) { return glm::pow(v, 10.f); },
};
SliderCurve curve_linear1k_perc {
[](float v) { return v * 10.f; },
[](float v) { return v * 0.1f; },
@@ -459,6 +464,7 @@ void NodePanelStroke::init_controls()
m_curves[m_dual_flow] = curve_quad;
m_curves[m_pattern_scale] = curve_size1k_perc;
m_curves[m_jitter_scatter] = curve_linear1k_perc;
m_curves[m_tip_mix] = curve_mix;
m_tip_aspect_reset = find<NodeButtonCustom>("tip-aspect-reset");
m_tip_aspect_reset->on_click = [this](Node*) {

View File

@@ -391,6 +391,18 @@ void NodeStrokePreview::draw_stroke_immediate()
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, size.x, size.y);
}
// CHEKCERBOARD
// copy background color to tex2
ShaderManager::use(kShader::Checkerboard);
ShaderManager::u_int(kShaderUniform::Colorize, b->m_tip_mix > 0.f || b->m_blend_mode != 0);
float aspect = size.x / size.y;
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f / aspect, .5f / aspect, -1.f, 1.f));
m_plane.draw_fill();
//m_rtt.clear({ .3f, .3f, .3f, 1.f });
m_tex_background.bind();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, size.x, size.y);
// DRAW MAIN BRUSH
ShaderManager::use(kShader::Stroke);
@@ -435,18 +447,6 @@ void NodeStrokePreview::draw_stroke_immediate()
m_tex.bind();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, size.x, size.y);
// CHEKCERBOARD
// copy background color to tex2
ShaderManager::use(kShader::Checkerboard);
ShaderManager::u_int(kShaderUniform::Colorize, b->m_tip_mix > 0.f || b->m_blend_mode != 0);
float aspect = size.x / size.y;
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f / aspect, .5f / aspect, -1.f, 1.f));
m_plane.draw_fill();
//m_rtt.clear({ .3f, .3f, .3f, 1.f });
m_tex_background.bind();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, size.x, size.y);
// COMPOSITE
ShaderManager::use(kShader::CompDraw);