// Author: Hector Navarro (hnavarro@ciens.ucv.ve),
//         Juan Carlos De Abreu (jcabreur@gmail.com)
//
// This class implement an Oriented Bounding Box that can be used to detect
// collision.

#ifndef OBB_H__
#define OBB_H__

#include "vector"

#include "../global.h"
#include "../Math/Vector.h"
#include "../Math/Matrix.h"

BEGIN_TEG_NAMESPACE();

class AABB;

class OBB {
 public:
  // OBB constructors and destructor.
  OBB();
  OBB(const AABB& aabb, const Mat4f& m);
  ~OBB();

  // Accessor and mutator methods to OBB attributes.
  inline const Vec3f& axis(int index) const { return axis_[index]; }
  inline const std::vector<Vec3f>& vertex() const { return vertex_; }

  // Methods to update the vertex of the OBB and for display it.
  void SetVertex();
  void Render() const;

 private:
  // OBB attributes.
  Vec3f orientation_;
  Vec3f axis_[3];
  Vec3f distance_;
  std::vector<Vec3f> vertex_;
};

END_TEG_NAMESPACE();

#endif  // OBB_H__
