From 2de9d4d9dc5d8c1fe3da0a47d85cc51757c50f96 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 19 Jan 2024 14:09:27 +0000 Subject: [PATCH] Fixed build with MSVC. --- sfw/core/aabb.cpp | 15 ++++++++------- tools/merger/sfw_full.cpp.inl | 7 ------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/sfw/core/aabb.cpp b/sfw/core/aabb.cpp index afe7e71..d0de91e 100644 --- a/sfw/core/aabb.cpp +++ b/sfw/core/aabb.cpp @@ -117,8 +117,9 @@ AABB AABB::intersection(const AABB &p_aabb) const { bool AABB::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip, Vector3 *r_normal) const { Vector3 c1, c2; Vector3 end = position + size; - real_t near = -1e20; - real_t far = 1e20; + // has a far and near macro defined, and we can't undo it here in the amalgamation + real_t aabb_near = -1e20; + real_t aabb_far = 1e20; int axis = 0; for (int i = 0; i < 3; i++) { @@ -133,14 +134,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] > aabb_near) { + aabb_near = c1[i]; axis = i; } - if (c2[i] < far) { - far = c2[i]; + if (c2[i] < aabb_far) { + aabb_far = c2[i]; } - if ((near > far) || (far < 0)) { + if ((aabb_near > aabb_far) || (aabb_far < 0)) { return false; } } diff --git a/tools/merger/sfw_full.cpp.inl b/tools/merger/sfw_full.cpp.inl index ad72859..71afab8 100644 --- a/tools/merger/sfw_full.cpp.inl +++ b/tools/merger/sfw_full.cpp.inl @@ -56,13 +56,6 @@ #undef ONLY_GLAD #include "sfw_3rd.m" -#if defined(_WIN64) || defined(_WIN32) -#undef far -#undef near -#undef FAR -#undef NEAR -#endif - #undef CursorShape #if defined(__linux__)