Add a cvar for sprite billboarding, off by default.

This commit is contained in:
Sryder 2019-05-06 16:57:32 +01:00
parent 4d77ed925e
commit 8273534967
4 changed files with 6 additions and 3 deletions

View File

@ -4249,7 +4249,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t
// This is expecting a pointer to an array containing 4 wallVerts for a sprite
static void HWR_RotateSpritePolyToAim(gr_vissprite_t *spr, FOutVector *wallVerts)
{
if (spr && spr->mobj && wallVerts)
if (cv_grspritebillboarding.value && spr && spr->mobj && wallVerts)
{
float basey = FIXED_TO_FLOAT(spr->mobj->z);
float lowy = wallVerts[0].y;
@ -4530,7 +4530,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
wallVerts[1].y = endbot;
// The x and y only need to be adjusted in the case that it's not a papersprite
if (spr->mobj)
if (cv_grspritebillboarding.value && spr->mobj)
{
// Get the x and z of the vertices so billboarding draws correctly
realheight = realbot - realtop;
@ -4559,7 +4559,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
wallVerts[0].y = wallVerts[1].y = bot;
// The x and y only need to be adjusted in the case that it's not a papersprite
if (spr->mobj)
if (cv_grspritebillboarding.value && spr->mobj)
{
// Get the x and z of the vertices so billboarding draws correctly
realheight = realbot - realtop;

View File

@ -95,6 +95,7 @@ extern consvar_t cv_grcorrecttricks;
extern consvar_t cv_voodoocompatibility;
extern consvar_t cv_grfovchange;
extern consvar_t cv_grsolvetjoin;
extern consvar_t cv_grspritebillboarding;
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy;

View File

@ -1407,6 +1407,7 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_grcoronasize);
#endif
CV_RegisterVar(&cv_grmd2);
CV_RegisterVar(&cv_grspritebillboarding);
#endif
#ifdef HWRENDER

View File

@ -81,6 +81,7 @@ consvar_t cv_grcoronasize = {"gr_coronasize", "1", CV_SAVE| CV_FLOAT, 0, NULL, 0
static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}};
// console variables in development
consvar_t cv_grmd2 = {"gr_md2", "Off", CV_SAVE, CV_MD2, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#endif
const UINT8 gammatable[5][256] =