![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
A short history of where one entity was, kept by tick. More...
#include <sample_track.h>
Public Member Functions | |
| void | record (uint32_t tick, const glm::vec3 &position, const glm::quat &rotation) |
Remember position and rotation as of tick. | |
| bool | poseAt (double tick, glm::vec3 &position, glm::quat &rotation) const |
Where the entity was at tick, which may fall between two samples. | |
| uint32_t | newest () const |
| The newest moment remembered, or zero when nothing is. | |
Public Attributes | |
| Sample | samples [N] |
| Oldest first, newest last; the first count are held. | |
| size_t | count = 0 |
| Samples held. | |
A short history of where one entity was, kept by tick.
Oldest first; answers "where was this at time t".
| N | How many samples to keep. |
|
inline |
Remember position and rotation as of tick.
A sample not newer than the newest held is dropped, keeping the order poseAt relies on.
| tick | The moment the sample describes. |
| position | Where the entity was then. |
| rotation | How it was turned then. |
|
inline |
Where the entity was at tick, which may fall between two samples.
Past either end the nearest moment is given, not extrapolated: an overshoot yanked back reads worse than holding still.
| tick | The moment wanted; a double, since a tick count outgrows a float's precision within hours. |
| position | Filled with the pose's position. |
| rotation | Filled with the pose's rotation. |