Changeset 5774 in orxonox.OLD for trunk/src/lib/graphics/importer
- Timestamp:
- Nov 25, 2005, 1:36:31 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 2 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 -
trunk/src/lib/graphics/importer/model.h
r5701 r5774 12 12 #include "glincl.h" 13 13 #include "array.h" 14 14 #include <list> 15 15 16 16 // FORWARD DECLARATION // 17 17 template<class T> class tArray; 18 template<class T> class tList;19 18 20 19 … … 176 175 177 176 private: 178 MODEL_TYPE type; //!< A type for the Model179 bool finalized; //!< Sets the Object to be finalized.177 MODEL_TYPE type; //!< A type for the Model 178 bool finalized; //!< Sets the Object to be finalized. 180 179 181 unsigned int vertexCount; //!< A modelwide Counter for vertices.182 unsigned int normalCount; //!< A modelwide Counter for the normals.183 unsigned int texCoordCount; //!< A modelwide Counter for the texCoord.184 unsigned int faceCount; //!< A modelwide Counter for the faces185 unsigned int triangleCount; //!< Number of triangles >= faceCount186 tArray<GLfloat>* vertices; //!< The Array that handles the Vertices.187 tArray<GLfloat>* normals; //!< The Array that handles the Normals.188 tArray<GLfloat>* vTexture; //!< The Array that handles the VertexTextureCoordinates.189 sTriangleExt* triangles; //!< The Array of triangles in the abstract_model.h style180 unsigned int vertexCount; //!< A modelwide Counter for vertices. 181 unsigned int normalCount; //!< A modelwide Counter for the normals. 182 unsigned int texCoordCount; //!< A modelwide Counter for the texCoord. 183 unsigned int faceCount; //!< A modelwide Counter for the faces 184 unsigned int triangleCount; //!< Number of triangles >= faceCount 185 tArray<GLfloat>* vertices; //!< The Array that handles the Vertices. 186 tArray<GLfloat>* normals; //!< The Array that handles the Normals. 187 tArray<GLfloat>* vTexture; //!< The Array that handles the VertexTextureCoordinates. 188 sTriangleExt* triangles; //!< The Array of triangles in the abstract_model.h style 190 189 191 ModelGroup* firstGroup; //!< The first of all groups.192 ModelGroup* currentGroup; //!< The currentGroup. this is the one we will work with.193 int groupCount; //!< The Count of Groups.190 ModelGroup* firstGroup; //!< The first of all groups. 191 ModelGroup* currentGroup; //!< The currentGroup. this is the one we will work with. 192 int groupCount; //!< The Count of Groups. 194 193 195 tList<ModelMaterial>*materialList; //!< A list for all the Materials in this Model194 std::list<ModelMaterial*> materialList; //!< A list for all the Materials in this Model 196 195 }; 197 196
Note: See TracChangeset
for help on using the changeset viewer.