Add a cvar gl_showbbox for drawing entities bounding boxes

This commit is contained in:
Yamagi Burmeister 2017-01-19 21:04:58 +01:00
parent 55d7842a02
commit 6e5cf7ee08
3 changed files with 21 additions and 0 deletions

View file

@ -229,6 +229,7 @@ extern cvar_t *gl_nobind;
extern cvar_t *gl_round_down;
extern cvar_t *gl_picmip;
extern cvar_t *gl_showtris;
extern cvar_t *gl_showbbox;
extern cvar_t *gl_finish;
extern cvar_t *gl_ztrick;
extern cvar_t *gl_zfix;

View file

@ -109,6 +109,7 @@ cvar_t *gl_nobind;
cvar_t *gl_round_down;
cvar_t *gl_picmip;
cvar_t *gl_showtris;
cvar_t *gl_showbbox;
cvar_t *gl_ztrick;
cvar_t *gl_zfix;
cvar_t *gl_finish;
@ -1218,6 +1219,7 @@ R_Register(void)
gl_round_down = Cvar_Get("gl_round_down", "1", 0);
gl_picmip = Cvar_Get("gl_picmip", "0", 0);
gl_showtris = Cvar_Get("gl_showtris", "0", 0);
gl_showbbox = Cvar_Get("gl_showbbox", "0", 0);
gl_ztrick = Cvar_Get("gl_ztrick", "0", 0);
gl_zfix = Cvar_Get("gl_zfix", "0", 0);
gl_finish = Cvar_Get("gl_finish", "0", CVAR_ARCHIVE);

View file

@ -754,6 +754,24 @@ R_DrawAliasModel(entity_t *e)
glPopMatrix();
if (gl_showbbox->value)
{
glDisable(GL_CULL_FACE);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glDisable(GL_TEXTURE_2D);
glBegin(GL_TRIANGLE_STRIP);
for (i = 0; i < 8; i++)
{
glVertex3fv(bbox[i]);
}
glEnd();
glEnable(GL_TEXTURE_2D);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_CULL_FACE);
}
if ((currententity->flags & RF_WEAPONMODEL) && (gl_lefthand->value == 1.0F))
{
glMatrixMode(GL_PROJECTION);