From 0fe21a8bb81c151d7f7427e788ca8cc576fe2778 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sun, 9 Mar 2025 08:26:51 +1100 Subject: speculative fix for lightmap flicker can't tell what's going on here - is lighting calculation being ran when the point lights aren't populated? weird --- source/game/StarWorldClient.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/game/StarWorldClient.cpp') diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp index efc2eb7..82c09ae 100644 --- a/source/game/StarWorldClient.cpp +++ b/source/game/StarWorldClient.cpp @@ -90,6 +90,7 @@ WorldClient::WorldClient(PlayerPtr mainPlayer, LuaRootPtr luaRoot) { m_altMusicActive = false; m_stopLightingThread = false; + m_pendingLightReady = false; clearWorld(); } @@ -461,6 +462,7 @@ void WorldClient::render(WorldRenderData& renderData, unsigned bufferTiles) { m_pendingLights = std::move(renderLightSources); m_pendingParticleLights = std::move(m_particles->lightSources()); m_pendingLightRange = window.padded(1); + m_pendingLightReady = true; } //Kae: Padded by one to fix light spread issues at the edges of the frame. if (m_asyncLighting) @@ -1667,7 +1669,9 @@ void WorldClient::lightingTileGather() { void WorldClient::lightingCalc() { MutexLocker prepLocker(m_lightMapPrepMutex); - + if (!m_pendingLightReady.load()) + return; + m_pendingLightReady = false; RectI lightRange = m_pendingLightRange; List lights = std::move(m_pendingLights); List> particleLights = std::move(m_pendingParticleLights); -- cgit v1.2.3