Debian Codegraph @

core/math/bvh_misc.inc

raw
1 int _handle_get_tree_id(BVHHandle p_handle) const {
2 if (USE_PAIRS) {
3 return _extra[p_handle.id()].tree_id;
4 }
5 return 0;
6 }
7
8 public:
9 void _handle_sort(BVHHandle &p_ha, BVHHandle &p_hb) const {
10 if (p_ha.id() > p_hb.id()) {
11 BVHHandle temp = p_hb;
12 p_hb = p_ha;
13 p_ha = temp;
14 }
15 }
16
17 private:
18 void create_root_node(int p_tree) {
19 // if there is no root node, create one
20 if (_root_node_id[p_tree] == BVHCommon::INVALID) {
21 uint32_t root_node_id;
22 TNode *node = _nodes.request(root_node_id);
23 node->clear();
24 _root_node_id[p_tree] = root_node_id;
25
26 // make the root node a leaf
27 uint32_t leaf_id;
28 TLeaf *leaf = _leaves.request(leaf_id);
29 leaf->clear();
30 node->neg_leaf_id = -(int)leaf_id;
31 }
32 }
33
34 bool node_is_leaf_full(TNode &tnode) const {
35 const TLeaf &leaf = _node_get_leaf(tnode);
36 return leaf.is_full();
37 }
38
39 public:
40 TLeaf &_node_get_leaf(TNode &tnode) {
41 BVH_ASSERT(tnode.is_leaf());
42 return _leaves[tnode.get_leaf_id()];
43 }
44
45 const TLeaf &_node_get_leaf(const TNode &tnode) const {
46 BVH_ASSERT(tnode.is_leaf());
47 return _leaves[tnode.get_leaf_id()];
48 }
49
50 private: