[renderer] Resurrect r_dlightframecount

This fixes dynamic light map updates for gl, glsl, and sw, but gl has
problems with map submodels not being dynamically lit.
This commit is contained in:
Bill Currie 2022-05-10 17:03:14 +09:00
parent be7a7d8bec
commit 600e7ecbea
2 changed files with 7 additions and 6 deletions

View file

@ -292,7 +292,6 @@ extern int r_maxsurfsseen, r_maxedgesseen;
extern qboolean r_dowarpold, r_viewchanged;
extern int r_clipflags;
extern int r_dlightframecount;
extern struct entqueue_s *r_ent_queue;
struct dlight_s;
@ -311,8 +310,6 @@ void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1);
void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip);
void R_RecursiveMarkLights (mod_brush_t *brush, const vec3_t lightorigin,
struct dlight_s *light, int bit, mnode_t *node);
void R_MarkLights (const vec3_t lightorigin, struct dlight_s *light, int bit,
model_t *model);
void R_LoadSkys (const char *);
//void Vulkan_R_LoadSkys (const char *, struct vulkan_ctx_s *ctx);

View file

@ -50,6 +50,7 @@ dlight_t *r_dlights;
vec3_t ambientcolor;
unsigned int r_maxdlights;
static int r_dlightframecount;
void
R_FindNearLights (vec4f_t pos, int count, dlight_t **lights)
@ -179,9 +180,9 @@ real_mark_surfaces (float dist, msurface_t *surf, const vec3_t lightorigin,
if (is * is + it * it > dist2)
return;
if (surf->dlightframe != r_framecount) {
if (surf->dlightframe != r_dlightframecount) {
memset (surf->dlightbits, 0, sizeof (surf->dlightbits));
surf->dlightframe = r_framecount;
surf->dlightframe = r_dlightframecount;
}
ind = lightnum / 32;
bit = 1 << (lightnum % 32);
@ -260,7 +261,7 @@ loc0:
}
void
static void
R_MarkLights (const vec3_t lightorigin, dlight_t *light, int lightnum,
model_t *model)
{
@ -321,6 +322,9 @@ R_PushDlights (const vec3_t entorigin)
dlight_t *l;
vec3_t lightorigin;
// because the count hasn't advanced yet for this frame
r_dlightframecount = r_framecount + 1;
if (!r_dlight_lightmap)
return;