Style: prevent bogus macro formatting by clang-format

Also prevent formatting of thirdparty snippet
This commit is contained in:
Rémi Verschelde 2017-03-05 15:56:52 +01:00
parent 131631b009
commit 45438e9918
3 changed files with 60 additions and 54 deletions

View file

@ -14,4 +14,4 @@ are known and expected due to important refactoring work, so no need to report t
**Link to minimal example project:** **Link to minimal example project:**
<!-- Optional but very welcome. You can drag and drop a zip archive to upload it. -->: <!-- Optional but very welcome. You can drag and drop a zip archive to upload it. -->

View file

@ -40,12 +40,15 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
switch (p_source.get_type()) { switch (p_source.get_type()) {
/* clang-format makes a mess of this macro usage */
/* clang-format off */
case Variant::VECTOR2: { case Variant::VECTOR2: {
SETUP_TYPE(Vector2) SETUP_TYPE(Vector2)
/**/ TRY_TRANSFER_FIELD("x",x) /**/ TRY_TRANSFER_FIELD("x", x)
else TRY_TRANSFER_FIELD("y",y) else TRY_TRANSFER_FIELD("y", y)
return target; return target;
} }
@ -54,10 +57,10 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
SETUP_TYPE(Rect2) SETUP_TYPE(Rect2)
/**/ TRY_TRANSFER_FIELD("x",pos.x) /**/ TRY_TRANSFER_FIELD("x", pos.x)
else TRY_TRANSFER_FIELD("y",pos.y) else TRY_TRANSFER_FIELD("y", pos.y)
else TRY_TRANSFER_FIELD("w",size.x) else TRY_TRANSFER_FIELD("w", size.x)
else TRY_TRANSFER_FIELD("h",size.y) else TRY_TRANSFER_FIELD("h", size.y)
return target; return target;
} }
@ -66,9 +69,9 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
SETUP_TYPE(Vector3) SETUP_TYPE(Vector3)
/**/ TRY_TRANSFER_FIELD("x",x) /**/ TRY_TRANSFER_FIELD("x", x)
else TRY_TRANSFER_FIELD("y",y) else TRY_TRANSFER_FIELD("y", y)
else TRY_TRANSFER_FIELD("z",z) else TRY_TRANSFER_FIELD("z", z)
return target; return target;
} }
@ -77,10 +80,10 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
SETUP_TYPE(Plane) SETUP_TYPE(Plane)
/**/ TRY_TRANSFER_FIELD("x",normal.x) /**/ TRY_TRANSFER_FIELD("x", normal.x)
else TRY_TRANSFER_FIELD("y",normal.y) else TRY_TRANSFER_FIELD("y", normal.y)
else TRY_TRANSFER_FIELD("z",normal.z) else TRY_TRANSFER_FIELD("z", normal.z)
else TRY_TRANSFER_FIELD("d",d) else TRY_TRANSFER_FIELD("d", d)
return target; return target;
} }
@ -89,10 +92,10 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
SETUP_TYPE(Quat) SETUP_TYPE(Quat)
/**/ TRY_TRANSFER_FIELD("x",x) /**/ TRY_TRANSFER_FIELD("x", x)
else TRY_TRANSFER_FIELD("y",y) else TRY_TRANSFER_FIELD("y", y)
else TRY_TRANSFER_FIELD("z",z) else TRY_TRANSFER_FIELD("z", z)
else TRY_TRANSFER_FIELD("w",w) else TRY_TRANSFER_FIELD("w", w)
return target; return target;
} }
@ -101,12 +104,12 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
SETUP_TYPE(Rect3) SETUP_TYPE(Rect3)
/**/ TRY_TRANSFER_FIELD("px",pos.x) /**/ TRY_TRANSFER_FIELD("px", pos.x)
else TRY_TRANSFER_FIELD("py",pos.y) else TRY_TRANSFER_FIELD("py", pos.y)
else TRY_TRANSFER_FIELD("pz",pos.z) else TRY_TRANSFER_FIELD("pz", pos.z)
else TRY_TRANSFER_FIELD("sx",size.x) else TRY_TRANSFER_FIELD("sx", size.x)
else TRY_TRANSFER_FIELD("sy",size.y) else TRY_TRANSFER_FIELD("sy", size.y)
else TRY_TRANSFER_FIELD("sz",size.z) else TRY_TRANSFER_FIELD("sz", size.z)
return target; return target;
} }
@ -115,12 +118,12 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
SETUP_TYPE(Transform2D) SETUP_TYPE(Transform2D)
/**/ TRY_TRANSFER_FIELD("xx",elements[0][0]) /**/ TRY_TRANSFER_FIELD("xx", elements[0][0])
else TRY_TRANSFER_FIELD("xy",elements[0][1]) else TRY_TRANSFER_FIELD("xy", elements[0][1])
else TRY_TRANSFER_FIELD("yx",elements[1][0]) else TRY_TRANSFER_FIELD("yx", elements[1][0])
else TRY_TRANSFER_FIELD("yy",elements[1][1]) else TRY_TRANSFER_FIELD("yy", elements[1][1])
else TRY_TRANSFER_FIELD("ox",elements[2][0]) else TRY_TRANSFER_FIELD("ox", elements[2][0])
else TRY_TRANSFER_FIELD("oy",elements[2][1]) else TRY_TRANSFER_FIELD("oy", elements[2][1])
return target; return target;
} }
@ -129,15 +132,15 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
SETUP_TYPE(Basis) SETUP_TYPE(Basis)
/**/ TRY_TRANSFER_FIELD("xx",elements[0][0]) /**/ TRY_TRANSFER_FIELD("xx", elements[0][0])
else TRY_TRANSFER_FIELD("xy",elements[0][1]) else TRY_TRANSFER_FIELD("xy", elements[0][1])
else TRY_TRANSFER_FIELD("xz",elements[0][2]) else TRY_TRANSFER_FIELD("xz", elements[0][2])
else TRY_TRANSFER_FIELD("yx",elements[1][0]) else TRY_TRANSFER_FIELD("yx", elements[1][0])
else TRY_TRANSFER_FIELD("yy",elements[1][1]) else TRY_TRANSFER_FIELD("yy", elements[1][1])
else TRY_TRANSFER_FIELD("yz",elements[1][2]) else TRY_TRANSFER_FIELD("yz", elements[1][2])
else TRY_TRANSFER_FIELD("zx",elements[2][0]) else TRY_TRANSFER_FIELD("zx", elements[2][0])
else TRY_TRANSFER_FIELD("zy",elements[2][1]) else TRY_TRANSFER_FIELD("zy", elements[2][1])
else TRY_TRANSFER_FIELD("zz",elements[2][2]) else TRY_TRANSFER_FIELD("zz", elements[2][2])
return target; return target;
} }
@ -146,18 +149,18 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
SETUP_TYPE(Transform) SETUP_TYPE(Transform)
/**/ TRY_TRANSFER_FIELD("xx",basis.elements[0][0]) /**/ TRY_TRANSFER_FIELD("xx", basis.elements[0][0])
else TRY_TRANSFER_FIELD("xy",basis.elements[0][1]) else TRY_TRANSFER_FIELD("xy", basis.elements[0][1])
else TRY_TRANSFER_FIELD("xz",basis.elements[0][2]) else TRY_TRANSFER_FIELD("xz", basis.elements[0][2])
else TRY_TRANSFER_FIELD("yx",basis.elements[1][0]) else TRY_TRANSFER_FIELD("yx", basis.elements[1][0])
else TRY_TRANSFER_FIELD("yy",basis.elements[1][1]) else TRY_TRANSFER_FIELD("yy", basis.elements[1][1])
else TRY_TRANSFER_FIELD("yz",basis.elements[1][2]) else TRY_TRANSFER_FIELD("yz", basis.elements[1][2])
else TRY_TRANSFER_FIELD("zx",basis.elements[2][0]) else TRY_TRANSFER_FIELD("zx", basis.elements[2][0])
else TRY_TRANSFER_FIELD("zy",basis.elements[2][1]) else TRY_TRANSFER_FIELD("zy", basis.elements[2][1])
else TRY_TRANSFER_FIELD("zz",basis.elements[2][2]) else TRY_TRANSFER_FIELD("zz", basis.elements[2][2])
else TRY_TRANSFER_FIELD("xo",origin.x) else TRY_TRANSFER_FIELD("xo", origin.x)
else TRY_TRANSFER_FIELD("yo",origin.y) else TRY_TRANSFER_FIELD("yo", origin.y)
else TRY_TRANSFER_FIELD("zo",origin.z) else TRY_TRANSFER_FIELD("zo", origin.z)
return target; return target;
} }
@ -165,6 +168,8 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const
default: { default: {
ERR_FAIL_V(p_target); ERR_FAIL_V(p_target);
} }
/* clang-format on */
} }
} }

View file

@ -28,6 +28,9 @@
/*************************************************************************/ /*************************************************************************/
#include "gjk_epa.h" #include "gjk_epa.h"
/* Disabling formatting for thirdparty code snippet */
/* clang-format off */
/*************** Bullet's GJK-EPA2 IMPLEMENTATION *******************/ /*************** Bullet's GJK-EPA2 IMPLEMENTATION *******************/
// Config // Config
@ -879,8 +882,7 @@ bool Penetration( const ShapeSW* shape0,
} // end of namespace } // end of namespace
/* clang-format on */
bool gjk_epa_calculate_distance(const ShapeSW *p_shape_A, const Transform& p_transform_A, const ShapeSW *p_shape_B, const Transform& p_transform_B, Vector3& r_result_A, Vector3& r_result_B) { bool gjk_epa_calculate_distance(const ShapeSW *p_shape_A, const Transform& p_transform_A, const ShapeSW *p_shape_B, const Transform& p_transform_B, Vector3& r_result_A, Vector3& r_result_B) {
@ -915,4 +917,3 @@ bool gjk_epa_calculate_penetration(const ShapeSW *p_shape_A, const Transform& p_
return false; return false;
} }