Skip to content

Commit

Permalink
Rename near and far.
Browse files Browse the repository at this point in the history
This is necessary because of global namespace pollution in `windef.h`
for people that wish to use this library the Win32 API at the same time.
Workarounds exist, like including files in a different order, or
undefining `near` and `far` before including this library, but it is a
common enough problem that it makes sense to change the library, as this
is such a minor change.

Should fix #64 and #62.
  • Loading branch information
madmann91 committed Sep 18, 2023
1 parent 9ec6c9e commit ad3d436
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/bvh/v2/bvh.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ void Bvh<Node>::intersect(Ray<Scalar, Node::dimension>& ray, Index start, Stack&
bool hit_right = intr_right.first <= intr_right.second;

if (hit_left) {
auto near = left.index;
auto near_index = left.index;
if (hit_right) {
auto far = right.index;
auto far_index = right.index;
if (!IsAnyHit && intr_left.first > intr_right.first)
std::swap(near, far);
stack.push(far);
std::swap(near_index, far_index);
stack.push(far_index);
}
top = near;
top = near_index;
} else if (hit_right)
top = right.index;
else [[unlikely]]
Expand Down

0 comments on commit ad3d436

Please sign in to comment.