QtCraft API C++ classes QML types Handbook

QcSnapshotBuffer Class

The recent server snapshots of one entity's motion, by server time (decision E-271), and its pose at any moment between them: interpolated between the two around it, extrapolated along the last movement for at most extrapolationMs past the newest one, then held. More...

Header: #include <clientcore/session/QcSnapshotBuffer.h>

Public Types

struct Snapshot

Public Functions

QcSnapshotBuffer::Snapshot at(double serverMs) const
void dropBefore(double serverMs)
bool isEmpty() const
const QcSnapshotBuffer::Snapshot &newest() const
void push(const QcSnapshotBuffer::Snapshot &snapshot, double intervalMs)
std::size_t size() const

Static Public Members

const std::size_t capacity
const double extrapolationMs
const double teleportMetres

Detailed Description

Member Function Documentation

QcSnapshotBuffer::Snapshot QcSnapshotBuffer::at(double serverMs) const

Returns the pose at server time serverMs: interpolated between the snapshots around it, the oldest before the oldest, and past the newest the last movement continued for at most extrapolationMs (yaw and pitch held), then held. An empty buffer gives a zero snapshot at serverMs.

void QcSnapshotBuffer::dropBefore(double serverMs)

Forgets the snapshots no longer needed for times from serverMs on.

bool QcSnapshotBuffer::isEmpty() const

Returns whether the buffer holds no snapshot.

const QcSnapshotBuffer::Snapshot &QcSnapshotBuffer::newest() const

Returns the newest snapshot; the buffer must not be empty.

void QcSnapshotBuffer::push(const QcSnapshotBuffer::Snapshot &snapshot, double intervalMs)

Adds the newest snapshot. intervalMs is the usual time between snapshots: after a longer pause (an item that lay still) the motion starts one interval before the new snapshot instead of creeping over the whole pause. A teleport or a snapshot older than the last drops the history.

std::size_t QcSnapshotBuffer::size() const

Returns the number of snapshots held.

Member Variable Documentation

const std::size_t QcSnapshotBuffer::capacity

Snapshots kept at most; the oldest go first.

const double QcSnapshotBuffer::extrapolationMs

How far past the newest snapshot the motion is extrapolated before it is held.

const double QcSnapshotBuffer::teleportMetres

A step this long between two snapshots is a teleport: shown at once, never in between.