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. | |
BodyID (uint32 inID) | |
Construct from index and sequence number combined in a single uint32 (use with care!) | |
BodyID (uint32 inID, uint8 inSequenceNumber) | |
Construct from index and sequence number. | |
uint32 | GetIndex () const |
Get index in body array. | |
uint8 | GetSequenceNumber () const |
uint32 | GetIndexAndSequenceNumber () const |
Returns the index and sequence number combined in an uint32. | |
bool | IsInvalid () const |
Check if the ID is valid. | |
bool | operator== (const BodyID &inRHS) const |
Equals check. | |
bool | operator!= (const BodyID &inRHS) const |
Not equals check. | |
bool | operator< (const BodyID &inRHS) const |
Smaller than operator, can be used for sorting bodies. | |
bool | operator> (const BodyID &inRHS) const |
Greater than operator, can be used for sorting bodies. | |
Static Public Attributes | |
static JPH_OVERRIDE_NEW_DELETE constexpr uint32 | cInvalidBodyID = 0xffffffff |
The value for an invalid body ID. | |
static constexpr uint32 | cBroadPhaseBit = 0x00800000 |
This bit is used by the broadphase. | |
static constexpr uint32 | cMaxBodyIndex = 0x7fffff |
Maximum value for body index (also the maximum amount of bodies supported - 1) | |
static constexpr uint8 | cMaxSequenceNumber = 0xff |
Maximum value for the sequence number. | |
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.
Smaller than operator, can be used for sorting bodies.
Greater than operator, can be used for sorting bodies.
This bit is used by the broadphase.
|
staticconstexpr |
The value for an invalid body ID.
Maximum value for body index (also the maximum amount of bodies supported - 1)
Maximum value for the sequence number.