Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5774 in orxonox.OLD for trunk/src/lib/graphics/importer/model.cc


Ignore:
Timestamp:
Nov 25, 2005, 1:36:31 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: stl in Model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/model.cc

    r5676 r5774  
    2424
    2525#include "vector.h"
    26 #include "list.h"
    2726
    2827using namespace std;
     
    166165  this->normals = new tArray<GLfloat>();
    167166
    168   this->materialList = new tList<ModelMaterial>;
    169 
    170167  if (this->type == MODEL_VERTEX_ARRAY)
    171168    glEnableClientState(GL_VERTEX_ARRAY | GL_NORMAL_ARRAY | GL_TEXTURE_COORD_ARRAY);
     
    196193  PRINTF(5)("Deleting Materials.\n");
    197194
    198   tIterator<ModelMaterial>* tmpIt = this->materialList->getIterator();
    199   ModelMaterial* modMat = tmpIt->firstElement();
    200195  //! @todo do we really have to delete this material??
    201   while(modMat != NULL)
     196  list<ModelMaterial*>::iterator modMat;
     197  for(modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
    202198  {
    203     if (!modMat->external)
    204       delete modMat->material;
    205     delete modMat;
    206     modMat = tmpIt->nextElement();
     199    if (!(*modMat)->external)
     200      delete (*modMat)->material;
     201    delete (*modMat);
    207202  }
    208   delete tmpIt;
    209   delete materialList;
    210203  delete this->pModelInfo;
    211204}
     
    396389  modMat->external = true;
    397390  modMat->material = material;
    398   this->materialList->add(modMat);
     391  this->materialList.push_back(modMat);
    399392  return modMat->material;
    400393}
     
    412405
    413406  // adding material to the List of materials
    414   this->materialList->add(modMat);
     407  this->materialList.push_back(modMat);
    415408  return modMat->material;
    416409}
     
    423416Material* Model::findMaterialByName(const char* materialName)
    424417{
    425   tIterator<ModelMaterial>* tmpIt = this->materialList->getIterator();
    426   ModelMaterial* modMat = tmpIt->firstElement();
    427   while(modMat != NULL)
    428     {
    429       if (!strcmp(modMat->material->getName(), materialName))
    430         {
    431           delete tmpIt;
    432           return modMat->material;
    433         }
    434       modMat = tmpIt->nextElement();
    435     }
    436   delete tmpIt;
     418  list<ModelMaterial*>::iterator modMat;
     419  for  (modMat = this->materialList.begin(); modMat != this->materialList.end(); modMat++)
     420    if (!strcmp((*modMat)->material->getName(), materialName))
     421      return (*modMat)->material;
    437422  return NULL;
    438423}
     
    929914  PRINTF(3)("got %i triangles, %i vertices\n", this->triangleCount, this->vertexCount);
    930915
    931  
     916
    932917  /* write MODELINFO structure */
    933918
Note: See TracChangeset for help on using the changeset viewer.