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

@ -24,6 +24,7 @@
#include "voxels/Chunks.hpp"
#include "window/Camera.hpp"
#include "world/Level.hpp"
#include "world/Weather.hpp"
#include "WorldRenderer.hpp"
namespace fs = std::filesystem;

View file

@ -51,6 +51,7 @@
#include "window/Window.hpp"
#include "world/Level.hpp"
#include "world/LevelEvents.hpp"
#include "world/Weather.hpp"
#include "world/World.hpp"
#include "debug/Logger.hpp"
@ -84,6 +85,7 @@ WorldRenderer::WorldRenderer(
level(frontend.getLevel()),
player(player),
assets(*engine.getAssets()),
weather(frontend.getWeather()),
frustumCulling(std::make_unique<Frustum>()),
lineBatch(std::make_unique<LineBatch>()),
batch3d(std::make_unique<Batch3D>(BATCH3D_CAPACITY)),
@ -590,7 +592,7 @@ void WorldRenderer::renderBlockOverlay(const DrawContext& wctx) {
batch3d->flush();
}
void WorldRenderer::clear() {
void WorldRenderer::resetCache() {
chunksRenderer->clear();
}

View file

@ -4,7 +4,6 @@
#include "typedefs.hpp"
#include "presets/WeatherPreset.hpp"
#include "world/Weather.hpp"
#include "window/Camera.hpp"
#include "util/ObjectsKeeper.hpp"
@ -36,6 +35,7 @@ class Skybox;
class TextsRenderer;
class CloudsRenderer;
struct EngineSettings;
struct Weather;
class WorldRenderer final : public util::ObjectsKeeper {
public:
@ -54,7 +54,7 @@ public:
PostProcessing& postProcessing
);
void clear();
void resetCache();
void setDebug(bool flag);
@ -66,6 +66,7 @@ private:
const Level& level;
Player& player;
const Assets& assets;
Weather& weather;
std::unique_ptr<Frustum> frustumCulling;
std::unique_ptr<LineBatch> lineBatch;
std::unique_ptr<Batch3D> batch3d;
@ -77,13 +78,11 @@ private:
std::unique_ptr<DebugLinesRenderer> debugLines;
std::unique_ptr<PrecipitationRenderer> precipitation;
std::unique_ptr<CloudsRenderer> cloudsRenderer;
Weather weather {};
float timer = 0.0f;
bool debug = false;
bool lightsDebug = false;
bool gbufferPipeline = false;
bool dirtySettings = false;
/// @brief Render block selection lines