From df7feed648d9842edddaf610dd44f1e6737cf73f Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 15:56:58 -0700 Subject: [PATCH] feat: add distinct STORM weather type with wind-driven particles Add Weather::Type::STORM enum value and wire it from SMSG_WEATHER type 3. Storm particles are faster (70 units/s vs rain's 50), wind-angled at 15+ units lateral velocity with gusty turbulence, darker blue-grey tint, and shorter lifetime. Previously storms rendered identically to rain. --- include/rendering/weather.hpp | 3 ++- src/rendering/renderer.cpp | 2 +- src/rendering/weather.cpp | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/rendering/weather.hpp b/include/rendering/weather.hpp index b92c963d..3349526f 100644 --- a/include/rendering/weather.hpp +++ b/include/rendering/weather.hpp @@ -28,7 +28,8 @@ public: enum class Type { NONE, RAIN, - SNOW + SNOW, + STORM }; Weather(); diff --git a/src/rendering/renderer.cpp b/src/rendering/renderer.cpp index 11c37bab..7199273d 100644 --- a/src/rendering/renderer.cpp +++ b/src/rendering/renderer.cpp @@ -3192,7 +3192,7 @@ void Renderer::update(float deltaTime) { // Server-driven weather (SMSG_WEATHER) — authoritative if (wType == 1) weather->setWeatherType(Weather::Type::RAIN); else if (wType == 2) weather->setWeatherType(Weather::Type::SNOW); - else if (wType == 3) weather->setWeatherType(Weather::Type::RAIN); // thunderstorm — use rain particles + else if (wType == 3) weather->setWeatherType(Weather::Type::STORM); else weather->setWeatherType(Weather::Type::NONE); weather->setIntensity(wInt); } else { diff --git a/src/rendering/weather.cpp b/src/rendering/weather.cpp index fed604dc..5dc525da 100644 --- a/src/rendering/weather.cpp +++ b/src/rendering/weather.cpp @@ -198,6 +198,10 @@ void Weather::update(const Camera& camera, float deltaTime) { if (weatherType == Type::RAIN) { p.velocity = glm::vec3(0.0f, -50.0f, 0.0f); // Fast downward p.maxLifetime = 5.0f; + } else if (weatherType == Type::STORM) { + // Storm: faster, angled rain with wind + p.velocity = glm::vec3(15.0f, -70.0f, 8.0f); + p.maxLifetime = 3.5f; } else { // SNOW p.velocity = glm::vec3(0.0f, -5.0f, 0.0f); // Slow downward p.maxLifetime = 10.0f; @@ -245,6 +249,12 @@ void Weather::updateParticle(Particle& particle, const Camera& camera, float del particle.velocity.x = windX; particle.velocity.z = windZ; } + // Storm: gusty, turbulent wind with varying direction + if (weatherType == Type::STORM) { + float gust = std::sin(particle.lifetime * 1.5f + particle.position.x * 0.1f) * 5.0f; + particle.velocity.x = 15.0f + gust; + particle.velocity.z = 8.0f + std::cos(particle.lifetime * 2.0f) * 3.0f; + } // Update position particle.position += particle.velocity * deltaTime; @@ -275,6 +285,9 @@ void Weather::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet) { if (weatherType == Type::RAIN) { push.particleSize = 3.0f; push.particleColor = glm::vec4(0.7f, 0.8f, 0.9f, 0.6f); + } else if (weatherType == Type::STORM) { + push.particleSize = 3.5f; + push.particleColor = glm::vec4(0.6f, 0.65f, 0.75f, 0.7f); // Darker, more opaque } else { // SNOW push.particleSize = 8.0f; push.particleColor = glm::vec4(1.0f, 1.0f, 1.0f, 0.9f);