Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Oct 20, 2006, 1:21:09 PM (18 years ago)
Author:
patrick
Message:

more interface and more structure

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

Legend:

Unmodified
Added
Removed
  • branches/coll_rect/src/lib/collision_reaction/collision_filter.cc

    r9896 r9898  
    151151
    152152
     153  /**
     154  * tests if the owner WorldEntity is listening to collisions from another specif WorldEntity entity
     155  *  @param entity WorldEntity to test against
     156  *
     157  * This is the most important interface function of this class: it performs a check and returns true
     158  * if the WorldEntity entity is actualy responsive for a certain other WorldEntity
     159   */
     160  bool CollisionFilter::operator()(const WorldEntity* entity, const CREngine::ReactionType type) const
     161  {
     162    // if there are no installed criterions just ommit and
     163    if( this->bReactive())
     164      return false;
    153165
    154 }
     166    // goes through all registered filter criterions and looks for matches
     167    std::vector<ClassID>::const_iterator it = this->_filters[type].begin();
     168    for(; it != this->_filters[type].end(); i++ )
     169      if( unlikely(entity->isA(*it)))
     170        return true;
     171
     172    return false;
     173  }
    155174
    156175
    157176
     177} // namespace end
     178
     179
     180
  • branches/coll_rect/src/lib/collision_reaction/collision_filter.h

    r9896 r9898  
    2222
    2323  class CollisionReaction;
    24 
    2524
    2625
     
    4948    /* Defines Operators */
    5049    bool operator()(const WorldEntity* entity) const;
     50    bool operator()(const WorldEntity* entity, const CREngine::ReactionType type) const;
    5151
    5252
    5353    /* Collision Reaction subscription unsubscription Block */
    5454  public:
    55     void subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1);
    56     void subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2);
    57     void subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2, const ClassID& target3);
     55    void subscribeReaction(CREngine::ReactionType type, const ClassID& target1);
     56    void subscribeReaction(CREngine::ReactionType type, const ClassID& target1, const ClassID& target2);
     57    void subscribeReaction(CREngine::ReactionType type, const ClassID& target1, const ClassID& target2, const ClassID& target3);
    5858
    59     void unsubscribeReaction(CoRe::CREngine::ReactionType type);
     59    void unsubscribeReaction(CREngine::ReactionType type);
    6060    void unsubscribeReactions();
    6161
  • branches/coll_rect/src/lib/collision_reaction/collision_tube.cc

    r9896 r9898  
    111111
    112112
     113
     114  /**
     115   * handles all collisions in registered in this tube
     116   */
     117  void CollisionTube::handleCollisions()
     118  {
     119    //
     120  }
     121
     122
    113123  /**
    114124   * checks if two objects are
     
    124134
    125135
    126   /**
    127    * handles all collisions in registered in this tube
    128    */
    129   void CollisionTube::handleCollisions()
    130   {
    131     //
    132   }
    133136
    134137
    135 }
     138}// namespace end
    136139
  • branches/coll_rect/src/lib/collision_reaction/collision_tube.h

    r9896 r9898  
    4848    ObjectListDeclaration(CollisionTube);
    4949
     50
     51    /* Constructor/Deconstructor/Singleton Interface */
    5052  public:
     53    inline static CollisionTube* getInstance() { if( CollisionTube::instance != NULL) CollisionTube::instance = new CollisionTube(); return CollisionTube::instance; }
    5154    virtual ~CollisionTube();
    5255
    53     inline static CollisionTube* getInstance() { if( CollisionTube::instance != NULL) CollisionTube::instance = new CollisionTube(); return CollisionTube::instance; }
     56  private:
     57    CollisionTube();
     58    CollisionTube(const CollisionTube& tube) {}
    5459
    55     /** @returns true if at least one of both WorldEntities are subscribed for a collision check */
    56     inline bool isReactive(const WorldEntity& entityA, const WorldEntity& entityB) const
    57     { return (entityA.isReactive() && entityB.isReactive()); }
    58     bool needCollisionChecking(const WorldEntity& entityA, const WorldEntity& entityB);
     60    static CollisionTube*          instance;            //!< the singleton instance
    5961
     62
     63    /* Collision Handling */
     64  public:
    6065    void registerCollisionEvent(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB);
    6166    void registerCollisionEvent(CREngine::CollisionType type, WorldEntity* entity, WorldEntity* groundEntity,
     
    6469    void handleCollisions();
    6570
    66 
    67   private:
    68     /* private std constructor since this is a singleton class */
    69     CollisionTube();
    70     /* private copy constructor so this object can't be passed as a */
    71     CollisionTube(const CollisionTube& tube) {}
    72 
    73 
    7471  private:
    7572    std::vector<Collision*>        _collisionList;      //!< the list of collisions since the last processing
    7673
    77     static CollisionTube*          instance;            //!< the singleton instance
     74
     75    /* Misc State Informations */
     76  public:
     77    /** @returns true if at least one of both WorldEntities are subscribed for a collision check */
     78    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);
     81
    7882  };
    7983
Note: See TracChangeset for help on using the changeset viewer.