Skip to content

Commit

Permalink
OpenXR - Camera type fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lvonasek committed Jul 22, 2024
1 parent b70c2cf commit b7eefbc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Common/VR/PPSSPPVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,9 +879,9 @@ void UpdateVRViewMatrices() {
}

// apply camera pitch offset
float pitchOffset = 0;
XrVector3f positionOffset = {g_Config.fCameraSide, g_Config.fCameraHeight, g_Config.fCameraDistance};
if (!flatScreen) {
float pitchOffset = 0;
switch (g_Config.iCameraPitch) {
case 1: //Top view -> First person
pitchOffset = 90;
Expand All @@ -901,9 +901,6 @@ void UpdateVRViewMatrices() {
float mPitch = mx * ToRadians(rotation.x);
float mYaw = my * ToRadians(rotation.y);
float mRoll = mz * ToRadians(rotation.z);
if (!VR_GetConfig(VR_CONFIG_REPROJECTION)) {
mPitch = 0; mYaw = 0; mRoll = 0;
}

// use in-game camera interpolated rotation
if (g_Config.bHeadRotationEnabled) mYaw = -my * ToRadians(hmdMotionDiffLast[1]); // horizontal
Expand All @@ -913,6 +910,10 @@ void UpdateVRViewMatrices() {
XrQuaternionf yaw = XrQuaternionf_CreateFromVectorAngle({0, 1, 0}, mYaw);
XrQuaternionf roll = XrQuaternionf_CreateFromVectorAngle({0, 0, 1}, mRoll);
invView.orientation = XrQuaternionf_Multiply(roll, XrQuaternionf_Multiply(pitch, yaw));
if (!VR_GetConfig(VR_CONFIG_REPROJECTION)) {
float axis = vrMirroring[VR_MIRRORING_PITCH] ? -1.0f : 1.0f;
invView.orientation = XrQuaternionf_CreateFromVectorAngle({axis, 0, 0}, ToRadians(pitchOffset));
}

float M[16];
XrQuaternionf_ToMatrix4f(&invView.orientation, M);
Expand Down

0 comments on commit b7eefbc

Please sign in to comment.