move weather from WorldRenderer to LevelFrontend

This commit is contained in:
MihailRis 2026-06-19 00:01:45 +03:00
parent 22f09d3659
commit ac00c561ee
7 changed files with 26 additions and 10 deletions

View file

@ -81,7 +81,7 @@ LevelScreen::LevelScreen(
auto resetChunks = [=](bool) {
player->chunks->saveAndClear();
renderer->clear();
renderer->resetCache();
};
keepAlive(settings.graphics.backlight.observe(resetChunks));
keepAlive(settings.graphics.softLighting.observe(resetChunks));
@ -94,7 +94,7 @@ LevelScreen::LevelScreen(
}));
keepAlive(input.addCallback(BIND_CHUNKS_RELOAD, [=]() {
player->chunks->saveAndClear();
renderer->clear();
renderer->resetCache();
return false;
}));
controller->preQuitCallbacks.listen([this]() {
@ -153,7 +153,7 @@ void LevelScreen::loadDecorations() {
}
auto data = io::read_object(CLIENT_FILE);
if (data.has("weather")) {
renderer->getWeather().deserialize(data["weather"]);
frontend->getWeather().deserialize(data["weather"]);
}
}
@ -161,7 +161,7 @@ void LevelScreen::saveDecorations() {
io::create_directory("world:client");
auto data = dv::object();
data["weather"] = renderer->getWeather().serialize();
data["weather"] = frontend->getWeather().serialize();
io::write_json(CLIENT_FILE, data, true);
}
@ -257,7 +257,7 @@ void LevelScreen::update(float delta) {
hud->update(hudVisible);
const Weather& weather = renderer->getWeather();
const Weather& weather = frontend->getWeather();
const Player& player = playerController->getPlayer();
const Camera& camera = *player.currentCamera;
decorator->update(paused ? 0.0f : delta, camera, weather);