diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2019-04-01 11:00:10 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2019-04-01 11:00:10 +0300 |
commit | d87b478d6057de5085feaf0890a16fcc9b407438 (patch) | |
tree | 81b38f4a4bde2abe8265320ff3f14dcdadb533dc /src/slic3r/GUI/Selection.cpp | |
parent | 1ce3bb690c1378a5af71594876fde24b9e79739e (diff) | |
parent | ba89f04429cd89da25c97c9d474697ac4fe14700 (diff) |
Camera refactoring
1) All camera related OpenGL calls moved into class
2) The Camera class now stores the view matrix, the projection matrix and the viewport
3) The Camera class now exposes methods to get the camera orientation vectors, the camera position, the view matrix, the projection matrix and the viewport
4) All the code operating on the camera or requiring camera data has been modified to use the new methods
Diffstat (limited to 'src/slic3r/GUI/Selection.cpp')
-rw-r--r-- | src/slic3r/GUI/Selection.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 3f5f6ba4f..c568b41a8 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -971,7 +971,23 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field) const glsafe(::glTranslated(center(0), center(1), center(2))); if (!boost::starts_with(sidebar_field, "position")) { - Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true); + Transform3d orient_matrix = Transform3d::Identity(); + if (boost::starts_with(sidebar_field, "scale")) + orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true); + else if (boost::starts_with(sidebar_field, "rotation")) + { + if (boost::ends_with(sidebar_field, "x")) + orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true); + else if (boost::ends_with(sidebar_field, "y")) + { + const Vec3d& rotation = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_rotation(); + if (rotation(0) == 0.0) + orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true); + else + orient_matrix.rotate(Eigen::AngleAxisd(rotation(2), Vec3d::UnitZ())); + } + } + glsafe(::glMultMatrixd(orient_matrix.data())); } } |