Changeset 4038 in orxonox.OLD
- Timestamp:
- May 4, 2005, 12:15:48 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/model.cc
r4023 r4038 35 35 */ 36 36 ModelFaceElement::ModelFaceElement() 37 {} 37 { 38 this->next = NULL; 39 } 38 40 39 41 /** … … 42 44 ModelFaceElement::~ModelFaceElement() 43 45 { 46 if (this->next) 47 delete this->next; 48 } 49 50 /** 51 \brief creates a new ModelFace 52 */ 53 ModelFace::ModelFace() 54 { 55 this->vertexCount = 0; 56 57 this->firstElem = NULL; 58 59 this->material = NULL; 60 61 this->next = NULL; 62 63 } 64 65 /** 66 \brief deletes a ModelFace 67 */ 68 ModelFace::~ModelFace() 69 { 70 PRINTF(5)("Cleaning up Face\n"); 71 72 if (this->firstElem != NULL) 73 delete this->firstElem; 74 44 75 if (this->next != NULL) 45 76 delete this->next; 46 }47 48 /**49 \brief creates a new ModelFace50 */51 ModelFace::ModelFace()52 {53 this->vertexCount = 0;54 55 this->firstElem = NULL;56 57 this->material = NULL;58 59 this->next = NULL;60 61 }62 63 /**64 \brief deletes a ModelFace65 */66 ModelFace::~ModelFace()67 {68 PRINTF(5)("Cleaning up Face\n");69 70 if (this->firstElem != NULL)71 {72 delete this->firstElem;73 }74 75 if (this->next != NULL)76 {77 delete this->next;78 }79 80 77 } 81 78 … … 102 99 PRINTF(5)("Cleaning up group\n"); 103 100 if (this->firstFace != NULL) 104 { 105 delete this->firstFace; 106 } 101 delete this->firstFace; 107 102 108 103 if (this->next !=NULL) … … 175 170 176 171 PRINTF(5)("Deleting display Lists.\n"); 177 ModelGroup* walker = this->firstGroup; 178 while (walker != NULL) 179 { 180 glDeleteLists (walker->listNumber, 1); 181 ModelGroup* delWalker = walker; 182 walker = walker->next; 183 delete delWalker; 184 } 172 delete this->firstGroup; 185 173 186 174 // deleting Arrays … … 191 179 tIterator<Material>* tmpIt = this->materialList->getIterator(); 192 180 Material* material = tmpIt->nextElement(); 181 182 //! \todo do we really have to delete this material?? 193 183 while(material) 194 184 { … … 227 217 { 228 218 PRINTF(4)("drawing the 3D-Models\n"); 229 ModelGroup* walker= this->firstGroup;230 while ( walker!= NULL)231 { 232 PRINTF(5)("Drawing model %s\n", walker->name);233 glCallList ( walker->listNumber);234 walker = walker->next;219 ModelGroup* tmpGroup = this->firstGroup; 220 while (tmpGroup != NULL) 221 { 222 PRINTF(5)("Drawing model %s\n", tmpGroup->name); 223 glCallList (tmpGroup->listNumber); 224 tmpGroup = tmpGroup->next; 235 225 } 236 226 } … … 250 240 } 251 241 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 252 ModelGroup* walker= this->firstGroup;242 ModelGroup* tmpGroup = this->firstGroup; 253 243 int counter = 0; 254 while ( walker!= NULL)244 while (tmpGroup != NULL) 255 245 { 256 246 if (counter == groupNumber) 257 247 { 258 PRINTF(4)("Drawing model number %i named %s\n", counter, walker->name);259 glCallList ( walker->listNumber);248 PRINTF(4)("Drawing model number %i named %s\n", counter, tmpGroup->name); 249 glCallList (tmpGroup->listNumber); 260 250 return; 261 251 } 262 252 ++counter; 263 walker = walker->next;253 tmpGroup = tmpGroup->next; 264 254 } 265 255 PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->name); … … 277 267 { 278 268 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 279 ModelGroup* walker= this->firstGroup;280 while ( walker!= NULL)281 { 282 if (!strcmp( walker->name, groupName))269 ModelGroup* tmpGroup = this->firstGroup; 270 while (tmpGroup != NULL) 271 { 272 if (!strcmp(tmpGroup->name, groupName)) 283 273 { 284 PRINTF(4)("Drawing model %s\n", walker->name);285 glCallList ( walker->listNumber);274 PRINTF(4)("Drawing model %s\n", tmpGroup->name); 275 glCallList (tmpGroup->listNumber); 286 276 return; 287 277 } 288 walker = walker->next;278 tmpGroup = tmpGroup->next; 289 279 } 290 280 PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->name); 291 281 return; 292 }293 294 /**295 \returns Count of the Models in this File296 */297 int Model::getGroupCount (void) const298 {299 return this->groupCount;300 282 } 301 283 … … 331 313 if (this->normals) 332 314 delete this->normals; 315 333 316 this->vertices = NULL; 334 317 this->vTexture = NULL; … … 410 393 With it you should be able to create Models with more than one SubModel inside 411 394 */ 412 bool Model::addGroup 395 bool Model::addGroup(const char* groupString) 413 396 { 414 397 PRINTF(5)("Read Group: %s.\n", groupString); … … 594 577 595 578 ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement; 596 tmpElem->next = NULL;597 579 598 580 va_list itemlist; … … 603 585 if (this->currentGroup->currentFace->vertexCount>0) 604 586 tmpElem = tmpElem->next = new ModelFaceElement; 605 tmpElem->next = NULL;606 587 607 588 tmpElem->vertexNumber = va_arg (itemlist, int) -1; … … 834 815 glNormalPointer(3, 0, this->normals->getArray()); 835 816 glTexCoordPointer(2, GL_FLOAT, 0, this->vTexture->getArray()); 836 837 817 } 838 818 … … 859 839 if (elem->vertexNumber != -1) 860 840 glVertex3fv(this->vertices->getArray() + elem->vertexNumber * 3); 861 862 841 } 863 842 -
orxonox/trunk/src/lib/graphics/importer/model.h
r4023 r4038 139 139 void draw(int groupNumber) const; 140 140 void draw(char* groupName) const; 141 int getGroupCount() const; 141 142 /** \returns Count of the Models (Groups) in this File */ 143 inline int getGroupCount(void) const {return this->groupCount;} 142 144 143 145 Material* addMaterial(Material* material); -
orxonox/trunk/src/lib/graphics/importer/objModel.cc
r3916 r4038 196 196 this->mtlFileName = new char [strlen(mtlFile)+1]; 197 197 strcpy(this->mtlFileName, mtlFile); 198 char* fileName = new char [strlen(objPath) + strlen(this->mtlFileName)+1]; 199 strcpy(fileName, this->objPath); 200 strcat(fileName, this->mtlFileName); 198 char* fileName = new char [strlen(this->objPath) + strlen(this->mtlFileName)+1]; 199 sprintf(fileName, "%s%s", this->objPath, this->mtlFileName); 201 200 202 201
Note: See TracChangeset
for help on using the changeset viewer.