1public:
2#ifdef BVH_VERBOSE
3void _debug_recursive_print_tree(int p_tree_id) const {
4 if (_root_node_id[p_tree_id] != BVHCommon::INVALID) {
5 _debug_recursive_print_tree_node(_root_node_id[p_tree_id]);
6 }
7}
8
9String _debug_aabb_to_string(const BVHABB_CLASS &aabb) const {
10 POINT size = aabb.calculate_size();
11
12 String sz;
13 float vol = 0.0;
14
15 for (int i = 0; i < POINT::AXIS_COUNT; ++i) {
16 sz += "(";
17 sz += itos(aabb.min[i]);
18 sz += " ~ ";
19 sz += itos(-aabb.neg_max[i]);
20 sz += ") ";
21
22 vol += size[i];
23 }
24
25 sz += "vol " + itos(vol);
26
27 return sz;
28}
29
30void _debug_recursive_print_tree_node(uint32_t p_node_id, int depth = 0) const {
31 const TNode &tnode = _nodes[p_node_id];
32
33 String sz = String("\t").repeat(depth) + itos(p_node_id);
34
35 if (tnode.is_leaf()) {
36 sz += " L";
37 sz += itos(tnode.height) + " ";
38 const TLeaf &leaf = _node_get_leaf(tnode);
39
40 sz += "[";
41 for (int n = 0; n < leaf.num_items; n++) {
42 if (n) {
43 sz += ", ";
44 }
45 sz += "r";
46 sz += itos(leaf.get_item_ref_id(n));
47 }
48 sz += "] ";
49 } else {
50 sz += " N";
51 sz += itos(tnode.height) + " ";
52 }
53
54 sz += _debug_aabb_to_string(tnode.aabb);
55 print_line(sz);
56
57 if (!tnode.is_leaf()) {
58 for (int n = 0; n < tnode.num_children; n++) {
59 _debug_recursive_print_tree_node(tnode.children[n], depth + 1);
60 }
61 }
62}
63#endif
64