Skip to content
Snippets Groups Projects
Commit 37c23573 authored by Yoel's avatar Yoel
Browse files

Added AABB-condition

parent 1681d783
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ std::optional<cam::Hit> TriangleMesh::intersect(const cam::Ray& r) const { ...@@ -28,6 +28,7 @@ std::optional<cam::Hit> TriangleMesh::intersect(const cam::Ray& r) const {
} }
std::optional<cam::Hit> TriangleMesh::intersect(size_t i, std::optional<cam::Hit> TriangleMesh::intersect(size_t i,
const cam::Ray& r) const { const cam::Ray& r) const {
if (!hierarchy[i].bb.intersects(r)) return std::nullopt;
std::array<cam::Hit, 3> hits = { std::array<cam::Hit, 3> hits = {
cam::Hit(util::Vec3(0), util::Vec3(0), cam::Hit(util::Vec3(0), util::Vec3(0),
std::numeric_limits<float>::infinity(), nullptr), std::numeric_limits<float>::infinity(), nullptr),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment