mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 09:33:29 +02:00
add AACube::operator<() so they can be sorted
This commit is contained in:
parent
a71823353b
commit
0cc6f559d4
2 changed files with 9 additions and 0 deletions
|
@ -314,6 +314,13 @@ bool AACube::findCapsulePenetration(const glm::vec3& start, const glm::vec3& end
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AACube::operator<(const AACube& otherCube) const {
|
||||
return (_corner.x < otherCube._corner.x
|
||||
|| (_corner.x == otherCube._corner.x && (_corner.y < otherCube._corner.y
|
||||
|| (_corner.y == otherCube._corner.y && (_corner.z < otherCube._corner.z
|
||||
|| _scale < otherCube._scale)))));
|
||||
}
|
||||
|
||||
glm::vec3 AACube::getClosestPointOnFace(const glm::vec3& point, BoxFace face) const {
|
||||
switch (face) {
|
||||
case MIN_X_FACE:
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
bool findSpherePenetration(const glm::vec3& center, float radius, glm::vec3& penetration) const;
|
||||
bool findCapsulePenetration(const glm::vec3& start, const glm::vec3& end, float radius, glm::vec3& penetration) const;
|
||||
|
||||
bool operator<(const AACube& otherCube) const; // for qSorted lists of AACubes
|
||||
|
||||
private:
|
||||
glm::vec3 getClosestPointOnFace(const glm::vec3& point, BoxFace face) const;
|
||||
glm::vec3 getClosestPointOnFace(const glm::vec4& origin, const glm::vec4& direction, BoxFace face) const;
|
||||
|
|
Loading…
Reference in a new issue