light_dynamic: Add r_showDlights, which will visually highlight active

dynamic lights that are active in-game.
This commit is contained in:
Marco Cawthorne 2022-03-03 14:16:46 -08:00
parent 53f5780ac0
commit 7ba2bee8e2
Signed by: eukara
GPG key ID: C196CD8BA993248A

View file

@ -52,6 +52,8 @@ games to tell the entity to start inactive as far as I can tell.
This entity was introduced in Half-Life 2 (2004).
*/
int autocvar_r_showDlights = 0;
enumflags
{
DLIGHTFL_CHANGED_ORIGIN,
@ -102,6 +104,18 @@ class light_dynamic:NSPointTrigger
float
light_dynamic::predraw(void)
{
/* debug drawing */
if (autocvar_r_showDlights) {
float a = (m_iState) ? 1.0 : 0.25f;
makevectors(view_angles);
R_BeginPolygon("textures/dev/light_dynamic", 0, 0);
R_PolygonVertex(origin + v_right * 24 - v_up * 24, [1,1], m_vecLight, a);
R_PolygonVertex(origin - v_right * 24 - v_up * 24, [0,1], m_vecLight, a);
R_PolygonVertex(origin - v_right * 24 + v_up * 24, [0,0], m_vecLight, a);
R_PolygonVertex(origin + v_right * 24 + v_up * 24, [1,0], m_vecLight, a);
R_EndPolygon();
}
if (!m_iState) {
return (PREDRAW_NEXT);
}