add 'graphics.dense-render' setting

This commit is contained in:
MihailRis
2024-12-21 08:13:05 +03:00
parent 954724c837
commit dc8f5e7873
12 changed files with 111 additions and 47 deletions
+7 -1
View File
@@ -17,6 +17,7 @@
#include "graphics/render/Decorator.hpp"
#include "graphics/ui/elements/Menu.hpp"
#include "graphics/ui/GUI.hpp"
#include "frontend/ContentGfxCache.hpp"
#include "logic/LevelController.hpp"
#include "logic/scripting/scripting_hud.hpp"
#include "util/stringutil.hpp"
@@ -42,7 +43,7 @@ LevelScreen::LevelScreen(Engine* engine, std::unique_ptr<Level> levelPtr)
controller = std::make_unique<LevelController>(engine, std::move(levelPtr));
frontend = std::make_unique<LevelFrontend>(
controller->getPlayer(), controller.get(), assets
controller->getPlayer(), controller.get(), assets, settings
);
worldRenderer = std::make_unique<WorldRenderer>(
engine, *frontend, controller->getPlayer()
@@ -57,6 +58,11 @@ LevelScreen::LevelScreen(Engine* engine, std::unique_ptr<Level> levelPtr)
controller->getLevel()->chunks->saveAndClear();
worldRenderer->clear();
}));
keepAlive(settings.graphics.denseRender.observe([=](bool) {
controller->getLevel()->chunks->saveAndClear();
worldRenderer->clear();
frontend->getContentGfxCache().refresh();
}));
keepAlive(settings.camera.fov.observe([=](double value) {
controller->getPlayer()->fpCamera->setFov(glm::radians(value));
}));