From 7150e0adda2673797b624e314782a81ca8279bb7 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 25 Jan 2022 13:59:10 +0100 Subject: [PATCH 1/2] Follow-up of f2a7245f365570660b85755003b45cc448117c76 - Apply clamping max bounding box to avoid z-fighting only in gcode preview --- src/slic3r/GUI/GLCanvas3D.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index f33377880c..d9e515b2ad 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5001,15 +5001,17 @@ BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_be bb.merge(m_gcode_viewer.get_max_bounding_box()); // clamp max bb size with respect to bed bb size - static const double max_scale_factor = 1.5; - const Vec3d bb_size = bb.size(); - const Vec3d bed_bb_size = bed_bb.size(); - if (bb_size.x() > max_scale_factor * bed_bb_size.x() || - bb_size.y() > max_scale_factor * bed_bb_size.y() || - bb_size.z() > max_scale_factor * bed_bb_size.z()) { - const Vec3d bed_bb_center = bed_bb.center(); - const Vec3d extend_by = max_scale_factor * bed_bb_size; - bb = BoundingBoxf3(bed_bb_center - extend_by, bed_bb_center + extend_by); + if (!m_picking_enabled) { + static const double max_scale_factor = 1.5; + const Vec3d bb_size = bb.size(); + const Vec3d bed_bb_size = bed_bb.size(); + if (bb_size.x() > max_scale_factor * bed_bb_size.x() || + bb_size.y() > max_scale_factor * bed_bb_size.y() || + bb_size.z() > max_scale_factor * bed_bb_size.z()) { + const Vec3d bed_bb_center = bed_bb.center(); + const Vec3d extend_by = max_scale_factor * bed_bb_size; + bb = BoundingBoxf3(bed_bb_center - extend_by, bed_bb_center + extend_by); + } } return bb; From c823ea07106599649add3705d87da8416703bc6b Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 25 Jan 2022 16:20:33 +0100 Subject: [PATCH 2/2] Fixed build on asan linux --- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d9e515b2ad..4898b63510 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -467,7 +467,7 @@ void GLCanvas3D::LayersEditing::render_profile(const Rect& bar_rect) const entity.positions.reserve(m_layer_height_profile.size()); entity.normals.reserve(m_layer_height_profile.size()); entity.indices.reserve(m_layer_height_profile.size()); - for (unsigned int i = 0; i < unsigned int(m_layer_height_profile.size()); i += 2) { + for (unsigned int i = 0; i < (unsigned int)m_layer_height_profile.size(); i += 2) { entity.positions.emplace_back(bar_rect.get_left() + float(m_layer_height_profile[i + 1]) * scale_x, bar_rect.get_bottom() + float(m_layer_height_profile[i]) * scale_y, 0.0f); entity.normals.emplace_back(Vec3f::UnitZ()); entity.indices.emplace_back(i / 2);