mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
refactor: move Weather instance to WorldInfo
This commit is contained in:
parent
0ea842580c
commit
9c4db8fa10
9 changed files with 116 additions and 61 deletions
|
|
@ -111,6 +111,7 @@ void WorldRenderer::setupWorldShader(
|
|||
const EngineSettings& settings,
|
||||
float fogFactor
|
||||
) {
|
||||
const auto& weather = level.getWorld()->getInfo().weather;
|
||||
shader.use();
|
||||
shader.uniformMatrix("u_model", glm::mat4(1.0f));
|
||||
shader.uniformMatrix("u_proj", camera.getProjection());
|
||||
|
|
@ -152,7 +153,7 @@ void WorldRenderer::renderLevel(
|
|||
bool pause,
|
||||
bool hudVisible
|
||||
) {
|
||||
weather.update(delta);
|
||||
const auto& weather = level.getWorld()->getInfo().weather;
|
||||
|
||||
texts->render(ctx, camera, settings, hudVisible, false);
|
||||
|
||||
|
|
@ -200,7 +201,7 @@ void WorldRenderer::renderLevel(
|
|||
|
||||
setupWorldShader(entityShader, camera, settings, fogFactor);
|
||||
|
||||
std::array<WeatherPreset*, 2> weatherInstances {&weather.a, &weather.b};
|
||||
std::array<const WeatherPreset*, 2> weatherInstances {&weather.a, &weather.b};
|
||||
for (const auto& weather : weatherInstances) {
|
||||
float zero = weather->fall.minOpacity;
|
||||
float one = weather->fall.maxOpacity;
|
||||
|
|
@ -335,6 +336,7 @@ void WorldRenderer::draw(
|
|||
) {
|
||||
timer += delta * !pause;
|
||||
auto world = level.getWorld();
|
||||
const auto& weather = world->getInfo().weather;
|
||||
const Viewport& vp = pctx.getViewport();
|
||||
camera.aspect = vp.getWidth() / static_cast<float>(vp.getHeight());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue