Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Dec 16, 2005, 7:13:57 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merge the ObjectManager to the trunk
merged with command:
svn merge -r6082:HEAD objectmanager/ ../trunk/

conflicts resolution was easy this time :)
but specially merged the world to network_world

Location:
trunk/src/lib
Files:
10 edited

Legend:

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

    r6022 r6142  
    6565    be able to enhance iteration speed.
    6666 */
    67 void CDEngine::checkCollisions()
    68 {
    69   this->checkCollisionObjects();
     67//void CDEngine::checkCollisions()
     68//{
     69//  this->checkCollisionObjects();
    7070  //this->checkCollisionGround();
    71 }
    72 
    73 #include "class_list.h"
    74 #include "state.h"
     71//}
     72
    7573/**
    7674 *  this checks the collisions with the objects
    7775 */
    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
     109void CDEngine::checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2)
    79110{
    80111  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;
    85113  PRINTF(3)("checking for collisions\n");
    86   while( entity1 != NULL)
     114
     115  pre1 = list1.begin();
     116  while (pre1 != list1.end())
    87117  {
    88     if( likely(entity1 != this->terrain))
     118    entity1 = pre1++;
     119    if( likely((*entity1) != this->terrain))
    89120    {
    90       entity2 = iterator2->nextElement();
    91 
    92       while( entity2 != NULL)
     121      pre2 = list2.begin();
     122      while (pre2 != list2.end())
    93123      {
    94         if( likely(entity2 != this->terrain))
     124        entity2 = pre2++;
     125        if( likely((*entity2) != this->terrain))
    95126        {
    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);
    99130        }
    100         entity2 = iterator2->nextElement();
    101131      }
    102132    }
    103     entity1 = iterator1->nextElement();
    104     entity2 = iterator2->iteratorElement(iterator1);
    105     entity2 = iterator2->nextElement();
    106133  }
    107   delete iterator1;
    108   delete iterator2;
    109134}
    110135
     
    134159  /* this would operate on  worldList bases, for testing purposes, we only use one OBBTree */
    135160  //this->rootTree->drawBV(depth, drawMode);
    136 
    137   tIterator<WorldEntity>* iterator = entityList->getIterator();
     161  /// FIXME
     162/*  tIterator<WorldEntity>* iterator = entityList->getIterator();
    138163  WorldEntity* entity = iterator->firstElement();
    139164  while( entity != NULL)
     
    142167    entity = iterator->nextElement();
    143168  }
    144   delete iterator;
     169  delete iterator;*/
    145170}
    146171
  • trunk/src/lib/collision_detection/cd_engine.h

    r6022 r6142  
    1212#include "model.h"
    1313
     14#include <list>
    1415
    15 template<class T> class tList;
    1616class WorldEntity;
    1717class OBBTree;
     
    4949  inline void disable(const int options) { int temp = this->state & options; this->state ^= temp; }
    5050
    51   inline void setEntityList(tList<WorldEntity>* entityList) { this->entityList = entityList; }
    5251  inline void setTerrain(Terrain* terrain) { this->terrain = terrain; }
    5352  //  inline void setPlayer(Player* player) { this->player = player; } /* only for debug purposes \todo: delete*/
     
    5554  void drawBV(int depth, int drawMode) const;
    5655
    57   void checkCollisions();
     56//  void checkCollisions();
     57  void checkCollisions(std::list<WorldEntity*>& list1, std::list<WorldEntity*>& list2);
    5858
    5959  void debug();
     
    7575 private:
    7676  int                     state;                            //!< the current state of the cd engine
    77   tList<WorldEntity>*     entityList;                       //!< pointer to the world entity list
    7877  OBBTree*                rootTree;                         //!< for testing purposes a root tree
    7978
  • trunk/src/lib/coord/p_node.cc

    r6078 r6142  
    8181    {
    8282      deleteNode = tmp;
    83       ++tmp;
     83      tmp++;
    8484//      printf("TEST::%s(%s) %s\n", (*deleteNode)->getName(), (*deleteNode)->getClassName(), this->getName());
    8585      if ((this->parentMode & PNODE_PROHIBIT_CHILD_DELETE) ||
     
    470470              this->getClassName(), this->getName(), child->getClassName(), child->getName());
    471471    child->parent = NULL;
     472    child->parentCoorChanged();
    472473  }
    473474}
     
    536537    if (this->parentMode & PNODE_REPARENT_CHILDREN_ON_REMOVE ||
    537538        (*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());
    539541      (*reparenter)->reparent();
    540542      printf("REPARENTED TO: %s::%s\n",(*reparenter)->getParent()->getClassName(),(*reparenter)->getParent()->getName());
     
    542544  }
    543545  if (this->parent != NULL)
     546  {
    544547    this->parent->eraseChild(this);
     548    this->parent = NULL;
     549  }
    545550}
    546551
  • trunk/src/lib/coord/p_node.h

    r6078 r6142  
    7979
    8080  // ACTIVATION //
    81   inline void activateNode() { this->bActive = true; };
     81  inline void activateNode() { this->bActive = this->bRelCoorChanged = this->bRelDirChanged = true; };
    8282  inline void deactivateNode() { this->bActive = false; };
    8383  inline bool getNodeActiveState() { return this->bActive; };
  • trunk/src/lib/graphics/graphics_engine.cc

    r6011 r6142  
    1919#include "resource_manager.h"
    2020#include "event_handler.h"
     21
     22#include "world_entity.h"
    2123
    2224#include "render_2d.h"
     
    573575}
    574576
     577void 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
    575586/**
    576587 * displays the Frames per second
  • trunk/src/lib/graphics/graphics_engine.h

    r5857 r6142  
    1515#include "glincl.h"
    1616
     17#include <list>
     18
    1719// Forward Declaration
    1820class Text;
    1921class IniParser;
    2022class SubString;
     23class WorldEntity;
    2124
    2225//! class to handle graphics
     
    6669    void tick(float dt);
    6770    void draw() const;
     71    void draw(const std::list<WorldEntity*>& drawList) const;
    6872    void displayFPS(bool display);
    6973
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r5944 r6142  
    1818#include "element_2d.h"
    1919#include "render_2d.h"
     20
     21#include <algorithm>
    2022
    2123#include "p_node.h"
     
    8284  if (this->parent != NULL)
    8385  {
    84     this->parent->children.remove(this);
     86    this->parent->eraseChild(this);
    8587    this->parent = NULL;
    8688  }
     
    512514  {
    513515    PRINTF(5)("Element2D::addChild() - reparenting node: removing it and adding it again\n");
    514     child->parent->children.remove(child);
     516    child->parent->eraseChild(child);
    515517  }
    516518  child->parent = this;
     
    581583  if (this->parent != NULL)
    582584  {
    583     this->parent->children.remove(this);
     585    this->parent->eraseChild(this);
    584586    this->parent = NULL;
    585587  }
     
    655657  if (parentNode != NULL)
    656658    this->setParentSoft2D(parentNode, bias);
     659}
     660
     661/** @param child the child to be erased from this Nodes List */
     662void 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);
    657666}
    658667
     
    733742    else if (unlikely(this->bindNode != NULL))
    734743    {
    735       GLdouble projectPos[3];
     744      GLdouble projectPos[3] = {0, 0, 0};
    736745      gluProject(this->bindNode->getAbsCoor().x,
    737746                 this->bindNode->getAbsCoor().y,
  • trunk/src/lib/graphics/render2D/element_2d.h

    r5775 r6142  
    195195
    196196  private:
     197    void eraseChild(Element2D* child);
    197198    /** tells the child that the parent's Coordinate has changed */
    198199    inline void parentCoorChanged () { this->bRelCoorChanged = true; }
  • trunk/src/lib/sound/sound_engine.cc

    r6076 r6142  
    141141    if (!this->ALSources.empty())
    142142    {
    143 
    144143      source = this->ALSources.top();
    145       printf("test: : %d\n", source);
    146144      this->ALSources.pop();
    147145    }
  • trunk/src/lib/sound/sound_source.cc

    r6139 r6142  
    6969    SoundEngine::getInstance()->popALSource(this->sourceID);
    7070
    71   //printf("%d\n",sourceID);
    7271  alSourceStop(this->sourceID);
    7372  alSourcei (this->sourceID, AL_BUFFER, buffer->getID());
Note: See TracChangeset for help on using the changeset viewer.