Avoid unqualified-id "near" and "far" in Node3DEditor/Viewport

This commit is contained in:
Silc Lizard (Tokage) Renew
2024-02-13 14:19:23 +09:00
parent 9050ee1542
commit 67e38709fd
8 changed files with 55 additions and 75 deletions

View File

@@ -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;
}
}