diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2019-06-13 09:48:19 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2019-06-13 09:48:19 +0300 |
commit | 26d48b7f5263e37cd891bdcdc49b7015e4bd0e47 (patch) | |
tree | e1d1d88d73356ae62aeead52cc7569b5a7e414ed /src | |
parent | 428cc4e7c9c2f3c4d95a24ee52a8387ca42ddc9d (diff) | |
parent | 9805417028c142784900ec5efbca9cd7f150c80b (diff) |
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_perspective_camera
Diffstat (limited to 'src')
-rw-r--r-- | src/slic3r/GUI/Camera.hpp | 4 | ||||
-rw-r--r-- | src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index 1f217be28..4b719dc23 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -56,9 +56,9 @@ public: Vec3d get_dir_right() const { return m_view_matrix.matrix().block(0, 0, 3, 3).row(0); } Vec3d get_dir_up() const { return m_view_matrix.matrix().block(0, 0, 3, 3).row(1); } - Vec3d get_dir_forward() const { return m_view_matrix.matrix().block(0, 0, 3, 3).row(2); } + Vec3d get_dir_forward() const { return -m_view_matrix.matrix().block(0, 0, 3, 3).row(2); } - Vec3d get_position() const { return m_view_matrix.matrix().block(0, 3, 3, 1); } + Vec3d get_position() const { return m_view_matrix.matrix().inverse().block(0, 3, 3, 1); } void apply_viewport(int x, int y, unsigned int w, unsigned int h) const; void apply_view_matrix() const; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index d118a6877..72db3a9dd 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -550,7 +550,7 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous const Selection& selection = m_parent.get_selection(); const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin()); const Transform3d& instance_matrix_no_translation_no_scaling = volume->get_instance_transformation().get_matrix(true,false,true); - Vec3f direction_to_camera = camera.get_dir_forward().cast<float>(); + Vec3f direction_to_camera = -camera.get_dir_forward().cast<float>(); Vec3f direction_to_camera_mesh = (instance_matrix_no_translation_no_scaling.inverse().cast<float>() * direction_to_camera).normalized().eval(); Vec3f scaling = volume->get_instance_scaling_factor().cast<float>(); direction_to_camera_mesh = Vec3f(direction_to_camera_mesh(0)*scaling(0), direction_to_camera_mesh(1)*scaling(1), direction_to_camera_mesh(2)*scaling(2)); |