summaryrefslogtreecommitdiffhomepage
path: root/opentrack-logic
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack-logic')
-rw-r--r--opentrack-logic/main-settings.hpp2
-rw-r--r--opentrack-logic/tracker.cpp7
2 files changed, 9 insertions, 0 deletions
diff --git a/opentrack-logic/main-settings.hpp b/opentrack-logic/main-settings.hpp
index 1aa0d38c..a7dcd11c 100644
--- a/opentrack-logic/main-settings.hpp
+++ b/opentrack-logic/main-settings.hpp
@@ -67,6 +67,7 @@ struct main_settings
value<bool> tcomp_p, tcomp_tz;
value<bool> tray_enabled;
value<int> camera_yaw, camera_pitch, camera_roll;
+ value<bool> use_camera_offset_from_centering;
value<bool> center_at_startup;
value<int> center_method;
key_opts key_start_tracking, key_stop_tracking, key_toggle_tracking, key_restart_tracking;
@@ -86,6 +87,7 @@ struct main_settings
camera_yaw(b, "camera-yaw", 0),
camera_pitch(b, "camera-pitch", 0),
camera_roll(b, "camera-roll", 0),
+ use_camera_offset_from_centering(b, "use-camera-offset-from-centering", false),
center_at_startup(b, "center-at-startup", true),
center_method(b, "centering-method", true),
key_start_tracking(b, "start-tracking"),
diff --git a/opentrack-logic/tracker.cpp b/opentrack-logic/tracker.cpp
index 3602ad4e..3596eb19 100644
--- a/opentrack-logic/tracker.cpp
+++ b/opentrack-logic/tracker.cpp
@@ -195,6 +195,13 @@ void Tracker::logic()
const euler_t euler = r2d * rmat_to_euler(m_);
+ euler_t tmp(t(0) - t_b[0], t(1) - t_b[1], t(2) - t_b[2]);
+
+ if (s.use_camera_offset_from_centering)
+ t_compensate(r_b.t() * cam.t(), tmp, tmp, false);
+ else
+ t_compensate(cam.t(), tmp, tmp, false);
+
for (int i = 0; i < 3; i++)
{
value(i) = tmp(i);