diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 11:23:06 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 11:23:06 +0100 |
commit | 3fabee84281da18ad1ce7df2f9099c7ec6678614 (patch) | |
tree | e33028b52b3a3309d9dec02a5b3fc1821ea212d8 /tracker-steamvr | |
parent | 4a5b7ff7ec97f9078780ffc44d923d11a0aa18c1 (diff) |
tracker/steamvr: fix signedness
Diffstat (limited to 'tracker-steamvr')
-rw-r--r-- | tracker-steamvr/steamvr.cpp | 22 | ||||
-rw-r--r-- | tracker-steamvr/steamvr.hpp | 16 |
2 files changed, 12 insertions, 26 deletions
diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index ff48ad3d..9a845d55 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -20,10 +20,8 @@ #include "api/plugin-api.hpp" -#include <cstdlib> #include <cmath> -#include <type_traits> -#include <algorithm> +#include <cstdlib> #include <QMessageBox> #include <QDebug> @@ -205,18 +203,16 @@ module_status steamvr::start_tracker(QFrame*) if (sz == 0) err = tr("No HMD connected"); - device_index = -1; - for (const device_spec& spec : specs) { if (serial == "" || serial == spec.to_string()) { - device_index = int(spec.k); + device_index = spec.k; break; } } - if (device_index == -1 && err.isEmpty()) + if (device_index == UINT_MAX && err.isEmpty()) err = tr("Can't find device with that serial"); if (err.isEmpty()) @@ -228,7 +224,7 @@ module_status steamvr::start_tracker(QFrame*) void steamvr::data(double* data) { - if (device_index != -1) + if (device_index != UINT_MAX) { auto [ok, pose] = device_list::get_pose(device_index); if (ok) @@ -274,15 +270,11 @@ bool steamvr::center() void steamvr::matrix_to_euler(double& yaw, double& pitch, double& roll, const vr::HmdMatrix34_t& result) { - using std::atan2; - using std::sqrt; - using std::asin; - using d = double; - yaw = atan2(d(result.m[2][0]), d(result.m[0][0])); - pitch = atan2(-d(result.m[1][2]), d(result.m[1][1])); - roll = asin(d(result.m[1][0])); + yaw = std::atan2(d(result.m[2][0]), d(result.m[0][0])); + pitch = std::atan2(-d(result.m[1][2]), d(result.m[1][1])); + roll = std::asin(d(result.m[1][0])); } steamvr_dialog::steamvr_dialog() diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index 88fa740a..c6f31fa9 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -1,25 +1,19 @@ #pragma once -#include "api/plugin-api.hpp" + #include "ui_dialog.h" +#include "api/plugin-api.hpp" #include "options/options.hpp" -#include "compat/euler.hpp" - -#include <openvr.h> - -#include <cmath> -#include <memory> #include <tuple> +#include <climits> #include <QString> #include <QMutex> -#include <QMutexLocker> #include <QList> -using namespace options; +#include <openvr.h> -using rmat = euler::rmat; -using euler_t = euler::euler_t; +using namespace options; using vr_error_t = vr::EVRInitError; using vr_t = vr::IVRSystem*; |