mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
feat: integrate lightning system for storm weather and heavy rain
The lightning system (lightning.hpp/cpp) was fully implemented but never wired into the renderer. Connect it now: - Enable lightning during server storm weather (wType==3, intensity>0.1) and heavy rain (wType==1, intensity>0.7) as a bonus visual - Scale lightning intensity proportionally to weather intensity - Render in both parallel (SEC_POST) and fallback rendering paths - Update and shutdown alongside the weather system - Show active lightning info in the performance HUD weather section
This commit is contained in:
parent
d58c2f4269
commit
727dfa5c6c
3 changed files with 40 additions and 0 deletions
|
|
@ -39,6 +39,7 @@ class StarField;
|
|||
class Clouds;
|
||||
class LensFlare;
|
||||
class Weather;
|
||||
class Lightning;
|
||||
class LightingManager;
|
||||
class SwimEffects;
|
||||
class MountDust;
|
||||
|
|
@ -127,6 +128,7 @@ public:
|
|||
Clouds* getClouds() const { return skySystem ? skySystem->getClouds() : nullptr; }
|
||||
LensFlare* getLensFlare() const { return skySystem ? skySystem->getLensFlare() : nullptr; }
|
||||
Weather* getWeather() const { return weather.get(); }
|
||||
Lightning* getLightning() const { return lightning.get(); }
|
||||
CharacterRenderer* getCharacterRenderer() const { return characterRenderer.get(); }
|
||||
WMORenderer* getWMORenderer() const { return wmoRenderer.get(); }
|
||||
M2Renderer* getM2Renderer() const { return m2Renderer.get(); }
|
||||
|
|
@ -216,6 +218,7 @@ private:
|
|||
std::unique_ptr<Clouds> clouds;
|
||||
std::unique_ptr<LensFlare> lensFlare;
|
||||
std::unique_ptr<Weather> weather;
|
||||
std::unique_ptr<Lightning> lightning;
|
||||
std::unique_ptr<LightingManager> lightingManager;
|
||||
std::unique_ptr<SkySystem> skySystem; // Coordinator for sky rendering
|
||||
std::unique_ptr<SwimEffects> swimEffects;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "rendering/clouds.hpp"
|
||||
#include "rendering/lens_flare.hpp"
|
||||
#include "rendering/weather.hpp"
|
||||
#include "rendering/lightning.hpp"
|
||||
#include "rendering/character_renderer.hpp"
|
||||
#include "rendering/wmo_renderer.hpp"
|
||||
#include "rendering/m2_renderer.hpp"
|
||||
|
|
@ -369,6 +370,11 @@ void PerformanceHUD::render(const Renderer* renderer, const Camera* camera) {
|
|||
ImGui::Text("Intensity: %.0f%%", weather->getIntensity() * 100.0f);
|
||||
}
|
||||
|
||||
auto* lightning = renderer->getLightning();
|
||||
if (lightning && lightning->isEnabled()) {
|
||||
ImGui::Text("Lightning: active (%.0f%%)", lightning->getIntensity() * 100.0f);
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "rendering/clouds.hpp"
|
||||
#include "rendering/lens_flare.hpp"
|
||||
#include "rendering/weather.hpp"
|
||||
#include "rendering/lightning.hpp"
|
||||
#include "rendering/lighting_manager.hpp"
|
||||
#include "rendering/sky_system.hpp"
|
||||
#include "rendering/swim_effects.hpp"
|
||||
|
|
@ -699,6 +700,9 @@ bool Renderer::initialize(core::Window* win) {
|
|||
weather = std::make_unique<Weather>();
|
||||
weather->initialize(vkCtx, perFrameSetLayout);
|
||||
|
||||
lightning = std::make_unique<Lightning>();
|
||||
lightning->initialize(vkCtx, perFrameSetLayout);
|
||||
|
||||
swimEffects = std::make_unique<SwimEffects>();
|
||||
swimEffects->initialize(vkCtx, perFrameSetLayout);
|
||||
|
||||
|
|
@ -802,6 +806,11 @@ void Renderer::shutdown() {
|
|||
weather.reset();
|
||||
}
|
||||
|
||||
if (lightning) {
|
||||
lightning->shutdown();
|
||||
lightning.reset();
|
||||
}
|
||||
|
||||
if (swimEffects) {
|
||||
swimEffects->shutdown();
|
||||
swimEffects.reset();
|
||||
|
|
@ -942,6 +951,7 @@ void Renderer::applyMsaaChange() {
|
|||
if (characterRenderer) characterRenderer->recreatePipelines();
|
||||
if (questMarkerRenderer) questMarkerRenderer->recreatePipelines();
|
||||
if (weather) weather->recreatePipelines();
|
||||
if (lightning) lightning->recreatePipelines();
|
||||
if (swimEffects) swimEffects->recreatePipelines();
|
||||
if (mountDust) mountDust->recreatePipelines();
|
||||
if (chargeEffect) chargeEffect->recreatePipelines();
|
||||
|
|
@ -2863,6 +2873,20 @@ void Renderer::update(float deltaTime) {
|
|||
weather->updateZoneWeather(currentZoneId, deltaTime);
|
||||
}
|
||||
weather->setEnabled(true);
|
||||
|
||||
// Enable lightning during storms (wType==3) and heavy rain
|
||||
if (lightning) {
|
||||
uint32_t wType2 = gh->getWeatherType();
|
||||
float wInt2 = gh->getWeatherIntensity();
|
||||
bool stormActive = (wType2 == 3 && wInt2 > 0.1f)
|
||||
|| (wType2 == 1 && wInt2 > 0.7f);
|
||||
lightning->setEnabled(stormActive);
|
||||
if (stormActive) {
|
||||
// Scale intensity: storm at full, heavy rain proportionally
|
||||
float lIntensity = (wType2 == 3) ? wInt2 : (wInt2 - 0.7f) / 0.3f;
|
||||
lightning->setIntensity(lIntensity);
|
||||
}
|
||||
}
|
||||
} else if (weather) {
|
||||
// No game handler (single-player without network) — zone weather only
|
||||
weather->updateZoneWeather(currentZoneId, deltaTime);
|
||||
|
|
@ -2932,6 +2956,11 @@ void Renderer::update(float deltaTime) {
|
|||
weather->update(*camera, deltaTime);
|
||||
}
|
||||
|
||||
// Update lightning (storm / heavy rain)
|
||||
if (lightning && camera && lightning->isEnabled()) {
|
||||
lightning->update(deltaTime, *camera);
|
||||
}
|
||||
|
||||
// Update swim effects
|
||||
if (swimEffects && camera && cameraController && waterRenderer) {
|
||||
swimEffects->update(*camera, *cameraController, *waterRenderer, deltaTime);
|
||||
|
|
@ -5217,6 +5246,7 @@ void Renderer::renderWorld(game::World* world, game::GameHandler* gameHandler) {
|
|||
if (waterRenderer && camera)
|
||||
waterRenderer->render(cmd, perFrameSet, *camera, globalTime, false, frameIdx);
|
||||
if (weather && camera) weather->render(cmd, perFrameSet);
|
||||
if (lightning && camera && lightning->isEnabled()) lightning->render(cmd, perFrameSet);
|
||||
if (swimEffects && camera) swimEffects->render(cmd, perFrameSet);
|
||||
if (mountDust && camera) mountDust->render(cmd, perFrameSet);
|
||||
if (chargeEffect && camera) chargeEffect->render(cmd, perFrameSet);
|
||||
|
|
@ -5353,6 +5383,7 @@ void Renderer::renderWorld(game::World* world, game::GameHandler* gameHandler) {
|
|||
if (waterRenderer && camera)
|
||||
waterRenderer->render(currentCmd, perFrameSet, *camera, globalTime, false, frameIdx);
|
||||
if (weather && camera) weather->render(currentCmd, perFrameSet);
|
||||
if (lightning && camera && lightning->isEnabled()) lightning->render(currentCmd, perFrameSet);
|
||||
if (swimEffects && camera) swimEffects->render(currentCmd, perFrameSet);
|
||||
if (mountDust && camera) mountDust->render(currentCmd, perFrameSet);
|
||||
if (chargeEffect && camera) chargeEffect->render(currentCmd, perFrameSet);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue