Skip to content

Commit

Permalink
Merge pull request #885 from cjcliffe/compiler-warning-cleanup-fixes
Browse files Browse the repository at this point in the history
Cleanup: C++11 updates, clean-up, warning fixes
  • Loading branch information
cjcliffe authored Jul 6, 2021
2 parents ed193f0 + 703ec4a commit 29db1bd
Show file tree
Hide file tree
Showing 171 changed files with 1,933 additions and 2,197 deletions.
16 changes: 8 additions & 8 deletions external/cubicvr2/math/aabb.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace CubicVR {

enum aabb_enum { AABB_DISJOINT, AABB_A_INSIDE_B, AABB_B_INSIDE_A, AABB_INTERSECT };
enum class aabb_intersect { AABB_DISJOINT, AABB_A_INSIDE_B, AABB_B_INSIDE_A, AABB_INTERSECT };

struct aabb {
vec3 min, max;
Expand Down Expand Up @@ -76,33 +76,33 @@ namespace CubicVR {
CubicVR.enums.aabb.B_INSIDE_A if boxB is inside boxA
CubicVR.enums.aabb.DISJOINT if AABBs are disjoint (do not intersect)
*/
aabb_enum intersects(aabb boxA, aabb boxB) {
aabb_intersect intersects(aabb boxA, aabb boxB) {
// Disjoint
if( boxA.min[0] > boxB.max[0] || boxA.max[0] < boxB.min[0] ){
return AABB_DISJOINT;
return aabb_intersect::AABB_DISJOINT;
}
if( boxA.min[1] > boxB.max[1] || boxA.max[1] < boxB.min[1] ){
return AABB_DISJOINT;
return aabb_intersect::AABB_DISJOINT;
}
if( boxA.min[2] > boxB.max[2] || boxA.max[2] < boxB.min[2] ){
return AABB_DISJOINT;
return aabb_intersect::AABB_DISJOINT;
}

// boxA is inside boxB.
if( boxA.min[0] >= boxB.min[0] && boxA.max[0] <= boxB.max[0] &&
boxA.min[1] >= boxB.min[1] && boxA.max[1] <= boxB.max[1] &&
boxA.min[2] >= boxB.min[2] && boxA.max[2] <= boxB.max[2]) {
return AABB_A_INSIDE_B;
return aabb_intersect::AABB_A_INSIDE_B;
}
// boxB is inside boxA.
if( boxB.min[0] >= boxA.min[0] && boxB.max[0] <= boxA.max[0] &&
boxB.min[1] >= boxA.min[1] && boxB.max[1] <= boxA.max[1] &&
boxB.min[2] >= boxA.min[2] && boxB.max[2] <= boxA.max[2]) {
return AABB_B_INSIDE_A;
return aabb_intersect::AABB_B_INSIDE_A;
}

// Otherwise AABB's intersect.
return AABB_INTERSECT;
return aabb_intersect::AABB_INTERSECT;
}
};
};
Expand Down
Loading

0 comments on commit 29db1bd

Please sign in to comment.