Optimise BVH
This commit is contained in:
14
aabb.h
14
aabb.h
@@ -53,6 +53,20 @@ class aabb {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int longestAxis() const {
|
||||
// Returns the index of the longest axis of the bounding box.
|
||||
if (x.size() > y.size()) {
|
||||
return x.size() > z.size() ? 0 : 2;
|
||||
} else {
|
||||
return y.size() > z.size() ? 1 : 2;
|
||||
}
|
||||
}
|
||||
|
||||
static const aabb empty, universe;
|
||||
};
|
||||
|
||||
const aabb aabb::empty = aabb(interval::empty, interval::empty, interval::empty);
|
||||
const aabb aabb::universe = aabb(interval::universe, interval::universe, interval::universe);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user