non linear slider for brush tip control

This commit is contained in:
2017-05-31 07:46:40 +01:00
parent 0f721393bb
commit 7495972763
3 changed files with 19 additions and 4 deletions

View File

@@ -164,8 +164,8 @@ ui::StrokeSample ui::Stroke::randomize_sample(const glm::vec2& pos, float pressu
StrokeSample s;
s.angle = (m_brush.m_tip_angle + rnd_nor() * m_brush.m_jitter_angle) * (float)(M_PI * 2.0);
s.pos = pos + (rnd_vec() * m_brush.m_jitter_spread * 100.f);
s.size = 100.f * m_brush.m_tip_size * (1.f - rnd_nor() * m_brush.m_jitter_scale);
s.flow = m_brush.m_tip_flow * (1.f - rnd_nor() * m_brush.m_jitter_flow) * pressure;
s.size = 800.f * glm::pow(m_brush.m_tip_size, 2.f) * (1.f - rnd_nor() * m_brush.m_jitter_scale);
s.flow = glm::pow(m_brush.m_tip_flow, 2.f) * (1.f - rnd_nor() * m_brush.m_jitter_flow) * pressure;
return s;
}
std::vector<ui::StrokeSample> ui::Stroke::compute_samples()
@@ -214,7 +214,7 @@ void ui::Stroke::start(const ui::Brush& brush)
{
m_last_kp = 0;
m_dist = 0.f;
m_step = glm::max(brush.m_tip_spacing * brush.m_tip_size * 30, 0.1f);
m_step = glm::max(brush.m_tip_spacing * 10, 1.f);
m_brush = brush;
prng.seed(0);
}