20 if (inLayer1 > inLayer2)
21 swap(inLayer1, inLayer2);
28 return (inLayer2 * (inLayer2 + 1)) / 2 + inLayer1;
36 mNumObjectLayers(inNumObjectLayers)
41 int table_size = (inNumObjectLayers * (inNumObjectLayers + 1) / 2 + 7) / 8;
42 mTable.
resize(table_size, 0);
48 return mNumObjectLayers;
54 uint bit = GetBit(inLayer1, inLayer2);
55 mTable[bit >> 3] &= (0xff ^ (1 << (bit & 0b111)));
61 uint bit = GetBit(inLayer1, inLayer2);
62 mTable[bit >> 3] |= 1 << (bit & 0b111);
69 uint bit = GetBit(inObject1, inObject2);
70 return (mTable[bit >> 3] & (1 << (bit & 0b111))) != 0;
74 uint mNumObjectLayers;
unsigned int uint
Definition Core.h:448
#define JPH_NAMESPACE_END
Definition Core.h:377
#define JPH_NAMESPACE_BEGIN
Definition Core.h:371
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:31
uint16 ObjectLayer
Definition ObjectLayer.h:16
void resize(size_type inNewSize)
Resize array to new length.
Definition Array.h:118
Filter class to test if two objects can collide based on their object layer. Used while finding colli...
Definition ObjectLayer.h:50
Definition ObjectLayerPairFilterTable.h:14
uint GetNumObjectLayers() const
Get the number of object layers.
Definition ObjectLayerPairFilterTable.h:46
void DisableCollision(ObjectLayer inLayer1, ObjectLayer inLayer2)
Disable collision between two object layers.
Definition ObjectLayerPairFilterTable.h:52
JPH_OVERRIDE_NEW_DELETE ObjectLayerPairFilterTable(uint inNumObjectLayers)
Constructs the table with inNumObjectLayers Layers, initially all layer pairs are disabled.
Definition ObjectLayerPairFilterTable.h:35
virtual bool ShouldCollide(ObjectLayer inObject1, ObjectLayer inObject2) const override
Returns true if two layers can collide.
Definition ObjectLayerPairFilterTable.h:66
void EnableCollision(ObjectLayer inLayer1, ObjectLayer inLayer2)
Enable collision between two object layers.
Definition ObjectLayerPairFilterTable.h:59