From 77d292283ba6e31e480bc92bb48ee6ae5171ae31 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 15 Oct 2020 12:20:38 +0200 Subject: [PATCH] Fixed rendering of thumbnails --- src/slic3r/GUI/GLCanvas3D.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index c2717761f..ad42b8ca7 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4472,8 +4472,7 @@ static void debug_output_thumbnail(const ThumbnailData& thumbnail_data) void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool printable_only, bool parts_only, bool show_bed, bool transparent_background) const { - auto is_visible = [](const GLVolume& v) -> bool - { + auto is_visible = [](const GLVolume& v) { bool ret = v.printable; ret &= (!v.shader_outside_printer_detection_enabled || !v.is_outside); return ret; @@ -4484,10 +4483,8 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool GLVolumePtrs visible_volumes; - for (GLVolume* vol : m_volumes.volumes) - { - if (!vol->is_modifier && !vol->is_wipe_tower && (!parts_only || (vol->composite_id.volume_id >= 0))) - { + for (GLVolume* vol : m_volumes.volumes) { + if (!vol->is_modifier && !vol->is_wipe_tower && (!parts_only || (vol->composite_id.volume_id >= 0))) { if (!printable_only || is_visible(*vol)) visible_volumes.emplace_back(vol); } @@ -4497,8 +4494,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool return; BoundingBoxf3 box; - for (const GLVolume* vol : visible_volumes) - { + for (const GLVolume* vol : visible_volumes) { box.merge(vol->transformed_bounding_box()); } @@ -4512,8 +4508,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool double near_z = -1.0; double far_z = -1.0; - if (show_bed) - { + if (show_bed) { // extends the near and far z of the frustrum to avoid the bed being clipped // box in eye space @@ -4524,7 +4519,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool camera.apply_projection(box, near_z, far_z); - GLShaderProgram* shader = wxGetApp().get_shader("gouraud"); + GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light"); if (shader == nullptr) return; @@ -4537,8 +4532,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool shader->start_using(); shader->set_uniform("print_box.volume_detection", 0); - for (const GLVolume* vol : visible_volumes) - { + for (const GLVolume* vol : visible_volumes) { shader->set_uniform("uniform_color", (vol->printable && !vol->is_outside) ? orange : gray); vol->render(); }