Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7711 in orxonox.OLD for trunk/src/world_entities/world_entity.cc


Ignore:
Timestamp:
May 18, 2006, 11:44:21 PM (18 years ago)
Author:
patrick
Message:

trunk: merged the cd branche back to trunk

File:
1 edited

Legend:

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

    r7230 r7711  
    3636SHELL_COMMAND(model, WorldEntity, loadModel)
    3737->describe("sets the Model of the WorldEntity")
    38 ->defaultValues("models/ships/fighter.obj", 1.0);
     38->defaultValues("models/ships/fighter.obj", 1.0f);
    3939
    4040SHELL_COMMAND(debugEntity, WorldEntity, debugWE);
     
    118118 * @param fileName the name of the model to load
    119119 * @param scaling the Scaling of the model
    120  */
    121 void WorldEntity::loadModel(const std::string& fileName, float scaling, unsigned int modelNumber)
     120 *
     121 * FIXME
     122 * @todo: separate the obb tree generation from the model
     123 */
     124void WorldEntity::loadModel(const std::string& fileName, float scaling, unsigned int modelNumber, unsigned int obbTreeDepth)
    122125{
    123126  this->modelLODName = fileName;
     
    154157
    155158      if( modelNumber == 0)
    156         this->buildObbTree(4);
     159        this->buildObbTree(obbTreeDepth);
    157160    }
    158161    else if(fileName.find(".md2") != std::string::npos)
     
    164167
    165168      if( m != NULL)
    166         this->buildObbTree(4);
     169        this->buildObbTree(obbTreeDepth);
    167170    }
    168171  }
     
    207210 * @param depth the depth to calculate
    208211 */
    209 bool WorldEntity::buildObbTree(unsigned int depth)
     212bool WorldEntity::buildObbTree(int depth)
    210213{
    211214  if (this->obbTree)
     
    214217  if (this->models[0] != NULL)
    215218  {
    216     PRINTF(4)("creating obb tree\n");
    217 
    218 
    219     this->obbTree = new OBBTree(depth, (sVec3D*)this->models[0]->getVertexArray(), this->models[0]->getVertexCount());
     219    this->obbTree = new OBBTree(depth, models[0]->getModelInfo(), this);
    220220    return true;
    221221  }
    222222  else
    223223  {
    224     PRINTF(2)("could not create obb-tree, because no model was loaded yet\n");
     224    PRINTF(1)("could not create obb-tree, because no model was loaded yet\n");
    225225    this->obbTree = NULL;
    226226    return false;
     
    468468 * @param drawMode the mode to draw this entity under
    469469 */
    470 void WorldEntity::drawBVTree(unsigned int depth, int drawMode) const
     470void WorldEntity::drawBVTree(int depth, int drawMode) const
    471471{
    472472  glMatrixMode(GL_MODELVIEW);
     
    480480  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    481481
     482
    482483  if (this->obbTree)
    483484    this->obbTree->drawBV(depth, drawMode);
     485
     486
    484487  glPopMatrix();
    485488}
     
    571574    std::string name = getModel( 0 )->getName();
    572575
    573     if (  name.find( ResourceManager::getInstance()->getDataDir() ) == 0 ) 
     576    if (  name.find( ResourceManager::getInstance()->getDataDir() ) == 0 )
    574577    {
    575578      name.erase(ResourceManager::getInstance()->getDataDir().size());
Note: See TracChangeset for help on using the changeset viewer.