diff options
author | Khoa Nguyen <khoanguyen@3forcom.com> | 2023-09-26 12:27:06 +0700 |
---|---|---|
committer | Khoa Nguyen <khoanguyen@3forcom.com> | 2023-09-26 12:27:06 +0700 |
commit | 4261d6e6cc366884cd35daf66d9fa35c3dda6267 (patch) | |
tree | aacfac76fe3d4025cda695b788cc339fb063a175 /tracker-tobii/ftnoir_tracker_tobii.cpp | |
parent | 6f836ab2ab0edb296e0dc3884983cf6b956fce68 (diff) |
tracker/tobii: add tobii input
Diffstat (limited to 'tracker-tobii/ftnoir_tracker_tobii.cpp')
-rw-r--r-- | tracker-tobii/ftnoir_tracker_tobii.cpp | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/tracker-tobii/ftnoir_tracker_tobii.cpp b/tracker-tobii/ftnoir_tracker_tobii.cpp deleted file mode 100644 index 595cf410..00000000 --- a/tracker-tobii/ftnoir_tracker_tobii.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "ftnoir_tracker_tobii.h" -#include "api/plugin-api.hpp" -#include "compat/math.hpp" - -tobii::~tobii() = default; - -module_status tobii::start_tracker(QFrame*) -{ - t.start(); - return status_ok(); -} - -void tobii::data(double *data) -{ - if (t.head_pose) { - tobii_head_pose_t p = *t.head_pose; - if (p.position_validity == TOBII_VALIDITY_VALID) { - if (center_pose.position_validity == TOBII_VALIDITY_VALID) { - p.position_xyz[0] = p.position_xyz[0] - center_pose.position_xyz[0]; - p.position_xyz[1] = p.position_xyz[1] - center_pose.position_xyz[1]; - p.position_xyz[2] = p.position_xyz[2] - center_pose.position_xyz[2]; - } - else { - center_pose = p; - } - data[0] = std::clamp(p.position_xyz[0] * 30.0 / 300.0, -30.0, 30.0); - data[1] = std::clamp(p.position_xyz[1] * 30.0 / 300.0, -30.0, 30.0); - data[2] = std::clamp(p.position_xyz[2] * 30.0 / 300.0, -30.0, 30.0); - } - - double max_yaw = 90.0; - if (p.rotation_validity_xyz[1] == TOBII_VALIDITY_VALID) { - if (center_pose.rotation_validity_xyz[1] == TOBII_VALIDITY_VALID) { - p.rotation_xyz[1] = p.rotation_xyz[1] - center_pose.rotation_xyz[1]; - } - data[3] = std::clamp(p.rotation_xyz[1] * 100.0 * max_yaw / 90.0, -max_yaw, max_yaw); - } - - double max_pitch = 90.0; - if (p.rotation_validity_xyz[0] == TOBII_VALIDITY_VALID) { - if (center_pose.rotation_validity_xyz[0] == TOBII_VALIDITY_VALID) { - p.rotation_xyz[0] = p.rotation_xyz[0] - center_pose.rotation_xyz[0]; - } - data[4] = std::clamp(p.rotation_xyz[0] * 100.0 * max_pitch / 90.0, -max_pitch, max_pitch); - } - - double max_roll = 90.0; - if (p.rotation_validity_xyz[2] == TOBII_VALIDITY_VALID) { - if (center_pose.rotation_validity_xyz[2] == TOBII_VALIDITY_VALID) { - p.rotation_xyz[2] = p.rotation_xyz[2] - center_pose.rotation_xyz[2]; - } - data[5] = std::clamp(p.rotation_xyz[2] * 100.0 * max_roll / 90.0, -max_roll, max_roll); - } - } -} - -bool tobii::center () -{ - if (t.head_pose) { - center_pose = *t.head_pose; - } - return false; -} - -OPENTRACK_DECLARE_TRACKER(tobii, dialog_tobii, tobiiDll) |