ENABLE_3DCONNEXION_DEVICES -> Slightly increased camera target movement limits

This commit is contained in:
Enrico Turri 2019-10-10 10:49:47 +02:00
parent ded6d44389
commit f4654e376e
3 changed files with 34 additions and 30 deletions

View file

@ -85,10 +85,21 @@ void Camera::select_next_type()
void Camera::set_target(const Vec3d& target)
{
#if ENABLE_3DCONNEXION_DEVICES
// We may let these factors be customizable
static const double ScaleFactor = 1.1;
BoundingBoxf3 test_box = m_scene_box;
test_box.scale(ScaleFactor);
m_target = target;
m_target(0) = clamp(test_box.min(0), test_box.max(0), m_target(0));
m_target(1) = clamp(test_box.min(1), test_box.max(1), m_target(1));
m_target(2) = clamp(test_box.min(2), test_box.max(2), m_target(2));
#else
m_target = target;
m_target(0) = clamp(m_scene_box.min(0), m_scene_box.max(0), m_target(0));
m_target(1) = clamp(m_scene_box.min(1), m_scene_box.max(1), m_target(1));
m_target(2) = clamp(m_scene_box.min(2), m_scene_box.max(2), m_target(2));
#endif // ENABLE_3DCONNEXION_DEVICES
}
void Camera::set_theta(float theta, bool apply_limit)
@ -117,9 +128,7 @@ void Camera::set_zoom(double zoom)
zoom = std::max(zoom, zoom_min * 0.7);
// Don't allow to zoom too close to the scene.
zoom = std::min(zoom, 100.0);
m_zoom = zoom;
m_zoom = std::min(zoom, 100.0);
}
#else
void Camera::set_zoom(double zoom, const BoundingBoxf3& max_box, int canvas_w, int canvas_h)