Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7839 in orxonox.OLD for trunk


Ignore:
Timestamp:
May 24, 2006, 10:35:26 PM (19 years ago)
Author:
patrick
Message:

trunk: collision reaction main structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_reaction/cr_engine.h

    r7819 r7839  
    1010
    1111// FORWARD DECLARATION
     12class CollisionHandle;
     13class Collision;
    1214
    1315//! A default singleton class.
    14 class CREngine : public BaseObject {
     16class CREngine : public BaseObject
     17{
    1518
    16  public:
     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  };
     31
     32
     33public:
    1734  virtual ~CREngine(void);
    1835  /** @returns a Pointer to the only object of this Class */
     
    2037
    2138
    22   void subscribeToCollisionEvent();
     39  CollisionHandle* subscribeReaction(WorldEntity* worldEntity, ClassId targets, CRType type);
    2340
    24  private:
     41  bool unsubscribeReaction(WorldEntity* worldEntity);
     42  bool unsubscribeReaction(CollisionHandle* collisionHandle);
     43
     44
     45  /** @returns an instance to a collision object. instead of creating new object this ones can be resycled */
     46  inline Collision* getCollisionObject() { /* return the first element of the cache list*/ }
     47  /** @param collision: returns the Collision object back to the cache list */
     48  inline void putCollisionObject(Collision* collision) { this->cachedCollisions.push_back(collision); }
     49
     50
     51private:
    2552  CREngine(void);
    26   static CREngine* singletonRef;
     53  static CREngine*                    singletonRef;             //!< the reference to the CREngine object (singleton)
     54
     55  std::vector<CollisionHandle*>       collisionHandles;         //!< list with the collision handles
     56  std::vector<Collision*>             cachedCollisions;         //!< a list of unused, cached collision events
    2757};
    2858
Note: See TracChangeset for help on using the changeset viewer.