summaryrefslogtreecommitdiffstats
path: root/servers/physics_2d/joints_2d_sw.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
committerRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /servers/physics_2d/joints_2d_sw.h
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
downloadredot-engine-5dbf1809c6e3e905b94b8764e99491e608122261.tar.gz
A Whole New World (clang-format edition)
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
Diffstat (limited to 'servers/physics_2d/joints_2d_sw.h')
-rw-r--r--servers/physics_2d/joints_2d_sw.h44
1 files changed, 18 insertions, 26 deletions
diff --git a/servers/physics_2d/joints_2d_sw.h b/servers/physics_2d/joints_2d_sw.h
index 1be15e4edc..8fe38f365a 100644
--- a/servers/physics_2d/joints_2d_sw.h
+++ b/servers/physics_2d/joints_2d_sw.h
@@ -29,30 +29,31 @@
#ifndef JOINTS_2D_SW_H
#define JOINTS_2D_SW_H
-#include "constraint_2d_sw.h"
#include "body_2d_sw.h"
-
-
+#include "constraint_2d_sw.h"
class Joint2DSW : public Constraint2DSW {
real_t max_force;
real_t bias;
real_t max_bias;
-public:
- _FORCE_INLINE_ void set_max_force(real_t p_force) { max_force=p_force; }
+public:
+ _FORCE_INLINE_ void set_max_force(real_t p_force) { max_force = p_force; }
_FORCE_INLINE_ real_t get_max_force() const { return max_force; }
- _FORCE_INLINE_ void set_bias(real_t p_bias) { bias=p_bias; }
+ _FORCE_INLINE_ void set_bias(real_t p_bias) { bias = p_bias; }
_FORCE_INLINE_ real_t get_bias() const { return bias; }
- _FORCE_INLINE_ void set_max_bias(real_t p_bias) { max_bias=p_bias; }
+ _FORCE_INLINE_ void set_max_bias(real_t p_bias) { max_bias = p_bias; }
_FORCE_INLINE_ real_t get_max_bias() const { return max_bias; }
- virtual Physics2DServer::JointType get_type() const=0;
- Joint2DSW(Body2DSW **p_body_ptr=NULL,int p_body_count=0) : Constraint2DSW(p_body_ptr,p_body_count) { bias=0; max_force=max_bias=3.40282e+38; };
-
+ virtual Physics2DServer::JointType get_type() const = 0;
+ Joint2DSW(Body2DSW **p_body_ptr = NULL, int p_body_count = 0)
+ : Constraint2DSW(p_body_ptr, p_body_count) {
+ bias = 0;
+ max_force = max_bias = 3.40282e+38;
+ };
};
#if 0
@@ -107,7 +108,7 @@ class PinJoint2DSW : public Joint2DSW {
};
Transform2D M;
- Vector2 rA,rB;
+ Vector2 rA, rB;
Vector2 anchor_A;
Vector2 anchor_B;
Vector2 bias;
@@ -115,7 +116,6 @@ class PinJoint2DSW : public Joint2DSW {
real_t softness;
public:
-
virtual Physics2DServer::JointType get_type() const { return Physics2DServer::JOINT_PIN; }
virtual bool setup(real_t p_step);
@@ -124,11 +124,10 @@ public:
void set_param(Physics2DServer::PinJointParam p_param, real_t p_value);
real_t get_param(Physics2DServer::PinJointParam p_param) const;
- PinJoint2DSW(const Vector2& p_pos,Body2DSW* p_body_a,Body2DSW* p_body_b=NULL);
+ PinJoint2DSW(const Vector2 &p_pos, Body2DSW *p_body_a, Body2DSW *p_body_b = NULL);
~PinJoint2DSW();
};
-
#endif
class GrooveJoint2DSW : public Joint2DSW {
@@ -150,25 +149,21 @@ class GrooveJoint2DSW : public Joint2DSW {
real_t jn_max;
real_t clamp;
Vector2 xf_normal;
- Vector2 rA,rB;
- Vector2 k1,k2;
-
+ Vector2 rA, rB;
+ Vector2 k1, k2;
bool correct;
public:
-
virtual Physics2DServer::JointType get_type() const { return Physics2DServer::JOINT_GROOVE; }
virtual bool setup(real_t p_step);
virtual void solve(real_t p_step);
-
- GrooveJoint2DSW(const Vector2& p_a_groove1,const Vector2& p_a_groove2, const Vector2& p_b_anchor, Body2DSW* p_body_a,Body2DSW* p_body_b);
+ GrooveJoint2DSW(const Vector2 &p_a_groove1, const Vector2 &p_a_groove2, const Vector2 &p_b_anchor, Body2DSW *p_body_a, Body2DSW *p_body_b);
~GrooveJoint2DSW();
};
-
class DampedSpringJoint2DSW : public Joint2DSW {
union {
@@ -180,7 +175,6 @@ class DampedSpringJoint2DSW : public Joint2DSW {
Body2DSW *_arr[2];
};
-
Vector2 anchor_A;
Vector2 anchor_B;
@@ -188,14 +182,13 @@ class DampedSpringJoint2DSW : public Joint2DSW {
real_t damping;
real_t stiffness;
- Vector2 rA,rB;
+ Vector2 rA, rB;
Vector2 n;
real_t n_mass;
real_t target_vrn;
real_t v_coef;
public:
-
virtual Physics2DServer::JointType get_type() const { return Physics2DServer::JOINT_DAMPED_SPRING; }
virtual bool setup(real_t p_step);
@@ -204,9 +197,8 @@ public:
void set_param(Physics2DServer::DampedStringParam p_param, real_t p_value);
real_t get_param(Physics2DServer::DampedStringParam p_param) const;
- DampedSpringJoint2DSW(const Vector2& p_anchor_a,const Vector2& p_anchor_b, Body2DSW* p_body_a,Body2DSW* p_body_b);
+ DampedSpringJoint2DSW(const Vector2 &p_anchor_a, const Vector2 &p_anchor_b, Body2DSW *p_body_a, Body2DSW *p_body_b);
~DampedSpringJoint2DSW();
};
-
#endif // JOINTS_2D_SW_H