summaryrefslogtreecommitdiffhomepage
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
parent39a4e610f0b29f80ff619c93e1e1e6424c896dd6 (diff)
gui, logic: allow prevent rotation from affecting compensation
Issue: #458
-rw-r--r--gui/options-dialog.cpp4
-rw-r--r--gui/options-dialog.ui150
-rw-r--r--logic/main-settings.hpp4
-rw-r--r--logic/tracker.cpp11
4 files changed, 136 insertions, 33 deletions
diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp
index 71297a59..2f40e39f 100644
--- a/gui/options-dialog.cpp
+++ b/gui/options-dialog.cpp
@@ -50,6 +50,10 @@ OptionsDialog::OptionsDialog(std::function<void(bool)> pause_keybindings) :
tie_setting(main.tcomp_disable_ty, ui.tcomp_ty_disable);
tie_setting(main.tcomp_disable_tz, ui.tcomp_tz_disable);
+ tie_setting(main.tcomp_disable_src_yaw, ui.tcomp_src_yaw_disable);
+ tie_setting(main.tcomp_disable_src_pitch, ui.tcomp_src_pitch_disable);
+ tie_setting(main.tcomp_disable_src_roll, ui.tcomp_src_roll_disable);
+
tie_setting(main.a_x.zero, ui.pos_tx);
tie_setting(main.a_y.zero, ui.pos_ty);
tie_setting(main.a_z.zero, ui.pos_tz);
diff --git a/gui/options-dialog.ui b/gui/options-dialog.ui
index 193d75a9..291a49d2 100644
--- a/gui/options-dialog.ui
+++ b/gui/options-dialog.ui
@@ -322,7 +322,13 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
- <number>3</number>
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
+ <number>2</number>
</property>
<item>
<widget class="QCheckBox" name="trayp">
@@ -334,7 +340,7 @@
<item>
<widget class="QCheckBox" name="tray_start">
<property name="text">
- <string>Minimize to tray on startup</string>
+ <string>Minimize to tray on startup when enabled</string>
</property>
</widget>
</item>
@@ -848,33 +854,117 @@ It won't work properly with translation compensation enabled.</string>
</widget>
</item>
<item>
- <widget class="QCheckBox" name="tcomp_tx_disable">
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <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"/>
+ <widget class="QFrame" name="frame_2">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
- <property name="text">
- <string>Disable Z compensation (for using zoom on Z axis)</string>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
</property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="tcomp_tx_disable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>3</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Disable X compensation</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="tcomp_ty_disable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>3</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Disable Y compensation</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="tcomp_tz_disable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>3</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Disable Z compensation (for zoom on Z axis)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="tcomp_src_yaw_disable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Disable compensation by yaw</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QCheckBox" name="tcomp_src_pitch_disable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Disable compensation by pitch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QCheckBox" name="tcomp_src_roll_disable">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Disable compensation by roll</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>
@@ -1324,7 +1414,7 @@ It won't work properly with translation compensation enabled.</string>
<item>
<widget class="QCheckBox" name="tracklogging_enabled">
<property name="text">
- <string>Enable - You will be asked for a filename whenever the tracker starts</string>
+ <string>Enable - You will be asked for a filename whenever tracking starts</string>
</property>
</widget>
</item>
@@ -1434,10 +1524,6 @@ It won't work properly with translation compensation enabled.</string>
<tabstop>pos_ty</tabstop>
<tabstop>pos_tz</tabstop>
<tabstop>center_method</tabstop>
- <tabstop>tcomp_enable</tabstop>
- <tabstop>tcomp_tx_disable</tabstop>
- <tabstop>tcomp_ty_disable</tabstop>
- <tabstop>tcomp_tz_disable</tabstop>
<tabstop>src_yaw</tabstop>
<tabstop>invert_yaw</tabstop>
<tabstop>src_pitch</tabstop>
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,