| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <Jolt/Core/HashCombine.h> |
| 8 |
|
| 9 |
JPH_NAMESPACE_BEGIN |
| 10 |
|
| 11 |
|
| 12 |
class [[nodiscard]] Double3 |
| 13 |
{ |
| 14 |
public: |
| 15 |
JPH_OVERRIDE_NEW_DELETE |
| 16 |
|
| 17 |
Double3() = default; |
| 18 |
Double3(const Double3 &inRHS) = default; |
| 19 |
Double3 & operator = (const Double3 &inRHS) = default; |
| 20 |
Double3(double inX, double inY, double inZ) : x(inX), y(inY), z(inZ) { } |
| 21 |
|
| 22 |
double operator [] (int inCoordinate) const |
| 23 |
{ |
| 24 |
JPH_ASSERT(inCoordinate < 3); |
| 25 |
return *(&x + inCoordinate); |
| 26 |
} |
| 27 |
|
| 28 |
bool operator == (const Double3 &inRHS) const |
| 29 |
{ |
| 30 |
return x == inRHS.x && y == inRHS.y && z == inRHS.z; |
| 31 |
} |
| 32 |
|
| 33 |
bool operator != (const Double3 &inRHS) const |
| 34 |
{ |
| 35 |
return x != inRHS.x || y != inRHS.y || z != inRHS.z; |
| 36 |
} |
| 37 |
|
| 38 |
double x; |
| 39 |
double y; |
| 40 |
double z; |
| 41 |
}; |
| 42 |
|
| 43 |
static_assert(std::is_trivial<Double3>(), "Is supposed to be a trivial type!"); |
| 44 |
|
| 45 |
JPH_NAMESPACE_END |
| 46 |
|
| 47 |
|
| 48 |
JPH_MAKE_HASHABLE(JPH::Double3, t.x, t.y, t.z) |