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