mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 15:31:39 +00:00
Compensate viewmodel distortion at fov > 90
See: https://github.com/Novum/vkQuake/issues/281
Controlled by new cvar cl_gun_fovscale (defaults to 1).
Based on code from Qrack:
3bc2862b1a/gl_rmain.c (L2384-L2392)
This commit is contained in:
parent
b796e366db
commit
401aa52d45
2 changed files with 10 additions and 2 deletions
|
@ -99,6 +99,8 @@ cvar_t scr_showpause = {"showpause","1",CVAR_NONE};
|
||||||
cvar_t scr_printspeed = {"scr_printspeed","8",CVAR_NONE};
|
cvar_t scr_printspeed = {"scr_printspeed","8",CVAR_NONE};
|
||||||
cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", CVAR_ARCHIVE};
|
cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", CVAR_ARCHIVE};
|
||||||
|
|
||||||
|
cvar_t cl_gun_fovscale = {"cl_gun_fovscale","1",CVAR_ARCHIVE}; // Qrack
|
||||||
|
|
||||||
extern cvar_t crosshair;
|
extern cvar_t crosshair;
|
||||||
|
|
||||||
qboolean scr_initialized; // ready to draw
|
qboolean scr_initialized; // ready to draw
|
||||||
|
@ -421,6 +423,7 @@ void SCR_Init (void)
|
||||||
Cvar_RegisterVariable (&scr_centertime);
|
Cvar_RegisterVariable (&scr_centertime);
|
||||||
Cvar_RegisterVariable (&scr_printspeed);
|
Cvar_RegisterVariable (&scr_printspeed);
|
||||||
Cvar_RegisterVariable (&gl_triplebuffer);
|
Cvar_RegisterVariable (&gl_triplebuffer);
|
||||||
|
Cvar_RegisterVariable (&cl_gun_fovscale);
|
||||||
|
|
||||||
Cmd_AddCommand ("screenshot",SCR_ScreenShot_f);
|
Cmd_AddCommand ("screenshot",SCR_ScreenShot_f);
|
||||||
Cmd_AddCommand ("sizeup",SCR_SizeUp_f);
|
Cmd_AddCommand ("sizeup",SCR_SizeUp_f);
|
||||||
|
|
|
@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
|
||||||
extern cvar_t r_drawflat, gl_overbright_models, gl_fullbrights, r_lerpmodels, r_lerpmove; //johnfitz
|
extern cvar_t r_drawflat, gl_overbright_models, gl_fullbrights, r_lerpmodels, r_lerpmove; //johnfitz
|
||||||
|
extern cvar_t scr_fov, cl_gun_fovscale;
|
||||||
|
|
||||||
//up to 16 color translated skins
|
//up to 16 color translated skins
|
||||||
gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz -- changed to an array of pointers
|
gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz -- changed to an array of pointers
|
||||||
|
@ -629,6 +630,7 @@ void R_DrawAliasModel (entity_t *e)
|
||||||
gltexture_t *tx, *fb;
|
gltexture_t *tx, *fb;
|
||||||
lerpdata_t lerpdata;
|
lerpdata_t lerpdata;
|
||||||
qboolean alphatest = !!(e->model->flags & MF_HOLEY);
|
qboolean alphatest = !!(e->model->flags & MF_HOLEY);
|
||||||
|
float fovscale = 1.0f;
|
||||||
|
|
||||||
//
|
//
|
||||||
// setup pose/lerp data -- do it first so we don't miss updates due to culling
|
// setup pose/lerp data -- do it first so we don't miss updates due to culling
|
||||||
|
@ -646,10 +648,13 @@ void R_DrawAliasModel (entity_t *e)
|
||||||
//
|
//
|
||||||
// transform it
|
// transform it
|
||||||
//
|
//
|
||||||
|
if (e == &cl.viewent && scr_fov.value > 90.f && cl_gun_fovscale.value)
|
||||||
|
fovscale = tan(scr_fov.value * (0.5f * M_PI / 180.f));
|
||||||
|
|
||||||
glPushMatrix ();
|
glPushMatrix ();
|
||||||
R_RotateForEntity (lerpdata.origin, lerpdata.angles);
|
R_RotateForEntity (lerpdata.origin, lerpdata.angles);
|
||||||
glTranslatef (paliashdr->scale_origin[0], paliashdr->scale_origin[1], paliashdr->scale_origin[2]);
|
glTranslatef (paliashdr->scale_origin[0], paliashdr->scale_origin[1] * fovscale, paliashdr->scale_origin[2] * fovscale);
|
||||||
glScalef (paliashdr->scale[0], paliashdr->scale[1], paliashdr->scale[2]);
|
glScalef (paliashdr->scale[0], paliashdr->scale[1] * fovscale, paliashdr->scale[2] * fovscale);
|
||||||
|
|
||||||
//
|
//
|
||||||
// random stuff
|
// random stuff
|
||||||
|
|
Loading…
Reference in a new issue