Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/collision_detection/cd_engine.h @ 4546

Last change on this file since 4546 was 4546, checked in by patrick, 19 years ago

orxonox/trunk: implemented some test functions, that don't work untils now: some link error when compiling the collision_detection/framework

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