| Rev | Line | |
|---|
| [7819] | 1 | /*! |
|---|
| 2 | * @file cr_engine.h |
|---|
| 3 | * @brief The collision reaction engine, defining generic collision reactions to collision events |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | #ifndef _CR_ENGINE_ |
|---|
| 7 | #define _CR_ENGINE_ |
|---|
| 8 | |
|---|
| 9 | #include "base_object.h" |
|---|
| 10 | |
|---|
| 11 | // FORWARD DECLARATION |
|---|
| [7839] | 12 | class CollisionHandle; |
|---|
| 13 | class Collision; |
|---|
| [7819] | 14 | |
|---|
| 15 | //! A default singleton class. |
|---|
| [7839] | 16 | class CREngine : public BaseObject |
|---|
| 17 | { |
|---|
| [7842] | 18 | #if 0 |
|---|
| [7839] | 19 | typedef enum CRType { |
|---|
| 20 | CR_CONSERVATION_OF_MOMENTUM = 0, |
|---|
| 21 | |
|---|
| 22 | CR_OBJECT_DAMAGE, |
|---|
| 23 | CR_OBJECT_PICKUP, |
|---|
| 24 | |
|---|
| 25 | CR_VERTEX_TRAFO, |
|---|
| 26 | |
|---|
| 27 | CR_CALLBACK, |
|---|
| 28 | |
|---|
| 29 | CR_NUMBER |
|---|
| 30 | }; |
|---|
| [7842] | 31 | #endif |
|---|
| [7839] | 32 | |
|---|
| 33 | public: |
|---|
| [7819] | 34 | virtual ~CREngine(void); |
|---|
| 35 | /** @returns a Pointer to the only object of this Class */ |
|---|
| 36 | inline static CREngine* getInstance(void) { if (!singletonRef) singletonRef = new CREngine(); return singletonRef; }; |
|---|
| 37 | |
|---|
| [7841] | 38 | #if 0 |
|---|
| 39 | CollisionHandle* subscribeReaction(WorldEntity* worldEntity, CRType type, int nrOfTargets, ...); |
|---|
| [7819] | 40 | |
|---|
| [7839] | 41 | bool unsubscribeReaction(WorldEntity* worldEntity); |
|---|
| 42 | bool unsubscribeReaction(CollisionHandle* collisionHandle); |
|---|
| 43 | |
|---|
| 44 | |
|---|
| [7841] | 45 | void handleCollisions(); |
|---|
| 46 | |
|---|
| [7839] | 47 | /** @returns an instance to a collision object. instead of creating new object this ones can be resycled */ |
|---|
| [7843] | 48 | inline Collision* getCollisionObject() { /* return the first element of the cache list*/ } |
|---|
| [7839] | 49 | /** @param collision: returns the Collision object back to the cache list */ |
|---|
| 50 | inline void putCollisionObject(Collision* collision) { this->cachedCollisions.push_back(collision); } |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | private: |
|---|
| 54 | |
|---|
| 55 | std::vector<CollisionHandle*> collisionHandles; //!< list with the collision handles |
|---|
| 56 | std::vector<Collision*> cachedCollisions; //!< a list of unused, cached collision events |
|---|
| [7841] | 57 | #endif |
|---|
| [7843] | 58 | private: |
|---|
| 59 | CREngine(void); |
|---|
| 60 | static CREngine* singletonRef; //!< the reference to the CREngine object (singleton) |
|---|
| [7819] | 61 | }; |
|---|
| 62 | |
|---|
| 63 | #endif /* _CR_ENGINE_ */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.