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
This commit is contained in:
Rémi Verschelde 2017-03-05 16:44:50 +01:00
parent 45438e9918
commit 5dbf1809c6
1318 changed files with 140051 additions and 166004 deletions

View file

@ -31,24 +31,23 @@
Vector<Vector3> SphereShape::_gen_debug_mesh_lines() {
float r=get_radius();
float r = get_radius();
Vector<Vector3> points;
for(int i=0;i<=360;i++) {
for (int i = 0; i <= 360; i++) {
float ra=Math::deg2rad((float)i);
float rb=Math::deg2rad((float)i+1);
Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*r;
Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*r;
points.push_back(Vector3(a.x,0,a.y));
points.push_back(Vector3(b.x,0,b.y));
points.push_back(Vector3(0,a.x,a.y));
points.push_back(Vector3(0,b.x,b.y));
points.push_back(Vector3(a.x,a.y,0));
points.push_back(Vector3(b.x,b.y,0));
float ra = Math::deg2rad((float)i);
float rb = Math::deg2rad((float)i + 1);
Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r;
Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r;
points.push_back(Vector3(a.x, 0, a.y));
points.push_back(Vector3(b.x, 0, b.y));
points.push_back(Vector3(0, a.x, a.y));
points.push_back(Vector3(0, b.x, b.y));
points.push_back(Vector3(a.x, a.y, 0));
points.push_back(Vector3(b.x, b.y, 0));
}
return points;
@ -56,12 +55,12 @@ Vector<Vector3> SphereShape::_gen_debug_mesh_lines() {
void SphereShape::_update_shape() {
PhysicsServer::get_singleton()->shape_set_data(get_shape(),radius);
PhysicsServer::get_singleton()->shape_set_data(get_shape(), radius);
}
void SphereShape::set_radius(float p_radius) {
radius=p_radius;
radius = p_radius;
_update_shape();
notify_change_to_owners();
_change_notify("radius");
@ -72,17 +71,16 @@ float SphereShape::get_radius() const {
return radius;
}
void SphereShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius","radius"),&SphereShape::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"),&SphereShape::get_radius);
ADD_PROPERTY( PropertyInfo(Variant::REAL,"radius",PROPERTY_HINT_RANGE,"0,4096,0.01"), "set_radius", "get_radius");
ClassDB::bind_method(D_METHOD("set_radius", "radius"), &SphereShape::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &SphereShape::get_radius);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_radius", "get_radius");
}
SphereShape::SphereShape() : Shape( PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_SPHERE)) {
SphereShape::SphereShape()
: Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_SPHERE)) {
set_radius(1.0);
}