Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/util/collision_detection/cd_engine.h @ 4523

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

orxonox/trunk: defined a set of cd_engine functions

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//! featured state options, they are all additive
17typedef 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
27//! The class representing the collision detection system of orxonox
28class CDEngine : public BaseObject {
29
30 public:
31  virtual ~CDEngine(void);
32  /** \returns a Pointer to the only object of this Class */
33  inline static CDEngine* getInstance(void) { if (!singletonRef) singletonRef = new CDEngine();  return singletonRef; };
34  void init();
35
36  void setState(const int newState) { this->state = newState; }
37  const int getState() const { return this->state; }
38  void enable(const int options) { this->state |= options; }
39  void disable(const int options) { int temp = this->state & options; this->state ^= temp;}
40
41  void drawBV(int currentDepth, int depth) const;
42  void drawBVPolygon(int currentDepth, int depth) const;
43  void drawBVBlended(int currentDepth, int depth) const;
44
45  void checkCollisions();
46
47 private:
48  CDEngine(void);
49  static CDEngine* singletonRef;
50
51  void spawnBVTree(int depth = MAX_BV_TREE_DEPTH);
52
53  void checkCollisionObjects();
54  void checkCollisionGround();
55
56
57 private:
58  int                     state;                            //!< the current state of the cd engine
59  tList<WorldEntity>*     entityList;                       //!< pointer to the world entity list
60};
61
62#endif /* _CD_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.