@@ -388,15 +388,9 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
388388 g_Config.fCameraHeight = clampFloat (g_Config.fCameraHeight , -150 .0f , 150 .0f );
389389 break ;
390390 case JOYSTICK_AXIS_Z:
391- if (g_Config.bEnableVR ) {
392- if (axis.second < -0 .75f ) g_Config.fHeadUpDisplayScale -= 0 .01f ;
393- if (axis.second > 0 .75f ) g_Config.fHeadUpDisplayScale += 0 .01f ;
394- g_Config.fHeadUpDisplayScale = clampFloat (g_Config.fHeadUpDisplayScale , 0 .0f , 1 .5f );
395- } else {
396- if (axis.second < -0 .75f ) g_Config.fCanvas3DDistance += 0 .1f ;
397- if (axis.second > 0 .75f ) g_Config.fCanvas3DDistance -= 0 .1f ;
398- g_Config.fCanvas3DDistance = clampFloat (g_Config.fCanvas3DDistance , 1 .0f , 15 .0f );
399- }
391+ if (axis.second < -0 .75f ) g_Config.fCameraPitch -= 0 .5f ;
392+ if (axis.second > 0 .75f ) g_Config.fCameraPitch += 0 .5f ;
393+ g_Config.fCameraPitch = clampFloat (g_Config.fCameraPitch , -90 .0f , 90 .0f );
400394 break ;
401395 case JOYSTICK_AXIS_RZ:
402396 if (axis.second > 0 .75f ) g_Config.fCameraDistance -= 0 .1f ;
@@ -539,11 +533,10 @@ bool UpdateVRKeys(const KeyInput &key) {
539533
540534 // Reset camera adjust
541535 if (pspKeys[VIRTKEY_VR_CAMERA_ADJUST] && pspKeys[VIRTKEY_VR_CAMERA_RESET]) {
542- g_Config.fCanvas3DDistance = 3 .0f ;
543536 g_Config.fCameraHeight = 0 ;
544537 g_Config.fCameraSide = 0 ;
545538 g_Config.fCameraDistance = 0 ;
546- g_Config.fHeadUpDisplayScale = 0 . 3f ;
539+ g_Config.fCameraPitch = 0 ;
547540 }
548541
549542 // block keys by camera adjust
@@ -667,12 +660,16 @@ bool StartVRRender() {
667660 M[10 ] = -1 ;
668661 M[11 ] = -(fovHack + fovHack);
669662 M[14 ] = -(nearZ + nearZ);
663+ if (g_Config.bAntiFlickeringFlow ) {
664+ M[0 ] /= 2 .0f ;
665+ }
670666 memcpy (vrMatrix[VR_PROJECTION_MATRIX], M, sizeof (float ) * 16 );
671667
672668 // Decide if the scene is 3D or not
673669 VR_SetConfigFloat (VR_CONFIG_CANVAS_ASPECT, 480 .0f / 272 .0f );
674670 if (g_Config.bEnableVR && !vrIncompatibleGame && (appMode == VR_GAME_MODE) && vrScene) {
675671 VR_SetConfig (VR_CONFIG_MODE, vrStereo ? VR_MODE_STEREO_6DOF : VR_MODE_MONO_6DOF);
672+ VR_SetConfig (VR_CONFIG_REPROJECTION, g_Config.bAntiFlickeringFlow ? 0 : 1 );
676673 vrFlatGame = false ;
677674 } else if (appMode == VR_GAME_MODE) {
678675 VR_SetConfig (VR_CONFIG_MODE, vrStereo ? VR_MODE_STEREO_SCREEN : VR_MODE_MONO_SCREEN);
@@ -689,7 +686,7 @@ bool StartVRRender() {
689686
690687 // Set customizations
691688 VR_SetConfigFloat (VR_CONFIG_CANVAS_DISTANCE, vrScene && (appMode == VR_GAME_MODE) ? g_Config.fCanvas3DDistance : g_Config.fCanvasDistance );
692- VR_SetConfig (VR_CONFIG_PASSTHROUGH, g_Config.bPassthrough );
689+ VR_SetConfig (VR_CONFIG_PASSTHROUGH, g_Config.bPassthrough && IsPassthroughSupported () );
693690 return true ;
694691 }
695692 return false ;
@@ -874,23 +871,13 @@ void UpdateVRViewMatrices() {
874871 invView = XrPosef_Inverse (invView);
875872 }
876873
877- // apply camera pitch offset
874+ // apply camera pitch
875+ float s = sin (ToRadians (g_Config.fCameraPitch ));
876+ float c = cos (ToRadians (g_Config.fCameraPitch ));
878877 XrVector3f positionOffset = {g_Config.fCameraSide , g_Config.fCameraHeight , g_Config.fCameraDistance };
879- if (!flatScreen) {
880- float pitchOffset = 0 ;
881- switch (g_Config.iCameraPitch ) {
882- case 1 : // Top view -> First person
883- pitchOffset = 90 ;
884- positionOffset = {positionOffset.x , positionOffset.z , -positionOffset.y };
885- break ;
886- case 2 : // First person -> Top view
887- pitchOffset = -90 ;
888- positionOffset = {positionOffset.x , -positionOffset.z + 20 , positionOffset.y };
889- break ;
890- }
891- XrQuaternionf rotationOffset = XrQuaternionf_CreateFromVectorAngle ({1 , 0 , 0 }, ToRadians (pitchOffset));
892- invView.orientation = XrQuaternionf_Multiply (rotationOffset, invView.orientation );
893- }
878+ positionOffset = {positionOffset.x , s * positionOffset.z + c * positionOffset.y , c * positionOffset.z - s * positionOffset.y };
879+ XrQuaternionf rotationOffset = XrQuaternionf_CreateFromVectorAngle ({1 , 0 , 0 }, ToRadians (g_Config.fCameraPitch ));
880+ invView.orientation = XrQuaternionf_Multiply (rotationOffset, invView.orientation );
894881
895882 // decompose rotation
896883 XrVector3f rotation = XrQuaternionf_ToEulerAngles (invView.orientation );
@@ -906,12 +893,16 @@ void UpdateVRViewMatrices() {
906893 XrQuaternionf yaw = XrQuaternionf_CreateFromVectorAngle ({0 , 1 , 0 }, mYaw );
907894 XrQuaternionf roll = XrQuaternionf_CreateFromVectorAngle ({0 , 0 , 1 }, mRoll );
908895 invView.orientation = XrQuaternionf_Multiply (roll, XrQuaternionf_Multiply (pitch, yaw));
896+ if (!VR_GetConfig (VR_CONFIG_REPROJECTION)) {
897+ float axis = vrMirroring[VR_MIRRORING_PITCH] ? -1 .0f : 1 .0f ;
898+ invView.orientation = XrQuaternionf_CreateFromVectorAngle ({axis, 0 , 0 }, ToRadians (g_Config.fCameraPitch ));
899+ }
909900
910901 float M[16 ];
911902 XrQuaternionf_ToMatrix4f (&invView.orientation , M);
912903
913904 // Apply 6Dof head movement
914- if (g_Config.bEnable6DoF && !g_Config.bHeadRotationEnabled && (g_Config. iCameraPitch == 0 ) ) {
905+ if (g_Config.bEnable6DoF && !g_Config.bHeadRotationEnabled ) {
915906 M[3 ] -= vrView[0 ].pose .position .x * (vrMirroring[VR_MIRRORING_AXIS_X] ? -1 .0f : 1 .0f ) * scale;
916907 M[7 ] -= vrView[0 ].pose .position .y * (vrMirroring[VR_MIRRORING_AXIS_Y] ? -1 .0f : 1 .0f ) * scale;
917908 M[11 ] -= vrView[0 ].pose .position .z * (vrMirroring[VR_MIRRORING_AXIS_Z] ? -1 .0f : 1 .0f ) * scale;
0 commit comments