summaryrefslogtreecommitdiffhomepage
path: root/tracker-rift-140/rift-140.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-rift-140/rift-140.cpp')
-rw-r--r--tracker-rift-140/rift-140.cpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/tracker-rift-140/rift-140.cpp b/tracker-rift-140/rift-140.cpp
index bf02191a..164b47f7 100644
--- a/tracker-rift-140/rift-140.cpp
+++ b/tracker-rift-140/rift-140.cpp
@@ -21,9 +21,7 @@
using namespace OVR;
-rift_tracker_140::rift_tracker_140() : old_yaw(0), hmd(nullptr)
-{
-}
+rift_tracker_140::rift_tracker_140() = default;
rift_tracker_140::~rift_tracker_140()
{
@@ -39,7 +37,10 @@ module_status rift_tracker_140::start_tracker(QFrame*)
if (OVR_FAILURE(ovr_Initialize(nullptr)))
goto error;
- if(OVR_FAILURE(ovr_Create(&hmd, &luid)))
+ if (OVR_FAILURE(ovr_Create(&hmd, &luid)))
+ goto error;
+
+ if (OVR_FAILURE(ovr_SetTrackingOriginType(hmd, ovrTrackingOrigin_EyeLevel)))
goto error;
return status_ok();
@@ -49,13 +50,13 @@ error:
ovrErrorInfo err;
ovr_GetLastErrorInfo(&err);
- QString strerror(err.ErrorString);
- if (strerror.size() == 0)
- strerror = QStringLiteral("Unknown reason #%1").arg(err.Result);
+ QString error_string(err.ErrorString);
+ if (error_string.size() == 0)
+ error_string = QStringLiteral("Unknown reason #%1").arg(err.Result);
ovr_Shutdown();
- return error(strerror);
+ return error(error_string);
}
void rift_tracker_140::data(double *data)
@@ -82,25 +83,21 @@ void rift_tracker_140::data(double *data)
pitch *= c_mult;
roll *= c_mult;
- double yaw_ = double(yaw);
- if (s.useYawSpring)
- {
- yaw_ = old_yaw*s.persistence + (yaw_-old_yaw);
- if(yaw_ > s.deadzone)
- yaw_ -= s.constant_drift;
- if(yaw_ < -s.deadzone)
- yaw_ += s.constant_drift;
- old_yaw = yaw_;
- }
constexpr double d2r = 180 / M_PI;
- data[Yaw] = yaw_ * -d2r;
- data[Pitch] = double(pitch) * d2r;
- data[Roll] = double(roll) * d2r;
- data[TX] = double(pose.Translation.x) * -1e2;
- data[TY] = double(pose.Translation.y) * 1e2;
- data[TZ] = double(pose.Translation.z) * 1e2;
+ data[Yaw] = double(yaw) * -d2r;
+ data[Pitch] = double(pitch) * d2r;
+ data[Roll] = double(roll) * d2r;
+ data[TX] = double(pose.Translation.x) * -1e2;
+ data[TY] = double(pose.Translation.y) * 1e2;
+ data[TZ] = double(pose.Translation.z) * 1e2;
}
}
}
+bool rift_tracker_140::center()
+{
+ (void)ovr_RecenterTrackingOrigin(hmd);
+ return false;
+}
+
OPENTRACK_DECLARE_TRACKER(rift_tracker_140, dialog_rift_140, rift_140Dll)