[4510] | 1 | /*! |
---|
[4511] | 2 | \file cd_engine.h |
---|
| 3 | \brief Definition of the collision detection engine |
---|
[4510] | 4 | |
---|
| 5 | */ |
---|
| 6 | |
---|
[4511] | 7 | #ifndef _CD_ENGINE_H |
---|
| 8 | #define _CD_ENGINE_H |
---|
[4510] | 9 | |
---|
| 10 | #include "base_object.h" |
---|
[4522] | 11 | #include "collision_defs.h" |
---|
[4510] | 12 | |
---|
[4523] | 13 | template<class T> class tList; |
---|
| 14 | class WorldEntity; |
---|
[4510] | 15 | |
---|
[4523] | 16 | //! featured state options, they are all additive |
---|
[4522] | 17 | typedef enum cdState |
---|
| 18 | { |
---|
| 19 | CD_DEBUG_DRAW_ALL = 1, |
---|
| 20 | CD_DEBUG_DRAW_POLYGONS = 1<<1, |
---|
| 21 | CD_DEBUG_DRAW_BLENDED = 1<<2, |
---|
| 22 | CD_DEBUG_DRAW_HIT_BV = 1<<3, |
---|
| 23 | CD_DEBUG_VERBOSE = 1<<4 |
---|
| 24 | }; |
---|
| 25 | |
---|
| 26 | |
---|
[4511] | 27 | //! The class representing the collision detection system of orxonox |
---|
| 28 | class CDEngine : public BaseObject { |
---|
[4510] | 29 | |
---|
| 30 | public: |
---|
[4511] | 31 | virtual ~CDEngine(void); |
---|
[4519] | 32 | /** \returns a Pointer to the only object of this Class */ |
---|
| 33 | inline static CDEngine* getInstance(void) { if (!singletonRef) singletonRef = new CDEngine(); return singletonRef; }; |
---|
[4522] | 34 | void init(); |
---|
[4510] | 35 | |
---|
[4523] | 36 | void setState(const int newState) { this->state = newState; } |
---|
[4522] | 37 | const int getState() const { return this->state; } |
---|
[4523] | 38 | void enable(const int options) { this->state |= options; } |
---|
[4524] | 39 | void disable(const int options) { int temp = this->state & options; this->state ^= temp; } |
---|
[4522] | 40 | |
---|
[4524] | 41 | void drawBV(int currentDepth, const int depth) const; |
---|
| 42 | void drawBVPolygon(int currentDepth, const int depth) const; |
---|
| 43 | void drawBVBlended(int currentDepth, const int depth) const; |
---|
[4522] | 44 | |
---|
| 45 | void checkCollisions(); |
---|
| 46 | |
---|
[4510] | 47 | private: |
---|
[4511] | 48 | CDEngine(void); |
---|
| 49 | static CDEngine* singletonRef; |
---|
[4522] | 50 | |
---|
[4523] | 51 | void spawnBVTree(int depth = MAX_BV_TREE_DEPTH); |
---|
[4522] | 52 | |
---|
[4523] | 53 | void checkCollisionObjects(); |
---|
| 54 | void checkCollisionGround(); |
---|
[4522] | 55 | |
---|
[4523] | 56 | |
---|
[4522] | 57 | private: |
---|
[4523] | 58 | int state; //!< the current state of the cd engine |
---|
| 59 | tList<WorldEntity>* entityList; //!< pointer to the world entity list |
---|
[4510] | 60 | }; |
---|
| 61 | |
---|
[4511] | 62 | #endif /* _CD_ENGINE_H */ |
---|