Changeset 5774 in orxonox.OLD for trunk/src/lib/graphics/importer/model.cc
- Timestamp:
- Nov 25, 2005, 1:36:31 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/model.cc
r5676 r5774 24 24 25 25 #include "vector.h" 26 #include "list.h"27 26 28 27 using namespace std; … … 166 165 this->normals = new tArray<GLfloat>(); 167 166 168 this->materialList = new tList<ModelMaterial>;169 170 167 if (this->type == MODEL_VERTEX_ARRAY) 171 168 glEnableClientState(GL_VERTEX_ARRAY | GL_NORMAL_ARRAY | GL_TEXTURE_COORD_ARRAY); … … 196 193 PRINTF(5)("Deleting Materials.\n"); 197 194 198 tIterator<ModelMaterial>* tmpIt = this->materialList->getIterator();199 ModelMaterial* modMat = tmpIt->firstElement();200 195 //! @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++) 202 198 { 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); 207 202 } 208 delete tmpIt;209 delete materialList;210 203 delete this->pModelInfo; 211 204 } … … 396 389 modMat->external = true; 397 390 modMat->material = material; 398 this->materialList ->add(modMat);391 this->materialList.push_back(modMat); 399 392 return modMat->material; 400 393 } … … 412 405 413 406 // adding material to the List of materials 414 this->materialList ->add(modMat);407 this->materialList.push_back(modMat); 415 408 return modMat->material; 416 409 } … … 423 416 Material* Model::findMaterialByName(const char* materialName) 424 417 { 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; 437 422 return NULL; 438 423 } … … 929 914 PRINTF(3)("got %i triangles, %i vertices\n", this->triangleCount, this->vertexCount); 930 915 931 916 932 917 /* write MODELINFO structure */ 933 918
Note: See TracChangeset
for help on using the changeset viewer.