Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/powerups/src/lib/collision_detection/cd_engine.h @ 5955

Last change on this file since 5955 was 5955, checked in by bensch, 18 years ago

branches/powerups: merged the trunk to branches/powerup
merged with commandsvn merge ../trunk/ powerups/ -r5848:HEAD
conflicts resolved in favor of the trunk

File size: 2.3 KB
RevLine 
[4615]1/*!
[5039]2 * @file cd_engine.h
[4836]3  *  Definition of the collision detection engine
[4615]4
[4510]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"
[4615]12#include "abstract_model.h"
[4510]13
[5026]14
[4523]15template<class T> class tList;
16class WorldEntity;
[4551]17class OBBTree;
[4918]18class Terrain;
[5955]19//class Player;
[4510]20
[4526]21
[4523]22//! featured state options, they are all additive
[4522]23typedef enum cdState
24  {
25    CD_DEBUG_DRAW_ALL = 1,
26    CD_DEBUG_DRAW_POLYGONS = 1<<1,
27    CD_DEBUG_DRAW_BLENDED = 1<<2,
28    CD_DEBUG_DRAW_HIT_BV = 1<<3,
[4541]29    CD_DEBUG_VERBOSE = 1<<4,
30
31    CD_STORE_VERTICES = 1<<5
[4522]32  };
33
34
[4511]35//! The class representing the collision detection system of orxonox
36class CDEngine : public BaseObject {
[4510]37
[5026]38  friend class WorldEntity;
39
[4510]40 public:
[4746]41  virtual ~CDEngine();
[4836]42  /** @returns a Pointer to the only object of this Class */
[4746]43  static CDEngine* getInstance() { if (!singletonRef) singletonRef = new CDEngine(); return singletonRef; }
[4522]44  void init();
[4510]45
[4688]46  inline void setState(const int newState) { this->state = newState; }
47  inline const int getState() const { return this->state; }
48  inline void enable(const int options) { this->state |= options; }
49  inline void disable(const int options) { int temp = this->state & options; this->state ^= temp; }
[4522]50
[4688]51  inline void setEntityList(tList<WorldEntity>* entityList) { this->entityList = entityList; }
[4918]52  inline void setTerrain(Terrain* terrain) { this->terrain = terrain; }
[5955]53  //  inline void setPlayer(Player* player) { this->player = player; } /* only for debug purposes \todo: delete*/
[4688]54
[4635]55  void drawBV(int depth, int drawMode) const;
[4522]56
57  void checkCollisions();
58
[4546]59  void debug();
60
[4924]61
[4510]62 private:
[4746]63  CDEngine();
[4511]64  static CDEngine* singletonRef;
[4522]65
[4523]66  void spawnBVTree(int depth = MAX_BV_TREE_DEPTH);
[4522]67
[4523]68  void checkCollisionObjects();
69  void checkCollisionGround();
[4522]70
[4924]71  void debugSpawnTree(int depth, sVec3D* vertices, int numVertices);
72  void debugDraw(int depth, int drawMode);
[4523]73
[4924]74
[4522]75 private:
[4523]76  int                     state;                            //!< the current state of the cd engine
77  tList<WorldEntity>*     entityList;                       //!< pointer to the world entity list
[4551]78  OBBTree*                rootTree;                         //!< for testing purposes a root tree
[4918]79
80  Terrain*                terrain;                          //!< this it a ref to the terrain, serving as a ground for all WE
[5955]81//  Player*                 player;
[4510]82};
83
[4511]84#endif /* _CD_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.