Jolt Physics
A multi core friendly Game Physics Engine
|
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding race conditions. More...
#include <BodyID.h>
Public Member Functions | |
BodyID () | |
Construct invalid body ID. More... | |
BodyID (uint32 inID) | |
Construct from index and sequence number combined in a single uint32 (use with care!) More... | |
BodyID (uint32 inID, uint8 inSequenceNumber) | |
Construct from index and sequence number. More... | |
uint32 | GetIndex () const |
Get index in body array. More... | |
uint8 | GetSequenceNumber () const |
uint32 | GetIndexAndSequenceNumber () const |
Returns the index and sequence number combined in an uint32. More... | |
bool | IsInvalid () const |
Check if the ID is valid. More... | |
bool | operator== (const BodyID &inRHS) const |
Equals check. More... | |
bool | operator!= (const BodyID &inRHS) const |
Not equals check. More... | |
bool | operator< (const BodyID &inRHS) const |
Smaller than operator, can be used for sorting bodies. More... | |
bool | operator> (const BodyID &inRHS) const |
Greater than operator, can be used for sorting bodies. More... | |
Static Public Attributes | |
static JPH_OVERRIDE_NEW_DELETE constexpr uint32 | cInvalidBodyID = 0xffffffff |
The value for an invalid body ID. More... | |
static constexpr uint32 | cBroadPhaseBit = 0x00800000 |
This bit is used by the broadphase. More... | |
static constexpr uint32 | cMaxBodyIndex = 0x7fffff |
Maximum value for body index (also the maximum amount of bodies supported - 1) More... | |
static constexpr uint8 | cMaxSequenceNumber = 0xff |
Maximum value for the sequence number. More... | |
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding race conditions.
|
inline |
Construct invalid body ID.
|
inlineexplicit |
Construct from index and sequence number combined in a single uint32 (use with care!)
Construct from index and sequence number.
|
inline |
Get index in body array.
|
inline |
Returns the index and sequence number combined in an uint32.
|
inline |
Get sequence number of body. The sequence number can be used to check if a body ID with the same body index has been reused by another body. It is mainly used in multi threaded situations where a body is removed and its body index is immediately reused by a body created from another thread. Functions querying the broadphase can (after acquiring a body lock) detect that the body has been removed (we assume that this won't happen more than 128 times in a row).
|
inline |
Check if the ID is valid.
|
inline |
Not equals check.
|
inline |
Smaller than operator, can be used for sorting bodies.
|
inline |
Equals check.
|
inline |
Greater than operator, can be used for sorting bodies.
|
staticconstexpr |
This bit is used by the broadphase.
|
staticconstexpr |
The value for an invalid body ID.
|
staticconstexpr |
Maximum value for body index (also the maximum amount of bodies supported - 1)
|
staticconstexpr |
Maximum value for the sequence number.