summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
Diffstat (limited to 'core/math')
-rw-r--r--core/math/SCsub2
-rw-r--r--core/math/a_star.cpp8
-rw-r--r--core/math/a_star.h6
-rw-r--r--core/math/aabb.h4
-rw-r--r--core/math/audio_frame.h6
-rw-r--r--core/math/camera_matrix.cpp2
-rw-r--r--core/math/camera_matrix.h2
-rw-r--r--core/math/disjoint_set.h2
-rw-r--r--core/math/expression.cpp80
-rw-r--r--core/math/expression.h4
-rw-r--r--core/math/geometry.h6
-rw-r--r--core/math/octree.h54
-rw-r--r--core/math/quat.h2
-rw-r--r--core/math/quick_hull.cpp6
-rw-r--r--core/math/quick_hull.h8
-rw-r--r--core/math/rect2.h2
-rw-r--r--core/math/triangulate.h2
17 files changed, 99 insertions, 97 deletions
diff --git a/core/math/SCsub b/core/math/SCsub
index be438fcfbe..c8fdac207e 100644
--- a/core/math/SCsub
+++ b/core/math/SCsub
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-Import('env')
+Import("env")
env_math = env.Clone()
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index bfff12ac45..3e3e6c50a7 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -66,7 +66,7 @@ void AStar::add_point(int p_id, const Vector3 &p_pos, real_t p_weight_scale) {
pt->id = p_id;
pt->pos = p_pos;
pt->weight_scale = p_weight_scale;
- pt->prev_point = NULL;
+ pt->prev_point = nullptr;
pt->open_pass = 0;
pt->closed_pass = 0;
pt->enabled = true;
@@ -167,7 +167,7 @@ void AStar::connect_points(int p_id, int p_with_id, bool bidirectional) {
if (bidirectional) s.direction = Segment::BIDIRECTIONAL;
Set<Segment>::Element *element = segments.find(s);
- if (element != NULL) {
+ if (element != nullptr) {
s.direction |= element->get().direction;
if (s.direction == Segment::BIDIRECTIONAL) {
// Both are neighbours of each other now
@@ -194,7 +194,7 @@ void AStar::disconnect_points(int p_id, int p_with_id, bool bidirectional) {
int remove_direction = bidirectional ? (int)Segment::BIDIRECTIONAL : s.direction;
Set<Segment>::Element *element = segments.find(s);
- if (element != NULL) {
+ if (element != nullptr) {
// s is the new segment
// Erase the directions to be removed
s.direction = (element->get().direction & ~remove_direction);
@@ -255,7 +255,7 @@ bool AStar::are_points_connected(int p_id, int p_with_id, bool bidirectional) co
Segment s(p_id, p_with_id);
const Set<Segment>::Element *element = segments.find(s);
- return element != NULL &&
+ return element != nullptr &&
(bidirectional || (element->get().direction & s.direction) == s.direction);
}
diff --git a/core/math/a_star.h b/core/math/a_star.h
index cc6c4619e9..8c10ace33c 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef ASTAR_H
-#define ASTAR_H
+#ifndef A_STAR_H
+#define A_STAR_H
#include "core/oa_hash_map.h"
#include "core/reference.h"
@@ -210,4 +210,4 @@ public:
~AStar2D();
};
-#endif // ASTAR_H
+#endif // A_STAR_H
diff --git a/core/math/aabb.h b/core/math/aabb.h
index d9d50c7139..eca74e6755 100644
--- a/core/math/aabb.h
+++ b/core/math/aabb.h
@@ -72,8 +72,8 @@ public:
AABB merge(const AABB &p_with) const;
void merge_with(const AABB &p_aabb); ///merge with another AABB
AABB intersection(const AABB &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
- bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
- bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
+ bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const;
+ bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = nullptr, Vector3 *r_normal = nullptr) const;
_FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
_FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count) const;
diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h
index 6477d029d5..e1dbb385e4 100644
--- a/core/math/audio_frame.h
+++ b/core/math/audio_frame.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef AUDIOFRAME_H
-#define AUDIOFRAME_H
+#ifndef AUDIO_FRAME_H
+#define AUDIO_FRAME_H
#include "core/math/vector2.h"
#include "core/typedefs.h"
@@ -140,4 +140,4 @@ struct AudioFrame {
_ALWAYS_INLINE_ AudioFrame() {}
};
-#endif
+#endif // AUDIO_FRAME_H
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index c4981b954b..c36070e47f 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -145,7 +145,7 @@ void CameraMatrix::set_for_hmd(int p_eye, real_t p_aspect, real_t p_intraocular_
f3 *= p_oversample;
// always apply KEEP_WIDTH aspect ratio
- f3 *= p_aspect;
+ f3 /= p_aspect;
switch (p_eye) {
case 1: { // left eye
diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h
index 60f7d15974..c10193bc84 100644
--- a/core/math/camera_matrix.h
+++ b/core/math/camera_matrix.h
@@ -124,4 +124,4 @@ Vector3 CameraMatrix::xform(const Vector3 &p_vec3) const {
return ret / w;
}
-#endif
+#endif // CAMERA_MATRIX_H
diff --git a/core/math/disjoint_set.h b/core/math/disjoint_set.h
index fb89941ce4..32b9875e4c 100644
--- a/core/math/disjoint_set.h
+++ b/core/math/disjoint_set.h
@@ -152,4 +152,4 @@ void DisjointSet<T, C, AL>::get_members(Vector<T> &out_members, T representative
}
}
-#endif
+#endif // DISJOINT_SET_H
diff --git a/core/math/expression.cpp b/core/math/expression.cpp
index 04fda9d09a..859b9be8c5 100644
--- a/core/math/expression.cpp
+++ b/core/math/expression.cpp
@@ -760,7 +760,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
PackedByteArray barr;
bool full_objects = *p_inputs[1];
int len;
- Error err = encode_variant(*p_inputs[0], NULL, len, full_objects);
+ Error err = encode_variant(*p_inputs[0], nullptr, len, full_objects);
if (err) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
@@ -791,7 +791,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
Variant ret;
{
const uint8_t *r = varr.ptr();
- Error err = decode_variant(ret, r, varr.size(), NULL, allow_objects);
+ Error err = decode_variant(ret, r, varr.size(), nullptr, allow_objects);
if (err != OK) {
r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format.");
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
@@ -1298,12 +1298,12 @@ Expression::ENode *Expression::_parse_expression() {
while (true) {
//keep appending stuff to expression
- ENode *expr = NULL;
+ ENode *expr = nullptr;
Token tk;
_get_token(tk);
if (error_set)
- return NULL;
+ return nullptr;
switch (tk.type) {
case TK_CURLY_BRACKET_OPEN: {
@@ -1321,18 +1321,18 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
dn->dict.push_back(subexpr);
_get_token(tk);
if (tk.type != TK_COLON) {
_set_error("Expected ':'");
- return NULL;
+ return nullptr;
}
subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
dn->dict.push_back(subexpr);
@@ -1365,7 +1365,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
an->array.push_back(subexpr);
cofs = str_ofs;
@@ -1385,11 +1385,11 @@ Expression::ENode *Expression::_parse_expression() {
//a suexpression
ENode *e = _parse_expression();
if (error_set)
- return NULL;
+ return nullptr;
_get_token(tk);
if (tk.type != TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')'");
- return NULL;
+ return nullptr;
}
expr = e;
@@ -1419,7 +1419,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
func_call->arguments.push_back(subexpr);
@@ -1484,7 +1484,7 @@ Expression::ENode *Expression::_parse_expression() {
_get_token(tk);
if (tk.type != TK_PARENTHESIS_OPEN) {
_set_error("Expected '('");
- return NULL;
+ return nullptr;
}
ConstructorNode *constructor = alloc_node<ConstructorNode>();
@@ -1501,7 +1501,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
constructor->arguments.push_back(subexpr);
@@ -1525,7 +1525,7 @@ Expression::ENode *Expression::_parse_expression() {
_get_token(tk);
if (tk.type != TK_PARENTHESIS_OPEN) {
_set_error("Expected '('");
- return NULL;
+ return nullptr;
}
BuiltinFuncNode *bifunc = alloc_node<BuiltinFuncNode>();
@@ -1542,7 +1542,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
bifunc->arguments.push_back(subexpr);
@@ -1584,7 +1584,7 @@ Expression::ENode *Expression::_parse_expression() {
default: {
_set_error("Expected expression.");
- return NULL;
+ return nullptr;
} break;
}
@@ -1594,7 +1594,7 @@ Expression::ENode *Expression::_parse_expression() {
int cofs2 = str_ofs;
_get_token(tk);
if (error_set)
- return NULL;
+ return nullptr;
bool done = false;
@@ -1607,14 +1607,14 @@ Expression::ENode *Expression::_parse_expression() {
ENode *what = _parse_expression();
if (!what)
- return NULL;
+ return nullptr;
index->index = what;
_get_token(tk);
if (tk.type != TK_BRACKET_CLOSE) {
_set_error("Expected ']' at end of index.");
- return NULL;
+ return nullptr;
}
expr = index;
@@ -1624,7 +1624,7 @@ Expression::ENode *Expression::_parse_expression() {
_get_token(tk);
if (tk.type != TK_IDENTIFIER) {
_set_error("Expected identifier after '.'");
- return NULL;
+ return nullptr;
}
StringName identifier = tk.value;
@@ -1648,7 +1648,7 @@ Expression::ENode *Expression::_parse_expression() {
//parse an expression
ENode *subexpr = _parse_expression();
if (!subexpr)
- return NULL;
+ return nullptr;
func_call->arguments.push_back(subexpr);
@@ -1698,7 +1698,7 @@ Expression::ENode *Expression::_parse_expression() {
int cofs = str_ofs;
_get_token(tk);
if (error_set)
- return NULL;
+ return nullptr;
Variant::Operator op = Variant::OP_MAX;
@@ -1805,7 +1805,7 @@ Expression::ENode *Expression::_parse_expression() {
default: {
_set_error("Parser bug, invalid operator in expression: " + itos(expression[i].op));
- return NULL;
+ return nullptr;
}
}
@@ -1822,7 +1822,7 @@ Expression::ENode *Expression::_parse_expression() {
if (next_op == -1) {
_set_error("Yet another parser bug....");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
// OK! create operator..
@@ -1835,7 +1835,7 @@ Expression::ENode *Expression::_parse_expression() {
if (expr_pos == expression.size()) {
//can happen..
_set_error("Unexpected end of expression...");
- return NULL;
+ return nullptr;
}
}
@@ -1845,7 +1845,7 @@ Expression::ENode *Expression::_parse_expression() {
OperatorNode *op = alloc_node<OperatorNode>();
op->op = expression[i].op;
op->nodes[0] = expression[i + 1].node;
- op->nodes[1] = NULL;
+ op->nodes[1] = nullptr;
expression.write[i].is_op = false;
expression.write[i].node = op;
expression.remove(i + 1);
@@ -1855,7 +1855,7 @@ Expression::ENode *Expression::_parse_expression() {
if (next_op < 1 || next_op >= (expression.size() - 1)) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
OperatorNode *op = alloc_node<OperatorNode>();
@@ -1864,7 +1864,7 @@ Expression::ENode *Expression::_parse_expression() {
if (expression[next_op - 1].is_op) {
_set_error("Parser bug...");
- ERR_FAIL_V(NULL);
+ ERR_FAIL_V(nullptr);
}
if (expression[next_op + 1].is_op) {
@@ -1874,7 +1874,7 @@ Expression::ENode *Expression::_parse_expression() {
// due to how precedence works, unaries will always disappear first
_set_error("Unexpected two consecutive operators.");
- return NULL;
+ return nullptr;
}
op->nodes[0] = expression[next_op - 1].node; //expression goes as left
@@ -1897,8 +1897,8 @@ bool Expression::_compile_expression() {
if (nodes) {
memdelete(nodes);
- nodes = NULL;
- root = NULL;
+ nodes = nullptr;
+ root = nullptr;
}
error_str = String();
@@ -1908,11 +1908,11 @@ bool Expression::_compile_expression() {
root = _parse_expression();
if (error_set) {
- root = NULL;
+ root = nullptr;
if (nodes) {
memdelete(nodes);
}
- nodes = NULL;
+ nodes = nullptr;
return true;
}
@@ -2151,8 +2151,8 @@ Error Expression::parse(const String &p_expression, const Vector<String> &p_inpu
if (nodes) {
memdelete(nodes);
- nodes = NULL;
- root = NULL;
+ nodes = nullptr;
+ root = nullptr;
}
error_str = String();
@@ -2164,11 +2164,11 @@ Error Expression::parse(const String &p_expression, const Vector<String> &p_inpu
root = _parse_expression();
if (error_set) {
- root = NULL;
+ root = nullptr;
if (nodes) {
memdelete(nodes);
}
- nodes = NULL;
+ nodes = nullptr;
return ERR_INVALID_PARAMETER;
}
@@ -2212,9 +2212,11 @@ Expression::Expression() :
output_type(Variant::NIL),
sequenced(false),
error_set(true),
- root(NULL),
- nodes(NULL),
+ root(nullptr),
+ nodes(nullptr),
execution_error(false) {
+ str_ofs = 0;
+ expression_dirty = false;
}
Expression::~Expression() {
diff --git a/core/math/expression.h b/core/math/expression.h
index bbf946bb0a..78de225ebf 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -219,7 +219,7 @@ private:
Type type;
- ENode() { next = NULL; }
+ ENode() { next = nullptr; }
virtual ~ENode() {
if (next) {
memdelete(next);
@@ -352,7 +352,7 @@ protected:
public:
Error parse(const String &p_expression, const Vector<String> &p_input_names = Vector<String>());
- Variant execute(Array p_inputs, Object *p_base = NULL, bool p_show_error = true);
+ Variant execute(Array p_inputs, Object *p_base = nullptr, bool p_show_error = true);
bool has_execute_failed() const;
String get_error_text() const;
diff --git a/core/math/geometry.h b/core/math/geometry.h
index 6453d16181..e47d18b056 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -891,7 +891,7 @@ public:
for (int i = 0; i < c; i++) {
const Vector2 &v1 = p[i];
const Vector2 &v2 = p[(i + 1) % c];
- if (segment_intersects_segment_2d(v1, v2, p_point, further_away, NULL)) {
+ if (segment_intersects_segment_2d(v1, v2, p_point, further_away, nullptr)) {
intersections++;
}
}
@@ -902,7 +902,7 @@ public:
static Vector<Vector<Face3>> separate_objects(Vector<Face3> p_array);
// Create a "wrap" that encloses the given geometry.
- static Vector<Face3> wrap_geometry(Vector<Face3> p_array, real_t *p_error = NULL);
+ static Vector<Face3> wrap_geometry(Vector<Face3> p_array, real_t *p_error = nullptr);
struct MeshData {
@@ -1019,4 +1019,4 @@ private:
static Vector<Vector<Point2>> _polypath_offset(const Vector<Point2> &p_polypath, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type);
};
-#endif
+#endif // GEOMETRY_H
diff --git a/core/math/octree.h b/core/math/octree.h
index 5478bdaf77..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
+#endif // OCTREE_H
diff --git a/core/math/quat.h b/core/math/quat.h
index 11ae03dffb..b3135ad1ca 100644
--- a/core/math/quat.h
+++ b/core/math/quat.h
@@ -231,4 +231,4 @@ bool Quat::operator!=(const Quat &p_quat) const {
return x != p_quat.x || y != p_quat.y || z != p_quat.z || w != p_quat.w;
}
-#endif
+#endif // QUAT_H
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 63dd18091f..7fbb26c377 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -399,7 +399,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
ERR_CONTINUE(!F);
List<Geometry::MeshData::Face>::Element *O = F->get().left == E ? F->get().right : F->get().left;
ERR_CONTINUE(O == E);
- ERR_CONTINUE(O == NULL);
+ ERR_CONTINUE(O == nullptr);
if (O->get().plane.is_equal_approx(f.plane)) {
//merge and delete edge and contiguous face, while repointing edges (uuugh!)
@@ -440,10 +440,10 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
// remove all edge connections to this face
for (Map<Edge, RetFaceConnect>::Element *G = ret_edges.front(); G; G = G->next()) {
if (G->get().left == O)
- G->get().left = NULL;
+ G->get().left = nullptr;
if (G->get().right == O)
- G->get().right = NULL;
+ G->get().right = nullptr;
}
ret_edges.erase(F); //remove the edge
diff --git a/core/math/quick_hull.h b/core/math/quick_hull.h
index aea9ffad8b..173f919a73 100644
--- a/core/math/quick_hull.h
+++ b/core/math/quick_hull.h
@@ -77,15 +77,15 @@ private:
struct FaceConnect {
List<Face>::Element *left, *right;
FaceConnect() {
- left = NULL;
- right = NULL;
+ left = nullptr;
+ right = nullptr;
}
};
struct RetFaceConnect {
List<Geometry::MeshData::Face>::Element *left, *right;
RetFaceConnect() {
- left = NULL;
- right = NULL;
+ left = nullptr;
+ right = nullptr;
}
};
diff --git a/core/math/rect2.h b/core/math/rect2.h
index 3b9660e2f0..30dbfdbbe5 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -105,7 +105,7 @@ struct Rect2 {
bool intersects_transformed(const Transform2D &p_xform, const Rect2 &p_rect) const;
- bool intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos = NULL, Point2 *r_normal = NULL) const;
+ bool intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos = nullptr, Point2 *r_normal = nullptr) const;
inline bool encloses(const Rect2 &p_rect) const {
diff --git a/core/math/triangulate.h b/core/math/triangulate.h
index f9bcb37141..c453b77ecf 100644
--- a/core/math/triangulate.h
+++ b/core/math/triangulate.h
@@ -58,4 +58,4 @@ private:
static bool snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V, bool relaxed);
};
-#endif
+#endif // TRIANGULATE_H