Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2020-03-10 15:02:39 +0300
committerEnrico Turri <enricoturri@seznam.cz>2020-03-10 15:02:39 +0300
commita6a9ab9dc7efda2dce6745778f6198d34ed800e8 (patch)
treefde57ad0ed1831399b22d83b0d9eefe3e8e0c4f7 /src/slic3r/GUI/Camera.hpp
parent33470f7f6d67306de247717a926bc4eef9cece78 (diff)
Follow-up of 6c36577e8e48e27a372f9a53cd2ba2a07e3a49a3 -> World Z axis set to vertical when disconnecting 3d mouse
Diffstat (limited to 'src/slic3r/GUI/Camera.hpp')
-rw-r--r--src/slic3r/GUI/Camera.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp
index 4b9144519..b784e7b96 100644
--- a/src/slic3r/GUI/Camera.hpp
+++ b/src/slic3r/GUI/Camera.hpp
@@ -122,6 +122,13 @@ public:
// returns true if the camera z axis (forward) is pointing in the negative direction of the world z axis
bool is_looking_downward() const { return get_dir_forward().dot(Vec3d::UnitZ()) < 0.0; }
+ // forces camera right vector to be parallel to XY plane
+ void recover_from_free_camera()
+ {
+ if (std::abs(get_dir_right()(2)) > EPSILON)
+ look_at(get_position(), m_target, Vec3d::UnitZ());
+ }
+
void look_at(const Vec3d& position, const Vec3d& target, const Vec3d& up);
double max_zoom() const { return 100.0; }