NcEngine
nc::PhysicsSnapshot Class Referencefinal

Holds serialized physics state for performing physics simulation rollbacks. More...

#include <PhysicsSnapshot.h>

Public Member Functions

 PhysicsSnapshot (PhysicsTick tick, std::vector< uint8_t > bytes)
 
 PhysicsSnapshot (PhysicsSnapshot &&) noexcept
 
PhysicsSnapshotoperator= (PhysicsSnapshot &&) noexcept
 
auto IsValid () const -> bool
 Check if the snapshot has recorded state.
 
auto GetTick () const -> PhysicsTick
 Get the PhysicsTick the snapshot was taken at, or PhysicsTick::Null() if invalid.
 
auto GetSize () const -> size_t
 Get the size of the snapshot in bytes.
 
auto ViewBuffer () const -> std::span< const uint8_t >
 Get a view over the serialized bytes.
 
auto ExtractBuffer () -> std::vector< uint8_t >
 Extract the serialized bytes, clearing the snapshot.
 
void ResetRead ()
 Set the read position back to the beginning of the snapshot.
 
void Clear ()
 Clear any recorded state.
 

Protected Attributes

std::unique_ptr< Impl > m_impl
 
PhysicsTick m_tick = PhysicsTick::Null()
 

Detailed Description

Holds serialized physics state for performing physics simulation rollbacks.


The documentation for this class was generated from the following file: