complete dual-brush implementation and ui integration
This commit is contained in:
@@ -282,7 +282,7 @@ std::array<std::vector<vertex_t>, 6> Canvas::stroke_draw_project(std::array<vert
|
||||
std::array<std::vector<vertex_t>, 6> ret;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
auto P = poly_intersect(std::data(B), std::data(B) + 4, m_plane_shape[i]);
|
||||
auto P = poly_intersect(B.data(), B.data() + 4, m_plane_shape[i]);
|
||||
glm::mat4 plane_camera = glm::lookAt(m_plane_origin[i], m_plane_normal[i], m_plane_tangent[i]);
|
||||
int intersections = 0;
|
||||
for (int j = 0; j < P.size(); j++)
|
||||
@@ -847,7 +847,8 @@ void Canvas::stroke_commit()
|
||||
void Canvas::stroke_update(glm::vec3 point, float pressure)
|
||||
{
|
||||
m_current_stroke->add_point(point, pressure);
|
||||
m_dual_stroke->add_point(point, pressure);
|
||||
if (m_dual_stroke)
|
||||
m_dual_stroke->add_point(point, pressure);
|
||||
}
|
||||
void Canvas::stroke_start(glm::vec3 point, float pressure)
|
||||
{
|
||||
@@ -869,11 +870,29 @@ void Canvas::stroke_start(glm::vec3 point, float pressure)
|
||||
m_current_stroke->start(m_current_brush);
|
||||
m_current_stroke->add_point(point, pressure);
|
||||
|
||||
m_dual_stroke = std::make_unique<Stroke>();
|
||||
m_dual_stroke->m_camera.rot = m_cam_rot;
|
||||
m_dual_stroke->m_camera.fov = m_cam_fov;
|
||||
m_dual_stroke->start(m_dual_brush);
|
||||
m_dual_stroke->add_point(point, pressure);
|
||||
// Generate a brush for the dual-brush
|
||||
if (m_current_brush->m_dual_enabled)
|
||||
{
|
||||
auto dual_brush = std::make_shared<Brush>();
|
||||
dual_brush->m_tip_flow = m_current_brush->m_dual_flow;
|
||||
dual_brush->m_tip_opacity = m_current_brush->m_dual_opacity;
|
||||
dual_brush->m_tip_flipx = m_current_brush->m_dual_flipx;
|
||||
dual_brush->m_tip_flipy = m_current_brush->m_dual_flipy;
|
||||
dual_brush->m_tip_invert = m_current_brush->m_dual_invert;
|
||||
dual_brush->m_blend_mode = m_current_brush->m_dual_blend_mode;
|
||||
dual_brush->m_tip_randflipx = m_current_brush->m_dual_randflip;
|
||||
dual_brush->m_tip_randflipy = m_current_brush->m_dual_randflip;
|
||||
dual_brush->m_tip_size = m_current_brush->m_dual_size;
|
||||
dual_brush->m_tip_spacing = m_current_brush->m_dual_spacing;
|
||||
dual_brush->m_jitter_spread = m_current_brush->m_dual_scatter;
|
||||
dual_brush->m_jitter_angle = m_current_brush->m_dual_rotate;
|
||||
dual_brush->m_tip_texture = m_current_brush->m_dual_texture;
|
||||
m_dual_stroke = std::make_unique<Stroke>();
|
||||
m_dual_stroke->m_camera.rot = m_cam_rot;
|
||||
m_dual_stroke->m_camera.fov = m_cam_fov;
|
||||
m_dual_stroke->start(dual_brush);
|
||||
m_dual_stroke->add_point(point, pressure);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
@@ -884,7 +903,7 @@ void Canvas::stroke_start(glm::vec3 point, float pressure)
|
||||
m_tmp[i].clear({ 0, 0, 0, 0 });
|
||||
m_tmp[i].unbindFramebuffer();
|
||||
|
||||
if (m_current_stroke->m_brush->m_dual_enabled)
|
||||
if (m_current_brush->m_dual_enabled)
|
||||
{
|
||||
m_tmp_dual[i].bindFramebuffer();
|
||||
m_tmp_dual[i].clear({ 0, 0, 0, 0 });
|
||||
|
||||
Reference in New Issue
Block a user