13 constexpr
float Variance = 35.f / 256.f;
14 constexpr
float BaseLine = 165.f / 256.f;
15 constexpr
float FadeRate = 1.f / 2.5f;
16 constexpr
float Wrap = 2.f * 3.141592653f / 3.f;
17 constexpr glm::vec3 Color(2.0f, 1.58f, 0.f);
19 float computeScale(
float t) {
return (std::sin(3.f * t)) / 1.6f; }
21 float computeLevel(
float t) {
return BaseLine + computeScale(t) * Variance; }
23 glm::vec3 computeColor(
float t) {
24 const float a = computeLevel(t);
25 return {Color.x * a, Color.y * a, 0.f};
50 if (t >= Wrap) t = 0.f;
52 if (stopping) { factor = std::max(0.f, factor - FadeRate * dt); }
53 else { factor = std::min(1.f, factor + FadeRate * dt); }
56 const glm::vec3 color = computeColor(t) - glm::vec3(1.f);
Core classes and functionality for both the editor and game.
void setColorTint(const glm::vec3 &tint)
Sets a color tint to apply to the ambient lighting.
The primary map class that represents a usable map in the game.
LightingSystem & lightingSystem()
Returns a reference to the lighting system in this map.
@ Sunny
A very sunny day with pulsating light.
virtual void update(float dt) override
Updates the sunny weather.
virtual bool stopped() const override
Returns true when the sun is finished fading.
virtual void start(bl::engine::Engine &engine, bl::rc::RenderTarget &renderTarget, Map &map) override
Starts the sunny weather.
Sunny()
Construct a new Sunny object.
virtual Weather::Type type() const override
Returns Sunny.
virtual void stop() override
Stops the sunny weather.