diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-29 10:31:59 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-29 10:31:59 +1000 |
commit | dc134e168bd04d39f8a30819ba3a0b00bb8ae1cb (patch) | |
tree | 1d44d013f4f4d2271f50203e63b072a6196fce31 /source/client/StarClientApplication.cpp | |
parent | afefd89533c87017bf3fac5ba7a1b6a316da1160 (diff) |
Move lightmap wait into WorldPainter to fix single-frame lightmap lag-behind
unfortunate
Diffstat (limited to 'source/client/StarClientApplication.cpp')
-rw-r--r-- | source/client/StarClientApplication.cpp | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp index be32e58..14af82e 100644 --- a/source/client/StarClientApplication.cpp +++ b/source/client/StarClientApplication.cpp @@ -364,38 +364,20 @@ void ClientApplication::render() { WorldClientPtr worldClient = m_universeClient->worldClient(); RendererPtr renderer = Application::renderer(); if (worldClient) { + int64_t start = Time::monotonicMilliseconds(); if (renderer) renderer->setEffectParameter("lightMapEnabled", true); worldClient->render(m_renderData, TilePainter::BorderTileSize); - // Might have to move lightmap adjustment code back into worldPainter->render - // eventually, can't be bothered to remove the passed lambda yet m_worldPainter->render(m_renderData, [&]() { worldClient->waitForLighting(); }); m_mainInterface->renderInWorldElements(); if (renderer) renderer->setEffectParameter("lightMapEnabled", false); + LogMap::set("render_world", strf("{}ms", Time::monotonicMilliseconds() - start)); } + int64_t start = Time::monotonicMilliseconds(); m_mainInterface->render(); m_cinematicOverlay->render(); - - if (worldClient && renderer) { - worldClient->waitForLighting(); - - if (m_renderData.isFullbright) { - renderer->setEffectTexture("lightMap", Image::filled(Vec2U(1, 1), { 255, 255, 255, 255 }, PixelFormat::RGB24)); - renderer->setEffectTexture("tileLightMap", Image::filled(Vec2U(1, 1), { 0, 0, 0, 0 }, PixelFormat::RGBA32)); - renderer->setEffectParameter("lightMapMultiplier", 1.0f); - } - else { - m_worldPainter->adjustLighting(m_renderData); - - WorldCamera const& camera = m_worldPainter->camera(); - renderer->setEffectParameter("lightMapMultiplier", assets->json("/rendering.config:lightMapMultiplier").toFloat()); - renderer->setEffectParameter("lightMapScale", Vec2F::filled(TilePixels * camera.pixelRatio())); - renderer->setEffectParameter("lightMapOffset", camera.worldToScreen(Vec2F(m_renderData.lightMinPosition))); - renderer->setEffectTexture("lightMap", m_renderData.lightMap); - renderer->setEffectTexture("tileLightMap", m_renderData.tileLightMap); - } - } + LogMap::set("render_ui", strf("{}ms", Time::monotonicMilliseconds() - start)); } if (!m_errorScreen->accepted()) |