mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Transport System (Phases 1-7): - Implement TransportManager with Catmull-Rom spline path interpolation - Add WMO dynamic transforms for moving transport instances - Implement player attachment via world position composition - Add test transport with circular path around Stormwind harbor - Add /transport board and /transport leave console commands - Reuse taxi flight spline system and external follow camera mode NPC Spawn Fixes: - Add smart ocean spawn filter: blocks land creatures at high altitude over water (Z>50) - Allow legitimate water creatures at sea level (Z≤50) to spawn correctly - Fixes Elder Grey Bears, Highland Striders, and Plainscreepers spawning over ocean - Snap online creatures to terrain height when valid ground exists NpcManager Removal: - Remove deprecated NpcManager (offline mode no longer supported) - Delete npc_manager.hpp and npc_manager.cpp - Simplify NPC animation callbacks to use only creatureInstances_ map - Move NPC callbacks to game initialization in application.cpp Water Rendering: - Fix tile seam gaps caused by per-vertex wave randomization - Add distance-based blending: seamless waves up close (<150u), grid effect far away (>400u) - Smooth transition between seamless and grid modes (150-400 unit range) - Preserves aesthetic grid pattern at horizon while eliminating gaps when swimming
73 lines
2.4 KiB
C++
73 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
#include <unordered_map>
|
|
#include <glm/glm.hpp>
|
|
#include <glm/gtc/quaternion.hpp>
|
|
|
|
namespace wowee::rendering {
|
|
class WMORenderer;
|
|
}
|
|
|
|
namespace wowee::game {
|
|
|
|
struct TransportPath {
|
|
uint32_t pathId;
|
|
std::vector<glm::vec3> waypoints; // Position keyframes
|
|
std::vector<glm::quat> rotations; // Optional rotation keyframes
|
|
bool looping;
|
|
float speed; // units/sec (default 18.0f like taxi)
|
|
};
|
|
|
|
struct ActiveTransport {
|
|
uint64_t guid; // Entity GUID
|
|
uint32_t wmoInstanceId; // WMO renderer instance ID
|
|
uint32_t pathId; // Current path
|
|
size_t currentSegment; // Current waypoint index
|
|
float segmentProgress; // Distance along segment
|
|
glm::vec3 position; // Current world position
|
|
glm::quat rotation; // Current world rotation
|
|
glm::mat4 transform; // Cached world transform
|
|
glm::mat4 invTransform; // Cached inverse for collision
|
|
|
|
// Player attachment (single-player for now)
|
|
bool playerOnBoard;
|
|
glm::vec3 playerLocalOffset;
|
|
|
|
// Optional deck boundaries
|
|
glm::vec3 deckMin;
|
|
glm::vec3 deckMax;
|
|
bool hasDeckBounds;
|
|
};
|
|
|
|
class TransportManager {
|
|
public:
|
|
TransportManager();
|
|
~TransportManager();
|
|
|
|
void setWMORenderer(rendering::WMORenderer* renderer) { wmoRenderer_ = renderer; }
|
|
|
|
void update(float deltaTime);
|
|
void registerTransport(uint64_t guid, uint32_t wmoInstanceId, uint32_t pathId);
|
|
void unregisterTransport(uint64_t guid);
|
|
|
|
ActiveTransport* getTransport(uint64_t guid);
|
|
glm::vec3 getPlayerWorldPosition(uint64_t transportGuid, const glm::vec3& localOffset);
|
|
glm::mat4 getTransportInvTransform(uint64_t transportGuid);
|
|
|
|
void loadPathFromNodes(uint32_t pathId, const std::vector<glm::vec3>& waypoints, bool looping = true, float speed = 18.0f);
|
|
void setDeckBounds(uint64_t guid, const glm::vec3& min, const glm::vec3& max);
|
|
|
|
private:
|
|
void updateTransportMovement(ActiveTransport& transport, float deltaTime);
|
|
glm::vec3 interpolatePath(const TransportPath& path, size_t segmentIdx, float t);
|
|
glm::quat calculateOrientation(const TransportPath& path, size_t segmentIdx, float t);
|
|
void updateTransformMatrices(ActiveTransport& transport);
|
|
|
|
std::unordered_map<uint64_t, ActiveTransport> transports_;
|
|
std::unordered_map<uint32_t, TransportPath> paths_;
|
|
rendering::WMORenderer* wmoRenderer_ = nullptr;
|
|
};
|
|
|
|
} // namespace wowee::game
|