diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-07-18 19:25:37 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-07-18 19:25:37 +0200 |
commit | 25804c1f4a5cd9374e4f4caaa6a6039d28b1e64a (patch) | |
tree | d3c100b87a71f29e35366c854704f5ca58f3a471 /ftnoir_tracker_rift | |
parent | cc8146215b034aa5e92ad0313db096aba3e73499 (diff) |
Rift: no need for temporary array, inline it
Diffstat (limited to 'ftnoir_tracker_rift')
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 219b0d7c..0a2ded7d 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -42,26 +42,24 @@ void Rift_Tracker::GetHeadPoseData(double *data) ovrPosef pose = ss.Predicted.Pose; Quatf quat = pose.Orientation; float yaw, pitch, roll; - double newHeadPose[6] = {0}; quat.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll); if (s.useYawSpring) { - newHeadPose[Yaw] = old_yaw*s.persistence + (yaw-old_yaw); - if(newHeadPose[Yaw]>s.deadzone)newHeadPose[Yaw]-= s.constant_drift; - if(newHeadPose[Yaw]<-s.deadzone)newHeadPose[Yaw]+= s.constant_drift; + 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; } - newHeadPose[Pitch] = pitch; - newHeadPose[Roll] = roll; - newHeadPose[Yaw] = yaw; if (s.bEnableYaw) { - data[Yaw] = newHeadPose[Yaw] * 57.295781f; + data[Yaw] = yaw * 57.295781f; } if (s.bEnablePitch) { - data[Pitch] = newHeadPose[Pitch] * 57.295781f; + data[Pitch] = pitch * 57.295781f; } if (s.bEnableRoll) { - data[Roll] = newHeadPose[Roll] * 57.295781f; + data[Roll] = roll * 57.295781f; } ovrHmd_EndFrameTiming(hmd); } |