Browse Source

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).
vectorfields
Vladimír Vondruš 14 years ago
parent
commit
876254efcd
  1. 1
      Doxyfile
  2. 5
      src/Physics/Capsule.h
  3. 6
      src/Physics/Plane.h
  4. 7
      src/Physics/Sphere.h

1
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\"" \

5
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
}}

6
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
}}

7
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
}}

Loading…
Cancel
Save