make lm_dynlights toggling work

This commit is contained in:
Ricardo Luís Vaz Silva 2025-05-29 08:19:32 -03:00 committed by Magnus Norddahl
commit daab336784
7 changed files with 48 additions and 4 deletions

View file

@ -19,8 +19,38 @@
#include <unordered_map>
#include "vm.h"
#include "p_setup.h"
EXTERN_CVAR(Bool, lm_dynlights);
static int InvalidateLightmap();
static void InvalidateActorLightTraceCache();
static void RefreshLightmap()
{
if(level.levelMesh)
{
level.levelMesh->FullRefresh();
InvalidateLightmap();
InvalidateActorLightTraceCache();
screen->SetLevelMesh(level.levelMesh); // force lightmap texture binding update
}
}
CUSTOM_CVAR(Bool, lm_dynlights, false, CVAR_ARCHIVE)
{
if(*self)
{
level.lightmaps = true;
RefreshLightmap();
}
else
{
level.lightmaps = level.orig_lightmapped;
if(level.lightmaps)
{
RefreshLightmap();
}
}
}
static bool RequireLevelMesh()
{