diff options
Diffstat (limited to 'core/math/octree.h')
-rw-r--r-- | core/math/octree.h | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/core/math/octree.h b/core/math/octree.h index b47c052b68..5225fbecb4 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -119,9 +119,9 @@ private: children_count = 0; parent_index = -1; last_pass = 0; - parent = NULL; + parent = nullptr; for (int i = 0; i < 8; i++) - children[i] = NULL; + children[i] = nullptr; } ~Octant() { @@ -171,7 +171,7 @@ private: octree = 0; pairable_mask = 0; pairable_type = 0; - common_parent = NULL; + common_parent = nullptr; } }; @@ -308,19 +308,19 @@ private: while (root && root->children_count < 2 && !root->elements.size() && !(use_pairs && root->pairable_elements.size())) { - Octant *new_root = NULL; + Octant *new_root = nullptr; if (root->children_count == 1) { for (int i = 0; i < 8; i++) { if (root->children[i]) { new_root = root->children[i]; - root->children[i] = NULL; + root->children[i] = nullptr; break; } } ERR_FAIL_COND(!new_root); - new_root->parent = NULL; + new_root->parent = nullptr; new_root->parent_index = -1; } @@ -332,7 +332,7 @@ private: void _insert_element(Element *p_element, Octant *p_octant); void _ensure_valid_root(const AABB &p_aabb); - bool _remove_element_from_octant(Element *p_element, Octant *p_octant, Octant *p_limit = NULL); + bool _remove_element_from_octant(Element *p_element, Octant *p_octant, Octant *p_limit = nullptr); void _remove_element(Element *p_element); void _pair_element(Element *p_element, Octant *p_octant); void _unpair_element(Element *p_element, Octant *p_octant); @@ -377,10 +377,10 @@ public: int get_subindex(OctreeElementID p_id) const; int cull_convex(const Vector<Plane> &p_convex, T **p_result_array, int p_result_max, uint32_t p_mask = 0xFFFFFFFF); - int cull_aabb(const AABB &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF); - int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF); + int cull_aabb(const AABB &p_aabb, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF); + int cull_segment(const Vector3 &p_from, const Vector3 &p_to, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF); - int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = NULL, uint32_t p_mask = 0xFFFFFFFF); + int cull_point(const Vector3 &p_point, T **p_result_array, int p_result_max, int *p_subindex_array = nullptr, uint32_t p_mask = 0xFFFFFFFF); void set_pair_callback(PairCallback p_callback, void *p_userdata); void set_unpair_callback(UnpairCallback p_callback, void *p_userdata); @@ -396,7 +396,7 @@ public: template <class T, bool use_pairs, class AL> T *Octree<T, use_pairs, AL>::get(OctreeElementID p_id) const { const typename ElementMap::Element *E = element_map.find(p_id); - ERR_FAIL_COND_V(!E, NULL); + ERR_FAIL_COND_V(!E, nullptr); return E->get().userdata; } @@ -442,7 +442,7 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct p_element->octant_owners.push_back(owner); - if (p_element->common_parent == NULL) { + if (p_element->common_parent == nullptr) { p_element->common_parent = p_octant; p_element->container_aabb = p_octant->aabb; } else { @@ -463,7 +463,7 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct } else { /* not big enough, send it to subitems */ int splits = 0; - bool candidate = p_element->common_parent == NULL; + bool candidate = p_element->common_parent == nullptr; for (int i = 0; i < 8; i++) { @@ -552,7 +552,7 @@ void Octree<T, use_pairs, AL>::_ensure_valid_root(const AABB &p_aabb) { root = memnew_allocator(Octant, AL); - root->parent = NULL; + root->parent = nullptr; root->parent_index = -1; root->aabb = base; @@ -634,11 +634,11 @@ bool Octree<T, use_pairs, AL>::_remove_element_from_octant(Element *p_element, O if (p_octant == root) { // won't have a parent, just erase - root = NULL; + root = nullptr; } else { ERR_FAIL_INDEX_V(p_octant->parent_index, 8, octant_removed); - parent->children[p_octant->parent_index] = NULL; + parent->children[p_octant->parent_index] = nullptr; parent->children_count--; } @@ -852,12 +852,12 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) { if (old_has_surf) { _remove_element(&e); // removing - e.common_parent = NULL; + e.common_parent = nullptr; e.aabb = AABB(); _optimize(); } else { _ensure_valid_root(p_aabb); // inserting - e.common_parent = NULL; + e.common_parent = nullptr; e.aabb = p_aabb; _insert_element(&e, root); if (use_pairs) @@ -884,7 +884,7 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) { combined.merge_with(p_aabb); _ensure_valid_root(combined); - ERR_FAIL_COND(e.octant_owners.front() == NULL); + ERR_FAIL_COND(e.octant_owners.front() == nullptr); /* FIND COMMON PARENT */ @@ -902,7 +902,7 @@ void Octree<T, use_pairs, AL>::move(OctreeElementID p_id, const AABB &p_aabb) { //prepare for reinsert e.octant_owners.clear(); - e.common_parent = NULL; + e.common_parent = nullptr; e.aabb = p_aabb; _insert_element(&e, common_parent); // reinsert from this point @@ -971,7 +971,7 @@ void Octree<T, use_pairs, AL>::set_pairable(OctreeElementID p_id, bool p_pairabl e.pairable = p_pairable; e.pairable_type = p_pairable_type; e.pairable_mask = p_pairable_mask; - e.common_parent = NULL; + e.common_parent = nullptr; if (!e.aabb.has_no_surface()) { _ensure_valid_root(e.aabb); @@ -1364,15 +1364,15 @@ Octree<T, use_pairs, AL>::Octree(real_t p_unit_size) { last_element_id = 1; pass = 1; unit_size = p_unit_size; - root = NULL; + root = nullptr; octant_count = 0; pair_count = 0; - pair_callback = NULL; - unpair_callback = NULL; - pair_callback_userdata = NULL; - unpair_callback_userdata = NULL; + pair_callback = nullptr; + unpair_callback = nullptr; + pair_callback_userdata = nullptr; + unpair_callback_userdata = nullptr; } #endif // OCTREE_H |