diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2022-09-01 00:04:48 +0200 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2022-09-01 00:04:48 +0200 |
| commit | 76a1e5b39825e2aa26d7d6625879dab63b3dadb6 (patch) | |
| tree | 109b1b1f4dc8274eb47b4fb96b4d86db50f22f8b /src/bvh.cpp | |
| parent | 8b8b3c8aaa859ceff95e82e26b81410688613cd7 (diff) | |
Fix bvh generation
Diffstat (limited to 'src/bvh.cpp')
| -rw-r--r-- | src/bvh.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/bvh.cpp b/src/bvh.cpp index a22cd5e..aaa6a42 100644 --- a/src/bvh.cpp +++ b/src/bvh.cpp @@ -83,32 +83,30 @@ bvh::bvh(std::vector<triangle>& triangles, std::vector<packed_bvh_node>& packed_ node.next_id = temp_nodes[old_node.next_id].df_id; } } - - // exporter(); } //------------------------- // BVH exporter for graphviz //------------------------- void bvh::exporter() { - std::cout << "digraph bvh {" << std::endl; + std::cout << "digraph bvh {\n"; traverse_depth_first(temp_nodes, 0); // traverse_depth_first_ordered(-1, 0); - std::cout << "}" << std::endl; + std::cout << "}\n"; } bool bvh::traverse_depth_first(std::vector<temp_node>& nodes, int32_t id) { - if (id <= 0) { - std::cout << ";" << std::endl; + if (id < 0) { return false; } - std::cout << " -> " << id; if (traverse_depth_first(nodes, nodes[id].left_id)) { - std::cout << "\t " << id; + std::cout << id << " -> " << nodes[id].left_id << ";\n"; + std::cout << id << " -> " << nodes[id].left_id + 1 << ";\n"; + traverse_depth_first(nodes, nodes[id].left_id + 1); } |
