refactor: move Weather instance to WorldInfo
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user