44 int GetBit(SubGroupID inSubGroup1, SubGroupID inSubGroup2)
const
49 if (inSubGroup1 > inSubGroup2)
50 swap(inSubGroup1, inSubGroup2);
57 return (inSubGroup2 * (inSubGroup2 - 1)) / 2 + inSubGroup1;
63 mNumSubGroups(inNumSubGroups)
66 int table_size = ((inNumSubGroups * (inNumSubGroups - 1)) / 2 + 7) / 8;
67 mTable.resize(table_size, 0xff);
76 int bit = GetBit(inSubGroup1, inSubGroup2);
77 mTable[bit >> 3] &= (0xff ^ (1 << (bit & 0b111)));
83 int bit = GetBit(inSubGroup1, inSubGroup2);
84 mTable[bit >> 3] |= 1 << (bit & 0b111);
91 int bit = GetBit(inSubGroup1, inSubGroup2);
92 return (mTable[bit >> 3] & (1 << (bit & 0b111))) != 0;
#define JPH_EXPORT
Definition Core.h:236
unsigned int uint
Definition Core.h:453
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(linkage, class_name)
Definition SerializableObject.h:109
Definition CollisionGroup.h:20
GroupID GetGroupID() const
Definition CollisionGroup.h:54
SubGroupID GetSubGroupID() const
Definition CollisionGroup.h:65
static const GroupID cInvalidGroup
Definition CollisionGroup.h:27
uint32 GroupID
Definition CollisionGroup.h:24
const GroupFilter * GetGroupFilter() const
Get the collision group filter.
Definition CollisionGroup.h:43
uint32 SubGroupID
Definition CollisionGroup.h:25
Abstract class that checks if two CollisionGroups collide.
Definition GroupFilter.h:18
virtual void SaveBinaryState(StreamOut &inStream) const
Saves the contents of the group filter in binary form to inStream.
Definition GroupFilter.cpp:17
virtual void RestoreBinaryState(StreamIn &inStream)
This function should not be called directly, it is used by sRestoreFromBinaryState.
Definition GroupFilter.cpp:22
Definition GroupFilterTable.h:36
void DisableCollision(SubGroupID inSubGroup1, SubGroupID inSubGroup2)
Disable collision between two sub groups.
Definition GroupFilterTable.h:74
void EnableCollision(SubGroupID inSubGroup1, SubGroupID inSubGroup2)
Enable collision between two sub groups.
Definition GroupFilterTable.h:81
GroupFilterTable(const GroupFilterTable &inRHS)
Copy constructor.
Definition GroupFilterTable.h:71
virtual bool CanCollide(const CollisionGroup &inGroup1, const CollisionGroup &inGroup2) const override
Checks if two CollisionGroups collide.
Definition GroupFilterTable.h:96
GroupFilterTable(uint inNumSubGroups=0)
Constructs the table with inNumSubGroups subgroups, initially all collision pairs are enabled except ...
Definition GroupFilterTable.h:62
bool IsCollisionEnabled(SubGroupID inSubGroup1, SubGroupID inSubGroup2) const
Check if the collision between two subgroups is enabled.
Definition GroupFilterTable.h:88
Simple binary input stream.
Definition StreamIn.h:13
Simple binary output stream.
Definition StreamOut.h:13