FDM supports gizmo: fixed rendering on mirrored objects

This commit is contained in:
Lukas Matena 2020-05-21 10:22:25 +02:00
parent feb591782f
commit ff0630cad2

View File

@ -120,6 +120,10 @@ void GLGizmoFdmSupports::render_triangles(const Selection& selection) const
mo->instances[selection.get_instance_idx()]->get_transformation().get_matrix() * mo->instances[selection.get_instance_idx()]->get_transformation().get_matrix() *
mv->get_matrix(); mv->get_matrix();
bool is_left_handed = trafo_matrix.matrix().determinant() < 0.;
if (is_left_handed)
glsafe(::glFrontFace(GL_CW));
glsafe(::glPushMatrix()); glsafe(::glPushMatrix());
glsafe(::glMultMatrixd(trafo_matrix.data())); glsafe(::glMultMatrixd(trafo_matrix.data()));
@ -130,6 +134,8 @@ void GLGizmoFdmSupports::render_triangles(const Selection& selection) const
iva.render(); iva.render();
} }
glsafe(::glPopMatrix()); glsafe(::glPopMatrix());
if (is_left_handed)
glsafe(::glFrontFace(GL_CCW));
} }
if (clipping_plane_active) if (clipping_plane_active)
glsafe(::glDisable(GL_CLIP_PLANE0)); glsafe(::glDisable(GL_CLIP_PLANE0));