From fa74f50af1761b1778a1da4e8d751fe65383e080 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 12 Oct 2020 13:05:22 +0200 Subject: [PATCH] Fixed clipping plane in painter gizmos: Obsolete variable m_clipping_plane was used instead of getting the clipping plane from the common gizmo data pool. This means the clipped parts of objects captured hits and could not be painted through. The clipped_mesh_was_hit variable is obsolete now. It was a mistake to introduce it in the first place. --- src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp | 25 +++++++------------- src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp | 3 --- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp index 4c159d79d8..d54e93b1dd 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp @@ -20,7 +20,6 @@ namespace GUI { GLGizmoPainterBase::GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id) : GLGizmoBase(parent, icon_filename, sprite_id) { - m_clipping_plane.reset(new ClippingPlane()); // Make sphere and save it into a vertex buffer. const TriangleMesh sphere_mesh = make_sphere(1., (2*M_PI)/24.); for (size_t i=0; iobject_clipper()->get_clipping_plane(), &facet)) { // In case this hit is clipped, skip it. - if (is_mesh_point_clipped(hit.cast(), trafo_matrices[mesh_id])) { - clipped_mesh_was_hit = true; + if (is_mesh_point_clipped(hit.cast(), trafo_matrices[mesh_id])) continue; - } // Is this hit the closest to the camera so far? double hit_squared_distance = (camera.get_position()-trafo_matrices[mesh_id]*hit.cast()).squaredNorm(); @@ -449,7 +442,7 @@ void GLGizmoPainterBase::update_raycast_cache(const Vec2d& mouse_position, } } - m_rr = {mouse_position, closest_hit_mesh_id, closest_hit, closest_facet, clipped_mesh_was_hit}; + m_rr = {mouse_position, closest_hit_mesh_id, closest_hit, closest_facet}; } bool GLGizmoPainterBase::on_is_activable() const diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp index 4fede0ec74..6f8cbec603 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp @@ -101,8 +101,6 @@ private: const Camera& camera, const std::vector& trafo_matrices) const; - float m_clipping_plane_distance = 0.f; - std::unique_ptr m_clipping_plane; GLIndexedVertexArray m_vbo_sphere; bool m_internal_stack_active = false; @@ -126,7 +124,6 @@ private: int mesh_id; Vec3f hit; size_t facet; - bool clipped_mesh_was_hit; }; mutable RaycastResult m_rr;