Changeset 6142 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Dec 16, 2005, 7:13:57 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_detection/cd_engine.cc
r6022 r6142 65 65 be able to enhance iteration speed. 66 66 */ 67 void CDEngine::checkCollisions()68 {69 this->checkCollisionObjects();67 //void CDEngine::checkCollisions() 68 //{ 69 // this->checkCollisionObjects(); 70 70 //this->checkCollisionGround(); 71 } 72 73 #include "class_list.h" 74 #include "state.h" 71 //} 72 75 73 /** 76 74 * this checks the collisions with the objects 77 75 */ 78 void CDEngine::checkCollisionObjects() 76 //void CDEngine::checkCollisionObjects() 77 //{ 78 // BVTree* tree; 79 // tIterator<WorldEntity>* iterator1 = entityList->getIterator(); 80 // tIterator<WorldEntity>* iterator2 = entityList->getIterator(); 81 // WorldEntity* entity1 = iterator1->firstElement(); 82 // WorldEntity* entity2 = iterator2->iteratorElement(iterator1); 83 // PRINTF(3)("checking for collisions\n"); 84 // while( entity1 != NULL) 85 // { 86 // if( likely(entity1 != this->terrain)) 87 // { 88 // entity2 = iterator2->nextElement(); 89 // 90 // while( entity2 != NULL) 91 // { 92 // if( likely(entity2 != this->terrain)) 93 // { 94 // PRINTF(4)("checking object %s against %s\n", entity1->getName(), entity2->getName()); 95 // tree = entity1->getOBBTree(); 96 // if( likely(tree != NULL) && entity2->getOBBTree() != NULL) tree->collideWith(entity1, entity2); 97 // } 98 // entity2 = iterator2->nextElement(); 99 // } 100 // } 101 // entity1 = iterator1->nextElement(); 102 // entity2 = iterator2->iteratorElement(iterator1); 103 // entity2 = iterator2->nextElement(); 104 // } 105 // delete iterator1; 106 // delete iterator2; 107 //} 108 109 void CDEngine::checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2) 79 110 { 80 111 BVTree* tree; 81 tIterator<WorldEntity>* iterator1 = entityList->getIterator(); 82 tIterator<WorldEntity>* iterator2 = entityList->getIterator(); 83 WorldEntity* entity1 = iterator1->firstElement(); 84 WorldEntity* entity2 = iterator2->iteratorElement(iterator1); 112 std::list<WorldEntity*>::iterator entity1, entity2, pre1, pre2; 85 113 PRINTF(3)("checking for collisions\n"); 86 while( entity1 != NULL) 114 115 pre1 = list1.begin(); 116 while (pre1 != list1.end()) 87 117 { 88 if( likely(entity1 != this->terrain)) 118 entity1 = pre1++; 119 if( likely((*entity1) != this->terrain)) 89 120 { 90 entity2 = iterator2->nextElement(); 91 92 while( entity2 != NULL) 121 pre2 = list2.begin(); 122 while (pre2 != list2.end()) 93 123 { 94 if( likely(entity2 != this->terrain)) 124 entity2 = pre2++; 125 if( likely((*entity2) != this->terrain)) 95 126 { 96 PRINTF(4)("checking object %s against %s\n", entity1->getName(), entity2->getName());97 tree = entity1->getOBBTree();98 if( likely(tree != NULL) && entity2->getOBBTree() != NULL) tree->collideWith(entity1,entity2);127 PRINTF(4)("checking object %s against %s\n", (*entity1)->getName(), (*entity2)->getName()); 128 tree = (*entity1)->getOBBTree(); 129 if( likely(tree != NULL) && (*entity2)->getOBBTree() != NULL) tree->collideWith(*entity1, *entity2); 99 130 } 100 entity2 = iterator2->nextElement();101 131 } 102 132 } 103 entity1 = iterator1->nextElement();104 entity2 = iterator2->iteratorElement(iterator1);105 entity2 = iterator2->nextElement();106 133 } 107 delete iterator1;108 delete iterator2;109 134 } 110 135 … … 134 159 /* this would operate on worldList bases, for testing purposes, we only use one OBBTree */ 135 160 //this->rootTree->drawBV(depth, drawMode); 136 137 tIterator<WorldEntity>* iterator = entityList->getIterator();161 /// FIXME 162 /* tIterator<WorldEntity>* iterator = entityList->getIterator(); 138 163 WorldEntity* entity = iterator->firstElement(); 139 164 while( entity != NULL) … … 142 167 entity = iterator->nextElement(); 143 168 } 144 delete iterator; 169 delete iterator;*/ 145 170 } 146 171 -
trunk/src/lib/collision_detection/cd_engine.h
r6022 r6142 12 12 #include "model.h" 13 13 14 #include <list> 14 15 15 template<class T> class tList;16 16 class WorldEntity; 17 17 class OBBTree; … … 49 49 inline void disable(const int options) { int temp = this->state & options; this->state ^= temp; } 50 50 51 inline void setEntityList(tList<WorldEntity>* entityList) { this->entityList = entityList; }52 51 inline void setTerrain(Terrain* terrain) { this->terrain = terrain; } 53 52 // inline void setPlayer(Player* player) { this->player = player; } /* only for debug purposes \todo: delete*/ … … 55 54 void drawBV(int depth, int drawMode) const; 56 55 57 void checkCollisions(); 56 // void checkCollisions(); 57 void checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2); 58 58 59 59 void debug(); … … 75 75 private: 76 76 int state; //!< the current state of the cd engine 77 tList<WorldEntity>* entityList; //!< pointer to the world entity list78 77 OBBTree* rootTree; //!< for testing purposes a root tree 79 78 -
trunk/src/lib/coord/p_node.cc
r6078 r6142 81 81 { 82 82 deleteNode = tmp; 83 ++tmp;83 tmp++; 84 84 // printf("TEST::%s(%s) %s\n", (*deleteNode)->getName(), (*deleteNode)->getClassName(), this->getName()); 85 85 if ((this->parentMode & PNODE_PROHIBIT_CHILD_DELETE) || … … 470 470 this->getClassName(), this->getName(), child->getClassName(), child->getName()); 471 471 child->parent = NULL; 472 child->parentCoorChanged(); 472 473 } 473 474 } … … 536 537 if (this->parentMode & PNODE_REPARENT_CHILDREN_ON_REMOVE || 537 538 (*reparenter)->parentMode & PNODE_REPARENT_ON_PARENTS_REMOVE) 538 { printf("TEST----------------%s ---- %s\n", this->getClassName(), (*reparenter)->getClassName()); 539 { 540 printf("TEST----------------%s ---- %s\n", this->getClassName(), (*reparenter)->getClassName()); 539 541 (*reparenter)->reparent(); 540 542 printf("REPARENTED TO: %s::%s\n",(*reparenter)->getParent()->getClassName(),(*reparenter)->getParent()->getName()); … … 542 544 } 543 545 if (this->parent != NULL) 546 { 544 547 this->parent->eraseChild(this); 548 this->parent = NULL; 549 } 545 550 } 546 551 -
trunk/src/lib/coord/p_node.h
r6078 r6142 79 79 80 80 // ACTIVATION // 81 inline void activateNode() { this->bActive = t rue; };81 inline void activateNode() { this->bActive = this->bRelCoorChanged = this->bRelDirChanged = true; }; 82 82 inline void deactivateNode() { this->bActive = false; }; 83 83 inline bool getNodeActiveState() { return this->bActive; }; -
trunk/src/lib/graphics/graphics_engine.cc
r6011 r6142 19 19 #include "resource_manager.h" 20 20 #include "event_handler.h" 21 22 #include "world_entity.h" 21 23 22 24 #include "render_2d.h" … … 573 575 } 574 576 577 void GraphicsEngine::draw(const std::list<WorldEntity*>& drawList ) const 578 { 579 std::list<WorldEntity*>::const_iterator entity; 580 for (entity = drawList.begin(); entity != drawList.end(); entity++) 581 if ((*entity)->isVisible()) 582 (*entity)->draw(); 583 } 584 585 575 586 /** 576 587 * displays the Frames per second -
trunk/src/lib/graphics/graphics_engine.h
r5857 r6142 15 15 #include "glincl.h" 16 16 17 #include <list> 18 17 19 // Forward Declaration 18 20 class Text; 19 21 class IniParser; 20 22 class SubString; 23 class WorldEntity; 21 24 22 25 //! class to handle graphics … … 66 69 void tick(float dt); 67 70 void draw() const; 71 void draw(const std::list<WorldEntity*>& drawList) const; 68 72 void displayFPS(bool display); 69 73 -
trunk/src/lib/graphics/render2D/element_2d.cc
r5944 r6142 18 18 #include "element_2d.h" 19 19 #include "render_2d.h" 20 21 #include <algorithm> 20 22 21 23 #include "p_node.h" … … 82 84 if (this->parent != NULL) 83 85 { 84 this->parent-> children.remove(this);86 this->parent->eraseChild(this); 85 87 this->parent = NULL; 86 88 } … … 512 514 { 513 515 PRINTF(5)("Element2D::addChild() - reparenting node: removing it and adding it again\n"); 514 child->parent-> children.remove(child);516 child->parent->eraseChild(child); 515 517 } 516 518 child->parent = this; … … 581 583 if (this->parent != NULL) 582 584 { 583 this->parent-> children.remove(this);585 this->parent->eraseChild(this); 584 586 this->parent = NULL; 585 587 } … … 655 657 if (parentNode != NULL) 656 658 this->setParentSoft2D(parentNode, bias); 659 } 660 661 /** @param child the child to be erased from this Nodes List */ 662 void Element2D::eraseChild(Element2D* child) 663 { 664 std::list<Element2D*>::iterator childIT = std::find(this->children.begin(), this->children.end(), child); 665 this->children.erase(childIT); 657 666 } 658 667 … … 733 742 else if (unlikely(this->bindNode != NULL)) 734 743 { 735 GLdouble projectPos[3] ;744 GLdouble projectPos[3] = {0, 0, 0}; 736 745 gluProject(this->bindNode->getAbsCoor().x, 737 746 this->bindNode->getAbsCoor().y, -
trunk/src/lib/graphics/render2D/element_2d.h
r5775 r6142 195 195 196 196 private: 197 void eraseChild(Element2D* child); 197 198 /** tells the child that the parent's Coordinate has changed */ 198 199 inline void parentCoorChanged () { this->bRelCoorChanged = true; } -
trunk/src/lib/sound/sound_engine.cc
r6076 r6142 141 141 if (!this->ALSources.empty()) 142 142 { 143 144 143 source = this->ALSources.top(); 145 printf("test: : %d\n", source);146 144 this->ALSources.pop(); 147 145 } -
trunk/src/lib/sound/sound_source.cc
r6139 r6142 69 69 SoundEngine::getInstance()->popALSource(this->sourceID); 70 70 71 //printf("%d\n",sourceID);72 71 alSourceStop(this->sourceID); 73 72 alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
Note: See TracChangeset
for help on using the changeset viewer.