Fix for the zooming fov cross-eyed issue

This commit is contained in:
Simon 2023-07-31 22:41:33 +01:00
parent 6a09e2d411
commit 67e1d61214
2 changed files with 14 additions and 23 deletions

View file

@ -21,11 +21,9 @@ extern "C" {
#include <client_ui.h> #include <client_ui.h>
#ifdef JK2_MODE #include "game/weapons.h"
#include "../OpenJK/codeJK2/game/weapons.h" #ifndef JK2_MODE
#else #include "game/g_vehicles.h"
#include "../OpenJK/code/game/weapons.h"
#include "../OpenJK/code/game/g_vehicles.h"
#endif #endif
@ -461,14 +459,14 @@ bool VR_GetVRProjection(int eye, float zNear, float zFar, float zZoomX, float zZ
} }
XrFovf fov = gAppState.Views[eye].fov; XrFovf fov = gAppState.Views[eye].fov;
fov.angleLeft /= zZoomX; fov.angleLeft = atanf((tanf(fov.angleLeft) / zZoomX));
fov.angleRight /= zZoomX; fov.angleRight = atanf((tanf(fov.angleRight) / zZoomX));
fov.angleUp /= zZoomY; fov.angleUp = atanf((tanf(fov.angleUp) / zZoomY));
fov.angleDown /= zZoomY; fov.angleDown = atanf((tanf(fov.angleDown) / zZoomY));
XrMatrix4x4f_CreateProjectionFov( XrMatrix4x4f_CreateProjectionFov(
(XrMatrix4x4f*)projection, GRAPHICS_OPENGL, (XrMatrix4x4f*)projection, GRAPHICS_OPENGL,
fov, zNear, zFar); fov, zNear, zFar);
return true; return true;
} }

View file

@ -280,18 +280,10 @@ void VR_Init()
} }
vr.menu_right_handed = vr_control_scheme->integer == 0; vr.menu_right_handed = vr_control_scheme->integer == 0;
Cvar_Get ("openXRHMD", gAppState.OpenXRHMD, CVAR_ARCHIVE);
} }
int VR_SetRefreshRate(int refreshRate) int VR_SetRefreshRate(int refreshRate)
{ {
// if (strstr(gAppState.OpenXRHMD, "meta") != NULL)
// {
// OXR(gAppState.pfnRequestDisplayRefreshRate(gAppState.Session, (float) refreshRate));
// return refreshRate;
// }
return 0; return 0;
} }
@ -324,10 +316,11 @@ bool VR_GetVRProjection(int eye, float zNear, float zFar, float zZoomX, float zZ
} }
XrFovf fov = gAppState.Views[eye].fov; XrFovf fov = gAppState.Views[eye].fov;
fov.angleLeft /= zZoomX;
fov.angleRight /= zZoomX; fov.angleLeft = atanf((tanf(fov.angleLeft) / zZoomX));
fov.angleUp /= zZoomY; fov.angleRight = atanf((tanf(fov.angleRight) / zZoomX));
fov.angleDown /= zZoomY; fov.angleUp = atanf((tanf(fov.angleUp) / zZoomY));
fov.angleDown = atanf((tanf(fov.angleDown) / zZoomY));
XrMatrix4x4f_CreateProjectionFov( XrMatrix4x4f_CreateProjectionFov(
(XrMatrix4x4f*)projection, GRAPHICS_OPENGL, (XrMatrix4x4f*)projection, GRAPHICS_OPENGL,