summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2021-04-05 14:02:50 +0200
committerRémi Verschelde <rverschelde@gmail.com>2021-04-05 14:05:07 +0200
commit9bbe51dc279e1203962bdf0b3266c9b14307638c (patch)
treec9cd262d5930dfb7b07176c2e879845c95f04e84 /core/math
parent65a288805726b219cb8f524db0c87fa58332a267 (diff)
Style: Apply clang-tidy's `modernize-use-nullptr`
Diffstat (limited to 'core/math')
-rw-r--r--core/math/dynamic_bvh.cpp12
-rw-r--r--core/math/dynamic_bvh.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp
index 4639a52278..8020e5f447 100644
--- a/core/math/dynamic_bvh.cpp
+++ b/core/math/dynamic_bvh.cpp
@@ -61,7 +61,7 @@ DynamicBVH::Node *DynamicBVH::_create_node_with_volume(Node *p_parent, const Vol
void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
if (!bvh_root) {
bvh_root = p_leaf;
- p_leaf->parent = 0;
+ p_leaf->parent = nullptr;
} else {
if (!p_root->is_leaf()) {
do {
@@ -71,7 +71,7 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
} while (!p_root->is_leaf());
}
Node *prev = p_root->parent;
- Node *node = _create_node_with_volume(prev, p_leaf->volume.merge(p_root->volume), 0);
+ Node *node = _create_node_with_volume(prev, p_leaf->volume.merge(p_root->volume), nullptr);
if (prev) {
prev->childs[p_root->get_index_in_parent()] = node;
node->childs[0] = p_root;
@@ -85,7 +85,7 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
break;
}
node = prev;
- } while (0 != (prev = node->parent));
+ } while (nullptr != (prev = node->parent));
} else {
node->childs[0] = p_root;
p_root->parent = node;
@@ -98,8 +98,8 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
if (leaf == bvh_root) {
- bvh_root = 0;
- return (0);
+ bvh_root = nullptr;
+ return (nullptr);
} else {
Node *parent = leaf->parent;
Node *prev = parent->parent;
@@ -119,7 +119,7 @@ DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
return (prev ? prev : bvh_root);
} else {
bvh_root = sibling;
- sibling->parent = 0;
+ sibling->parent = nullptr;
_delete_node(parent);
return (bvh_root);
}
diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h
index c71db2d24d..7cce1de0a6 100644
--- a/core/math/dynamic_bvh.h
+++ b/core/math/dynamic_bvh.h
@@ -278,7 +278,7 @@ private:
public:
// Methods
void clear();
- bool is_empty() const { return (0 == bvh_root); }
+ bool is_empty() const { return (nullptr == bvh_root); }
void optimize_bottom_up();
void optimize_top_down(int bu_threshold = 128);
void optimize_incremental(int passes);