static int mirror_height;
static ovrEyeRenderDesc eyeRenderDesc[2];
static ovrPosef hmdToEyeViewPose[2];
+static ovrPosef headPose;
static ovrPosef handPoses[2];
static ovrInputState inputState;
static ovrLayerEyeFov layer;
return -EINVAL;
}
-void get_poses_ovr(int *button_a, int *button_b, int *button_x, int *button_y, int *button_menu, int *button_trigger, int *button_left_thumb, int *button_right_thumb, double *hand_right_x, double *hand_right_y, double *hand_right_z, double *hand_right_yaw, double *hand_right_pitch, double *hand_right_roll, double *stick_left_x, double *stick_left_y, double *stick_right_x, double *stick_right_y)
+void get_poses_ovr(int *button_a, int *button_b, int *button_x, int *button_y, int *button_menu, int *button_trigger, int *button_left_thumb, int *button_right_thumb, double *hand_right_x, double *hand_right_y, double *hand_right_z, double *hand_right_yaw, double *hand_right_pitch, double *hand_right_roll, double *stick_left_x, double *stick_left_y, double *stick_right_x, double *stick_right_y, double *head_yaw, double *head_pitch, double *head_roll)
{
ovrResult result;
float yaw, pitch, roll;
double displayMidpointSeconds = ovr_GetPredictedDisplayTime(session, frameIndex);
ovrTrackingState hmdState = ovr_GetTrackingState(session, displayMidpointSeconds, ovrTrue);
ovr_CalcEyePoses(hmdState.HeadPose.ThePose, hmdToEyeViewPose, layer.RenderPose);
- /* Grab hand poses useful for rendering hand or controller representation */
+ /* Grab hand poses useful for rendering head/hand or controller representation */
+ headPose = hmdState.HeadPose.ThePose;
handPoses[ovrHand_Left] = hmdState.HandPoses[ovrHand_Left].ThePose;
handPoses[ovrHand_Right] = hmdState.HandPoses[ovrHand_Right].ThePose;
x = handPoses[ovrHand_Right].Position.x;
*hand_right_x = x / 0.0254;
*hand_right_y = y / 0.0254;
*hand_right_z = z / 0.0254;
+ ovrOrientation2yawpitchroll(headPose.Orientation, &yaw, &pitch, &roll);
+ *head_yaw = yaw;
+ *head_pitch = pitch;
+ *head_roll = roll;
ovrOrientation2yawpitchroll(handPoses[ovrHand_Right].Orientation, &yaw, &pitch, &roll);
*hand_right_yaw = yaw;
*hand_right_pitch = pitch;