Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9988 in orxonox.OLD for branches/coll_rect/src/lib


Ignore:
Timestamp:
Dec 3, 2006, 4:55:19 PM (18 years ago)
Author:
patrick
Message:

removed most of the compiler bugs. more to come

Location:
branches/coll_rect/src/lib/collision_reaction
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/coll_rect/src/lib/collision_reaction/collision.h

    r9985 r9988  
    3131  class Collision
    3232  {
     33
     34    typedef std::vector<CollisionEvent*>                  CollisionVector;  //!< the vector containing all collision events
     35    typedef std::vector<CollisionEvent*>::iterator        Iterator;         //!< iterator definition
     36    typedef std::vector<CollisionEvent*>::const_iterator  ConstIterator;   //!< constant iterator definition
     37
     38
    3339  public:
    3440
     
    3743
    3844    /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */
    39     inline void collide(WorldEntity* entityA, WorldEntity* entityB) { this->entityA = entityA; this->entityB = entityB; this->bDispatched = false; }
     45    inline void collide(WorldEntity* entityA, WorldEntity* entityB) { this->_entityA = entityA; this->_entityB = entityB; }
    4046
    4147
    4248    /* list stuff */
    4349  public:
    44     typedef std::vector<CollisionEvent*>                  CollisionVector;  //!< the vector containing all collision events
    45     typedef std::vector<CollisionEvent*>::iterator        Iterator;         //!< iterator definition
    46     typedef std::vector<CollisionEvent*>::const_iterator  ConstIterator;   //!< constant iterator definition
    4750
    4851    /** registers a @param event CollisionEvent to take place */
    49     inline void registerCollisionEvent(CollisionEvent* event) { this->_collisionEvents.push_back(event); this->bDispatched = false;}
     52    inline void registerCollisionEvent(CollisionEvent* event) { this->_collisionEvents.push_back(event); }
    5053
    5154    void reset();
     
    8790    bool                         _entityBCollide;                //!< true if entity B is subscribed for collision reaction
    8891
    89     collisionVector              _collisionEvents;               //!< the collision event list
     92    CollisionVector              _collisionEvents;               //!< the collision event list
    9093
    9194  };
  • branches/coll_rect/src/lib/collision_reaction/collision_filter.cc

    r9980 r9988  
    2121#include "collision.h"
    2222#include "collision_event.h"
    23 #include "collision_reaction.h"
    2423
    25 #include "cr_object_damage.h"
    26 #include "cr_physics_ground_walk.h"
    27 #include "cr_physics_full_walk.h"
    2824
    2925#include "debug.h"
     
    112108    if( likely(this->validCRType( type)))
    113109      this->_filters[type].clear();
     110
     111    for( int i = 0; i < CREngine::CR_NUMBER; i++)
     112    {
     113      if( this->_filters[i].size() > 0)
     114      {
     115        this->_bReactive = true;
     116        break;
     117      }
     118    }
     119
    114120  }
    115121
     
    121127    for(int i = 0; i < CREngine::CR_NUMBER; i++)
    122128      this->_filters[i].clear();
     129
     130    this->_bReactive = false;
    123131  }
    124132
     
    135143  {
    136144    // if there are no installed criterions just ommit and
    137     if( this->bReactive())
     145    if( this->isReactive())
    138146      return false;
    139147
     
    142150    {
    143151      TargetIterator it = this->_filters[i].begin();
    144       for(; it != this->_filters[i].end(); i++ )
    145         if( unlikely(entity.isA(*it)))
    146           return true;
     152
     153
     154//       for(; it != this->_filters[i].end(); i++ )
     155//         if( unlikely(entity.isA(*it) ) )
     156//           return true;
    147157    }
    148158
     
    161171  {
    162172    // if there are no installed criterions just omit and return
    163     if( !this->bReactive())
     173    if( !this->isReactive())
    164174      return false;
    165175
  • branches/coll_rect/src/lib/collision_reaction/collision_filter.h

    r9980 r9988  
    6363    void unsubscribeReactions();
    6464
    65     inline bool isSubscribed(CREngine::ReactionType type) const { /*if( this->validCRType(type)) return this->_filters[type] != NULL; else return false;*/}
    66 
    6765  private:
    6866    std::vector<ClassID>          _filters[CREngine::CR_NUMBER];  //!< an array of filter targets: for each collision type a list of filter objects
     
    7270  public:
    7371    /** @returns true if this handle should be pulled also if there are no collisions, can also be set with this function (reference)*/
    74     inline bool& bContinousPoll() { return this->_bContinuousPoll; }
     72    inline bool isContinousPoll() { return this->_bContinuousPoll; }
    7573    /** @returns true if this filter should be pulled always */
    76     inline bool bContinousPoll() const { return this->_bContinuousPoll; }
     74    inline bool isContinousPoll() const { return this->_bContinuousPoll; }
     75    /** @returns true if this filter is reactive i.e. at least one filter criterion installed */
     76    inline bool isReactive() const { return this->_bReactive; }
     77
     78
     79  private:
    7780    /** @returns true if this @param type Collision Reaction type is a valid number */
    7881    inline bool validCRType(const CREngine::ReactionType& type) const {return (type >= 0 && type < CREngine::CR_NUMBER); }
    79     /** @returns true if this filter is reactive i.e. at least one filter criterion installed */
    80     inline bool bReactive() const { return this->_bReactive; }
     82
    8183
    8284  private:
  • branches/coll_rect/src/lib/collision_reaction/collision_tube.h

    r9986 r9988  
    4949
    5050    typedef std::vector<Collision*>::iterator     CollisionIterator;
     51    typedef std::vector<Collision*>               CollisionVector;
     52
    5153
    5254    /* Constructor/Deconstructor/Singleton Interface */
     
    5961    CollisionTube(const CollisionTube& tube) {}
    6062
    61     static CollisionTube*          instance;            //!< the singleton instance
     63    static CollisionTube*          instance;                         //!< the singleton instance
    6264
    6365
     
    6971
    7072    /** @returns an iterator pointing to the beginning of the list */
    71     CollisionIterator& begin() { return this->_collisionList.begin(); }
     73    CollisionIterator begin() { return this->_collisionList.begin(); }
    7274    /** @returns an iterator pointing to the end of the list */
    73     CollisionIterator& end()   { return this->_collisionList.end(); }
     75    CollisionIterator end()   { return this->_collisionList.end(); }
    7476
    7577
    7678  private:
    77     std::vector<Collision*>         _collisionList;                      //!< the list of collisions since the last processing
     79    CollisionVector             _collisionList;                      //!< the list of collisions since the last processing
    7880
    7981
  • branches/coll_rect/src/lib/collision_reaction/cr_engine.cc

    r9985 r9988  
    1717
    1818
     19#include "cr_object_damage.h"
     20#include "cr_physics_full_walk.h"
     21#include "cr_physics_ground_walk.h"
    1922
    2023#include "collision.h"
    2124#include "collision_event.h"
    2225#include "collision_filter.h"
     26#include "collision_tube.h"
    2327#include "cr_defs.h"
    2428
     
    6266      PRINTF(0)("CollisionReaction Error: CollisionEvent cache size missmatch: %i of %i\n", this->collisionEventsUnused.size(), CR_MAX_COLLISION_EVENTS);
    6367
    64     this->reset();
    6568    this->flushCollisions();
    6669
    67     CollisionList it1 = this->collisionsUnused.begin();
     70    CollisionIterator it1 = this->collisionsUnused.begin();
    6871    for(; it1 < this->collisionsUnused.end(); it1++)
    6972      delete *it1;
    70     CollisionEventList it2 = this->collisionEventsUnused.begin();
     73    CollisionEventIterator it2 = this->collisionEventsUnused.begin();
    7174    for(; it2 < this->collisionEventsUnused.end(); it2++)
    7275      delete *it2;
     
    146149    for(; ci < CollisionTube::getInstance()->end(); ++ci)
    147150    {
    148       for( int i = CREngine::CR_PHYSICS_MOMENTUM; i < CREngine::CR_NUBER; i++)
     151      for( int i = CREngine::CR_PHYSICS_MOMENTUM; i < CREngine::CR_NUMBER; i++)
    149152      {
    150153        // check if entity A or B is subscibed for this event
    151         if( (*ci)->getEntityA()->bReactibe((*it)->getEnityB(), i) || (*ci)->getEntityB()->bReactibe((*it)->getEnityA(), i))
    152           (*ci)->reactToCollision(*ci);
     154        if( (*ci)->getEntityA()->isReactive(*(*ci)->getEntityB(), (CREngine::ReactionType)i) ||
     155            (*ci)->getEntityB()->isReactive(*(*ci)->getEntityA(), (CREngine::ReactionType)i))
     156          this->_reactionList[i]->reactToCollision(*ci);
    153157
    154158        (*ci)->reset();
  • branches/coll_rect/src/lib/collision_reaction/cr_engine.h

    r9986 r9988  
    3131    ObjectListDeclaration(CREngine);
    3232
     33    typedef std::vector<CollisionEvent*>             CollisionEventVector;
     34    typedef std::vector<Collision*>                  CollisionVector;
    3335    typedef std::vector<Collision*>::iterator        CollisionIterator;
    3436    typedef std::vector<CollisionEvent*>::iterator   CollisionEventIterator;
     
    9092    static CREngine*                    singletonRef;             //!< the reference to the CREngine object (singleton)
    9193
    92     std::vector<Collision*>             collisionsUsed;           //!< a list of used, cached collisions
    93     std::vector<Collision*>             collisionsUnused;         //!< a list of unused, cached collisions
     94    CollisionVector                     collisionsUsed;           //!< a list of used, cached collisions
     95    CollisionVector                     collisionsUnused;         //!< a list of unused, cached collisions
    9496
    95     std::vector<CollisionEvent*>        collisionEventsUsed;      //!< a list of used, cached collision events
    96     std::vector<CollisionEvent*>        collisionEventsUnused;    //!< a list of unused, cached collision events
     97    CollisionEventVector                collisionEventsUsed;      //!< a list of used, cached collision events
     98    CollisionEventVector                collisionEventsUnused;    //!< a list of unused, cached collision events
    9799
    98100    CollisionReaction*                  _reactionList[CREngine::CR_NUMBER];  //!< the collision reaction list containing all reactions types
  • branches/coll_rect/src/lib/collision_reaction/cr_object_damage.cc

    r9889 r9988  
    7474    }
    7575
    76     collision->flushCollisionEvents();
    77     collision->dispatched();
    78 
    7976    //   const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
    8077    //   std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
  • branches/coll_rect/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r9982 r9988  
    7979
    8080
    81     const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
    82     std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
    83     for(; it != collisionEvents->end(); it++)
     81    std::vector<CollisionEvent*>::const_iterator it = collision->begin();
     82    for(; it != collision->end(); it++)
    8483    {
    8584
Note: See TracChangeset for help on using the changeset viewer.