载入中...
搜索中...
未找到
RigidPlayback.cpp
浏览该文件的文档.
1// eve-hot-path
3#include <utility>
4namespace eve::physics {
5RigidPlayback::RigidPlayback(RigidPoseTrack track) : track_(std::move(track)) {}
6Result<void> RigidPlayback::advance(double seconds) { return clock_.advance(seconds, track_.duration()); }
7Result<void> RigidPlayback::seek(double seconds) { return clock_.seek(seconds, track_.duration()); }
11 if (track_.space() == RigidTrackSpace::PlanarPixels &&
12 (placement.z != 0 || placement.rotationX != 0 || placement.rotationY != 0))
14 DiagnosticCode::InvalidArgument, "planar playback placement leaves the XY plane", "rigidPlayback"));
15 return transform_.set(placement);
16}
17BakeRigidPlacement RigidPlayback::placement() const noexcept { return transform_.placement(); }
18void RigidPlayback::setPaused(bool paused) noexcept { clock_.setPaused(paused); }
19double RigidPlayback::time() const noexcept { return clock_.time(); }
20double RigidPlayback::rate() const noexcept { return clock_.rate(); }
21bool RigidPlayback::paused() const noexcept { return clock_.paused(); }
22float RigidPlayback::duration() const noexcept { return track_.duration(); }
23RigidPoseTrack RigidPlayback::track() const { return track_; }
25 auto sampled = track_.sample(static_cast<float>(clock_.time()), id);
26 if (!sampled) return sampled;
27 return transform_.apply(sampled.value());
28}
29} // namespace eve::physics
Placement placement
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Id128 public API.
Definition Identity.h:111
bool paused() const noexcept
Whether advances leave time unchanged.
double rate() const noexcept
Current signed speed.
Result< void > seek(double seconds, double duration)
Seek finite seconds into inclusive [0,duration], ignoring rate and pause; errors preserve time.
Result< void > advance(double elapsedSeconds, double duration)
Advance using nonnegative finite elapsed time and duration; errors preserve time even when paused.
double time() const noexcept
Current injected playback time.
Result< void > setWrap(BakePlaybackWrap wrap)
Set a valid wrap policy, preserving state on invalid enum input.
Result< void > setRate(double rate)
Set finite signed speed; zero freezes and negative reverses.
Result< void > set(BakeRigidPlacement placement)
Validate finite translation and a nonzero XYZW quaternion; failures preserve prior placement.
BakeRigidPlacement placement() const noexcept
Return the normalized placement by value.
Result< RigidTrackPose > apply(RigidTrackPose pose) const
Rotate and translate a finite pose, preserving inputs on failure.
bool paused() const noexcept
Whether this player is paused.
Result< void > setWrap(BakePlaybackWrap wrap)
Set clamp/loop policy, rejecting unknown values.
void setPaused(bool paused) noexcept
Pause without modifying time or speed.
RigidPlayback(RigidPoseTrack track)
Start at zero, unpaused at rate one; copying the frozen track is constant-time.
Result< void > advance(double elapsedSeconds)
Advance by explicit nonnegative elapsed seconds; failure preserves time.
Result< void > setPlacement(BakeRigidPlacement placement)
Set instance placement in track units; planar tracks reject out-of-plane translation/rotation.
double rate() const noexcept
Current signed speed.
BakeRigidPlacement placement() const noexcept
Current normalized placement by value.
double time() const noexcept
Current playback time in seconds.
float duration() const noexcept
Duration from the immutable track, the sole duration authority.
Result< RigidTrackPose > sample(PersistentId id) const
Sample one persistent identity at this player's current time.
RigidPoseTrack track() const
Return a cheap owning copy of the immutable track, valid after player destruction.
Result< void > setRate(double rate)
Set finite signed speed; zero freezes and negative reverses.
Result< void > seek(double seconds)
Seek finite seconds, clamping to both clip endpoints.
Frozen fixed-roster rigid poses, independent of physics, graphics and script providers....
Result< RigidTrackPose > sample(float seconds, PersistentId id) const
Sample a known stable identity at finite seconds, clamping outside the recorded interval.
RigidTrackSpace space() const noexcept
Coordinate contract of every pose in this track.
float duration() const noexcept
Last recorded timestamp.
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36
BakePlaybackWrap
Endpoint policy: advances clamp or wrap; explicit seeks always clamp inclusively.
Rotation about the baked origin followed by translation, in the track's explicit units; no scaling.