Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7944 in orxonox.OLD


Ignore:
Timestamp:
May 29, 2006, 12:02:04 AM (18 years ago)
Author:
patrick
Message:

cr: collision registration work

Location:
branches/cr/src
Files:
5 edited

Legend:

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

    r7736 r7944  
    506506                 (treeNode->nodeRight == NULL || treeNode->nodeLeft == NULL)) )
    507507    {
    508       nodeA->collidesWith(nodeB, treeNode->bvElement->center);
    509       nodeB->collidesWith(nodeA, this->bvElement->center);
     508//       nodeA->collidesWith(nodeB, treeNode->bvElement->center);
     509//       nodeB->collidesWith(nodeA, this->bvElement->center);
     510      nodeA->registerCollision(nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement);
    510511    }
    511512
  • branches/cr/src/lib/collision_reaction/cr_engine.cc

    r7940 r7944  
    5757  Collision* collisions = new Collision[CR_MAX_COLLISIONS];
    5858  for( int i = 0; i < CR_MAX_COLLISIONS; i++)
    59     this->cachedCollisions.push_back(collisions[i]);
     59    this->cachedCollisions.push_back(&collisions[i]);
    6060}
    6161
  • branches/cr/src/lib/collision_reaction/cr_engine.h

    r7940 r7944  
    5050  bool unsubscribeReaction(CollisionHandle* collisionHandle);
    5151
    52 
    5352  void handleCollisions();
    5453
    5554  /** @returns an instance to a collision object. instead of creating new object this ones can be resycled */
    56   inline Collision* getCollisionObject() { /* return the first element of the cache list*/ }
     55  inline Collision* popCollisionObject() { if(!this->cachedCollisions.empty()) { this->cachedCollisions.back(); this->cachedCollisions.pop_back();} else return NULL; }
    5756  /** @param collision: returns the Collision object back to the cache list */
    58   inline void putCollisionObject(Collision* collision) { this->cachedCollisions.push_back(collision); }
     57  inline void pushCollisionObject(Collision* collision) { this->cachedCollisions.push_back(collision); }
    5958
    6059
  • branches/cr/src/world_entities/world_entity.cc

    r7937 r7944  
    254254
    255255/**
     256 * registers a new collision to this world entity
     257 *  @param collisionEvent the event
     258 */
     259void WorldEntity::registerCollision(WorldEntity* entityA, WorldEntity* entityB, BouningVolume* bvA, BoundingVolume* bvB)
     260{
     261  // create a collision event
     262  Collision* c = CREngine::getInstance()->popCollisionObject();
     263  c->collide(entityA, entityB, bvA, bvB);
     264
     265  for(int i = 0; i < CREngine::CR_NUMBER; ++i)
     266    if( this->collisionHandles[i] != NULL)
     267      this->collisionHandles[i]->registerCollision(c);
     268}
     269
     270
     271/**
    256272 * @brief moves this entity to the List OM_List
    257273 * @param list the list to set this Entity to.
  • branches/cr/src/world_entities/world_entity.h

    r7933 r7944  
    2424
    2525class BVTree;
     26class BoundingVolume;
    2627class Model;
    2728class CollisionHandle;
     29class Collision;
    2830
    2931
     
    6971  /* --- Collision Reaction Block --- */
    7072  void subscribeReaction(CREngine::CRType type, int nrOfTargets, long target, ...);
     73  void registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB);
    7174
    7275
Note: See TracChangeset for help on using the changeset viewer.