esp::gfx::replay::Player class

Playback for "render replay".

This class is work in progress (readKeyframesFromFile isn't implemented yet).

This class reads render keyframes from a file so that observations can be reproduced (from the same camera perspective or a different one). A loaded keyframe can be set (applied to the scene) with setKeyframeIndex; render asset instances are added to the scene as needed and new observations can be rendered. Render assets are loaded as needed. See also Recorder. See examples/replay_tutorial.py for usage of this class through bindings (coming soon).

Public static functions

static auto keyframeFromString(const std::string& keyframe) -> Keyframe
Given a JSON string encoding a wrapped keyframe, returns the keyframe itself.
static auto keyframeFromStringUnwrapped(Corrade::Containers::StringView keyframe) -> Keyframe
Given a JSON string encoding a keyframe, returns the keyframe itself.

Constructors, destructors, conversion operators

Player(std::shared_ptr<AbstractPlayerImplementation> implementation) explicit
Construct a Player.
Player(const Player&&) deleted
Player(Player&&) defaulted noexcept
~Player()

Public functions

auto operator=(const Player&) -> Player& deleted
auto operator=(Player&&) -> Player& defaulted noexcept
void readKeyframesFromFile(const std::string& filepath)
Read keyframes. See also Recorder::writeSavedKeyframesToFile. After calling this, use setKeyframeIndex to set a keyframe.
auto getKeyframeIndex() const -> int
Get the currently-set keyframe, or -1 if no keyframe is set.
auto getNumKeyframes() const -> int
Get the number of keyframes read from file.
void setKeyframeIndex(int frameIndex)
Set a keyframe by index, or pass -1 to clear the currently-set keyframe.
auto getUserTransform(const std::string& name, Magnum::Vector3* translation, Magnum::Quaternion* rotation) const -> bool
Get a user transform. See Recorder::addUserTransformToKeyframe for usage tips.
void close()
Unload all keyframes.
void debugSetKeyframes(std::vector<Keyframe>&& keyframes)
Reserved for unit-testing.
auto debugGetKeyframes() const -> const std::vector<Keyframe>&
Reserved for unit-testing.
void appendKeyframe(Keyframe&& keyframe)
Appends a Keyframe to the keyframe list.
void setSingleKeyframe(Keyframe&& keyframe)
void appendJSONKeyframe(const std::string& keyframe)
Appends a JSON keyframe to the keyframe list.

Function documentation

static Keyframe esp::gfx::replay::Player::keyframeFromString(const std::string& keyframe)

Given a JSON string encoding a wrapped keyframe, returns the keyframe itself.

The JSON string is expected to be an object with a single keyframe key containing data for the one keyframe. Use keyframeFromStringUnwrapped() to consume directly the data.

static Keyframe esp::gfx::replay::Player::keyframeFromStringUnwrapped(Corrade::Containers::StringView keyframe)

Given a JSON string encoding a keyframe, returns the keyframe itself.

The JSON string is expected to directly contain the keyframe object, (with loads, creations, etc.). Use keyframeFromString() to consume a keyframe wrapped in an additional object.

esp::gfx::replay::Player::Player(std::shared_ptr<AbstractPlayerImplementation> implementation) explicit

Construct a Player.

The implementation is assumed to be owned by the caller for the whole lifetime of the Player instance.

void esp::gfx::replay::Player::readKeyframesFromFile(const std::string& filepath)

Read keyframes. See also Recorder::writeSavedKeyframesToFile. After calling this, use setKeyframeIndex to set a keyframe.

Parameters
filepath