add brush follow-orientation flag to stroke settings and fix stroke preview

This commit is contained in:
2017-08-20 16:01:49 +01:00
parent eee574085b
commit 506923de69
8 changed files with 77 additions and 14 deletions

View File

@@ -69,6 +69,8 @@ void NodeStrokePreview::draw_stroke()
b.m_tip_size *= .7f; // reduce the size in the preview
m_stroke.reset();
m_stroke.start(b);
if (!m_stroke.m_keypoints.empty())
m_stroke.m_prev_sample.origin = m_stroke.m_keypoints[0].pos;
auto samples = m_stroke.compute_samples();
auto& tex = TextureManager::get(m_brush.m_tex_id);
tex.bind();
@@ -127,6 +129,7 @@ void NodeStrokePreview::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
float w = new_size.x;
float h = new_size.y;
std::vector<glm::vec2> kp = { { pad, pad },{ pad, h - pad },{ w - pad, pad },{ w - pad, h - pad } };
m_stroke.reset();
m_stroke.start(m_brush);
for (int i = 0; i < 20; i++)
m_stroke.add_point(BezierCurve::Bezier2D(kp, i / 20.f), 1.f);