Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/client/StarClientApplication.cpp26
-rw-r--r--source/game/StarWorldClient.cpp2
-rw-r--r--source/rendering/StarWorldPainter.cpp19
3 files changed, 25 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())
diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp
index b0b2c1e..758ba12 100644
--- a/source/game/StarWorldClient.cpp
+++ b/source/game/StarWorldClient.cpp
@@ -1447,8 +1447,10 @@ void WorldClient::lightingMain() {
MutexLocker locker(m_lightingMutex);
if (m_renderData) {
+ int64_t start = Time::monotonicMilliseconds();
m_lightingCalculator.calculate(m_renderData->lightMap);
m_renderData = nullptr;
+ LogMap::set("render_light_calc", strf("{}ms", Time::monotonicMilliseconds() - start));
}
m_lightingCond.wait(m_lightingMutex);
diff --git a/source/rendering/StarWorldPainter.cpp b/source/rendering/StarWorldPainter.cpp
index a93a592..8e27006 100644
--- a/source/rendering/StarWorldPainter.cpp
+++ b/source/rendering/StarWorldPainter.cpp
@@ -64,6 +64,25 @@ void WorldPainter::render(WorldRenderData& renderData, function<void()> lightWai
m_environmentPainter->renderSky(Vec2F(m_camera.screenSize()), renderData.skyRenderData);
m_environmentPainter->renderFrontOrbiters(m_camera.pixelRatio(), Vec2F(m_camera.screenSize()), renderData.skyRenderData);
+ if (lightWaiter) {
+ int64_t start = Time::monotonicMilliseconds();
+ lightWaiter();
+ LogMap::set("render_light_wait", strf("{}ms", Time::monotonicMilliseconds() - start));
+ }
+
+ if (renderData.isFullbright) {
+ m_renderer->setEffectTexture("lightMap", Image::filled(Vec2U(1, 1), { 255, 255, 255, 255 }, PixelFormat::RGB24));
+ m_renderer->setEffectTexture("tileLightMap", Image::filled(Vec2U(1, 1), { 0, 0, 0, 0 }, PixelFormat::RGBA32));
+ m_renderer->setEffectParameter("lightMapMultiplier", 1.0f);
+ } else {
+ adjustLighting(renderData);
+ m_renderer->setEffectParameter("lightMapMultiplier", m_assets->json("/rendering.config:lightMapMultiplier").toFloat());
+ m_renderer->setEffectParameter("lightMapScale", Vec2F::filled(TilePixels * m_camera.pixelRatio()));
+ m_renderer->setEffectParameter("lightMapOffset", m_camera.worldToScreen(Vec2F(renderData.lightMinPosition)));
+ m_renderer->setEffectTexture("lightMap", renderData.lightMap);
+ m_renderer->setEffectTexture("tileLightMap", renderData.tileLightMap);
+ }
+
// Parallax layers
auto parallaxDelta = m_camera.worldGeometry().diff(m_camera.centerWorldPosition(), m_previousCameraCenter);