Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 31, 2006, 11:05:36 PM (19 years ago)
Author:
patrick
Message:

cd: collision algorithm works almost

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/current_cd/src/lib/collision_detection/cd_engine.cc

    r6911 r6921  
    5959
    6060/**
    61  *  this is the collision checking function
    62 
    63     there are some speed improvements that can be done here. a rewrite of the list a would be appropriate to
    64     be able to enhance iteration speed.
     61 *
    6562 */
    66 //void CDEngine::checkCollisions()
    67 //{
    68 //  this->checkCollisionObjects();
    69   //this->checkCollisionGround();
    70 //}
    71 
    72 /**
    73  *  this checks the collisions with the objects
    74  */
    75 //void CDEngine::checkCollisionObjects()
    76 //{
    77 //   BVTree* tree;
    78 //   tIterator<WorldEntity>* iterator1 = entityList->getIterator();
    79 //   tIterator<WorldEntity>* iterator2 = entityList->getIterator();
    80 //   WorldEntity* entity1 = iterator1->firstElement();
    81 //   WorldEntity* entity2 = iterator2->iteratorElement(iterator1);
    82 //   PRINTF(3)("checking for collisions\n");
    83 //   while( entity1 != NULL)
    84 //   {
    85 //     if( likely(entity1 != this->terrain))
    86 //     {
    87 //       entity2 = iterator2->nextElement();
    88 //
    89 //       while( entity2 != NULL)
    90 //       {
    91 //         if( likely(entity2 != this->terrain))
    92 //         {
    93 //           PRINTF(4)("checking object %s against %s\n", entity1->getName(), entity2->getName());
    94 //           tree = entity1->getOBBTree();
    95 //           if( likely(tree != NULL) && entity2->getOBBTree() != NULL) tree->collideWith(entity1, entity2);
    96 //         }
    97 //         entity2 = iterator2->nextElement();
    98 //       }
    99 //     }
    100 //     entity1 = iterator1->nextElement();
    101 //     entity2 = iterator2->iteratorElement(iterator1);
    102 //     entity2 = iterator2->nextElement();
    103 //   }
    104 //   delete iterator1;
    105 //   delete iterator2;
    106 //}
    107 
    10863void CDEngine::checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2)
    10964{
     
    151106
    152107/**
    153  *  this draws the bounding volume tree
    154  * @param depth until which depth to draw the tree
    155  * @param drawMode mod which states how to draw it
    156  */
    157 void CDEngine::drawBV(int depth, int drawMode) const
    158 {
    159   /* this would operate on  worldList bases, for testing purposes, we only use one OBBTree */
    160   //this->rootTree->drawBV(depth, drawMode);
    161   /// FIXME
    162 /*  tIterator<WorldEntity>* iterator = entityList->getIterator();
    163   WorldEntity* entity = iterator->firstElement();
    164   while( entity != NULL)
    165   {
    166     entity->drawBVTree(depth, drawMode);
    167     entity = iterator->nextElement();
    168   }
    169   delete iterator;*/
    170 }
    171 
    172 
    173 /**
    174108 * some debug output on the class
    175109 */
     
    199133  std::list<WorldEntity*>::const_iterator entity;
    200134  for (entity = drawList.begin(); entity != drawList.end(); entity++)
    201     if ((*entity)->isVisible())
    202       (*entity)->drawBVTree(3, 226);
     135    (*entity)->drawBVTree(1, 226);
    203136}
    204137
Note: See TracChangeset for help on using the changeset viewer.