group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
InterpolationBuffer.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "AnimSnapshot.hpp"
7
8#include <SDL3/SDL_stdinc.h>
9
10#include <array>
11#include <cstddef>
12#include <glm/vec3.hpp>
13
39{
41 static constexpr std::size_t k_capacity = 8;
42
56 struct Sample
57 {
58 Uint64 captureNs = 0;
59 glm::vec3 position{0.0f};
60 glm::vec3 velocity{0.0f};
61 float yaw = 0.0f;
62 float pitch = 0.0f;
63
64 // PlayerVisState fields the animator reads, interp-delayed
65 // alongside the position so locomotion-state transitions
66 // happen at the SAME logical instant the body visibly
67 // changes pose. Stored as `uint8_t` casts to keep this
68 // header free of `PlayerStateEnums.hpp` dependency.
69 std::uint8_t moveMode = 0;
70 std::uint8_t wallRunSide = 0;
71 bool grounded = false;
72 bool sprinting = false;
73 bool crouching = false;
74
83 };
84
85 std::array<Sample, k_capacity> ring{};
86 std::size_t head = 0;
87 std::size_t count = 0;
88};
PR-27 — per-entity animation state snapshot, decoupled from CharacterAnimator.
Snapshot of an entity's full animation state at one instant.
Definition AnimSnapshot.hpp:73
One snapshot's worth of interpolatable state.
Definition InterpolationBuffer.hpp:57
glm::vec3 position
World-space position.
Definition InterpolationBuffer.hpp:59
std::uint8_t moveMode
MoveMode enum cast (PR-28).
Definition InterpolationBuffer.hpp:69
float pitch
Player pitch (rad, PR-28).
Definition InterpolationBuffer.hpp:62
Uint64 captureNs
SDL_GetTicksNS() at append time.
Definition InterpolationBuffer.hpp:58
AnimSnapshot anim
PR-29: server-authoritative animation state at this sample's tick.
Definition InterpolationBuffer.hpp:82
glm::vec3 velocity
World-space velocity (PR-28).
Definition InterpolationBuffer.hpp:60
float yaw
Player yaw (rad). 0 for non-player entities.
Definition InterpolationBuffer.hpp:61
bool sprinting
PR-28.
Definition InterpolationBuffer.hpp:72
bool crouching
PR-28.
Definition InterpolationBuffer.hpp:73
std::uint8_t wallRunSide
WallSide enum cast (PR-28).
Definition InterpolationBuffer.hpp:70
bool grounded
PR-28.
Definition InterpolationBuffer.hpp:71
Render-time interpolation history for a remote entity.
Definition InterpolationBuffer.hpp:39
std::array< Sample, k_capacity > ring
Definition InterpolationBuffer.hpp:85
static constexpr std::size_t k_capacity
Maximum samples retained. Sized for ~250 ms at 32 Hz snapshot rate.
Definition InterpolationBuffer.hpp:41
std::size_t head
Next write index (mod k_capacity).
Definition InterpolationBuffer.hpp:86
std::size_t count
Live entries; saturates at k_capacity.
Definition InterpolationBuffer.hpp:87