Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9895 in orxonox.OLD for branches/coll_rect/src


Ignore:
Timestamp:
Oct 19, 2006, 3:54:49 PM (18 years ago)
Author:
patrick
Message:

interface adjustements

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

Legend:

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

    r9894 r9895  
    1515#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_REACTION
    1616
    17 #include "collision_handle.h"
     17#include "collision_filter.h"
    1818
    1919#include "world_entity.h"
     
    3232{
    3333
    34   ObjectListDefinition(CollisionHandle);
     34  ObjectListDefinition(CollisionFilter);
    3535
    3636  /**
     
    3838   * @todo this constructor is not jet implemented - do it
    3939  */
    40   CollisionHandle::CollisionHandle (WorldEntity* owner, CREngine::ReactionType type)
    41   {
    42     this->registerObject(this, CollisionHandle::_objectList);
     40  CollisionFilter::CollisionFilter (WorldEntity* owner, CREngine::ReactionType type)
     41  {
     42    this->registerObject(this, CollisionFilter::_objectList);
    4343
    4444    this->owner = owner;
     
    7676   * standard deconstructor
    7777  */
    78   CollisionHandle::~CollisionHandle ()
     78  CollisionFilter::~CollisionFilter ()
    7979  {
    8080    // delete what has to be deleted here
     
    8484
    8585  /**
    86    * restores the CollisionHandle to its initial state
    87    */
    88   void CollisionHandle::reset()
     86   * restores the CollisionFilter to its initial state
     87   */
     88  void CollisionFilter::reset()
    8989  {
    9090    this->flushCollisions();
     
    9696   *  @param classID the classid to look for
    9797   */
    98   void CollisionHandle::addTarget(const ClassID& target)
     98  void CollisionFilter::addTarget(const ClassID& target)
    9999  {
    100100    // make sure there is no dublicate
     
    114114   * handles the collisions and react according to algorithm
    115115   */
    116   void CollisionHandle::handleCollisions()
     116  void CollisionFilter::handleCollisions()
    117117  {
    118118    // if continuous poll the reaction
     
    146146   *  @param collisionEvent the collision event to filter
    147147   */
    148   bool CollisionHandle::filterCollisionEvent(CollisionEvent* collisionEvent)
     148  bool CollisionFilter::filterCollisionEvent(CollisionEvent* collisionEvent)
    149149  {
    150150    std::vector<ClassID>::iterator it = this->targetList.begin();
     
    201201   *  @param collision the collision object to filter
    202202   */
    203   bool CollisionHandle::filterCollision(Collision* collision)
     203  bool CollisionFilter::filterCollision(Collision* collision)
    204204  {
    205205    std::vector<ClassID>::iterator it = this->targetList.begin();
  • branches/coll_rect/src/lib/collision_reaction/collision_filter.h

    r9894 r9895  
    44*/
    55
    6 #ifndef _COLLISION_HANDLE_H
    7 #define _COLLISION_HANDLE_H
     6#ifndef _COLLISION_FILTER_H
     7#define _COLLISION_FILTER_H
    88
    99#include "base_object.h"
     
    2525
    2626  //! A class for defining collision reactions and storing events
    27   class CollisionHandle : public BaseObject
     27  class CollisionFilter : public BaseObject
    2828  {
    29     ObjectListDeclaration(CollisionHandle);
     29    ObjectListDeclaration(CollisionFilter);
    3030
    3131  public:
    32     CollisionHandle(WorldEntity* owner, CREngine::ReactionType type);
    33     virtual ~CollisionHandle();
     32    CollisionFilter(WorldEntity* owner, CREngine::ReactionType type);
     33    virtual ~CollisionFilter();
    3434
    3535    void reset();
     
    7373
    7474}
    75 #endif /* _COLLISION_HANDLE_H */
     75#endif /* _COLLISION_FILTER_H */
  • branches/coll_rect/src/lib/collision_reaction/cr_engine.cc

    r9893 r9895  
    2020#include "collision.h"
    2121#include "collision_event.h"
    22 #include "collision_handle.h"
     22#include "collision_filter.h"
    2323#include "cr_defs.h"
    2424
     
    122122  void CREngine::reset()
    123123  {
    124     // first clear all CollisionHandles
    125     std::vector<CollisionHandle*>::iterator it = this->collisionHandles.begin();
    126     for(; it < this->collisionHandles.end(); it++)
    127     {
    128       (*it)->reset();
    129       delete *it;
    130     }
    131 
    132     this->collisionHandles.clear();
     124//     // first clear all CollisionHandles
     125//     std::vector<CollisionHandle*>::iterator it = this->collisionHandles.begin();
     126//     for(; it < this->collisionHandles.end(); it++)
     127//     {
     128//       (*it)->reset();
     129//       delete *it;
     130//     }
     131//
     132//     this->collisionHandles.clear();
    133133  }
    134134
     
    140140   *  @return the newly created CollisionHandle
    141141   */
    142   CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, ReactionType type)
    143   {
    144     CollisionHandle* ch = new CollisionHandle(owner, type);
    145     this->collisionHandles.push_back(ch);
    146 
    147     return ch;
    148   }
     142//   CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, ReactionType type)
     143//   {
     144//     CollisionHandle* ch = new CollisionHandle(owner, type);
     145//     this->collisionHandles.push_back(ch);
     146//
     147//     return ch;
     148//   }
    149149
    150150
     
    154154   *  @param returns true if worked collrectly
    155155   */
    156   bool CREngine::unsubscribeReaction(CollisionHandle* collisionHandle)
    157   {
    158     std::vector<CollisionHandle*>::iterator it;
    159     for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)
    160     {
    161       if( *it == collisionHandle)
    162       {
    163         this->collisionHandles.erase(it);
    164         delete collisionHandle;
    165         return true;
    166       }
    167     }
    168     return false;
    169   }
     156//   bool CREngine::unsubscribeReaction(CollisionHandle* collisionHandle)
     157//   {
     158//     std::vector<CollisionHandle*>::iterator it;
     159//     for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)
     160//     {
     161//       if( *it == collisionHandle)
     162//       {
     163//         this->collisionHandles.erase(it);
     164//         delete collisionHandle;
     165//         return true;
     166//       }
     167//     }
     168//     return false;
     169//   }
    170170
    171171
     
    175175  void CREngine::handleCollisions()
    176176  {
    177     std::vector<CollisionHandle*>::iterator it;
    178     for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)
    179     {
    180       if( !(*it)->isDispatched() || (*it)->isContinuousPoll())  //does it have any collisions to report at all
    181       {
    182         (*it)->handleCollisions();
    183       }
    184     }
    185     this->flushCollisions();
     177//     std::vector<CollisionHandle*>::iterator it;
     178//     for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)
     179//     {
     180//       if( !(*it)->isDispatched() || (*it)->isContinuousPoll())  //does it have any collisions to report at all
     181//       {
     182//         (*it)->handleCollisions();
     183//       }
     184//     }
     185//     this->flushCollisions();
    186186  }
    187187
  • branches/coll_rect/src/lib/collision_reaction/cr_engine.h

    r9892 r9895  
    2121namespace CoRe
    2222{
    23   class CollisionHandle;
    2423  class Collision;
    2524  class CollisionEvent;
     
    6160
    6261
    63 #define COLLISION_TYPE_AXIS_X      1
    64 #define COLLISION_TYPE_AXIS_X_NEG  2
    65 //!< the collision axis y collision event
    66 #define COLLISION_TYPE_AXIS_Y      3
    67 #define COLLISION_TYPE_AXIS_Y_NEG  4
    68 //!< the collision axis z collision event
    69 #define COLLISION_TYPE_AXIS_Z      5
    70 #define COLLISION_TYPE_AXIS_Z_NEG  6
    71 //!< the collision is a obb collision
    72 #define COLLISION_TYPE_OBB         8
    73 
    7462    virtual ~CREngine(void);
    7563
     
    7765    inline static CREngine* getInstance() { if (!singletonRef) singletonRef = new CREngine();  return singletonRef; };
    7866
    79     CollisionHandle* subscribeReaction(WorldEntity* worldEntity, ReactionType type);
    80     bool unsubscribeReaction(CollisionHandle* collisionHandle);
     67//     CollisionHandle* subscribeReaction(WorldEntity* worldEntity, ReactionType type);
     68//     bool unsubscribeReaction(CollisionHandle* collisionHandle);
    8169
    8270
     
    9886
    9987  private:
    100     std::vector<CollisionHandle*>       collisionHandles;         //!< list with the collision handles
     88    //std::vector<CollisionHandle*>       collisionHandles;         //!< list with the collision handles
    10189
    10290    std::vector<Collision*>             collisionsUsed;           //!< a list of used, cached collisions
  • branches/coll_rect/src/lib/collision_reaction/cr_physics_full_walk.cc

    r9892 r9895  
    9696      {
    9797          /* collision in the X-AXIS */
    98           case COLLISION_TYPE_AXIS_X:
     98        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X:
    9999          front = collPos.len() - box->halfLength[0];
    100100
     
    116116          break;
    117117
    118           case COLLISION_TYPE_AXIS_X_NEG:
     118        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X_NEG:
    119119          back = collPos.len() - box->halfLength[0];
    120120
     
    138138
    139139          /* collision in the Y-AXIS */
    140           case COLLISION_TYPE_AXIS_Y_NEG:
     140        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG:
    141141          // calulate the height above ground
    142142          height = collPos.len() - box->halfLength[1];
     
    165165
    166166          /* collision in the Z-AXIS */
    167           case COLLISION_TYPE_AXIS_Z:
     167        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z:
    168168
    169169          right = collPos.len()  - box->halfLength[2];
     
    187187
    188188          // collision in the z-axis
    189           case COLLISION_TYPE_AXIS_Z_NEG:
     189        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z_NEG:
    190190
    191191          left = collPos.len()  - box->halfLength[2];
  • branches/coll_rect/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r9889 r9895  
    9494      {
    9595          /* collision in the Y-AXIS */
    96           case COLLISION_TYPE_AXIS_Y_NEG:
     96        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG:
    9797          // calulate the height above ground
    9898          height = collPos.len() - box->halfLength[1];
Note: See TracChangeset for help on using the changeset viewer.