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.
This commit is contained in:
Kelsi 2026-03-20 15:56:58 -07:00
parent d1bcd2f844
commit df7feed648
3 changed files with 16 additions and 2 deletions

View file

@ -28,7 +28,8 @@ public:
enum class Type {
NONE,
RAIN,
SNOW
SNOW,
STORM
};
Weather();

View file

@ -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 {

View file

@ -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);