group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
EntityInterpolation.hpp
Go to the documentation of this file.
1
12
13#pragma once
14
15#include "ecs/components/InterpolationBuffer.hpp" // NOLINT(misc-include-cleaner) — surfaced as part of the API contract for debug-UI consumers.
16
17#include <SDL3/SDL_stdinc.h>
18
19#include <entt/entity/fwd.hpp>
20#include <glm/vec3.hpp>
21
23{
24
35{
36 glm::vec3 position{0.0f};
37 glm::vec3 velocity{0.0f};
38 float yaw = 0.0f;
39 float pitch = 0.0f;
40
41 // Discrete animator inputs — older-bracketing-sample, not lerped.
42 std::uint8_t moveMode = 0;
43 std::uint8_t wallRunSide = 0;
44 bool grounded = false;
45 bool sprinting = false;
46 bool crouching = false;
47
54
55 bool fromBuffer = false;
56};
57
61{
62 glm::vec3 position{0.0f};
63 glm::vec3 velocity{0.0f};
64 float yaw = 0.0f;
65 float pitch = 0.0f;
66 std::uint8_t moveMode = 0;
67 std::uint8_t wallRunSide = 0;
68 bool grounded = false;
69 bool sprinting = false;
70 bool crouching = false;
71
76};
77
93void appendSample(entt::registry& registry, entt::entity e, Uint64 captureNs, const SampleInputs& inputs);
94
111InterpolatedTransform sample(const entt::registry& registry,
112 entt::entity e,
113 Uint64 renderTimeNs,
114 const glm::vec3& fallbackPos,
115 float fallbackYaw);
116
117} // namespace entity_interpolation
Per-entity ring of recent snapshot samples for renderer interpolation.
Definition EntityInterpolation.cpp:14
InterpolatedTransform sample(const entt::registry &registry, entt::entity e, Uint64 renderTimeNs, const glm::vec3 &fallbackPos, float fallbackYaw)
Look up e's interpolated transform at renderTimeNs.
Definition EntityInterpolation.cpp:121
void appendSample(entt::registry &registry, entt::entity e, Uint64 captureNs, const SampleInputs &inputs)
Append a snapshot sample at captureNs into the entity's InterpolationBuffer, creating the component o...
Definition EntityInterpolation.cpp:34
Snapshot of an entity's full animation state at one instant.
Definition AnimSnapshot.hpp:73
Result of sampling an entity's interpolation buffer.
Definition EntityInterpolation.hpp:35
std::uint8_t wallRunSide
WallSide enum cast (PR-28).
Definition EntityInterpolation.hpp:43
bool sprinting
PR-28.
Definition EntityInterpolation.hpp:45
bool crouching
PR-28.
Definition EntityInterpolation.hpp:46
bool fromBuffer
True if a real lerp happened; false on fallback.
Definition EntityInterpolation.hpp:55
bool grounded
PR-28.
Definition EntityInterpolation.hpp:44
AnimSnapshot anim
PR-29: server-authoritative animation state at the render tick.
Definition EntityInterpolation.hpp:53
std::uint8_t moveMode
MoveMode enum cast (PR-28).
Definition EntityInterpolation.hpp:42
glm::vec3 velocity
Interpolated (or fallback) velocity (PR-28).
Definition EntityInterpolation.hpp:37
glm::vec3 position
Interpolated (or fallback) position.
Definition EntityInterpolation.hpp:36
float pitch
Interpolated (or fallback) pitch (PR-28).
Definition EntityInterpolation.hpp:39
float yaw
Interpolated (or fallback) yaw.
Definition EntityInterpolation.hpp:38
PR-28: full sample payload.
Definition EntityInterpolation.hpp:61
std::uint8_t moveMode
Definition EntityInterpolation.hpp:66
float yaw
Definition EntityInterpolation.hpp:64
bool crouching
Definition EntityInterpolation.hpp:70
float pitch
Definition EntityInterpolation.hpp:65
std::uint8_t wallRunSide
Definition EntityInterpolation.hpp:67
glm::vec3 position
Definition EntityInterpolation.hpp:62
AnimSnapshot anim
PR-29: server's animation state at this snapshot tick.
Definition EntityInterpolation.hpp:75
glm::vec3 velocity
Definition EntityInterpolation.hpp:63
bool sprinting
Definition EntityInterpolation.hpp:69
bool grounded
Definition EntityInterpolation.hpp:68