summaryrefslogtreecommitdiffhomepage
path: root/tracker-tobii-eyex
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-tobii-eyex')
-rw-r--r--tracker-tobii-eyex/CMakeLists.txt36
-rw-r--r--tracker-tobii-eyex/images/tobii-eyex-logo.pngbin1319 -> 402 bytes
-rw-r--r--tracker-tobii-eyex/tobii-eyex-dialog.cpp28
-rw-r--r--tracker-tobii-eyex/tobii-eyex-dialog.hpp5
-rw-r--r--tracker-tobii-eyex/tobii-eyex-dialog.ui771
-rw-r--r--tracker-tobii-eyex/tobii-eyex.cpp8
-rw-r--r--tracker-tobii-eyex/tobii-eyex.hpp9
-rw-r--r--tracker-tobii-eyex/tobii-settings.cpp118
-rw-r--r--tracker-tobii-eyex/tobii-settings.hpp55
9 files changed, 397 insertions, 633 deletions
diff --git a/tracker-tobii-eyex/CMakeLists.txt b/tracker-tobii-eyex/CMakeLists.txt
index 6d133f1d..eead67bf 100644
--- a/tracker-tobii-eyex/CMakeLists.txt
+++ b/tracker-tobii-eyex/CMakeLists.txt
@@ -1,34 +1,24 @@
if(WIN32)
set(SDK_TOBII_EYEX "" CACHE PATH "")
if(SDK_TOBII_EYEX)
- if(CMAKE_COMPILER_IS_GNUCXX)
- add_definitions(-Wno-error)
- endif()
- set(porked NO-INSTALL)
- otr_module(tracker-tobii-eyex ${porked})
- target_link_libraries(opentrack-tracker-tobii-eyex opentrack-spline)
+ otr_module(tracker-tobii)
set(tobii-libdir ${SDK_TOBII_EYEX}/lib/x86/)
- set(tobii-dll ${tobii-libdir}/Tobii.EyeX.Client.dll)
+ set(tobii-dll "${tobii-libdir}/Tobii.EyeX.Client.dll")
# we only care about the .lib for MSVC++ build anyway
- set(tobii-link ${tobii-libdir}/Tobii.EyeX.Client.lib)
- target_include_directories(opentrack-tracker-tobii-eyex PRIVATE ${CMAKE_SOURCE_DIR}/spline)
- target_link_libraries(opentrack-tracker-tobii-eyex ${tobii-link} opentrack-spline)
+ target_link_libraries(opentrack-tracker-tobii "${tobii-libdir}/Tobii.EyeX.Client.lib")
# we only ever use the C headers due to Microsoft CRT ABI incompatibility with GNU
- set(tobii-incdir ${SDK_TOBII_EYEX}/include/eyex)
- target_include_directories(opentrack-tracker-tobii-eyex SYSTEM PUBLIC ${tobii-incdir})
+ target_include_directories(opentrack-tracker-tobii SYSTEM PUBLIC "${SDK_TOBII_EYEX}/include/eyex")
- if(NOT "!${porked}" STREQUAL "!NO-INSTALL")
- install(FILES ${tobii-dll} DESTINATION ${opentrack-hier-pfx} ${opentrack-perms-exec})
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
- file(TO_CMAKE_PATH "$ENV{SystemRoot}" sysroot)
- if (IS_DIRECTORY "${sysroot}/SysWOW64")
- set(src "${sysroot}/SysWOW64")
- else()
- set(src "${sysroot}/System32")
- endif()
- install(FILES "${src}/msvcp110.dll" DESTINATION ${opentrack-hier-pfx} PERMISSIONS ${opentrack-perms-exec})
- install(FILES "${src}/msvcr110.dll" DESTINATION ${opentrack-hier-pfx} PERMISSIONS ${opentrack-perms-exec})
+ install(FILES "${tobii-dll}" DESTINATION "${opentrack-hier-pfx}" PERMISSIONS ${opentrack-perms-exec})
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ file(TO_CMAKE_PATH "$ENV{SystemRoot}" sysroot)
+ if (IS_DIRECTORY "${sysroot}/SysWOW64")
+ set(src "${sysroot}/SysWOW64")
+ else()
+ set(src "${sysroot}/System32")
endif()
+ install(FILES "${src}/msvcp110.dll" DESTINATION ${opentrack-hier-pfx} PERMISSIONS ${opentrack-perms-exec})
+ install(FILES "${src}/msvcr110.dll" DESTINATION ${opentrack-hier-pfx} PERMISSIONS ${opentrack-perms-exec})
endif()
endif()
endif()
diff --git a/tracker-tobii-eyex/images/tobii-eyex-logo.png b/tracker-tobii-eyex/images/tobii-eyex-logo.png
index b952891b..e01bc1ae 100644
--- a/tracker-tobii-eyex/images/tobii-eyex-logo.png
+++ b/tracker-tobii-eyex/images/tobii-eyex-logo.png
Binary files differ
diff --git a/tracker-tobii-eyex/tobii-eyex-dialog.cpp b/tracker-tobii-eyex/tobii-eyex-dialog.cpp
index 8997c6c2..807542e1 100644
--- a/tracker-tobii-eyex/tobii-eyex-dialog.cpp
+++ b/tracker-tobii-eyex/tobii-eyex-dialog.cpp
@@ -7,39 +7,15 @@ tobii_eyex_dialog::tobii_eyex_dialog()
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &tobii_eyex_dialog::do_ok);
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &tobii_eyex_dialog::do_cancel);
- ui.tracking_mode->addItem("Relative", tobii_relative);
- ui.tracking_mode->addItem("Absolute", tobii_absolute);
+ ui.tracking_mode->addItem("Snap", tobii_snap);
+ ui.tracking_mode->addItem("Accumulative", tobii_acc);
tie_setting(s.mode, ui.tracking_mode);
-
- ui.relative_mode_gain->setConfig(&rs.acc_mode_spline);
- ui.relative_mode_gain->set_preview_only(true);
-
- tie_setting(rs.dz_len, ui.deadzone);
- tie_setting(rs.expt_slope, ui.exponent);
- tie_setting(rs.expt_len, ui.exponent_len);
- tie_setting(rs.expt_norm, ui.exponent_norm);
-
- tie_setting(rs.log_len, ui.log_len);
-
- connect(rs.b.get(), &bundle_::changed, this, [this]() { rs.make_spline(); }, Qt::QueuedConnection);
-
- // todo add specialization for label with traits
-#if 0
- tie_setting(rs.dz_len, ui.deadzone_label);
- tie_setting(rs.expt_slope, ui.exponent_label);
- tie_setting(rs.expt_len, ui.exponent_len_label);
- tie_setting(rs.expt_norm, ui.exponent_norm_label);
- tie_setting(rs.log_slope, ui.log_base_label);
- tie_setting(rs.log_len, ui.log_len_label);
- tie_setting(rs.log_norm, ui.log_norm_label);
-#endif
}
void tobii_eyex_dialog::do_ok()
{
s.b->save();
- rs.b->save();
close();
}
diff --git a/tracker-tobii-eyex/tobii-eyex-dialog.hpp b/tracker-tobii-eyex/tobii-eyex-dialog.hpp
index 51957bf2..8ff0e46f 100644
--- a/tracker-tobii-eyex/tobii-eyex-dialog.hpp
+++ b/tracker-tobii-eyex/tobii-eyex-dialog.hpp
@@ -6,17 +6,14 @@
#include "ui_tobii-eyex-dialog.h"
#include <QObject>
-class tobii_eyex_dialog final : public ITrackerDialog
+struct tobii_eyex_dialog final : public ITrackerDialog
{
- Q_OBJECT
-public:
tobii_eyex_dialog();
void register_tracker(ITracker*) override {}
void unregister_tracker() override {}
private:
Ui::tobii_eyex_dialog_widgets ui;
settings s;
- rel_settings rs;
private slots:
void do_ok();
void do_cancel();
diff --git a/tracker-tobii-eyex/tobii-eyex-dialog.ui b/tracker-tobii-eyex/tobii-eyex-dialog.ui
index f32c91f4..a6aecafb 100644
--- a/tracker-tobii-eyex/tobii-eyex-dialog.ui
+++ b/tracker-tobii-eyex/tobii-eyex-dialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>702</width>
- <height>440</height>
+ <width>659</width>
+ <height>471</height>
</rect>
</property>
<property name="windowTitle">
@@ -17,20 +17,42 @@
<iconset resource="tobii-eyex-res.qrc">
<normaloff>:/images/tobii-eyex-logo.png</normaloff>:/images/tobii-eyex-logo.png</iconset>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QGridLayout" name="gridLayout_4">
<property name="bottomMargin">
<number>4</number>
</property>
- <item>
+ <item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title">
<string>Tracking settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>617</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="text">
- <string>Relative mode shifts the view toward a target that may be offscreen then fixes upon it.The absolute mode is not gradual.</string>
+ <string>Accumulative mode shifts the view toward a target that may be offscreen then fixes upon it.
+On the other hand, the snap mode allows for a quick glance outside the field of vision.</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -39,6 +61,12 @@
</item>
<item>
<widget class="QFrame" name="frame">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
@@ -74,7 +102,7 @@
<item row="0" column="1">
<widget class="QComboBox" name="tracking_mode">
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -100,432 +128,348 @@
</layout>
</widget>
</item>
- <item>
+ <item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title">
- <string>Relative tracking mode gain</string>
+ <string>Accumulative mode settings</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <property name="spacing">
- <number>0</number>
- </property>
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
<widget class="QLabel" name="label_3">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
- <string>Adjust the gain mapping and speed to suit your preference, game type, display size, and distance from the screen.</string>
+ <string>Screen edge length</string>
</property>
- <property name="wordWrap">
- <bool>true</bool>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSlider" name="acc_inv_deadzone_slider">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
+ <horstretch>9</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>20</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item>
- <widget class="QFrame" name="frame_2">
+ <item row="0" column="2">
+ <widget class="QLabel" name="acc_inv_deadzone_label">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>10</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
+ <property name="text">
+ <string>Speed</string>
</property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Max yaw</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSlider" name="acc_speed_slider">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
+ <horstretch>9</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Max pitch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="acc_max_yaw">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="acc_max_pitch">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Position output</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QCheckBox" name="acc_pos_output">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Enabled</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Snap mode settings</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="2" column="1" rowspan="2">
+ <widget class="QComboBox" name="snap_max_yaw">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" rowspan="2">
+ <widget class="QLabel" name="label_10">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Max pitch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Max yaw</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Speed</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSlider" name="snap_inv_deazone_slider">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
+ <horstretch>8</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>20</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QComboBox" name="snap_max_pitch">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="snap_inv_deadzone_label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>10</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSlider" name="snap_speed_slider">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
+ <horstretch>8</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Screen edge length</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QCheckBox" name="snap_pos_output">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Enabled</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_12">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Position output</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="spacing">
- <number>0</number>
- </property>
- <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>
- <item>
- <widget class="QFrame" name="frame_3">
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <property name="leftMargin">
- <number>4</number>
- </property>
- <property name="topMargin">
- <number>4</number>
- </property>
- <property name="bottomMargin">
- <number>4</number>
- </property>
- <property name="verticalSpacing">
- <number>3</number>
- </property>
- <item row="1" column="0">
- <widget class="QLabel" name="label_4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Deadzone</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QSlider" name="deadzone">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="exponent_label">
- <property name="minimumSize">
- <size>
- <width>24</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QSlider" name="exponent">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="speed_label">
- <property name="minimumSize">
- <size>
- <width>24</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_11">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Speed</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="deadzone_label">
- <property name="minimumSize">
- <size>
- <width>24</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_8">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Log segment length</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_10">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Exponent</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="exponent_len_label">
- <property name="minimumSize">
- <size>
- <width>24</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="2">
- <widget class="QSlider" name="log_len">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_5">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Exponent segment length</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QSlider" name="speed">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QLabel" name="log_len_label">
- <property name="minimumSize">
- <size>
- <width>24</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QSlider" name="exponent_norm">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_6">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Exponent norm</string>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QSlider" name="exponent_len">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLabel" name="exponent_norm_label">
- <property name="minimumSize">
- <size>
- <width>24</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>0</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="spline_widget" name="relative_mode_gain" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>300</width>
- <height>150</height>
- </size>
- </property>
- <property name="colorBezier" stdset="0">
- <color>
- <red>192</red>
- <green>32</green>
- <blue>8</blue>
- </color>
- </property>
- <property name="colorBackground" stdset="0">
- <color>
- <red>240</red>
- <green>240</green>
- <blue>240</blue>
- </color>
- </property>
- <property name="is_preview_only" stdset="0">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- <zorder>relative_mode_gain</zorder>
- <zorder>frame_3</zorder>
</widget>
</item>
</layout>
</widget>
</item>
- <item>
+ <item row="3" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
@@ -533,13 +477,6 @@
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>spline_widget</class>
- <extends>QWidget</extends>
- <header>spline/spline-widget.hpp</header>
- </customwidget>
- </customwidgets>
<resources>
<include location="tobii-eyex-res.qrc"/>
</resources>
diff --git a/tracker-tobii-eyex/tobii-eyex.cpp b/tracker-tobii-eyex/tobii-eyex.cpp
index eb5aae42..e35c849e 100644
--- a/tracker-tobii-eyex/tobii-eyex.cpp
+++ b/tracker-tobii-eyex/tobii-eyex.cpp
@@ -1,13 +1,13 @@
#include "tobii-eyex.hpp"
+#include "compat/math-imports.hpp"
+
#include <cstdlib>
#include <cstdio>
-#include <cmath>
+
#include <QDebug>
#include <QMutexLocker>
#include <QMessageBox>
-// XXX TODO whole opentrack needs different debug levels -sh 20160801
-
//#define TOBII_EYEX_DEBUG_PRINTF
#define TOBII_EYEX_VERBOSE_PRINTF
@@ -236,7 +236,7 @@ void tobii_eyex_tracker::start_tracker(QFrame*)
dbg_verbose("api initialized");
}
-tobii_eyex_tracker::num tobii_eyex_tracker::gain(num /*x_*/)
+tobii_eyex_tracker::num tobii_eyex_tracker::gain(num x)
{
return 1;
}
diff --git a/tracker-tobii-eyex/tobii-eyex.hpp b/tracker-tobii-eyex/tobii-eyex.hpp
index 62b0d733..a86a4a76 100644
--- a/tracker-tobii-eyex/tobii-eyex.hpp
+++ b/tracker-tobii-eyex/tobii-eyex.hpp
@@ -10,13 +10,13 @@
#include "tobii-settings.hpp"
-#include <EyeX.h>
-
#include "api/plugin-api.hpp"
#include "options/options.hpp"
using namespace options;
#include "compat/timer.hpp"
+#include <EyeX.h>
+
#include <functional>
#include <atomic>
@@ -53,9 +53,6 @@ private:
num gain(num x);
- settings s;
- rel_settings rel_s;
-
TX_CONTEXTHANDLE dev_ctx;
TX_TICKET conn_state_changed_ticket;
TX_TICKET event_handler_ticket;
@@ -63,7 +60,7 @@ private:
TX_HANDLE display_state;
QMutex global_state_mtx;
-
+ settings s;
Timer t;
struct state
diff --git a/tracker-tobii-eyex/tobii-settings.cpp b/tracker-tobii-eyex/tobii-settings.cpp
deleted file mode 100644
index bc201be4..00000000
--- a/tracker-tobii-eyex/tobii-settings.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-#include "tobii-settings.hpp"
-#include <cmath>
-#include <iterator>
-#include <utility>
-#include <numeric>
-
-/*
- def plot(f, max=None, min=None):
- if max is None and min is None:
- min, max = -1.5, 1.5
- elif max is None:
- max=-min
- elif min is None:
- min=-max
-
- assert max > min
- c = 1e-4*(max-min)
- if c < 1e-12:
- c = 1e-6
- rng = arange(min, max, c)
- plt.plot(rng, map(f, rng))
-*/
-
-/*
- def richards(b, q, v, c=1):
- return lambda x: 1./((c + q * exp(-b * x) ** (1./v)))
-*/
-
-void rel_settings::make_spline()
-{
- const double dz_len_ = dz_len(),
- expt_len_ = expt_len(),
- expt_norm_ = expt_norm(),
- expt_slope_ = expt_slope(),
- log_len_ = log_len();
-
- const double expt_deriv_at_end = expt_norm_ * expt_slope_ * std::pow(expt_len_, expt_slope_ - 1); // cnx^(n-1)
- const double expt_at_end = expt_norm_ * std::pow(expt_len_, expt_slope_); // cx^n
-
- const double lin_len = 1 - dz_len_ - expt_len_ - log_len_;
-
- // this isn't correct but works.
- // we use exponentiation of the linear part to get logarithmic approximation of the linear
- // part rather than linear approximation of the linear part
-
- const double lin_at_end = std::pow(M_E, lin_len * expt_deriv_at_end - expt_at_end); // e^(cx + a)
- const double lin_deriv_at_end = expt_deriv_at_end * std::exp(-expt_at_end + expt_deriv_at_end * lin_len); // ce^(a + cx)
-
- // this was all derived by the awesome linear approximation
- // calculator <http://www.emathhelp.net/calculators/calculus-1/linear-approximation-calculator/>
-
- auto expt_part = [=](double x) { return expt_norm_ * std::pow(x, expt_slope_); };
- const double expt_inv_norm = expt_norm_/expt_part(expt_len_);
-
- auto lin_part = [=](double x) { return expt_inv_norm * (expt_at_end + expt_deriv_at_end * (x - expt_len_)); };
- const double lin_inv_norm = (1 - expt_norm_ - .25)/lin_part(lin_len);
-
- // TODO needs norm for log/lin parts
- auto log_part = [=](double x) { return expt_inv_norm * lin_inv_norm * std::log(lin_at_end + lin_deriv_at_end * (x - lin_len)); };
- const double log_inv_norm = .25/log_part(expt_len_);
-
- qDebug() << "lin" << expt_deriv_at_end << lin_inv_norm;
-
- part functors[]
- {
- { dz_len_, [](double) { return 0; } },
- { expt_len_, [=](double x) { return expt_inv_norm * expt_part(x); } }, // cx^n
- { lin_len, [=](double x) { return lin_inv_norm * lin_part(x); } }, // cx + a
- { log_len_, [=](double x) { return log_inv_norm * log_part(x); } }, // ln(cx + a)
- };
-
- make_spline_(functors, std::distance(std::begin(functors), std::end(functors)));
-}
-
-rel_settings::rel_settings() :
- opts("tobii-eyex-relative-mode"),
- speed(b, "speed", s(3, .1, 10)),
- dz_len(b, "deadzone-length", s(.04, 0, .2)),
- expt_slope(b, "exponent-slope", s(1.75, 1.5, 3)),
- expt_len(b, "exponent-length", s(.2, 0, .5)),
- expt_norm(b, "exponent-norm", s(.4, .1, .5)),
- log_len(b, "log-len", s(.1, 0, .2))
-{
- make_spline();
-}
-
-// there's an underflow in spline code, can't use 1e0
-constexpr double spline_max = 1e2;
-
-double rel_settings::gain(double value)
-{
- return acc_mode_spline.get_value_no_save(value * spline_max) / spline_max;
-}
-
-void rel_settings::make_spline_(part* functors, unsigned len)
-{
- acc_mode_spline.clear();
-
- double lastx = 0;
-
- for (unsigned k = 0; k < len; k++)
- {
- part& fun = functors[k];
-
- constexpr unsigned nparts = 7;
-
- for (unsigned i = 1; i <= nparts; i++)
- {
- const double x = i*fun.len/nparts;
- const double y = clamp(fun.f(x), 0, 1);
- if (i == nparts/2)
- qDebug() << k << i << x << y;
- acc_mode_spline.add_point((lastx + x) * spline_max, y * spline_max);
- }
-
- lastx += fun.len;
- }
-}
diff --git a/tracker-tobii-eyex/tobii-settings.hpp b/tracker-tobii-eyex/tobii-settings.hpp
index 08e05ecf..cfdfa65c 100644
--- a/tracker-tobii-eyex/tobii-settings.hpp
+++ b/tracker-tobii-eyex/tobii-settings.hpp
@@ -1,51 +1,36 @@
#pragma once
-#include "api/plugin-api.hpp"
#include "options/options.hpp"
using namespace options;
-#include "spline/spline.hpp"
-#include "spline/spline-widget.hpp"
-
-#include <functional>
-
-#include <QObject>
enum tobii_mode
{
- tobii_relative,
- tobii_absolute,
+ tobii_snap = 0xf00d,
+ tobii_acc = 0xacc,
};
-class rel_settings final : public QObject, public opts
+enum max_yaw
{
- Q_OBJECT
-
- using functor = std::function<double(double)>;
-
- struct part
- {
- double len;
- functor f;
- };
-
- void make_spline_(part* functors, unsigned len);
-
-public:
- using s = slider_value;
- value<slider_value> speed, dz_len, expt_slope, expt_len, expt_norm, log_len;
- spline acc_mode_spline;
- rel_settings();
- double gain(double value);
+ y10, y15, y20, y30, y45,
+};
-public slots:
- void make_spline();
+enum max_pitch
+{
+ p10, p15, p25, p35,
};
struct settings final : public opts
{
- value<tobii_mode> mode;
- settings() :
- opts("tobii-eyex"),
- mode(b, "mode", tobii_relative)
- {}
+ value<tobii_mode> mode { b, "mode", tobii_snap };
+
+ value<slider_value> snap_speed { b, "snap-speed", slider_value(.1, .05, 1) },
+ snap_inv_dz { b, "snap-screen-edge-length", slider_value(.35, .1, .5) };
+ value<slider_value> acc_speed { b, "acc-speed", slider_value(.1, .05, 1) },
+ acc_dz_len { b, "acc-screen-edge-length", slider_value(.1, .1, 1) };
+ value<max_yaw> snap_yaw { b, "snap-max-yaw", y20 },
+ acc_yaw { b, "acc-max-yaw", y20 };
+ value<max_pitch> snap_pitch { b, "snap-max-pitch", p15 },
+ acc_pitch { b, "acc-max-pitch", p15 };
+
+ settings() : opts("tobii-eyex") {}
};