diff options
author | Lukas Matena <lukasmatena@seznam.cz> | 2020-01-16 15:08:37 +0300 |
---|---|---|
committer | Lukas Matena <lukasmatena@seznam.cz> | 2020-01-16 15:18:43 +0300 |
commit | d9786f2bcddf2d79aead22354b7b8ca99d5736fd (patch) | |
tree | 405605b740834fadaf5c76dd14e2194060fde5f0 /src | |
parent | 822f9ff4a6921a7b42af4689da8dc387716129e0 (diff) |
Fixed SLA gizmos picking problem - hollowed mesh was not rendered for picking
Diffstat (limited to 'src')
-rw-r--r-- | src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp | 28 | ||||
-rw-r--r-- | src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp | 1 | ||||
-rw-r--r-- | src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 31 | ||||
-rw-r--r-- | src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp | 1 |
4 files changed, 38 insertions, 23 deletions
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp index a832b5e5c..d02fdd077 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp @@ -115,6 +115,23 @@ void GLGizmoHollow::on_render() const glsafe(::glEnable(GL_BLEND)); glsafe(::glEnable(GL_DEPTH_TEST)); + m_z_shift = selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z(); + + render_hollowed_mesh(); + + if (m_quadric != nullptr && selection.is_from_single_instance()) + render_points(selection, false); + + m_selection_rectangle.render(m_parent); + render_clipping_plane(selection); + + glsafe(::glDisable(GL_BLEND)); +} + + + +void GLGizmoHollow::render_hollowed_mesh() const +{ if (m_c->m_volume_with_cavity) { m_c->m_volume_with_cavity->set_sla_shift_z(m_z_shift); m_parent.get_shader().start_using(); @@ -132,16 +149,6 @@ void GLGizmoHollow::on_render() const m_c->m_volume_with_cavity->render(color_id, print_box_detection_id, print_box_worldmatrix_id); m_parent.get_shader().stop_using(); } - - m_z_shift = selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z(); - - if (m_quadric != nullptr && selection.is_from_single_instance()) - render_points(selection, false); - - m_selection_rectangle.render(m_parent); - render_clipping_plane(selection); - - glsafe(::glDisable(GL_BLEND)); } @@ -241,6 +248,7 @@ void GLGizmoHollow::on_render_for_picking() const glsafe(::glEnable(GL_DEPTH_TEST)); render_points(selection, true); + render_hollowed_mesh(); } void GLGizmoHollow::render_points(const Selection& selection, bool picking) const diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp index b6a125972..f6560c861 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp @@ -52,6 +52,7 @@ private: void render_points(const Selection& selection, bool picking = false) const; void render_clipping_plane(const Selection& selection) const; + void render_hollowed_mesh() const; bool is_mesh_update_necessary() const; void update_mesh(); void hollow_mesh(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 45a766ccc..c6e0d9007 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -126,6 +126,23 @@ void GLGizmoSlaSupports::on_render() const glsafe(::glEnable(GL_BLEND)); glsafe(::glEnable(GL_DEPTH_TEST)); + m_z_shift = selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z(); + + render_hollowed_mesh(); + + if (m_quadric != nullptr && selection.is_from_single_instance()) + render_points(selection, false); + + m_selection_rectangle.render(m_parent); + render_clipping_plane(selection); + + glsafe(::glDisable(GL_BLEND)); +} + + + +void GLGizmoSlaSupports::render_hollowed_mesh() const +{ if (m_c->m_volume_with_cavity) { m_c->m_volume_with_cavity->set_sla_shift_z(m_z_shift); m_parent.get_shader().start_using(); @@ -143,19 +160,6 @@ void GLGizmoSlaSupports::on_render() const m_c->m_volume_with_cavity->render(color_id, print_box_detection_id, print_box_worldmatrix_id); m_parent.get_shader().stop_using(); } - // Show/hide the original object - //m_parent.toggle_model_objects_visibility(! m_editing_mode && ! m_c->m_cavity_mesh, m_c->m_model_object, m_c->m_active_instance); - //m_parent.toggle_sla_auxiliaries_visibility(! m_editing_mode, m_c->m_model_object, m_c->m_active_instance); - - m_z_shift = selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z(); - - if (m_quadric != nullptr && selection.is_from_single_instance()) - render_points(selection, false); - - m_selection_rectangle.render(m_parent); - render_clipping_plane(selection); - - glsafe(::glDisable(GL_BLEND)); } @@ -256,6 +260,7 @@ void GLGizmoSlaSupports::on_render_for_picking() const glsafe(::glEnable(GL_DEPTH_TEST)); render_points(selection, true); + render_hollowed_mesh(); } void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking) const diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp index 7700ad3a6..3697e7af6 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp @@ -90,6 +90,7 @@ private: //void render_selection_rectangle() const; void render_points(const Selection& selection, bool picking = false) const; void render_clipping_plane(const Selection& selection) const; + void render_hollowed_mesh() const; bool is_mesh_update_necessary() const; void update_mesh(); bool unsaved_changes() const; |