change brush preview curve and fix max size also on dual brush

This commit is contained in:
2019-02-27 19:12:11 +01:00
parent f8987e2236
commit b8cf9c7318

View File

@@ -245,8 +245,12 @@ void NodeStrokePreview::draw_stroke()
m_sampler_linear.bind(4);
const auto& b = m_brush;
float w = m_size.x * App::I.zoom;
float h = m_size.y * App::I.zoom;
m_stroke.m_filter_points = false;
m_stroke.m_max_size = m_size.y;
m_stroke.m_max_size = h * .75f;
m_stroke.m_camera.fov = Canvas::I->m_cam_fov;
m_stroke.m_camera.rot = Canvas::I->m_cam_rot;
m_stroke.reset(true);
@@ -274,6 +278,7 @@ void NodeStrokePreview::draw_stroke()
if (b->m_dual_enabled)
{
m_dual_stroke.m_filter_points = false;
m_dual_stroke.m_max_size = m_stroke.m_max_size * b->m_dual_size;
m_dual_stroke.m_camera.fov = Canvas::I->m_cam_fov;
m_dual_stroke.m_camera.rot = Canvas::I->m_cam_rot;
m_dual_stroke.reset(true);
@@ -281,12 +286,15 @@ void NodeStrokePreview::draw_stroke()
}
{
float w = m_size.x * App::I.zoom;
float h = m_size.y * App::I.zoom;
glm::vec2 pad = { 10, 10 };
if (!b->m_tip_size_pressure)
pad.x = pad.y = m_size.y * App::I.zoom * .15f;
std::vector<glm::vec2> kp = { pad, { pad.x, h - pad.y },{ w - pad.x, pad.y },{ w - pad.x, h - pad.y } };
float pad = glm::max(glm::min(m_stroke.m_max_size, m_brush->m_tip_size) / 2.f, 10.f);
if (b->m_tip_size_pressure)
pad = 10.f;
std::vector<glm::vec2> kp = {
{ pad, h / 2.f },
{ w / 2.f, 0 },
{ w / 2.f, h },
{ w - pad, h / 2.f },
};
for (int i = 0; i < 100; i++)
{
float t = (float)i / 100.f;