Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7927 in orxonox.OLD for trunk


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
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r7919 r7927  
    249249  /// Collision
    250250  CL_COLLISION                  =    0x00000711,
     251  CL_COLLISION_HANDLE           =    0x00000712,
    251252  CL_BV_TREE                    =    0x00701000,
    252253  CL_BV_TREE_NODE               =    0x00702000,
  • trunk/src/defs/include_paths.am

    r7193 r7927  
    2424AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/physics/fields
    2525AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/collision_detection
     26AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/collision_reaction
    2627AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/newmat
    2728AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/sound
  • 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)
  • trunk/src/world_entities/world_entity.cc

    r7779 r7927  
    3232#include "camera.h"
    3333
     34#include "cr_engine.h"
     35#include "collision_handle.h"
     36
     37
    3438using namespace std;
    3539
     
    6569
    6670  this->toList(OM_NULL);
     71
     72  //this->collisionHandles = new *CollisionHandle[CREngine::CR_NUMBER]();
    6773}
    6874
     
    228234}
    229235
     236
     237/**
     238 * subscribes this world entity to a collision reaction
     239 *  @param type the type of reaction to subscribe to
     240 *  @param nrOfTargets number of target filters
     241 *  @param ... the targets as classIDs
     242 */
     243void WorldEntity::subscribeReaction(CREngine::CRType type, int nrOfTargets, ...)
     244{}
     245
     246
    230247/**
    231248 * @brief moves this entity to the List OM_List
  • trunk/src/world_entities/world_entity.h

    r7779 r7927  
    1111#include "model.h"
    1212
     13#include "cr_engine.h"
    1314#include "object_manager.h"
    1415#include "glincl.h"
    1516#include <vector>
     17#include <stdarg.h>
     18
     19
    1620
    1721// FORWARD DECLARATION
     
    2125class BVTree;
    2226class Model;
     27class CollisionHandle;
     28
    2329
    2430//class CharacterAttributes;
     
    5460  virtual void draw () const;
    5561
     62  /* --- Collision Detection Block  --- */
    5663  bool buildObbTree(int depth);
    5764  virtual void collidesWith (WorldEntity* entity, const Vector& location);
     
    6067  void drawBVTree(int depth, int drawMode) const;
    6168
    62   void debugWE() { this->debugEntity(); }
    63   ;  ///FIXME
    64   void debugEntity() const;
     69  /* --- Collision Reaction Block --- */
     70  void subscribeReaction(CREngine::CRType type, int nrOfTargets, ...);
    6571
    6672
     
    7278  //  CharacterAttributes* getCharacterAttributes();
    7379
     80  /* --- Object Manager Block --- */
    7481  void toList(OM_LIST list);
    75 
    76 
    7782  /** @returns a Reference to the objectListNumber to set. */
    7883  OM_LIST& getOMListNumber() { return this->objectListNumber; }
     
    8085  ObjectManager::EntityList::iterator& getEntityIterator() { return this->objectListIterator; }
    8186
     87  /* --- Network Block --- */
    8288  int       writeState(const byte* data, int length, int sender);
    8389  int       readState(byte* data, int maxLength );
    8490
     91  /* --- Character Attribute Block --- */
    8592  /** @returns the Energy of the entity */
    8693  float getHealth() const { return this->health; };
     
    9299  OrxGui::GLGuiWidget* getHealthWidget();
    93100  bool hasHealthWidget() const { return this->healthWidget; };
     101
     102  /* --- Misc Stuff Block --- */
     103  void debugWE() { this->debugEntity(); }
     104  ;  ///FIXME
     105  void debugEntity() const;
     106
    94107
    95108protected:
     
    121134
    122135  float                   scaling;
     136  CollisionHandle**       collisionHandles;
    123137
    124138
Note: See TracChangeset for help on using the changeset viewer.