mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
refactor: decompose TransportManager and upgrade Entity to CatmullRom splines
TransportManager decomposition: - Extract TransportClockSync: server clock offset, yaw flip detection, velocity bootstrap, client/server mode switching - Extract TransportAnimator: spline evaluation, Z clamping, orientation from server yaw or spline tangent - Slim TransportManager to thin orchestrator delegating to ClockSync and Animator; add pushTransform() helper to deduplicate WMO/M2 renderer calls - Remove legacy orientationFromSplineTangent (now uses CatmullRomSpline::orientationFromTangent) Entity path following upgrade: - Replace pathPoints_/pathSegDists_ linear lerp with std::optional<CatmullRomSpline> activeSpline_ - startMoveAlongPath builds SplineKeys with distance-proportional timing - updateMovement evaluates CatmullRomSpline for smooth Catmull-Rom interpolation matching server-side creature movement - Reset activeSpline_ on setPosition/startMoveTo to prevent stale state Tests: - Add test_transport_components (9 cases): ClockSync client/server/reverse modes, yaw flip detection, Animator position eval, server yaw, Z clamping - Link spline.cpp into test_entity for CatmullRomSpline dependency Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
This commit is contained in:
parent
de0383aa6b
commit
39719cac82
10 changed files with 704 additions and 337 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "game/transport_path_repository.hpp"
|
||||
#include "game/transport_clock_sync.hpp"
|
||||
#include "game/transport_animator.hpp"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
|
@ -124,10 +126,11 @@ public:
|
|||
private:
|
||||
void updateTransportMovement(ActiveTransport& transport, float deltaTime);
|
||||
void updateTransformMatrices(ActiveTransport& transport);
|
||||
/// Legacy transport orientation from tangent (preserves original cross-product order).
|
||||
static glm::quat orientationFromSplineTangent(const glm::vec3& tangent);
|
||||
void pushTransform(ActiveTransport& transport);
|
||||
|
||||
TransportPathRepository pathRepo_;
|
||||
TransportClockSync clockSync_;
|
||||
TransportAnimator animator_;
|
||||
std::unordered_map<uint64_t, ActiveTransport> transports_;
|
||||
rendering::WMORenderer* wmoRenderer_ = nullptr;
|
||||
rendering::M2Renderer* m2Renderer_ = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue