diff options
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/aabb.h | 2 | ||||
-rw-r--r-- | core/math/camera_matrix.cpp | 18 | ||||
-rw-r--r-- | core/math/expression.cpp | 48 | ||||
-rw-r--r-- | core/math/geometry.cpp | 5 | ||||
-rw-r--r-- | core/math/rect2.h | 4 | ||||
-rw-r--r-- | core/math/triangulate.cpp | 2 | ||||
-rw-r--r-- | core/math/vector2.cpp | 13 | ||||
-rw-r--r-- | core/math/vector2.h | 13 |
8 files changed, 53 insertions, 52 deletions
diff --git a/core/math/aabb.h b/core/math/aabb.h index 9bbedfe59c..4106fbb93c 100644 --- a/core/math/aabb.h +++ b/core/math/aabb.h @@ -198,7 +198,7 @@ Vector3 AABB::get_endpoint(int p_point) const { return Vector3(position.x + size.x, position.y + size.y, position.z); case 7: return Vector3(position.x + size.x, position.y + size.y, position.z + size.z); - }; + } ERR_FAIL_V(Vector3()); } diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 81c602d8fe..22ab83f358 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -116,18 +116,18 @@ void CameraMatrix::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_ left = -xmax + frustumshift; right = xmax + frustumshift; modeltranslation = p_intraocular_dist / 2.0; - }; break; + } break; case 2: { // right eye left = -xmax - frustumshift; right = xmax - frustumshift; modeltranslation = -p_intraocular_dist / 2.0; - }; break; + } break; default: { // mono, should give the same result as set_perspective(p_fovy_degrees,p_aspect,p_z_near,p_z_far,p_flip_fov) left = -xmax; right = xmax; modeltranslation = 0.0; - }; break; - }; + } break; + } set_frustum(left, right, -ymax, ymax, p_z_near, p_z_far); @@ -157,14 +157,14 @@ void CameraMatrix::set_for_hmd(int p_eye, real_t p_aspect, real_t p_intraocular_ switch (p_eye) { case 1: { // left eye set_frustum(-f2 * p_z_near, f1 * p_z_near, -f3 * p_z_near, f3 * p_z_near, p_z_near, p_z_far); - }; break; + } break; case 2: { // right eye set_frustum(-f1 * p_z_near, f2 * p_z_near, -f3 * p_z_near, f3 * p_z_near, p_z_near, p_z_far); - }; break; + } break; default: { // mono, does not apply here! - }; break; - }; -}; + } break; + } +} void CameraMatrix::set_orthogonal(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_znear, real_t p_zfar) { set_identity(); diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 81c1e7f564..db3bf2f830 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -753,39 +753,39 @@ Error Expression::_get_token(Token &r_token) { case 0: { r_token.type = TK_EOF; return OK; - }; + } case '{': { r_token.type = TK_CURLY_BRACKET_OPEN; return OK; - }; + } case '}': { r_token.type = TK_CURLY_BRACKET_CLOSE; return OK; - }; + } case '[': { r_token.type = TK_BRACKET_OPEN; return OK; - }; + } case ']': { r_token.type = TK_BRACKET_CLOSE; return OK; - }; + } case '(': { r_token.type = TK_PARENTHESIS_OPEN; return OK; - }; + } case ')': { r_token.type = TK_PARENTHESIS_CLOSE; return OK; - }; + } case ',': { r_token.type = TK_COMMA; return OK; - }; + } case ':': { r_token.type = TK_COLON; return OK; - }; + } case '$': { r_token.type = TK_INPUT; int index = 0; @@ -803,7 +803,7 @@ Error Expression::_get_token(Token &r_token) { r_token.value = index; return OK; - }; + } case '=': { cchar = GET_CHAR(); if (cchar == '=') { @@ -814,7 +814,7 @@ Error Expression::_get_token(Token &r_token) { return ERR_PARSE_ERROR; } return OK; - }; + } case '!': { if (expression[str_ofs] == '=') { r_token.type = TK_OP_NOT_EQUAL; @@ -823,7 +823,7 @@ Error Expression::_get_token(Token &r_token) { r_token.type = TK_OP_NOT; } return OK; - }; + } case '>': { if (expression[str_ofs] == '=') { r_token.type = TK_OP_GREATER_EQUAL; @@ -835,7 +835,7 @@ Error Expression::_get_token(Token &r_token) { r_token.type = TK_OP_GREATER; } return OK; - }; + } case '<': { if (expression[str_ofs] == '=') { r_token.type = TK_OP_LESS_EQUAL; @@ -847,27 +847,27 @@ Error Expression::_get_token(Token &r_token) { r_token.type = TK_OP_LESS; } return OK; - }; + } case '+': { r_token.type = TK_OP_ADD; return OK; - }; + } case '-': { r_token.type = TK_OP_SUB; return OK; - }; + } case '/': { r_token.type = TK_OP_DIV; return OK; - }; + } case '*': { r_token.type = TK_OP_MUL; return OK; - }; + } case '%': { r_token.type = TK_OP_MOD; return OK; - }; + } case '&': { if (expression[str_ofs] == '&') { r_token.type = TK_OP_AND; @@ -876,7 +876,7 @@ Error Expression::_get_token(Token &r_token) { r_token.type = TK_OP_BIT_AND; } return OK; - }; + } case '|': { if (expression[str_ofs] == '|') { r_token.type = TK_OP_OR; @@ -885,17 +885,17 @@ Error Expression::_get_token(Token &r_token) { r_token.type = TK_OP_BIT_OR; } return OK; - }; + } case '^': { r_token.type = TK_OP_BIT_XOR; return OK; - }; + } case '~': { r_token.type = TK_OP_BIT_INVERT; return OK; - }; + } case '"': { String str; while (true) { @@ -1666,7 +1666,7 @@ Expression::ENode *Expression::_parse_expression() { op = Variant::OP_BIT_NEGATE; break; default: { - }; + } } if (op == Variant::OP_MAX) { //stop appending stuff diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index f6f22e1db2..a4e9169a6f 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -42,16 +42,15 @@ // This implementation is very inefficient, commenting unless bugs happen. See the other one. /* bool Geometry::is_point_in_polygon(const Vector2 &p_point, const Vector<Vector2> &p_polygon) { - Vector<int> indices = Geometry::triangulate_polygon(p_polygon); for (int j = 0; j + 3 <= indices.size(); j += 3) { int i1 = indices[j], i2 = indices[j + 1], i3 = indices[j + 2]; - if (Geometry::is_point_in_triangle(p_point, p_polygon[i1], p_polygon[i2], p_polygon[i3])) + if (Geometry::is_point_in_triangle(p_point, p_polygon[i1], p_polygon[i2], p_polygon[i3])) { return true; + } } return false; } - */ void Geometry::MeshData::optimize_vertices() { diff --git a/core/math/rect2.h b/core/math/rect2.h index 1b86dbd49a..14393325ec 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -156,7 +156,7 @@ struct Rect2 { new_rect.size = new_rect.size - new_rect.position; //make relative again return new_rect; - }; + } inline bool has_point(const Point2 &p_point) const { if (p_point.x < position.x) { return false; @@ -323,7 +323,7 @@ struct Rect2i { new_rect.size = new_rect.size - new_rect.position; //make relative again return new_rect; - }; + } bool has_point(const Point2 &p_point) const { if (p_point.x < position.x) { return false; diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp index 7fab36ff50..12bd384c6a 100644 --- a/core/math/triangulate.cpp +++ b/core/math/triangulate.cpp @@ -79,7 +79,7 @@ bool Triangulate::is_inside_triangle(real_t Ax, real_t Ay, } else { return ((aCROSSbp >= 0.0) && (bCROSScp >= 0.0) && (cCROSSap >= 0.0)); } -}; +} bool Triangulate::snip(const Vector<Vector2> &p_contour, int u, int v, int w, int n, const Vector<int> &V, bool relaxed) { int p; diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index 7f264ce119..233421e070 100644 --- a/core/math/vector2.cpp +++ b/core/math/vector2.cpp @@ -209,28 +209,29 @@ void Vector2i::operator-=(const Vector2i &p_v) { Vector2i Vector2i::operator*(const Vector2i &p_v1) const { return Vector2i(x * p_v1.x, y * p_v1.y); -}; +} Vector2i Vector2i::operator*(const int &rvalue) const { return Vector2i(x * rvalue, y * rvalue); -}; +} + void Vector2i::operator*=(const int &rvalue) { x *= rvalue; y *= rvalue; -}; +} Vector2i Vector2i::operator/(const Vector2i &p_v1) const { return Vector2i(x / p_v1.x, y / p_v1.y); -}; +} Vector2i Vector2i::operator/(const int &rvalue) const { return Vector2i(x / rvalue, y / rvalue); -}; +} void Vector2i::operator/=(const int &rvalue) { x /= rvalue; y /= rvalue; -}; +} Vector2i Vector2i::operator-() const { return Vector2i(-x, -y); diff --git a/core/math/vector2.h b/core/math/vector2.h index e5774f1d55..8a08d3bf64 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -174,28 +174,29 @@ _FORCE_INLINE_ void Vector2::operator-=(const Vector2 &p_v) { _FORCE_INLINE_ Vector2 Vector2::operator*(const Vector2 &p_v1) const { return Vector2(x * p_v1.x, y * p_v1.y); -}; +} _FORCE_INLINE_ Vector2 Vector2::operator*(const real_t &rvalue) const { return Vector2(x * rvalue, y * rvalue); -}; +} + _FORCE_INLINE_ void Vector2::operator*=(const real_t &rvalue) { x *= rvalue; y *= rvalue; -}; +} _FORCE_INLINE_ Vector2 Vector2::operator/(const Vector2 &p_v1) const { return Vector2(x / p_v1.x, y / p_v1.y); -}; +} _FORCE_INLINE_ Vector2 Vector2::operator/(const real_t &rvalue) const { return Vector2(x / rvalue, y / rvalue); -}; +} _FORCE_INLINE_ void Vector2::operator/=(const real_t &rvalue) { x /= rvalue; y /= rvalue; -}; +} _FORCE_INLINE_ Vector2 Vector2::operator-() const { return Vector2(-x, -y); |