From 00b9727d4d0f6aa55a3ba27a111448a3c1527345 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 16 Apr 2015 18:28:08 +0200 Subject: yaw adjustment for rift --- client2.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client2.cpp b/client2.cpp index 4ae6bba..6f8e79d 100644 --- a/client2.cpp +++ b/client2.cpp @@ -817,6 +817,7 @@ int main(int argc, const char** argv) char key; float aberr_r=0.989, aberr_b=1.021; + float yaw_plus=0.0; int i=-1; while (key=' ') //while ((key=waitKey(1)) != 'e') @@ -883,6 +884,8 @@ int main(int argc, const char** argv) oculus_pitch = asin(2.0*(quat[0]*quat[2]-quat[1]*quat[3])); oculus_roll = -atan2(2.0*(quat[2]*quat[3]+quat[0]*quat[1]), -(quat[0]*quat[0]-quat[1]*quat[1]-quat[2]*quat[2]+quat[3]*quat[3])); + oculus_yaw = fixup_range(oculus_yaw+yaw_plus, -PI, PI); + //printf("oculus yaw, pitch, roll = \t%f\t%f\t%f\n", oculus_yaw*180/PI, oculus_pitch*180/PI, oculus_roll*180/PI); } else @@ -928,6 +931,10 @@ int main(int argc, const char** argv) if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, GL_TRUE); + if (glfwGetKey(window, GLFW_KEY_ENTER) == GLFW_PRESS) + { + yaw_plus = PI+yaw_cam/180.*PI+yaw_plus-oculus_yaw; + } showFPS(); -- cgit v1.2.3