mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-24 13:01:36 +00:00
Fix adjustment to weapon scopes for asymmetric fov HMDs
This commit is contained in:
parent
c01babfc1d
commit
afaf887a47
5 changed files with 12 additions and 8 deletions
|
@ -38,7 +38,8 @@ typedef struct {
|
||||||
bool third_person;
|
bool third_person;
|
||||||
float fov_x;
|
float fov_x;
|
||||||
float fov_y;
|
float fov_y;
|
||||||
float off_center_fov;
|
float off_center_fov_x;
|
||||||
|
float off_center_fov_y;
|
||||||
|
|
||||||
float tempWeaponVelocity;
|
float tempWeaponVelocity;
|
||||||
|
|
||||||
|
|
|
@ -1875,8 +1875,8 @@ void TBXR_prepareEyeBuffer(int eye )
|
||||||
//Seems odd, but used to move the HUD elements to be central on the player's view
|
//Seems odd, but used to move the HUD elements to be central on the player's view
|
||||||
//HMDs with a symmetric fov (like the PICO) will have 0 in this value, but the Meta Quest
|
//HMDs with a symmetric fov (like the PICO) will have 0 in this value, but the Meta Quest
|
||||||
//will have an asymmetric fov and the HUD would be very misaligned as a result
|
//will have an asymmetric fov and the HUD would be very misaligned as a result
|
||||||
vr.off_center_fov = -(gAppState.Views[eye].fov.angleLeft + gAppState.Views[eye].fov.angleRight) / 2.0f;
|
vr.off_center_fov_x = -(gAppState.Views[eye].fov.angleLeft + gAppState.Views[eye].fov.angleRight) / 2.0f;
|
||||||
}
|
vr.off_center_fov_y = -(gAppState.Views[eye].fov.angleUp + gAppState.Views[eye].fov.angleDown) / 2.0f;}
|
||||||
|
|
||||||
void TBXR_finishEyeBuffer(int eye )
|
void TBXR_finishEyeBuffer(int eye )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1099,7 +1099,8 @@ void TBXR_prepareEyeBuffer(int eye )
|
||||||
//Seems odd, but used to move the HUD elements to be central on the player's view
|
//Seems odd, but used to move the HUD elements to be central on the player's view
|
||||||
//HMDs with a symmetric fov (like the PICO) will have 0 in this value, but the Meta Quest
|
//HMDs with a symmetric fov (like the PICO) will have 0 in this value, but the Meta Quest
|
||||||
//will have an asymmetric fov and the HUD would be very misaligned as a result
|
//will have an asymmetric fov and the HUD would be very misaligned as a result
|
||||||
vr.off_center_fov = -(gAppState.Views[eye].fov.angleLeft + gAppState.Views[eye].fov.angleRight) / 2.0f;
|
vr.off_center_fov_x = -(gAppState.Views[eye].fov.angleLeft + gAppState.Views[eye].fov.angleRight) / 2.0f;
|
||||||
|
vr.off_center_fov_y = -(gAppState.Views[eye].fov.angleUp + gAppState.Views[eye].fov.angleDown) / 2.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WIN_SwapWindow();
|
void WIN_SwapWindow();
|
||||||
|
|
|
@ -39,7 +39,8 @@ void CG_AdjustFrom640(float* x, float* y, float* w, float* h) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//We need to add an offset due to the effect of the compositor projection for asymmetric FOVs
|
//We need to add an offset due to the effect of the compositor projection for asymmetric FOVs
|
||||||
xoffset += vr->off_center_fov * 640;
|
xoffset += vr->off_center_fov_x * 640;
|
||||||
|
float yoffset = vr->off_center_fov_y * 480;
|
||||||
|
|
||||||
*x *= screenXScale;
|
*x *= screenXScale;
|
||||||
*y *= screenYScale;
|
*y *= screenYScale;
|
||||||
|
@ -51,7 +52,7 @@ void CG_AdjustFrom640(float* x, float* y, float* w, float* h) {
|
||||||
}
|
}
|
||||||
|
|
||||||
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
|
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
|
||||||
*y += (480 - (480 * screenYScale)) / 2.0f - ((cg.drawingHUD != CG_HUD_ZOOM) ? cg_hudYOffset.value : 0);
|
*y += (480 - (480 * screenYScale)) / 2.0f - ((cg.drawingHUD != CG_HUD_ZOOM) ? cg_hudYOffset.value : 0) - yoffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,8 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//We need to add an offset due to the effect of the compositor projection for asymmetric FOVs
|
//We need to add an offset due to the effect of the compositor projection for asymmetric FOVs
|
||||||
xoffset += vr->off_center_fov * 640;
|
xoffset += vr->off_center_fov_x * 640;
|
||||||
|
float yoffset = vr->off_center_fov_y * 480;
|
||||||
|
|
||||||
*x *= screenXScale;
|
*x *= screenXScale;
|
||||||
*y *= screenYScale;
|
*y *= screenYScale;
|
||||||
|
@ -50,7 +51,7 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
|
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
|
||||||
*y += (480 - (480 * screenYScale)) / 2.0f - ((cg.drawingHUD != CG_HUD_ZOOM) ? cg_hudYOffset.value : 0);
|
*y += (480 - (480 * screenYScale)) / 2.0f - ((cg.drawingHUD != CG_HUD_ZOOM) ? cg_hudYOffset.value : 0) - yoffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue