Jolt Physics
A multi core friendly Game Physics Engine
|
A sub shape id contains a path to an element (usually a triangle or other primitive type) of a compound shape. More...
#include <SubShapeID.h>
Public Types | |
using | Type = uint32 |
Underlying storage type. More... | |
using | BiggerType = uint64 |
Type that is bigger than the underlying storage type for operations that would otherwise overflow. More... | |
Public Member Functions | |
SubShapeID ()=default | |
Constructor. More... | |
Type | PopID (uint inBits, SubShapeID &outRemainder) const |
Get the next id in the chain of ids (pops parents before children) More... | |
Type | GetValue () const |
Get the value of the path to the sub shape ID. More... | |
void | SetValue (Type inValue) |
Set the value of the sub shape ID (use with care!) More... | |
bool | IsEmpty () const |
bool | operator== (const SubShapeID &inRHS) const |
Check equal. More... | |
bool | operator!= (const SubShapeID &inRHS) const |
Check not-equal. More... | |
Static Public Attributes | |
static constexpr uint | MaxBits = 8 * sizeof(Type) |
How many bits we can store in this ID. More... | |
Friends | |
class | SubShapeIDCreator |
A sub shape id contains a path to an element (usually a triangle or other primitive type) of a compound shape.
Each sub shape knows how many bits it needs to encode its ID, so knows how many bits to take from the sub shape ID.
For example:
The bit pattern of the sub shape ID to identify a triangle in MeshShape C will then be CCCCCCCBBAAA.
A sub shape ID will become invalid when the structure of the shape changes. For example, if a child shape is removed from a compound shape, the sub shape ID will no longer be valid. This can be a problem when caching sub shape IDs from one frame to the next. See comments at ContactListener::OnContactPersisted / OnContactRemoved.
using SubShapeID::BiggerType = uint64 |
Type that is bigger than the underlying storage type for operations that would otherwise overflow.
using SubShapeID::Type = uint32 |
Underlying storage type.
|
default |
Constructor.
|
inline |
Get the value of the path to the sub shape ID.
|
inline |
Check if there is any bits of subshape ID left. Note that this is not a 100% guarantee as the subshape ID could consist of all 1 bits. Use for asserts only.
|
inline |
Check not-equal.
|
inline |
Check equal.
|
inline |
Get the next id in the chain of ids (pops parents before children)
|
inline |
Set the value of the sub shape ID (use with care!)
|
friend |
How many bits we can store in this ID.