Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7927 in orxonox.OLD for trunk/src/lib/collision_reaction


Ignore:
Timestamp:
May 28, 2006, 6:46:33 PM (19 years ago)
Author:
patrick
Message:

trunk: added more cr framework, i will branche soon with this stuff so the trunk dosn't get involved to much in the development phase

Location:
trunk/src/lib/collision_reaction
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_reaction/Makefile.am

    r7819 r7927  
    44noinst_LIBRARIES = libORXcr.a
    55
    6 libORXcr_a_SOURCES = cr_engine.cc
     6libORXcr_a_SOURCES = cr_engine.cc \
     7                     collision_handle.cc
    78
    89
    910
    10 noinst_HEADERS =     cr_engine.h
     11noinst_HEADERS =     cr_engine.h \
     12                                                                                 collision_handle.h
    1113
  • trunk/src/lib/collision_reaction/collision_handle.cc

    r7841 r7927  
    1010
    1111   ### File Specific:
    12    main-programmer: Patirick Boenzli
     12   main-programmer: Patrick Boenzli
    1313*/
    1414
     
    2424 * @todo this constructor is not jet implemented - do it
    2525*/
    26 CollisionHandle::CollisionHandle ()
     26CollisionHandle::CollisionHandle (WorldEntity* owner, CREngine::CRType type)
    2727{
    28    this->setClassID(CL_COLLISION_HANDLE, "CollisionHandle");
     28  this->setClassID(CL_COLLISION_HANDLE, "CollisionHandle");
     29
     30  this->owner = owner;
     31  this->type = type;
    2932
    3033}
  • trunk/src/lib/collision_reaction/collision_handle.h

    r7841 r7927  
    88
    99#include "base_object.h"
     10#include "cr_engine.h"
     11
     12#include <vector>
     13
    1014
    1115class Collision;
     16class WorldEntity;
     17
     18// struct CRType;
     19
    1220
    1321//! A class for defining collision reactions and storing events
     
    1523
    1624 public:
    17   CollisionHandle();
     25  CollisionHandle(WorldEntity* owner, CREngine::CRType type);
    1826  virtual ~CollisionHandle();
     27
     28
     29  void addTarget();
    1930
    2031  void registerCollision(Collision* collision);
     
    2536 private:
    2637   WorldEntity*                  owner;                   //!< the worldenity this reaction will be applied on
    27    classID                       targetClass;             //!< the entities triggering the handle
     38   CREngine::CRType              type;                    //!< the reaction type
    2839
    2940   bool                          bDispatched;             //!< true if this handle has already been dispatched
    30    bool                          bStopOnFirstCollision    //!< true if the cd of this object should be terminated after one match
     41   bool                          bStopOnFirstCollision;   //!< true if the cd of this object should be terminated after one match
    3142
    3243   std::vector<Collision*>       collisionList;           //!< a list full of collisions
    33    std::vector<classID>          targetList;              //!< a list of target classes for filtering
     44   std::vector<long>             targetList;              //!< a list of target classes for filtering
    3445
    3546};
  • trunk/src/lib/collision_reaction/cr_engine.cc

    r7865 r7927  
    4747
    4848
    49 CollisionHandle* CREngine::subscribeReaction(WorldEntity* worldEntity, CRType type, int nrOfTargets, ...)
     49CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, CRType type, int nrOfTargets, ...)
    5050{
     51
    5152  va_list itemlist;
    5253  va_start (itemlist, type);
    53   for (int i = 0; i < nrOfTargets; i++)
    54     this->targetList.push_back(va_arg(itemlist, int));
     54//  for (int i = 0; i < nrOfTargets; i++)
     55  //  this->targetList.push_back(va_arg(itemlist, int));
    5556  va_end(itemlist);
    5657}
  • trunk/src/lib/collision_reaction/cr_engine.h

    r7865 r7927  
    2020{
    2121
     22  public:
    2223  typedef enum CRType {
    23     CR_CONSERVATION_OF_MOMENTUM   = 0,
     24    CR_PHYSICS_MOMENTUM   = 0,
     25    CR_PHYSICS_GROUND,
     26    CR_PHYSICS_GROUND_WALK,
    2427
    2528    CR_OBJECT_DAMAGE,
     
    2831    CR_VERTEX_TRAFO,
    2932
    30     CR_CALLBACK,
     33    CR_SPECIAL_CALLBACK,
    3134
    3235    CR_NUMBER
    3336  };
    3437
     38  virtual ~CREngine(void);
    3539
    36 public:
    37   virtual ~CREngine(void);
    3840  /** @returns a Pointer to the only object of this Class */
    3941  inline static CREngine* getInstance(void) { if (!singletonRef) singletonRef = new CREngine();  return singletonRef; };
     
    5759  CREngine(void);
    5860
     61
    5962private:
    6063  std::vector<CollisionHandle*>       collisionHandles;         //!< list with the collision handles
    6164  std::vector<Collision*>             cachedCollisions;         //!< a list of unused, cached collision events
    62   std::vector<int>                    targetList;
    6365
    6466  static CREngine*                    singletonRef;             //!< the reference to the CREngine object (singleton)
Note: See TracChangeset for help on using the changeset viewer.