Navigation
API > API/Runtime > API/Runtime/Chaos
Container type for double buffered physics data. Wrap whatever results object in this to have well definied semantics for accessing each side of a buffer and flipping it
| Name | TBufferedData |
| Type | class |
| Header File | /Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Framework/BufferedData.h |
| Include Path | #include "Chaos/Framework/BufferedData.h" |
Syntax
template<typename DataType>
class TBufferedData
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TBufferedData() |
Chaos/Framework/BufferedData.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| BufferIndex | TAtomic< int32 > | Atomic index for accessing the buffer sides. | Chaos/Framework/BufferedData.h | |
| Data | DataType | The actual data type stored. | Chaos/Framework/BufferedData.h | |
| DataSyncCounts | uint32 | Counter values for each side of the buffer. | Chaos/Framework/BufferedData.h | |
| SyncCounter | uint32 | Counter used to identify writes. | Chaos/Framework/BufferedData.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Flip() |
Flips the double buffer, no locks here - if synchronizing multiple threads make sure there's a lock somewhere | Chaos/Framework/BufferedData.h | |
DataType & Get
(
int32 InIndex |
Direct access to buffered data, useful to initialise members before beginning simulation. | Chaos/Framework/BufferedData.h | |
const DataType & GetGameDataForRead() |
Get a readable reference for the game thread side of the double buffer | Chaos/Framework/BufferedData.h | |
DataType & GetGameDataForWrite () |
Only for the game side to call, gets a writable reference to the game side data. | Chaos/Framework/BufferedData.h | |
int32 GetGameDataSyncCount() |
Get the counter for the last written state on the game side | Chaos/Framework/BufferedData.h | |
const DataType & GetPhysicsDataForRead() |
Get a readable reference for the physics side of the double buffer | Chaos/Framework/BufferedData.h | |
DataType & GetPhysicsDataForWrite() |
Only for the physics side to call, gets a writable reference to the physics side and increments the current sync counter to uniquely identify this write | Chaos/Framework/BufferedData.h | |
int32 GetPhysicsDataSyncCount() |
Get the counter for the last written state on the physics side | Chaos/Framework/BufferedData.h |