r_gunfov for the software renderer

This commit is contained in:
Daniel Gibson 2018-04-21 21:35:13 +02:00
parent c59c1bfda1
commit 12a8da7180
3 changed files with 18 additions and 4 deletions

View file

@ -444,6 +444,7 @@ extern cvar_t *sw_waterwarp;
extern cvar_t *r_fullbright; extern cvar_t *r_fullbright;
extern cvar_t *r_lefthand; extern cvar_t *r_lefthand;
extern cvar_t *r_gunfov;
extern cvar_t *r_drawworld; extern cvar_t *r_drawworld;
extern cvar_t *r_lerpmodels; extern cvar_t *r_lerpmodels;
extern cvar_t *r_lightlevel; extern cvar_t *r_lightlevel;

View file

@ -723,12 +723,22 @@ void R_AliasDrawModel (void)
if ( r_lerpmodels->value == 0 ) if ( r_lerpmodels->value == 0 )
currententity->backlerp = 0; currententity->backlerp = 0;
float oldAliasxscale = aliasxscale;
float oldAliasyscale = aliasyscale;
if ( currententity->flags & RF_WEAPONMODEL ) if ( currententity->flags & RF_WEAPONMODEL )
{ {
if ( r_lefthand->value == 2.0F )
{
return;
}
float fov = 2.0*tan((r_gunfov->value*(4.0/3.0))/360.0*M_PI);
aliasxscale = ((float)r_refdef.vrect.width / fov) * r_aliasuvscale;
aliasyscale = aliasxscale;
if ( r_lefthand->value == 1.0F ) if ( r_lefthand->value == 1.0F )
aliasxscale = -aliasxscale; aliasxscale = -aliasxscale;
else if ( r_lefthand->value == 2.0F )
return;
} }
/* /*
@ -851,8 +861,9 @@ void R_AliasDrawModel (void)
R_AliasPreparePoints (); R_AliasPreparePoints ();
if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) ) if ( currententity->flags & RF_WEAPONMODEL )
{ {
aliasxscale = -aliasxscale; aliasxscale = oldAliasxscale;
aliasyscale = oldAliasyscale;
} }
} }

View file

@ -109,6 +109,7 @@ float da_time1, da_time2, dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_t
float se_time1, se_time2, de_time1, de_time2; float se_time1, se_time2, de_time1, de_time2;
cvar_t *r_lefthand; cvar_t *r_lefthand;
cvar_t *r_gunfov;
static cvar_t *sw_aliasstats; static cvar_t *sw_aliasstats;
cvar_t *sw_clearcolor; cvar_t *sw_clearcolor;
cvar_t *sw_drawflat; cvar_t *sw_drawflat;
@ -274,6 +275,7 @@ R_Register (void)
r_mode = ri.Cvar_Get( "r_mode", "0", CVAR_ARCHIVE ); r_mode = ri.Cvar_Get( "r_mode", "0", CVAR_ARCHIVE );
r_lefthand = ri.Cvar_Get( "hand", "0", CVAR_USERINFO | CVAR_ARCHIVE ); r_lefthand = ri.Cvar_Get( "hand", "0", CVAR_USERINFO | CVAR_ARCHIVE );
r_gunfov = ri.Cvar_Get( "r_gunfov", "80", CVAR_USERINFO | CVAR_ARCHIVE );
r_speeds = ri.Cvar_Get ("r_speeds", "0", 0); r_speeds = ri.Cvar_Get ("r_speeds", "0", 0);
r_fullbright = ri.Cvar_Get ("r_fullbright", "0", 0); r_fullbright = ri.Cvar_Get ("r_fullbright", "0", 0);
r_drawentities = ri.Cvar_Get ("r_drawentities", "1", 0); r_drawentities = ri.Cvar_Get ("r_drawentities", "1", 0);