summaryrefslogtreecommitdiffstats
path: root/core/math/aabb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/aabb.cpp')
-rw-r--r--core/math/aabb.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp
index e1d49dacc0..76e9e74dea 100644
--- a/core/math/aabb.cpp
+++ b/core/math/aabb.cpp
@@ -117,11 +117,6 @@ AABB AABB::intersection(const AABB &p_aabb) const {
return AABB(min, max - min);
}
-#ifdef MINGW_ENABLED
-#undef near
-#undef far
-#endif
-
bool AABB::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip, Vector3 *r_normal) const {
#ifdef MATH_CHECKS
if (unlikely(size.x < 0 || size.y < 0 || size.z < 0)) {
@@ -130,8 +125,8 @@ bool AABB::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *
#endif
Vector3 c1, c2;
Vector3 end = position + size;
- real_t near = -1e20;
- real_t far = 1e20;
+ real_t depth_near = -1e20;
+ real_t depth_far = 1e20;
int axis = 0;
for (int i = 0; i < 3; i++) {
@@ -146,14 +141,14 @@ bool AABB::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *
if (c1[i] > c2[i]) {
SWAP(c1, c2);
}
- if (c1[i] > near) {
- near = c1[i];
+ if (c1[i] > depth_near) {
+ depth_near = c1[i];
axis = i;
}
- if (c2[i] < far) {
- far = c2[i];
+ if (c2[i] < depth_far) {
+ depth_far = c2[i];
}
- if ((near > far) || (far < 0)) {
+ if ((depth_near > depth_far) || (depth_far < 0)) {
return false;
}
}