| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <Jolt/Physics/Body/BodyID.h> |
| 8 |
#include <Jolt/Core/HashCombine.h> |
| 9 |
|
| 10 |
JPH_NAMESPACE_BEGIN |
| 11 |
|
| 12 |
|
| 13 |
struct alignas(uint64) BodyPair |
| 14 |
{ |
| 15 |
JPH_OVERRIDE_NEW_DELETE |
| 16 |
|
| 17 |
|
| 18 |
BodyPair() = default; |
| 19 |
BodyPair(BodyID inA, BodyID inB) : mBodyA(inA), mBodyB(inB) { } |
| 20 |
|
| 21 |
|
| 22 |
bool operator == (const BodyPair &inRHS) const { return *reinterpret_cast<const uint64 *>(this) == *reinterpret_cast<const uint64 *>(&inRHS); } |
| 23 |
|
| 24 |
|
| 25 |
bool operator < (const BodyPair &inRHS) const { return *reinterpret_cast<const uint64 *>(this) < *reinterpret_cast<const uint64 *>(&inRHS); } |
| 26 |
|
| 27 |
|
| 28 |
uint64 GetHash() const { return Hash64(*reinterpret_cast<const uint64 *>(this)); } |
| 29 |
|
| 30 |
BodyID mBodyA; |
| 31 |
BodyID mBodyB; |
| 32 |
}; |
| 33 |
|
| 34 |
static_assert(sizeof(BodyPair) == sizeof(uint64), "Mismatch in class size"); |
| 35 |
|
| 36 |
JPH_NAMESPACE_END |