diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 13:23:58 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch) | |
tree | a27e497da7104dd0a64f98a04fa3067668735e91 /servers/physics_2d/shape_2d_sw.h | |
parent | 710b34b70227becdc652b4ae027fe0ac47409642 (diff) |
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.
This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.
There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).
Part of #33027.
Diffstat (limited to 'servers/physics_2d/shape_2d_sw.h')
-rw-r--r-- | servers/physics_2d/shape_2d_sw.h | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h index ca001e6dd9..97a051ca65 100644 --- a/servers/physics_2d/shape_2d_sw.h +++ b/servers/physics_2d/shape_2d_sw.h @@ -57,7 +57,6 @@ public: }; class Shape2DSW { - RID self; Rect2 aabb; bool configured; @@ -100,13 +99,11 @@ public: const Map<ShapeOwner2DSW *, int> &get_owners() const; _FORCE_INLINE_ void get_supports_transformed_cast(const Vector2 &p_cast, const Vector2 &p_normal, const Transform2D &p_xform, Vector2 *r_supports, int &r_amount) const { - get_supports(p_xform.basis_xform_inv(p_normal).normalized(), r_supports, r_amount); for (int i = 0; i < r_amount; i++) r_supports[i] = p_xform.xform(r_supports[i]); if (r_amount == 1) { - if (Math::abs(p_normal.dot(p_cast.normalized())) < (1.0 - _SEGMENT_IS_VALID_SUPPORT_THRESHOLD)) { //make line because they are parallel r_amount = 2; @@ -117,7 +114,6 @@ public: } } else { - if (Math::abs(p_normal.dot(p_cast.normalized())) < (1.0 - _SEGMENT_IS_VALID_SUPPORT_THRESHOLD)) { //optimize line and make it larger because they are parallel if ((r_supports[1] - r_supports[0]).dot(p_cast) > 0) { @@ -145,7 +141,6 @@ public: project_range_cast(p_cast, p_normal, p_transform, r_min, r_max); \ } \ _FORCE_INLINE_ void project_range_cast(const Vector2 &p_cast, const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { \ - \ real_t mina, maxa; \ real_t minb, maxb; \ Transform2D ofsb = p_transform; \ @@ -157,7 +152,6 @@ public: } class LineShape2DSW : public Shape2DSW { - Vector2 normal; real_t d; @@ -195,7 +189,6 @@ public: }; class RayShape2DSW : public Shape2DSW { - real_t length; bool slips_on_slope; @@ -220,7 +213,6 @@ public: r_max = p_normal.dot(p_transform.get_origin()); r_min = p_normal.dot(p_transform.xform(Vector2(0, length))); if (r_max < r_min) { - SWAP(r_max, r_min); } } @@ -232,7 +224,6 @@ public: }; class SegmentShape2DSW : public Shape2DSW { - Vector2 a; Vector2 b; Vector2 n; @@ -245,7 +236,6 @@ public: virtual PhysicsServer2D::ShapeType get_type() const { return PhysicsServer2D::SHAPE_SEGMENT; } _FORCE_INLINE_ Vector2 get_xformed_normal(const Transform2D &p_xform) const { - return (p_xform.xform(b) - p_xform.xform(a)).normalized().tangent(); } virtual void project_rangev(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal, p_transform, r_min, r_max); } @@ -263,7 +253,6 @@ public: r_max = p_normal.dot(p_transform.xform(a)); r_min = p_normal.dot(p_transform.xform(b)); if (r_max < r_min) { - SWAP(r_max, r_min); } } @@ -279,7 +268,6 @@ public: }; class CircleShape2DSW : public Shape2DSW { - real_t radius; public: @@ -313,7 +301,6 @@ public: }; class RectangleShape2DSW : public Shape2DSW { - Vector2 half_extents; public: @@ -336,7 +323,6 @@ public: r_max = -1e20; r_min = 1e20; for (int i = 0; i < 4; i++) { - real_t d = p_normal.dot(p_transform.xform(Vector2(((i & 1) * 2 - 1) * half_extents.x, ((i >> 1) * 2 - 1) * half_extents.y))); if (d > r_max) @@ -347,7 +333,6 @@ public: } _FORCE_INLINE_ Vector2 get_circle_axis(const Transform2D &p_xform, const Transform2D &p_xform_inv, const Vector2 &p_circle) const { - Vector2 local_v = p_xform_inv.xform(p_circle); Vector2 he( @@ -358,7 +343,6 @@ public: } _FORCE_INLINE_ Vector2 get_box_axis(const Transform2D &p_xform, const Transform2D &p_xform_inv, const RectangleShape2DSW *p_B, const Transform2D &p_B_xform, const Transform2D &p_B_xform_inv) const { - Vector2 a, b; { @@ -387,7 +371,6 @@ public: }; class CapsuleShape2DSW : public Shape2DSW { - real_t radius; real_t height; @@ -419,7 +402,6 @@ public: r_min = p_normal.dot(p_transform.xform(-n)); if (r_max < r_min) { - SWAP(r_max, r_min); } @@ -430,9 +412,7 @@ public: }; class ConvexPolygonShape2DSW : public Shape2DSW { - struct Point { - Vector2 pos; Vector2 normal; //normal to next segment }; @@ -445,7 +425,6 @@ public: _FORCE_INLINE_ const Vector2 &get_point(int p_idx) const { return points[p_idx].pos; } _FORCE_INLINE_ const Vector2 &get_segment_normal(int p_idx) const { return points[p_idx].normal; } _FORCE_INLINE_ Vector2 get_xformed_segment_normal(const Transform2D &p_xform, int p_idx) const { - Vector2 a = points[p_idx].pos; p_idx++; Vector2 b = points[p_idx == point_count ? 0 : p_idx].pos; @@ -465,7 +444,6 @@ public: virtual Variant get_data() const; _FORCE_INLINE_ void project_range(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const { - if (!points || point_count <= 0) { r_min = r_max = 0; return; @@ -473,7 +451,6 @@ public: r_min = r_max = p_normal.dot(p_transform.xform(points[0].pos)); for (int i = 1; i < point_count; i++) { - real_t d = p_normal.dot(p_transform.xform(points[i].pos)); if (d > r_max) r_max = d; @@ -489,7 +466,6 @@ public: }; class ConcaveShape2DSW : public Shape2DSW { - public: virtual bool is_concave() const { return true; } typedef void (*Callback)(void *p_userdata, Shape2DSW *p_convex); @@ -498,9 +474,7 @@ public: }; class ConcavePolygonShape2DSW : public ConcaveShape2DSW { - struct Segment { - int points[2]; }; @@ -508,7 +482,6 @@ class ConcavePolygonShape2DSW : public ConcaveShape2DSW { Vector<Point2> points; struct BVH { - Rect2 aabb; int left, right; }; @@ -517,17 +490,13 @@ class ConcavePolygonShape2DSW : public ConcaveShape2DSW { int bvh_depth; struct BVH_CompareX { - _FORCE_INLINE_ bool operator()(const BVH &a, const BVH &b) const { - return (a.aabb.position.x + a.aabb.size.x * 0.5) < (b.aabb.position.x + b.aabb.size.x * 0.5); } }; struct BVH_CompareY { - _FORCE_INLINE_ bool operator()(const BVH &a, const BVH &b) const { - return (a.aabb.position.y + a.aabb.size.y * 0.5) < (b.aabb.position.y + b.aabb.size.y * 0.5); } }; |