diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2022-08-08 23:38:19 +0200 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2022-08-08 23:38:19 +0200 |
| commit | d78200b71b259b87f401b24906385af4e2553fbe (patch) | |
| tree | a3f50e975303896063f49c069752bd1be774e766 /src/bvh.cpp | |
| parent | 45247b737b1527fbeffac2c68a41e71c565d86a8 (diff) | |
Refactored gltf imported and mesh management
Diffstat (limited to 'src/bvh.cpp')
| -rw-r--r-- | src/bvh.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bvh.cpp b/src/bvh.cpp index 80f141d..9d0b4b8 100644 --- a/src/bvh.cpp +++ b/src/bvh.cpp @@ -1,5 +1,7 @@ #include "bvh.hpp" +#include <cassert> + #include <algorithm> #include <iostream> @@ -45,6 +47,8 @@ bvh::bvh(std::vector<triangle>& triangles, std::vector<packed_bvh_node>& packed_nodes) :triangles(triangles) { + + assert(!triangles.empty()); packed_nodes.resize(2 * triangles.size() - 1); temp_nodes = std::vector<temp_node>(2 * triangles.size() - 1); leafs = std::vector<temp_node>(triangles.size()); @@ -125,7 +129,7 @@ int32_t bvh::traverse_depth_first_ordered(std::vector<bvh_node>& nodes, int32_t if (next_id != -1) { return traverse_depth_first_ordered(nodes, id, next_id); } - } else if (nodes[id].primitive_id != -1 && nodes[id].next_id != -1) { + } else if (nodes[id].next_id != -1) { std::cout << "\t " << parent_id << " -> " << id << ";\n"; return nodes[id].next_id; } else { |
