diff options
Diffstat (limited to 'ftnoir_tracker_rift')
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 20 | ||||
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.h | 8 |
2 files changed, 15 insertions, 13 deletions
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 031eff32..ea268f12 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -24,11 +24,12 @@ void Rift_Tracker::StartTracker(QFrame*) hmd = ovrHmd_Create(0); if (hmd) { - ovrHmd_GetDesc(hmd, &hmdDesc); - ovrHmd_StartSensor(hmd, ovrSensorCap_Orientation| ovrSensorCap_YawCorrection | ovrSensorCap_Position, ovrSensorCap_Orientation); - }else{ - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); - } + ovrHmd_ConfigureTracking(hmd, ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position, ovrTrackingCap_Orientation); + } + else + { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } } @@ -36,11 +37,12 @@ void Rift_Tracker::GetHeadPoseData(double *data) { if (hmd) { - frameTiming = ovrHmd_BeginFrameTiming(hmd, 0); - ovrSensorState ss = ovrHmd_GetSensorState(hmd, frameTiming.ScanoutMidpointSeconds); - ovrHmd_EndFrameTiming(hmd); + ovrHSWDisplayState hsw; + if (ovrHmd_GetHSWDisplayState(hmd, &hsw), hsw.Displayed) + ovrHmd_DismissHSWDisplay(hmd); + ovrTrackingState ss = ovrHmd_GetTrackingState(hmd, frameTiming.ScanoutMidpointSeconds); if(ss.StatusFlags & ovrStatus_OrientationTracked) { - ovrPosef pose = ss.Predicted.Pose; + auto pose = ss.HeadPose.ThePose; Quatf quat = pose.Orientation; float yaw, pitch, roll; quat.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll); diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index e351b5fe..3e26abdb 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -33,11 +33,11 @@ class Rift_Tracker : public ITracker { public: Rift_Tracker(); - virtual ~Rift_Tracker() virt_override; + virtual ~Rift_Tracker() override; - void StartTracker(QFrame *) virt_override; - void GetHeadPoseData(double *data) virt_override; - virtual int preferredHz() virt_override { return 250; } + void StartTracker(QFrame *) override; + void GetHeadPoseData(double *data) override; + virtual int preferredHz() override { return 250; } volatile bool should_quit; protected: void run(); // qthread override run method |