mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 10:37:35 +02:00
parents AACube should encompass all children's
This commit is contained in:
parent
1d9a81d5d4
commit
abaa329984
3 changed files with 22 additions and 0 deletions
|
@ -465,3 +465,10 @@ AABox AACube::clamp(float min, float max) const {
|
||||||
return temp.clamp(min, max);
|
return temp.clamp(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AACube& AACube::operator += (const glm::vec3& point) {
|
||||||
|
_corner = glm::min(_corner, point);
|
||||||
|
glm::vec3 scale = point - _corner;
|
||||||
|
_scale = glm::max(_scale, scale.x, scale.y, scale.z);
|
||||||
|
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
|
@ -64,6 +64,8 @@ public:
|
||||||
AABox clamp(const glm::vec3& min, const glm::vec3& max) const;
|
AABox clamp(const glm::vec3& min, const glm::vec3& max) const;
|
||||||
AABox clamp(float min, float max) const;
|
AABox clamp(float min, float max) const;
|
||||||
|
|
||||||
|
AACube& operator += (const glm::vec3& point);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
glm::vec3 getClosestPointOnFace(const glm::vec3& point, BoxFace face) const;
|
glm::vec3 getClosestPointOnFace(const glm::vec3& point, BoxFace face) const;
|
||||||
glm::vec3 getClosestPointOnFace(const glm::vec4& origin, const glm::vec4& direction, BoxFace face) const;
|
glm::vec3 getClosestPointOnFace(const glm::vec4& origin, const glm::vec4& direction, BoxFace face) const;
|
||||||
|
|
|
@ -585,6 +585,19 @@ bool SpatiallyNestable::setPuffedQueryAACube() {
|
||||||
_queryAACube = AACube(currentAACube.getCorner() - glm::vec3(currentAACube.getScale()), currentAACube.getScale() * 3.0f);
|
_queryAACube = AACube(currentAACube.getCorner() - glm::vec3(currentAACube.getScale()), currentAACube.getScale() * 3.0f);
|
||||||
// _queryAACube = AACube(currentAACube.getCorner(), currentAACube.getScale());
|
// _queryAACube = AACube(currentAACube.getCorner(), currentAACube.getScale());
|
||||||
_queryAACubeSet = true;
|
_queryAACubeSet = true;
|
||||||
|
|
||||||
|
getThisPointer()->forEachDescendant([&](SpatiallyNestablePointer descendant) {
|
||||||
|
bool success;
|
||||||
|
AACube descendantAACube = descendant->getMaximumAACube(success);
|
||||||
|
if (success) {
|
||||||
|
if (_queryAACube.contains(currentAACube)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_queryAACube += descendantAACube.getMinimumPoint();
|
||||||
|
_queryAACube += descendantAACube.getMaximumPoint();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue