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:
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;