summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-24 13:51:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-24 13:51:47 +0200
commit783ad7d52940b978462afe7b743da72c4529542c (patch)
tree6f4301d807cf2f389598369048c58c42d26f139e
parent2b02544134e5c1badd036f183d2908405d5348a8 (diff)
logic, gui: allow for disabling any of the three tcomp options
Issue: #458 Requested-by: @Borisovich
-rw-r--r--gui/options-dialog.cpp5
-rw-r--r--gui/options-dialog.ui24
-rw-r--r--logic/main-settings.hpp6
-rw-r--r--logic/tracker.cpp30
-rw-r--r--logic/tracker.h3
5 files changed, 53 insertions, 15 deletions
diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp
index be846b35..71297a59 100644
--- a/gui/options-dialog.cpp
+++ b/gui/options-dialog.cpp
@@ -45,7 +45,10 @@ OptionsDialog::OptionsDialog(std::function<void(bool)> pause_keybindings) :
tie_setting(main.center_at_startup, ui.center_at_startup);
tie_setting(main.tcomp_p, ui.tcomp_enable);
- tie_setting(main.tcomp_tz, ui.tcomp_rz);
+
+ tie_setting(main.tcomp_disable_tx, ui.tcomp_tx_disable);
+ tie_setting(main.tcomp_disable_ty, ui.tcomp_ty_disable);
+ tie_setting(main.tcomp_disable_tz, ui.tcomp_tz_disable);
tie_setting(main.a_x.zero, ui.pos_tx);
tie_setting(main.a_y.zero, ui.pos_ty);
diff --git a/gui/options-dialog.ui b/gui/options-dialog.ui
index 7011f156..420a82b8 100644
--- a/gui/options-dialog.ui
+++ b/gui/options-dialog.ui
@@ -821,12 +821,32 @@ It won't work properly with translation compensation enabled.</string>
</widget>
</item>
<item>
- <widget class="QCheckBox" name="tcomp_rz">
+ <widget class="QCheckBox" name="tcomp_tx_disable">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
- <string>Disable Z axis compensation</string>
+ <string>Disable X compensation</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="tcomp_ty_disable">
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Disable Y compensation</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="tcomp_tz_disable">
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Disable Z compensation</string>
</property>
</widget>
</item>
diff --git a/logic/main-settings.hpp b/logic/main-settings.hpp
index 346c3fb2..ca18a0e9 100644
--- a/logic/main-settings.hpp
+++ b/logic/main-settings.hpp
@@ -67,7 +67,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_tz;
+ value<bool> tcomp_p, tcomp_disable_tx, tcomp_disable_ty, tcomp_disable_tz;
value<bool> tray_enabled, tray_start;
value<int> camera_yaw, camera_pitch, camera_roll;
value<bool> use_camera_offset_from_centering;
@@ -89,7 +89,9 @@ struct main_settings
a_pitch(b, b_map, "pitch", Pitch),
a_roll(b, b_map, "roll", Roll),
tcomp_p(b, "compensate-translation", true),
- tcomp_tz(b, "compensate-translation-disable-z-axis", false),
+ 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),
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 f404e8e0..a2c913d3 100644
--- a/logic/tracker.cpp
+++ b/logic/tracker.cpp
@@ -62,16 +62,26 @@ double Tracker::map(double pos, Map& axis)
return double(fc.getValue(pos));
}
-void Tracker::t_compensate(const rmat& rmat, const euler_t& xyz_, euler_t& output, bool rz)
+void Tracker::t_compensate(const rmat& rmat, const euler_t& xyz, euler_t& output,
+ bool disable_tx, bool disable_ty, bool disable_tz)
{
// TY is really yaw axis. need swapping accordingly.
- const euler_t ret = rmat * euler_t(xyz_(TZ), -xyz_(TX), -xyz_(TY));
- if (!rz)
+ const euler_t ret = rmat * euler_t(xyz(TZ), -xyz(TX), -xyz(TY));
+
+ if (disable_tz)
+ output(2) = xyz(TZ);
+ else
output(2) = ret(0);
+
+ if (disable_ty)
+ output(1) = xyz(TY);
+ else
+ output(1) = -ret(2);
+
+ if (disable_tx)
+ output(0) = xyz(TX);
else
- output(2) = xyz_(2);
- output(1) = -ret(2);
- output(0) = -ret(1);
+ output(0) = -ret(1);
}
#include "compat/nan.hpp"
@@ -230,9 +240,9 @@ void Tracker::logic()
euler_t pos = euler_t(&value[TX]) - t_center;
if (s.use_camera_offset_from_centering)
- t_compensate(real_rotation.rot_center.t() * real_rotation.camera.t(), pos, pos, false);
+ t_compensate(real_rotation.rot_center.t() * real_rotation.camera.t(), pos, pos, false, false, false);
else
- t_compensate(real_rotation.camera.t(), pos, pos, false);
+ t_compensate(real_rotation.camera.t(), pos, pos, false, false, false);
for (int i = 0; i < 3; i++)
{
@@ -279,7 +289,9 @@ void Tracker::logic()
t_compensate(euler_to_rmat(euler_t(value(Yaw) * d2r, value(Pitch) * d2r, value(Roll) * d2r)),
value_,
value_,
- s.tcomp_tz);
+ s.tcomp_disable_tx,
+ s.tcomp_disable_ty,
+ s.tcomp_disable_tz);
if (is_nan(value_))
nanp = true;
for (int i = 0; i < 3; i++)
diff --git a/logic/tracker.h b/logic/tracker.h
index 1546d910..5be55ccb 100644
--- a/logic/tracker.h
+++ b/logic/tracker.h
@@ -118,7 +118,8 @@ private:
double map(double pos, Map& axis);
void logic();
- void t_compensate(const rmat& rmat, const euler_t& ypr, euler_t& output, bool rz);
+ void t_compensate(const rmat& rmat, const euler_t& ypr, euler_t& output,
+ bool disable_tx, bool disable_ty, bool disable_tz);
void run() override;
static constexpr double r2d = 180. / M_PI;