summaryrefslogtreecommitdiffhomepage
path: root/logic
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-25 09:05:14 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-25 09:10:47 +0200
commitccea3f9d2a4fba4273e3922f106ccaf504e7d2cd (patch)
tree9b19f5b1129161377daf30ed93cc54cf82232bf6 /logic
parent39a4e610f0b29f80ff619c93e1e1e6424c896dd6 (diff)
gui, logic: allow prevent rotation from affecting compensation
Issue: #458
Diffstat (limited to 'logic')
-rw-r--r--logic/main-settings.hpp4
-rw-r--r--logic/tracker.cpp11
2 files changed, 14 insertions, 1 deletions
diff --git a/logic/main-settings.hpp b/logic/main-settings.hpp
index ca18a0e9..53c5fae1 100644
--- a/logic/main-settings.hpp
+++ b/logic/main-settings.hpp
@@ -68,6 +68,7 @@ struct main_settings
bundle b, b_map;
axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll;
value<bool> tcomp_p, tcomp_disable_tx, tcomp_disable_ty, tcomp_disable_tz;
+ value<bool> tcomp_disable_src_yaw, tcomp_disable_src_pitch, tcomp_disable_src_roll;
value<bool> tray_enabled, tray_start;
value<int> camera_yaw, camera_pitch, camera_roll;
value<bool> use_camera_offset_from_centering;
@@ -92,6 +93,9 @@ struct main_settings
tcomp_disable_tx(b, "compensate-translation-disable-x-axis", false),
tcomp_disable_ty(b, "compensate-translation-disable-y-axis", false),
tcomp_disable_tz(b, "compensate-translation-disable-z-axis", false),
+ tcomp_disable_src_yaw(b, "compensate-translation-disable-source-yaw", false),
+ tcomp_disable_src_pitch(b, "compensate-translation-disable-source-pitch", false),
+ tcomp_disable_src_roll(b, "compensate-translation-disable-source-roll", false),
tray_enabled(b, "use-system-tray", false),
tray_start(b, "start-in-tray", false),
camera_yaw(b, "camera-yaw", 0),
diff --git a/logic/tracker.cpp b/logic/tracker.cpp
index f0826a5f..84d3afdb 100644
--- a/logic/tracker.cpp
+++ b/logic/tracker.cpp
@@ -288,8 +288,17 @@ void Tracker::logic()
if (s.tcomp_p && !get(f_tcomp_disabled))
{
+ const double tcomp_c[] =
+ {
+ double(!s.tcomp_disable_src_yaw),
+ double(!s.tcomp_disable_src_pitch),
+ double(!s.tcomp_disable_src_roll),
+ };
euler_t value_(value(TX), value(TY), value(TZ));
- t_compensate(euler_to_rmat(euler_t(value(Yaw) * d2r, value(Pitch) * d2r, value(Roll) * d2r)),
+ t_compensate(euler_to_rmat(
+ euler_t(value(Yaw) * d2r * tcomp_c[0],
+ value(Pitch) * d2r * tcomp_c[1],
+ value(Roll) * d2r * tcomp_c[2])),
value_,
value_,
s.tcomp_disable_tx,