@@ -34,6 +34,8 @@ backEndState_t backEnd;
34
34
35
35
static Cvar::Cvar<bool > r_clear ( " r_clear" , " Clear screen before painting over it on every frame" , Cvar::NONE, false );
36
36
Cvar::Cvar<bool > r_drawSky ( " r_drawSky" , " Draw the sky (clear the sky if disabled)" , Cvar::NONE, true );
37
+ static Cvar::Cvar<int > r_showEntityBounds (
38
+ " r_showEntityBounds" , " show bboxes used for culling (1: wireframe; 2: translucent solid)" , Cvar::CHEAT, 0 );
37
39
38
40
void GL_Bind ( image_t *image )
39
41
{
@@ -1563,7 +1565,7 @@ static void RB_RenderDebugUtils()
1563
1565
{
1564
1566
GLIMP_LOGCOMMENT ( " --- RB_RenderDebugUtils ---" );
1565
1567
1566
- if ( r_showEntityTransforms-> integer )
1568
+ if ( r_showEntityBounds. Get () )
1567
1569
{
1568
1570
trRefEntity_t *ent;
1569
1571
int i;
@@ -1577,13 +1579,23 @@ static void RB_RenderDebugUtils()
1577
1579
gl_genericShader->SetDepthFade ( false );
1578
1580
gl_genericShader->BindProgram ( 0 );
1579
1581
1580
- GL_State ( GLS_POLYMODE_LINE | GLS_DEPTHTEST_DISABLE );
1582
+ if ( r_showEntityBounds.Get () == 2 )
1583
+ {
1584
+ GL_State ( GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
1585
+ glEnable ( GL_POLYGON_OFFSET_FILL );
1586
+ GL_PolygonOffset ( r_offsetFactor->value , r_offsetUnits->value );
1587
+ }
1588
+ else
1589
+ {
1590
+ GL_State ( GLS_POLYMODE_LINE | GLS_DEPTHTEST_DISABLE );
1591
+ }
1592
+
1581
1593
GL_Cull ( cullType_t::CT_TWO_SIDED );
1582
1594
1583
1595
// set uniforms
1584
1596
gl_genericShader->SetUniform_AlphaTest ( GLS_ATEST_NONE );
1585
1597
SetUniform_ColorModulateColorGen ( gl_genericShader, colorGen_t::CGEN_VERTEX, alphaGen_t::AGEN_VERTEX );
1586
- SetUniform_Color ( gl_genericShader, Color::Black );
1598
+ SetUniform_Color ( gl_genericShader, Color::Color ( 0 , 0 , 0 , 0 ) );
1587
1599
1588
1600
// bind u_ColorMap
1589
1601
gl_genericShader->SetUniform_ColorMapBindless (
@@ -1613,16 +1625,23 @@ static void RB_RenderDebugUtils()
1613
1625
1614
1626
Tess_Begin ( Tess_StageIteratorDebug, nullptr , nullptr , true , -1 , 0 );
1615
1627
1616
- Tess_AddCube ( vec3_origin, ent->localBounds [ 0 ], ent->localBounds [ 1 ], Color::Blue );
1617
-
1618
- Tess_AddCube ( vec3_origin, mins, maxs,Color::White );
1628
+ if ( r_showEntityBounds.Get () == 2 )
1629
+ {
1630
+ Tess_AddCube ( vec3_origin, ent->localBounds [ 0 ], ent->localBounds [ 1 ], Color::Color (0 , 0 , 0.5 , 0.4 ) );
1631
+ }
1632
+ else
1633
+ {
1634
+ Tess_AddCube ( vec3_origin, ent->localBounds [ 0 ], ent->localBounds [ 1 ], Color::Blue );
1635
+ Tess_AddCube ( vec3_origin, mins, maxs,Color::White );
1636
+ }
1619
1637
1620
1638
Tess_End ();
1621
1639
}
1622
1640
1623
1641
// go back to the world modelview matrix
1624
1642
backEnd.orientation = backEnd.viewParms .world ;
1625
1643
GL_LoadModelViewMatrix ( backEnd.viewParms .world .modelViewMatrix );
1644
+ glDisable ( GL_POLYGON_OFFSET_FILL );
1626
1645
}
1627
1646
1628
1647
if ( r_showSkeleton->integer )
0 commit comments