Add cvar lm_scale for multiplying resolution of the lightmap

This commit is contained in:
RaveYard 2023-09-09 14:38:09 +02:00 committed by Magnus Norddahl
commit 19e9ac1db3
2 changed files with 5 additions and 1 deletions

View file

@ -21,7 +21,7 @@ ADD_STAT(lightmapper)
CVAR(Int, lm_background_updates, 8, CVAR_NOSAVE);
CVAR(Int, lm_max_updates, 128, CVAR_NOSAVE);
CVAR(Float, lm_scale, 1.0, CVAR_NOSAVE);
VkLightmap::VkLightmap(VulkanRenderDevice* fb) : fb(fb)
{

View file

@ -35,6 +35,8 @@ CCMD(invalidatelightmap)
Printf("Marked %d out of %d surfaces for update.\n", count, level.levelMesh->Surfaces.Size());
}
EXTERN_CVAR(Float, lm_scale);
DoomLevelMesh::DoomLevelMesh(FLevelLocals &doomMap)
{
SunColor = doomMap.SunColor; // TODO keep only one copy?
@ -1100,6 +1102,8 @@ void DoomLevelMesh::BuildSurfaceParams(int lightMapTextureWidth, int lightMapTex
surface.sampleDimension = LightmapSampleDistance;
}
surface.sampleDimension = uint16_t(max(int(roundf(float(surface.sampleDimension) / max(1.0f / 4, float(lm_scale)))), 1));
{
// Round to nearest power of two
uint32_t n = uint16_t(surface.sampleDimension);