mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 06:41:58 +00:00
OpenXR calculate FOV as average of both eyes
This commit is contained in:
parent
52799aa99d
commit
65ff5bbd80
1 changed files with 5 additions and 2 deletions
|
@ -409,14 +409,17 @@ void VR_DrawFrame( engine_t* engine ) {
|
||||||
projections));
|
projections));
|
||||||
//
|
//
|
||||||
|
|
||||||
XrFovf fov;
|
XrFovf fov = {};
|
||||||
XrPosef viewTransform[2];
|
XrPosef viewTransform[2];
|
||||||
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
|
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
|
||||||
XrPosef xfHeadFromEye = projections[eye].pose;
|
XrPosef xfHeadFromEye = projections[eye].pose;
|
||||||
XrPosef xfStageFromEye = XrPosef_Multiply(xfStageFromHead, xfHeadFromEye);
|
XrPosef xfStageFromEye = XrPosef_Multiply(xfStageFromHead, xfHeadFromEye);
|
||||||
viewTransform[eye] = XrPosef_Inverse(xfStageFromEye);
|
viewTransform[eye] = XrPosef_Inverse(xfStageFromEye);
|
||||||
|
|
||||||
fov = projections[eye].fov;
|
fov.angleLeft += projections[eye].fov.angleLeft / 2.0f;
|
||||||
|
fov.angleRight += projections[eye].fov.angleRight / 2.0f;
|
||||||
|
fov.angleUp += projections[eye].fov.angleUp / 2.0f;
|
||||||
|
fov.angleDown += projections[eye].fov.angleDown / 2.0f;
|
||||||
}
|
}
|
||||||
vr.fov_x = (fabs(fov.angleLeft) + fabs(fov.angleRight)) * 180.0f / M_PI;
|
vr.fov_x = (fabs(fov.angleLeft) + fabs(fov.angleRight)) * 180.0f / M_PI;
|
||||||
vr.fov_y = (fabs(fov.angleUp) + fabs(fov.angleDown)) * 180.0f / M_PI;
|
vr.fov_y = (fabs(fov.angleUp) + fabs(fov.angleDown)) * 180.0f / M_PI;
|
||||||
|
|
Loading…
Reference in a new issue