mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Refine water rendering, swimming, and underwater visuals
This commit is contained in:
parent
1951dbd9e6
commit
d0dac0df07
8 changed files with 440 additions and 56 deletions
|
|
@ -124,7 +124,7 @@ private:
|
|||
static constexpr float SWIM_GRAVITY = -5.0f;
|
||||
static constexpr float SWIM_BUOYANCY = 8.0f;
|
||||
static constexpr float SWIM_SINK_SPEED = -3.0f;
|
||||
static constexpr float WATER_SURFACE_OFFSET = 1.5f;
|
||||
static constexpr float WATER_SURFACE_OFFSET = 0.9f;
|
||||
|
||||
// State
|
||||
bool enabled = true;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class CharacterRenderer;
|
|||
class WMORenderer;
|
||||
class M2Renderer;
|
||||
class Minimap;
|
||||
class Shader;
|
||||
|
||||
class Renderer {
|
||||
public:
|
||||
|
|
@ -153,6 +154,9 @@ private:
|
|||
std::unique_ptr<audio::FootstepManager> footstepManager;
|
||||
std::unique_ptr<audio::ActivitySoundManager> activitySoundManager;
|
||||
std::unique_ptr<game::ZoneManager> zoneManager;
|
||||
std::unique_ptr<Shader> underwaterOverlayShader;
|
||||
uint32_t underwaterOverlayVAO = 0;
|
||||
uint32_t underwaterOverlayVBO = 0;
|
||||
|
||||
pipeline::AssetManager* cachedAssetManager = nullptr;
|
||||
uint32_t currentZoneId = 0;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <vector>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <cstdint>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace wowee {
|
||||
|
|
@ -22,9 +23,12 @@ class Shader;
|
|||
*/
|
||||
struct WaterSurface {
|
||||
glm::vec3 position; // World position
|
||||
glm::vec3 origin; // Mesh origin (world)
|
||||
glm::vec3 stepX; // Mesh X step vector in world space
|
||||
glm::vec3 stepY; // Mesh Y step vector in world space
|
||||
float minHeight; // Minimum water height
|
||||
float maxHeight; // Maximum water height
|
||||
uint8_t liquidType; // 0=water, 1=ocean, 2=magma, 3=slime
|
||||
uint16_t liquidType; // LiquidType.dbc ID (WotLK)
|
||||
|
||||
// Owning tile coordinates (for per-tile removal)
|
||||
int tileX = -1, tileY = -1;
|
||||
|
|
@ -119,6 +123,7 @@ public:
|
|||
* Returns the highest water surface height at that XY, or nullopt if no water.
|
||||
*/
|
||||
std::optional<float> getWaterHeightAt(float glX, float glY) const;
|
||||
std::optional<uint16_t> getWaterTypeAt(float glX, float glY) const;
|
||||
|
||||
/**
|
||||
* Get water surface count
|
||||
|
|
@ -129,8 +134,8 @@ private:
|
|||
void createWaterMesh(WaterSurface& surface);
|
||||
void destroyWaterMesh(WaterSurface& surface);
|
||||
|
||||
glm::vec4 getLiquidColor(uint8_t liquidType) const;
|
||||
float getLiquidAlpha(uint8_t liquidType) const;
|
||||
glm::vec4 getLiquidColor(uint16_t liquidType) const;
|
||||
float getLiquidAlpha(uint16_t liquidType) const;
|
||||
|
||||
std::unique_ptr<Shader> waterShader;
|
||||
std::vector<WaterSurface> surfaces;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue