Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4689 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
Jun 24, 2005, 3:06:04 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: enhanced world entities to support collisions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/cd_engine.cc

    r4688 r4689  
    2020#include "debug.h"
    2121#include "abstract_model.h"
     22#include "world_entity.h"
     23#include "list.h"
    2224
    2325using namespace std;
     
    3335
    3436   /* testing purposes only: */
    35    this->rootTree = new OBBTree();
     37   //this->rootTree = new OBBTree();
    3638}
    3739
     
    5456void CDEngine::checkCollisions()
    5557{
     58  tIterator<WorldEntity>* iterator1 = entityList->getIterator();
     59  tIterator<WorldEntity>* iterator2 = entityList->getIterator();
     60  WorldEntity* entity1 = iterator1->nextElement();
     61  WorldEntity* entity2 = iterator2->nextElement();
     62  while( entity1 != NULL)
     63  {
     64    while( entity2 != NULL && entity1 != entity2)
     65    {
     66      entity1->collideWith(entity2);
     67      entity2 = iterator2->nextElement();
     68    }
     69    entity1 = iterator1->nextElement();
     70  }
     71  delete iterator1;
     72  delete iterator2;
     73
    5674
    5775}
     
    7088{
    7189  /* this would operate on  worldList bases, for testing purposes, we only use one OBBTree */
    72   this->rootTree->drawBV(depth, drawMode);
     90  //this->rootTree->drawBV(depth, drawMode);
     91
     92  tIterator<WorldEntity>* iterator = entityList->getIterator();
     93  WorldEntity* entity = iterator->nextElement();
     94  while( entity != NULL)
     95  {
     96    entity->drawBVTree(depth, drawMode);
     97    entity = iterator->nextElement();
     98  }
     99  delete iterator;
     100  //model->draw();
    73101}
    74102
     
    81109  PRINT(0)("\n=============================| CDEngine::debug() |===\n");
    82110  PRINT(0)("=  CDEngine: Spawning Tree Start\n");
    83   this->rootTree->debug();
     111  //this->rootTree->debug();
    84112  PRINT(0)("=  CDEngine: Spawning Tree: Finished\n");
    85113  PRINT(0)("=======================================================\n");
     
    89117void CDEngine::debugSpawnTree(int depth, sVec3D* vertices, int numVertices)
    90118{
     119  if ( this->rootTree == NULL)
     120    this->rootTree = new OBBTree();
    91121  this->rootTree->spawnBVTree(depth, vertices, numVertices);
    92122}
Note: See TracChangeset for help on using the changeset viewer.