+ /* Grab hand poses useful for rendering head/hand or controller representation */
+ headPose = hmdState.HeadPose.ThePose;
+ handPose = headPose;
+// if ((hmdState.HandStatusFlags[ovrHand_Left] & hand_mask) == hand_flags)
+// handPose = hmdState.HandPoses[ovrHand_Left].ThePose;
+ if ((hmdState.HandStatusFlags[ovrHand_Right] & hand_mask) == hand_flags)
+ handPose = hmdState.HandPoses[ovrHand_Right].ThePose;
+ x = handPose.Position.x;
+ y = handPose.Position.y;
+ z = handPose.Position.z;
+ x += hand_x_reset;
+ y += hand_y_reset;
+ z += hand_z_reset;
+ *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(handPose.Orientation, &yaw, &pitch, &roll);
+ *hand_right_yaw = yaw;
+ *hand_right_pitch = pitch;
+ *hand_right_roll = roll;
+
+ result = ovr_GetInputState(session, ovrControllerType_Active, &inputState);
+ if (OVR_SUCCESS(result)) {
+ if (inputState.Buttons & ovrButton_A)
+ *button_a = 1;
+ else
+ *button_a = 0;
+ if (inputState.Buttons & ovrButton_B)
+ *button_b = 1;
+ else
+ *button_b = 0;
+ if (inputState.Buttons & ovrButton_X)
+ *button_x = 1;
+ else
+ *button_x = 0;
+ if (inputState.Buttons & ovrButton_Y)
+ *button_y = 1;
+ else
+ *button_y = 0;
+ if (inputState.Buttons & ovrButton_Enter)
+ *button_menu = 1;
+ else
+ *button_menu = 0;
+ if (inputState.Buttons & ovrButton_LThumb)
+ *button_left_thumb = 1;
+ else
+ *button_left_thumb = 0;
+ if (inputState.Buttons & ovrButton_RThumb)
+ *button_right_thumb = 1;
+ else
+ *button_right_thumb = 0;
+ if (inputState.IndexTrigger[ovrHand_Left] >= 0.8)
+ *button_left_trigger = 1;
+ else
+ *button_left_trigger = 0;
+ if (inputState.IndexTrigger[ovrHand_Right] >= 0.8)
+ *button_right_trigger = 1;
+ else
+ *button_right_trigger = 0;
+ *stick_left_x = inputState.ThumbstickNoDeadzone[ovrHand_Left].x;
+ *stick_left_y = inputState.ThumbstickNoDeadzone[ovrHand_Left].y;
+ *stick_right_x = inputState.ThumbstickNoDeadzone[ovrHand_Right].x;
+ *stick_right_y = inputState.ThumbstickNoDeadzone[ovrHand_Right].y;
+ }
+}
+
+void begin_render_ovr(void)
+{
+ ovrResult result;