From 876254efcdedf373584f90602755c11816316c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 22 May 2012 16:50:18 +0200 Subject: [PATCH] Custom @collisionoperator command instead of hiding the functions. Uses @relates, so the collision operator is tied to class for which the collision is implemented (not to which contains the implementation). --- Doxyfile | 1 + src/Physics/Capsule.h | 5 +++-- src/Physics/Plane.h | 6 ++++-- src/Physics/Sphere.h | 7 +++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Doxyfile b/Doxyfile index b758d6dfb..fdca5df16 100644 --- a/Doxyfile +++ b/Doxyfile @@ -196,6 +196,7 @@ TAB_SIZE = 8 ALIASES = \ "debugoperator{1}=@relates \1\n@brief Debug output operator" \ + "collisionoperator{2}=@relates \1\n@brief Collision of %\1 and %\2\n@see \2::operator%(const \1&) const" \ "todoc=@xrefitem todox \"Documentation todo\" \"Documentation-related todo list\"" \ "requires_gl30=@xrefitem RequiresGL30 \"Requires OpenGL 3.0\" \"Functionality requiring OpenGL 3.0\"" \ "requires_gl31=@xrefitem RequiresGL31 \"Requires OpenGL 3.1\" \"Functionality requiring OpenGL 3.1\"" \ diff --git a/src/Physics/Capsule.h b/src/Physics/Capsule.h index e1e2a552b..b9cec4c3a 100644 --- a/src/Physics/Capsule.h +++ b/src/Physics/Capsule.h @@ -78,10 +78,11 @@ class PHYSICS_EXPORT Capsule: public AbstractShape { float _radius, _transformedRadius; }; -#ifndef DOXYGEN_GENERATING_OUTPUT +/** @collisionoperator{Point,Capsule} */ inline bool operator%(const Point& a, const Capsule& b) { return b % a; } + +/** @collisionoperator{Sphere,Capsule} */ inline bool operator%(const Sphere& a, const Capsule& b) { return b % a; } -#endif }} diff --git a/src/Physics/Plane.h b/src/Physics/Plane.h index 2b9cc417b..70f6ed16f 100644 --- a/src/Physics/Plane.h +++ b/src/Physics/Plane.h @@ -76,10 +76,12 @@ class PHYSICS_EXPORT Plane: public AbstractShape { _normal, _transformedNormal; }; -#ifndef DOXYGEN_GENERATING_OUTPUT +/** @collisionoperator{Line,Plane} */ inline bool operator%(const Line& a, const Plane& b) { return b % a; } + +/** @collisionoperator{LineSegment,Plane} */ inline bool operator%(const LineSegment& a, const Plane& b) { return b % a; } -#endif + }} diff --git a/src/Physics/Sphere.h b/src/Physics/Sphere.h index 0acd8f627..5fda872f3 100644 --- a/src/Physics/Sphere.h +++ b/src/Physics/Sphere.h @@ -83,11 +83,14 @@ class PHYSICS_EXPORT Sphere: public AbstractShape { float _radius, _transformedRadius; }; -#ifndef DOXYGEN_GENERATING_OUTPUT +/** @collisionoperator{Point,Sphere} */ inline bool operator%(const Point& a, const Sphere& b) { return b % a; } + +/** @collisionoperator{Line,Sphere} */ inline bool operator%(const Line& a, const Sphere& b) { return b % a; } + +/** @collisionoperator{LineSegment,Sphere} */ inline bool operator%(const LineSegment& a, const Sphere& b) { return b % a; } -#endif }}