Added r_entity_doublelight cvar to renderer.

This commit is contained in:
Knightmare66 2020-09-30 03:17:50 -04:00
parent fdca639bd4
commit c137bb8926
4 changed files with 36 additions and 20 deletions

View file

@ -66,6 +66,8 @@ Changes as of v0.20 update 8:
- Added changeable gl_clear color controlled by cvars r_clearcolor_r, r_clearcolor_g, and r_clearcolor_b.
Values are normalized (0-1).
- Added doubled entity lighting to mimic Q2's original entity lighting. Set the cvar r_entity_doublelight to 1 to enable this.
- Added ifeq, ifneq, ifgt, ifge, iflt, ifle, ifbit, and ifnbit layout script commands.
- Added a check to prevent game code from sending unicasts to non-present clients (i.e. bots). This would

View file

@ -399,7 +399,7 @@ void R_LightPoint (vec3_t p, vec3_t color, qboolean isEnt)
}
// this catches too bright modulated color
for (i=0;i<3;i++)
for (i=0; i<3; i++)
if (color[i]>1) color[i] = 1;
//
@ -422,8 +422,13 @@ void R_LightPoint (vec3_t p, vec3_t color, qboolean isEnt)
if (add > 0)
VectorMA (color, add, dl->color, color);
}
//VectorScale (color, r_modulate->value, color); // Knightmare- this makes ents too bright
//VectorScale (color, r_modulate->value*1.5f, color); // Knightmare- this makes ents too bright
// scale up light color by r_modulate if enabled
if (r_entity_doublelight->integer) {
VectorScale (color, r_modulate->value, color);
}
// VectorScale (color, r_modulate->value, color); // Knightmare- this makes ents too bright
// VectorScale (color, r_modulate->value*1.5f, color); // Knightmare- this makes ents too bright
}
@ -462,7 +467,7 @@ void R_LightPointDynamics (vec3_t p, vec3_t color, m_dlight_t *list, int *amount
VectorCopy (pointcolor, color);
}
//this catches too bright modulated color
// this catches too bright modulated color
for (i=0;i<3;i++)
if (color[i]>1) color[i] = 1;
@ -471,7 +476,7 @@ void R_LightPointDynamics (vec3_t p, vec3_t color, m_dlight_t *list, int *amount
//
m_dl = 0;
dl = r_newrefdef.dlights;
for (lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++, dl++)
for (lnum=0; lnum<r_newrefdef.num_dlights; lnum++, dl++)
{
if (dl->spotlight) // spotlights
continue;
@ -485,7 +490,7 @@ void R_LightPointDynamics (vec3_t p, vec3_t color, m_dlight_t *list, int *amount
float highest = -1;
VectorScale(dl->color, add, dlColor);
for (i=0;i<3;i++)
for (i=0; i<3; i++)
if (highest<dlColor[i]) highest = dlColor[i];
if (m_dl<max)
@ -500,8 +505,8 @@ void R_LightPointDynamics (vec3_t p, vec3_t color, m_dlight_t *list, int *amount
float least_val = 10;
int least_index = 0;
for (i=0;i<m_dl;i++)
if (list[i].strength<least_val)
for (i=0; i<m_dl; i++)
if (list[i].strength < least_val)
{
@ -517,6 +522,11 @@ void R_LightPointDynamics (vec3_t p, vec3_t color, m_dlight_t *list, int *amount
}
}
// scale up light color by r_modulate if enabled
if (r_entity_doublelight->integer) {
VectorScale (color, r_modulate->value, color);
}
*amount = m_dl;
}

View file

@ -241,6 +241,7 @@ extern cvar_t *r_dlights_normal;
extern cvar_t *r_model_shading;
extern cvar_t *r_model_dlights;
extern cvar_t *r_model_minlight;
extern cvar_t *r_entity_doublelight;
extern cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level

View file

@ -104,6 +104,7 @@ cvar_t *r_dlights_normal; // lerped dlights on models
cvar_t *r_model_shading;
cvar_t *r_model_dlights;
cvar_t *r_model_minlight;
cvar_t *r_entity_doublelight;
cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level
@ -683,9 +684,9 @@ void R_RenderView (refdef_t *fd)
{
R_SuspendFog ();
// R_DrawAllDecals();
R_DrawAllEntities(false);
R_DrawAllParticles();
// R_DrawAllDecals ();
R_DrawAllEntities( false);
R_DrawAllParticles ();
R_ResumeFog ();
}
@ -696,17 +697,17 @@ void R_RenderView (refdef_t *fd)
R_RenderDlights();
if (r_transrendersort->integer) {
//R_BuildParticleList();
R_SortParticlesOnList();
R_DrawAllDecals();
//R_DrawAllEntityShadows();
R_DrawSolidEntities();
R_DrawEntitiesOnList(ents_trans);
// R_BuildParticleList ();
R_SortParticlesOnList ();
R_DrawAllDecals ();
// R_DrawAllEntityShadows ();
R_DrawSolidEntities ();
R_DrawEntitiesOnList (ents_trans);
}
else {
R_DrawAllDecals();
//R_DrawAllEntityShadows();
R_DrawAllEntities(true);
R_DrawAllDecals ();
// R_DrawAllEntityShadows ();
R_DrawAllEntities (true);
}
R_DrawAllParticles ();
@ -964,6 +965,8 @@ void R_Register (void)
Cvar_SetDescription ("r_model_dlights", "Sets maximum number of dynamic lights for a model.");
r_model_minlight = Cvar_Get ("r_model_minlight", "0.02", CVAR_ARCHIVE );
Cvar_SetDescription ("r_model_minlight", "Sets minimum light level for alias model rendering.");
r_entity_doublelight = Cvar_Get ("r_entity_doublelight", "0", CVAR_ARCHIVE );
Cvar_SetDescription ("r_entity_doublelight", "Enables original glitchy double-lighting of models. This is a sort-of-exploit, but is not considered a cheat.");
r_lightlevel = Cvar_Get ("r_lightlevel", "0", 0);
Cvar_SetDescription ("r_lightlevel", "Hack to send player's light level to server. This is overwritten every render frame.");