Merge branch 'main' into voice
This commit is contained in:
commit
70bfb54e55
@ -1455,20 +1455,21 @@ void WorldClient::lightingTileGather() {
|
|||||||
void WorldClient::lightingMain() {
|
void WorldClient::lightingMain() {
|
||||||
while (true) {
|
while (true) {
|
||||||
MutexLocker locker(m_lightingMutex);
|
MutexLocker locker(m_lightingMutex);
|
||||||
|
|
||||||
|
m_lightingCond.wait(m_lightingMutex);
|
||||||
if (m_stopLightingThread)
|
if (m_stopLightingThread)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_renderData) {
|
if (WorldRenderData* renderData = m_renderData) {
|
||||||
int64_t start = Time::monotonicMicroseconds();
|
int64_t start = Time::monotonicMicroseconds();
|
||||||
|
|
||||||
lightingTileGather();
|
lightingTileGather();
|
||||||
|
|
||||||
m_lightingCalculator.calculate(m_renderData->lightMap);
|
m_lightingCalculator.calculate(renderData->lightMap);
|
||||||
m_renderData = nullptr;
|
m_renderData = nullptr;
|
||||||
LogMap::set("client_render_world_async_light_calc", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
|
LogMap::set("client_render_world_async_light_calc", strf(u8"{:05d}\u00b5s", Time::monotonicMicroseconds() - start));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lightingCond.wait(m_lightingMutex);
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
@ -1546,6 +1547,8 @@ void WorldClient::clearWorld() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waitForLighting();
|
||||||
|
|
||||||
m_currentStep = 0;
|
m_currentStep = 0;
|
||||||
m_currentServerStep = 0.0;
|
m_currentServerStep = 0.0;
|
||||||
m_inWorld = false;
|
m_inWorld = false;
|
||||||
|
@ -252,9 +252,9 @@ private:
|
|||||||
mutable CellularLightIntensityCalculator m_lightIntensityCalculator;
|
mutable CellularLightIntensityCalculator m_lightIntensityCalculator;
|
||||||
ThreadFunction<void> m_lightingThread;
|
ThreadFunction<void> m_lightingThread;
|
||||||
|
|
||||||
mutable Mutex m_lightingMutex;
|
Mutex m_lightingMutex;
|
||||||
mutable ConditionVariable m_lightingCond;
|
ConditionVariable m_lightingCond;
|
||||||
mutable WorldRenderData* m_renderData;
|
atomic<WorldRenderData*> m_renderData;
|
||||||
atomic<bool> m_stopLightingThread;
|
atomic<bool> m_stopLightingThread;
|
||||||
|
|
||||||
SkyPtr m_sky;
|
SkyPtr m_sky;
|
||||||
|
Loading…
Reference in New Issue
Block a user