mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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:
parent
d1bcd2f844
commit
df7feed648
3 changed files with 16 additions and 2 deletions
|
|
@ -28,7 +28,8 @@ public:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
NONE,
|
NONE,
|
||||||
RAIN,
|
RAIN,
|
||||||
SNOW
|
SNOW,
|
||||||
|
STORM
|
||||||
};
|
};
|
||||||
|
|
||||||
Weather();
|
Weather();
|
||||||
|
|
|
||||||
|
|
@ -3192,7 +3192,7 @@ void Renderer::update(float deltaTime) {
|
||||||
// Server-driven weather (SMSG_WEATHER) — authoritative
|
// Server-driven weather (SMSG_WEATHER) — authoritative
|
||||||
if (wType == 1) weather->setWeatherType(Weather::Type::RAIN);
|
if (wType == 1) weather->setWeatherType(Weather::Type::RAIN);
|
||||||
else if (wType == 2) weather->setWeatherType(Weather::Type::SNOW);
|
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);
|
else weather->setWeatherType(Weather::Type::NONE);
|
||||||
weather->setIntensity(wInt);
|
weather->setIntensity(wInt);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,10 @@ void Weather::update(const Camera& camera, float deltaTime) {
|
||||||
if (weatherType == Type::RAIN) {
|
if (weatherType == Type::RAIN) {
|
||||||
p.velocity = glm::vec3(0.0f, -50.0f, 0.0f); // Fast downward
|
p.velocity = glm::vec3(0.0f, -50.0f, 0.0f); // Fast downward
|
||||||
p.maxLifetime = 5.0f;
|
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
|
} else { // SNOW
|
||||||
p.velocity = glm::vec3(0.0f, -5.0f, 0.0f); // Slow downward
|
p.velocity = glm::vec3(0.0f, -5.0f, 0.0f); // Slow downward
|
||||||
p.maxLifetime = 10.0f;
|
p.maxLifetime = 10.0f;
|
||||||
|
|
@ -245,6 +249,12 @@ void Weather::updateParticle(Particle& particle, const Camera& camera, float del
|
||||||
particle.velocity.x = windX;
|
particle.velocity.x = windX;
|
||||||
particle.velocity.z = windZ;
|
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
|
// Update position
|
||||||
particle.position += particle.velocity * deltaTime;
|
particle.position += particle.velocity * deltaTime;
|
||||||
|
|
@ -275,6 +285,9 @@ void Weather::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet) {
|
||||||
if (weatherType == Type::RAIN) {
|
if (weatherType == Type::RAIN) {
|
||||||
push.particleSize = 3.0f;
|
push.particleSize = 3.0f;
|
||||||
push.particleColor = glm::vec4(0.7f, 0.8f, 0.9f, 0.6f);
|
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
|
} else { // SNOW
|
||||||
push.particleSize = 8.0f;
|
push.particleSize = 8.0f;
|
||||||
push.particleColor = glm::vec4(1.0f, 1.0f, 1.0f, 0.9f);
|
push.particleColor = glm::vec4(1.0f, 1.0f, 1.0f, 0.9f);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue