mirror of
https://github.com/Relintai/sfw.git
synced 2024-11-08 07:52:09 +01:00
Fixed build with MSVC.
This commit is contained in:
parent
61ceb39736
commit
2de9d4d9dc
@ -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 {
|
bool AABB::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip, Vector3 *r_normal) const {
|
||||||
Vector3 c1, c2;
|
Vector3 c1, c2;
|
||||||
Vector3 end = position + size;
|
Vector3 end = position + size;
|
||||||
real_t near = -1e20;
|
//<windows.h> has a far and near macro defined, and we can't undo it here in the amalgamation
|
||||||
real_t far = 1e20;
|
real_t aabb_near = -1e20;
|
||||||
|
real_t aabb_far = 1e20;
|
||||||
int axis = 0;
|
int axis = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
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]) {
|
if (c1[i] > c2[i]) {
|
||||||
SWAP(c1, c2);
|
SWAP(c1, c2);
|
||||||
}
|
}
|
||||||
if (c1[i] > near) {
|
if (c1[i] > aabb_near) {
|
||||||
near = c1[i];
|
aabb_near = c1[i];
|
||||||
axis = i;
|
axis = i;
|
||||||
}
|
}
|
||||||
if (c2[i] < far) {
|
if (c2[i] < aabb_far) {
|
||||||
far = c2[i];
|
aabb_far = c2[i];
|
||||||
}
|
}
|
||||||
if ((near > far) || (far < 0)) {
|
if ((aabb_near > aabb_far) || (aabb_far < 0)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,13 +56,6 @@
|
|||||||
#undef ONLY_GLAD
|
#undef ONLY_GLAD
|
||||||
#include "sfw_3rd.m"
|
#include "sfw_3rd.m"
|
||||||
|
|
||||||
#if defined(_WIN64) || defined(_WIN32)
|
|
||||||
#undef far
|
|
||||||
#undef near
|
|
||||||
#undef FAR
|
|
||||||
#undef NEAR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef CursorShape
|
#undef CursorShape
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
Loading…
Reference in New Issue
Block a user