4#include <unordered_map>
7#include <glm/gtc/quaternion.hpp>
10#include "net/prediction/sample_track.h"
12namespace Vkm::Engine {
32 NetRewind() =
default;
33 ~NetRewind() =
default;
35 NetRewind(
const NetRewind& other) =
delete;
36 NetRewind& operator=(
const NetRewind& other) =
delete;
38 NetRewind(NetRewind && other) =
delete;
39 NetRewind& operator=(NetRewind && other) =
delete;
43 void record(
EntityId entity, uint32_t tick,
const glm::vec3& position,
const glm::quat& rotation);
57 bool poseAt(
EntityId entity,
double tick, glm::vec3& position, glm::quat& rotation)
const;
68 void clear() { m_tracks.clear(); }
70 size_t tracked()
const {
return m_tracks.size(); }
73 std::unordered_map<uint32_t, SampleTrack<HISTORY_TICKS>> m_tracks;
void record(EntityId entity, uint32_t tick, const glm::vec3 &position, const glm::quat &rotation)
Remember where entity was on tick, in the server's own clock.
bool poseAt(EntityId entity, double tick, glm::vec3 &position, glm::quat &rotation) const
Where entity was at tick, which may fall between two.
void forget(EntityId entity)
Forget entity, for a seat changing hands.
static constexpr size_t HISTORY_TICKS
Ticks of history kept per player.
Definition rewind.h:29
Names one entity of one Scene, for as long as that slot holds it.
Definition entity.h:23