Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: modified the cd subproject, so it loads an md2 file now. the polygons are rendered black, so the bounding box is not viewable! Must render them in another color:)

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