From 0f9a9de745726ef9f67a5b7ebfea3cc33e432274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Mon, 25 Oct 2021 08:41:41 +0200 Subject: [PATCH] Fixed darker colors of objects inside multi-material gizmo when objects are mirrored. --- resources/shaders/mm_gouraud.fs | 5 +++++ src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/resources/shaders/mm_gouraud.fs b/resources/shaders/mm_gouraud.fs index f7154b419a..5932efe592 100644 --- a/resources/shaders/mm_gouraud.fs +++ b/resources/shaders/mm_gouraud.fs @@ -22,6 +22,8 @@ uniform vec4 uniform_color; varying vec3 clipping_planes_dots; varying vec4 model_pos; +uniform bool volume_mirrored; + void main() { if (any(lessThan(clipping_planes_dots, ZERO))) @@ -34,6 +36,9 @@ void main() triangle_normal = -triangle_normal; #endif + if (volume_mirrored) + triangle_normal = -triangle_normal; + // First transform the normal into camera space and normalize the result. vec3 eye_normal = normalize(gl_NormalMatrix * triangle_normal); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index ee15dab888..4e86b562b1 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -203,6 +203,7 @@ void GLGizmoMmuSegmentation::render_triangles(const Selection &selection) const glsafe(::glMultMatrixd(trafo_matrix.data())); shader->set_uniform("volume_world_matrix", trafo_matrix); + shader->set_uniform("volume_mirrored", is_left_handed); m_triangle_selectors[mesh_id]->render(m_imgui); glsafe(::glPopMatrix());