Skip to content

Commit

Permalink
- do not run the dynamic light ticker when lights are switched off.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Aug 11, 2021
1 parent f662c62 commit 3adadfe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/common/rendering/hwrenderer/data/hw_shadowmap.cpp
Expand Up @@ -25,7 +25,6 @@
#include "hw_dynlightdata.h"
#include "buffers.h"
#include "shaderuniforms.h"
#include "g_cvars.h"
#include "hwrenderer/postprocessing/hw_postprocess.h"

/*
Expand Down
1 change: 1 addition & 0 deletions src/common/rendering/v_video.h
Expand Up @@ -279,6 +279,7 @@ extern DFrameBuffer *screen;
#define SCREENPITCH (screen->GetPitch ())

EXTERN_CVAR (Float, vid_gamma)
EXTERN_CVAR(Bool, gl_lights)


// Allocates buffer screens, call before R_Init.
Expand Down
14 changes: 9 additions & 5 deletions src/playsim/dthinker.cpp
Expand Up @@ -42,6 +42,7 @@
#include "v_text.h"
#include "g_levellocals.h"
#include "a_dynlight.h"
#include "v_video.h"


static int ThinkCount;
Expand Down Expand Up @@ -124,11 +125,14 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
}
} while (count != 0);

for (auto light = Level->lights; light;)
if (gl_lights)
{
auto next = light->next;
light->Tick();
light = next;
for (auto light = Level->lights; light;)
{
auto next = light->next;
light->Tick();
light = next;
}
}
}
else
Expand All @@ -150,7 +154,7 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
}
} while (count != 0);

if (Level->lights)
if (Level->lights && gl_lights)
{
// Also profile the internal dynamic lights, even though they are not implemented as thinkers.
auto &prof = Profiles[NAME_InternalDynamicLight];
Expand Down

0 comments on commit 3adadfe

Please sign in to comment.