Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5061 in orxonox.OLD for orxonox/trunk/src/world_entities


Ignore:
Timestamp:
Aug 17, 2005, 12:17:00 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: buildObbTree-function added to WorldEntity

Location:
orxonox/trunk/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/world_entity.cc

    r5057 r5061  
    7878      this->model = (Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, &scaling);
    7979
    80     PRINTF(4)("creating obb tree\n");
    81     this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
     80    this->buildObbTree(4);
    8281  }
    8382  else
     
    8584}
    8685
     86/**
     87 * builds the obb-tree
     88 * @param depth the depth to calculate
     89 */
     90bool WorldEntity::buildObbTree(unsigned int depth)
     91{
     92  if (this->obbTree)
     93    delete this->obbTree;
     94
     95  if (this->model)
     96  {
     97    PRINTF(4)("creating obb tree\n");
     98    this->obbTree = new OBBTree(depth, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
     99    return true;
     100  }
     101  else
     102  {
     103    PRINTF(2)("could not create obb-tree, because no model was loaded yet\n");
     104    this->obbTree = NULL;
     105    return false;
     106  }
     107}
    87108
    88109
  • orxonox/trunk/src/world_entities/world_entity.h

    r5057 r5061  
    3434  void loadModel(const char* fileName) { this->loadModelWithScale(fileName, 1.0); };
    3535  void loadModelWithScale(const char* fileName, float scaling);
     36
     37  bool buildObbTree(unsigned int depth);
    3638
    3739
Note: See TracChangeset for help on using the changeset viewer.