Changeset 6921 in orxonox.OLD for branches/current_cd/src/lib
- Timestamp:
- Jan 31, 2006, 11:05:36 PM (19 years ago)
- Location:
- branches/current_cd/src/lib/collision_detection
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/current_cd/src/lib/collision_detection/cd_engine.cc
r6911 r6921 59 59 60 60 /** 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 * 65 62 */ 66 //void CDEngine::checkCollisions()67 //{68 // this->checkCollisionObjects();69 //this->checkCollisionGround();70 //}71 72 /**73 * this checks the collisions with the objects74 */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 108 63 void CDEngine::checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2) 109 64 { … … 151 106 152 107 /** 153 * this draws the bounding volume tree154 * @param depth until which depth to draw the tree155 * @param drawMode mod which states how to draw it156 */157 void CDEngine::drawBV(int depth, int drawMode) const158 {159 /* this would operate on worldList bases, for testing purposes, we only use one OBBTree */160 //this->rootTree->drawBV(depth, drawMode);161 /// FIXME162 /* 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 /**174 108 * some debug output on the class 175 109 */ … … 199 133 std::list<WorldEntity*>::const_iterator entity; 200 134 for (entity = drawList.begin(); entity != drawList.end(); entity++) 201 if ((*entity)->isVisible()) 202 (*entity)->drawBVTree(3, 226); 135 (*entity)->drawBVTree(1, 226); 203 136 } 204 137 -
branches/current_cd/src/lib/collision_detection/cd_engine.h
r6316 r6921 50 50 51 51 inline void setTerrain(Terrain* terrain) { this->terrain = terrain; } 52 // inline void setPlayer(Player* player) { this->player = player; } /* only for debug purposes \todo: delete*/53 52 54 void drawBV(int depth, int drawMode) const;55 56 // void checkCollisions();57 53 void checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2); 58 54 -
branches/current_cd/src/lib/collision_detection/obb_tree_node.cc
r6919 r6921 515 515 516 516 517 void OBBTreeNode::collideWith(const BVTreeNode& treeNode, WorldEntity* nodeA, WorldEntity* nodeB) 518 { 517 void OBBTreeNode::collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB) 518 { 519 if( unlikely(treeNode == 1)) 520 return; 521 519 522 PRINTF(3)("collideWith\n"); 520 523 /* if the obb overlap, make subtests: check which node is realy overlaping */ … … 772 775 } 773 776 774 if( this->nodeLeft == NULL ||this->nodeRight == NULL)777 if( this->nodeLeft == NULL && this->nodeRight == NULL) 775 778 depth = 0; 779 776 780 if( !(drawMode & DRAW_SINGLE && depth != 0)) 777 781 { 782 PRINTF(0)("debug poly draw: depth: %i, mode: %i\n", depth, drawMode); 783 778 784 Vector cen = this->bvElement->center; 779 785 Vector* axis = this->bvElement->axis;
Note: See TracChangeset
for help on using the changeset viewer.