/*! \file cd_engine.h \brief Definition of the collision detection engine */ #ifndef _CD_ENGINE_H #define _CD_ENGINE_H #include "base_object.h" #include "collision_defs.h" template class tList; class WorldEntity; class OBBTree; //! featured state options, they are all additive typedef enum cdState { CD_DEBUG_DRAW_ALL = 1, CD_DEBUG_DRAW_POLYGONS = 1<<1, CD_DEBUG_DRAW_BLENDED = 1<<2, CD_DEBUG_DRAW_HIT_BV = 1<<3, CD_DEBUG_VERBOSE = 1<<4, CD_STORE_VERTICES = 1<<5 }; //! The class representing the collision detection system of orxonox class CDEngine : public BaseObject { public: virtual ~CDEngine(void); /** \returns a Pointer to the only object of this Class */ static CDEngine* getInstance(void) { if (!singletonRef) singletonRef = new CDEngine(); return singletonRef; } void init(); void setState(const int newState) { this->state = newState; } const int getState() const { return this->state; } void enable(const int options) { this->state |= options; } void disable(const int options) { int temp = this->state & options; this->state ^= temp; } void drawBV(int currentDepth, const int depth) const; void drawBVPolygon(int currentDepth, const int depth) const; void drawBVBlended(int currentDepth, const int depth) const; void checkCollisions(); void debug(); private: CDEngine(void); static CDEngine* singletonRef; void spawnBVTree(int depth = MAX_BV_TREE_DEPTH); void checkCollisionObjects(); void checkCollisionGround(); private: int state; //!< the current state of the cd engine tList* entityList; //!< pointer to the world entity list OBBTree* rootTree; //!< for testing purposes a root tree }; #endif /* _CD_ENGINE_H */