Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9939 in orxonox.OLD for branches/coll_rect


Ignore:
Timestamp:
Nov 20, 2006, 12:53:27 AM (18 years ago)
Author:
patrick
Message:

removed some comilation problems.

Location:
branches/coll_rect/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/coll_rect/src/lib/collision_detection/obb_tree_node.cc

    r9896 r9939  
    477477{
    478478  if( unlikely(treeNode == NULL || nodeA == NULL || nodeB == NULL))
     479    return;
     480
     481  if( !CoRe::CollisionTube::getInstance()->isReactive( *nodeA, *nodeB) )
    479482    return;
    480483
  • branches/coll_rect/src/lib/collision_reaction/collision.h

    r9892 r9939  
    3232  {
    3333  public:
     34
    3435    Collision();
    3536    virtual ~Collision();
     
    3940
    4041
     42    /* list stuff */
     43  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  const_iterator;   //!< constant iterator definition
     47
     48    /** registers a @param event CollisionEvent to take place */
     49    inline void registerCollisionEvent(CollisionEvent* event) { this->_collisionEvents.push_back(event); this->bDispatched = false;}
     50    /** @returns a vector of collision events */
     51    inline const std::vector<CollisionEvent*>& getCollisionEvents() const { return this->_collisionEvents; }
     52
     53    void flushCollisionEvents();
     54
     55
     56    /** @returns iterator pointing to the beginning of the collision event vector */
     57    inline iterator       begin()        { return this->_collisionEvents.begin(); }
     58    /** @returns const iterator pointing to the beginning of the collision event vector */
     59    inline const_iterator begin() const  { return this->_collisionEvents.begin(); }
     60    /** @returns iterator pointing to the end of the collision event vector */
     61    inline iterator       end()          { return this->_collisionEvents.end(); }
     62    /** @returns const iterator pointing to the end of the collision event vector */
     63    inline const_iterator end() const    { return this->_collisionEvents.end(); }
     64
     65
     66  private:
     67    collisionVector  _collisionEvents;               //!< the collision event list
     68
     69
     70
     71    /* misc interface functions */
     72  public:
    4173    /** @return Collision WorldEntity A */
    4274    inline WorldEntity* getEntityA() const { return this->entityA; }
    4375    /** @return Collision WorldEntity B */
    4476    inline WorldEntity* getEntityB() const { return this->entityB; }
     77    inline bool match(const WorldEntity& entityA, WorldEntity& entityB) const {
     78      return ((this->entityA == &entityA && this->entityB == &entityB) || (this->entityA == &entityB && this->entityB == &entityA)); }
     79
    4580    /** @return true if Entity A collides */
    4681    inline bool isEntityACollide() const { return this->entityACollide; }
     
    5388
    5489
    55     inline bool match(const WorldEntity& entityA, WorldEntity& entityB) const {
    56       return ((this->entityA == &entityA && this->entityB == &entityB) || (this->entityA == &entityB && this->entityB == &entityA)); }
     90
    5791    /** @returns true if this Collision has already been dispatched */
    5892    inline bool isDispatched() { return this->bDispatched; }
    5993    /** sets the dispatched flag to true */
    6094    inline void dispatched() { this->bDispatched = true; }
    61 
    62     /** registers a @param event CollisionEvent to take place */
    63     inline void registerCollisionEvent(CollisionEvent* event) { this->collisionEvents.push_back(event); this->bDispatched = false;}
    64     /** @returns a vector of collision events */
    65     inline const std::vector<CollisionEvent*>& getCollisionEvents() const { return this->collisionEvents; }
    66 
    67 
    68     void flushCollisionEvents();
    69 
    7095
    7196  private:
     
    77102    bool                         bDispatched;                   //!< true if this collision has already been dispatched
    78103
    79     std::vector<CollisionEvent*> collisionEvents;               //!< the collision event list
    80104  };
    81105}
  • branches/coll_rect/src/lib/collision_reaction/collision_filter.cc

    r9898 r9939  
    7070    if( likely(this->validCRType( type)))
    7171    {
    72       //check if this or any parent class isn't already registered
     72      //check if this class isn't already registered
    7373      std::vector<ClassID>::iterator it = this->_filters[type].begin();
    7474      for(; it != this->_filters[type].end(); it++)
     
    7878      }
    7979
    80       // so subscribe the reaction finaly
     80      // so subscribe the reaction finally
    8181      this->_filters[type].push_back(target1);
    8282      this->_bReactive = true;
     
    132132   * if the WorldEntity entity is actualy responsive for a certain other WorldEntity
    133133   */
    134   bool CollisionFilter::operator()(const WorldEntity* entity) const
     134  bool CollisionFilter::operator()(const WorldEntity& entity) const
    135135  {
    136136    // if there are no installed criterions just ommit and
     
    143143      std::vector<ClassID>::const_iterator it = this->_filters[i].begin();
    144144      for(; it != this->_filters[i].end(); i++ )
    145         if( unlikely(entity->isA(*it)))
     145        if( unlikely(entity.isA(*it)))
    146146          return true;
    147147    }
     
    158158  * if the WorldEntity entity is actualy responsive for a certain other WorldEntity
    159159   */
    160   bool CollisionFilter::operator()(const WorldEntity* entity, const CREngine::ReactionType type) const
     160  bool CollisionFilter::operator()(const WorldEntity& entity, const CREngine::ReactionType type) const
    161161  {
    162162    // if there are no installed criterions just ommit and
     
    166166    // goes through all registered filter criterions and looks for matches
    167167    std::vector<ClassID>::const_iterator it = this->_filters[type].begin();
    168     for(; it != this->_filters[type].end(); i++ )
    169       if( unlikely(entity->isA(*it)))
     168    for(; it != this->_filters[type].end(); it++ )
     169      if( unlikely(entity.isA(*it)))
    170170        return true;
    171171
  • branches/coll_rect/src/lib/collision_reaction/collision_filter.h

    r9898 r9939  
    4646
    4747
     48  public:
    4849    /* Defines Operators */
    49     bool operator()(const WorldEntity* entity) const;
    50     bool operator()(const WorldEntity* entity, const CREngine::ReactionType type) const;
     50    bool operator()(const WorldEntity& entity) const;
     51    bool operator()(const WorldEntity& entity, const CREngine::ReactionType type) const;
    5152
    5253
     
    5960    void unsubscribeReaction(CREngine::ReactionType type);
    6061    void unsubscribeReactions();
     62
     63    inline bool isSubscribed(CREngine::ReactionType type) const { /*if( this->validCRType(type)) return this->_filters[type] != NULL; else return false;*/}
    6164
    6265  private:
  • branches/coll_rect/src/lib/collision_reaction/collision_tube.cc

    r9898 r9939  
    9595                              const Vector& normal, const Vector& position, bool bInWall)
    9696  {
     97    // get last collision
    9798    Collision* collision = this->_collisionList.back();
    9899
    99100    // check if there is already a collision defined between these objects
    100     if( !collision->match(*entity, *groundEntity))
     101    if( collision != NULL && !collision->match(*entity, *groundEntity))
    101102    {
     103      // get a new collision object
    102104      collision = CREngine::getInstance()->popCollisionObject();
    103105      collision->collide( entity, groundEntity);
     
    117119  void CollisionTube::handleCollisions()
    118120  {
    119     //
     121    // for all collisions:
     122    std::vector<Collision*>::iterator collisions = this->_collisionList.begin();
     123    for(; collisions < this->_collisionList.end(); collisions++)
     124    {
     125
     126
     127      // for all collision events of each collision:
     128      Collision::iterator events = (*collisions)->begin();
     129      for(; events < (*collisions)->end(); events++)
     130      {
     131
     132      }
     133    }
    120134  }
    121135
    122136
    123   /**
    124    * checks if two objects are
    125    */
    126   bool CollisionTube::needCollisionChecking(const WorldEntity& entityA, const WorldEntity& entityB)
    127   {
    128     //if( !this->isReactive( entityA, entityB) )
    129     //  return false;
    130137
    131     //if( entityA->)
    132 
    133   }
    134138
    135139
  • branches/coll_rect/src/lib/collision_reaction/collision_tube.h

    r9898 r9939  
    7575    /* Misc State Informations */
    7676  public:
    77     /** @returns true if at least one of both WorldEntities are subscribed for a collision check */
     77    /** @returns true if at least one of both WorldEntities are subscribed for a collision reaction */
    7878    inline bool isReactive(const WorldEntity& entityA, const WorldEntity& entityB) const
    79       { return (entityA.isReactive() && entityB.isReactive()); }
    80     bool needCollisionChecking(const WorldEntity& entityA, const WorldEntity& entityB);
     79      { return (entityA.isReactive(entityB) && entityB.isReactive(entityA)); }
    8180
    8281  };
  • branches/coll_rect/src/world_entities/world_entity.h

    r9896 r9939  
    8888  void unsubscribeReactions();
    8989
     90  inline bool isSubscribed(CoRe::CREngine::ReactionType type) const { return this->_collisionFilter.isSubscribed( type); }
     91
    9092  /** @return true if there is at least on collision reaction subscribed */
    9193  inline bool isReactive() const { return this->bReactive; }
    92 
    93   const CoRe::CollisionFilter& getCollisionFilter(CoRe::CREngine::ReactionType type) const { return this->collisionFilter; }
     94  inline bool isReactive( const WorldEntity& worldEntity) const { return this->isReactive() || (this->_collisionFilter(worldEntity)); }
     95
     96  const CoRe::CollisionFilter& getCollisionFilter(CoRe::CREngine::ReactionType type) const { return this->_collisionFilter; }
    9497
    9598  /** @returns true if this entity is standing on ground (BSP model) */
     
    191194
    192195  /* collision reaction stuff */
    193   CoRe::CollisionFilter   collisionFilter;                 //!< filter for collision event filtering (not every entity listens to all collisions)
     196  CoRe::CollisionFilter   _collisionFilter;                //!< filter for collision event filtering (not every entity listens to all collisions)
    194197  bool                    bReactive;                       //!< true if there is at least one collision reaction subscibed
    195198
Note: See TracChangeset for help on using the changeset viewer.