]> git.localhorst.tv Git - sdl-test8.git/blobdiff - src/shape/Shape.h
some comments
[sdl-test8.git] / src / shape / Shape.h
index 69eedc252e7f19f1720aa55ea2a833a3b7a7591a..9feb5e1c79ad35988de4e63a0e639d8a079075ed 100644 (file)
@@ -19,6 +19,9 @@ namespace shape {
 class AABB;
 class Circle;
 
+/// Base class for all "shapes" (i.e. collision primitives).
+/// This serves as an interface for game::Entity to double dispatch the
+/// collision detection algorithms.
 class Shape {
 
        public:
@@ -30,10 +33,17 @@ class Shape {
                virtual ~Shape(void) { };
 
        public:
+               /// Move the shape by given delta.
                virtual void Translate(const Vector &delta) = 0;
+               /// Rotate the shape by given delta (in radians).
                virtual void Rotate(Scalar delta) = 0;
 
        public:
+               /// Check if this shape overlaps the given and, if it does, write the
+               /// surface normal into given vector.
+               /// All shapes must override this method to dispatch to the specialized
+               /// version of CheckCollision().
+               /// See AABB::CheckCollision(const Shape &, Ray &) const for details.
                virtual bool CheckCollision(const Shape &, Ray &) const = 0;
                virtual bool CheckCollision(const AABB &, Ray &) const = 0;
                virtual bool CheckCollision(const Circle &, Ray &) const = 0;