add gfx.weather library & add weather.set command
This commit is contained in:
@@ -154,22 +154,6 @@ void WorldRenderer::renderLevel(
|
||||
) {
|
||||
weather.update(delta);
|
||||
|
||||
if (timer > 1.0f && weather.b.fall.texture.empty() && timer < 2.0f) {
|
||||
weather.b.deserialize(io::read_json("res:presets/weather/snow.json"));
|
||||
weather.t = 0.0f;
|
||||
weather.speed = 0.5f;
|
||||
weather.update(delta);
|
||||
}
|
||||
|
||||
if (timer > 15.0f && weather.a.fall.texture.empty()) {
|
||||
std::swap(weather.a, weather.b);
|
||||
weather.b = {};
|
||||
weather.b.deserialize(io::read_json("res:presets/weather/fog.json"));
|
||||
weather.t = 0.0f;
|
||||
weather.speed = 0.1f;
|
||||
weather.update(delta);
|
||||
}
|
||||
|
||||
texts->render(ctx, camera, settings, hudVisible, false);
|
||||
|
||||
bool culling = engine.getSettings().graphics.frustumCulling.get();
|
||||
|
||||
@@ -47,6 +47,14 @@ struct Weather {
|
||||
a.intensity = 1.0f - t;
|
||||
}
|
||||
|
||||
void change(WeatherPreset preset, float time) {
|
||||
std::swap(a, b);
|
||||
b = std::move(preset);
|
||||
t = 0.0f;
|
||||
speed = 1.0f / glm::max(time, 1.e-5f);
|
||||
update(0.0f);
|
||||
}
|
||||
|
||||
float fogOpacity() const {
|
||||
return b.fogOpacity * t + a.fogOpacity * (1.0f - t);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user