Changeset 3605 in orxonox.OLD for orxonox/branches/levelloader/src/lib/graphics/importer/model.cc
- Timestamp:
- Mar 18, 2005, 11:52:15 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/lib/graphics/importer/model.cc
r3499 r3605 13 13 co-programmer: ... 14 14 */ 15 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 15 17 16 18 #include "model.h" … … 80 82 Model::~Model(void) 81 83 { 82 PRINTF( 3)("Deleting Model ");84 PRINTF(4)("Deleting Model "); 83 85 if (this->name) 84 86 { 85 PRINT( 3)("%s\n", this->name);87 PRINT(4)("%s\n", this->name); 86 88 delete []this->name; 87 89 } 88 90 else 89 PRINT( 3)("\n");90 91 PRINTF( 3)("Deleting display Lists.\n");91 PRINT(4)("\n"); 92 93 PRINTF(4)("Deleting display Lists.\n"); 92 94 Group* walker = this->firstGroup; 93 95 while (walker != NULL) … … 99 101 } 100 102 101 PRINTF( 3)("Deleting Materials.\n");103 PRINTF(4)("Deleting Materials.\n"); 102 104 if (this->material) 103 105 delete this->material; … … 122 124 void Model::draw (void) const 123 125 { 124 PRINTF( 2)("drawing the 3D-Models\n");126 PRINTF(4)("drawing the 3D-Models\n"); 125 127 Group* walker = this->firstGroup; 126 128 while (walker != NULL) 127 129 { 128 PRINTF( 3)("Drawing model %s\n", walker->name);130 PRINTF(5)("Drawing model %s\n", walker->name); 129 131 glCallList (walker->listNumber); 130 132 walker = walker->next; … … 142 144 if (groupNumber >= this->groupCount) 143 145 { 144 PRINTF( 1)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);146 PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount); 145 147 return; 146 148 } 147 PRINTF( 2)("drawing the requested 3D-Models if found.\n");149 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 148 150 Group* walker = this->firstGroup; 149 151 int counter = 0; … … 152 154 if (counter == groupNumber) 153 155 { 154 PRINTF( 2)("Drawing model number %i named %s\n", counter, walker->name);156 PRINTF(4)("Drawing model number %i named %s\n", counter, walker->name); 155 157 glCallList (walker->listNumber); 156 158 return; … … 159 161 walker = walker->next; 160 162 } 161 PRINTF( 1)("Model number %i in %s not Found.\n", groupNumber, this->name);163 PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->name); 162 164 return; 163 165 … … 172 174 void Model::draw (char* groupName) const 173 175 { 174 PRINTF( 2)("drawing the requested 3D-Models if found.\n");176 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 175 177 Group* walker = this->firstGroup; 176 178 while (walker != NULL) … … 178 180 if (!strcmp(walker->name, groupName)) 179 181 { 180 PRINTF( 2)("Drawing model %s\n", walker->name);182 PRINTF(4)("Drawing model %s\n", walker->name); 181 183 glCallList (walker->listNumber); 182 184 return; … … 184 186 walker = walker->next; 185 187 } 186 PRINTF( 1)("Model Named %s in %s not Found.\n", groupName, this->name);188 PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->name); 187 189 return; 188 190 } … … 204 206 bool Model::initialize (void) 205 207 { 206 PRINTF( 2)("new 3D-Model is being created\n");208 PRINTF(4)("new 3D-Model is being created\n"); 207 209 208 210 this->name = NULL; … … 243 245 bool Model::initGroup(Group* group) 244 246 { 245 PRINTF( 3)("Adding new Group\n");247 PRINTF(4)("Adding new Group\n"); 246 248 group->name = ""; 247 249 group->faceMode = -1; … … 277 279 bool Model::cleanup(void) 278 280 { 279 PRINTF( 3)("cleaning up the 3D-Model to save Memory.\n");281 PRINTF(4)("cleaning up the 3D-Model to save Memory.\n"); 280 282 281 283 if (this->vertices) … … 296 298 bool Model::cleanupGroup (Group* group) 297 299 { 298 PRINTF( 3)("Cleaning up group\n");300 PRINTF(5)("Cleaning up group\n"); 299 301 if (group->firstFace != NULL) 300 302 { … … 314 316 bool Model::cleanupFace (Face* face) 315 317 { 316 PRINTF( 3)("Cleaning up Face\n");318 PRINTF(5)("Cleaning up Face\n"); 317 319 318 320 if (face->materialString != NULL) … … 355 357 bool Model::addGroup (char* groupString) 356 358 { 357 PRINTF( 3)("Read Group: %s.\n", groupString);359 PRINTF(5)("Read Group: %s.\n", groupString); 358 360 if (this->groupCount != 0 && this->currentGroup->faceCount>0) 359 361 { … … 384 386 float subbuffer3; 385 387 sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3); 386 PRINTF( 3)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);388 PRINTF(5)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3); 387 389 this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor); 388 390 return true; … … 398 400 bool Model::addVertex(const float x, const float y, const float z) 399 401 { 400 PRINTF( 4)("reading in a vertex: %f %f %f\n", x, y, z);402 PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z); 401 403 this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*scaleFactor); 402 404 return true; … … 513 515 float subbuffer3; 514 516 sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3); 515 PRINTF( 3)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);517 PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3); 516 518 this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3); 517 519 return true; … … 544 546 float subbuffer2; 545 547 sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2); 546 PRINTF( 3)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);548 PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2); 547 549 this->vTexture->addEntry(subbuffer1); 548 550 this->vTexture->addEntry(subbuffer2); … … 610 612 if ((this->currentGroup->listNumber = glGenLists(1)) == 0) 611 613 { 612 PRINTF( 1)("list could not be created for this Model\n");614 PRINTF(2)("glList could not be created for this Model\n"); 613 615 return false; 614 616 } … … 628 630 { 629 631 tmpMat->select(); 630 PRINTF( 2)("using material %s for coming Faces.\n", tmpFace->materialString);632 PRINTF(5)("using material %s for coming Faces.\n", tmpFace->materialString); 631 633 } 632 634 else 633 PRINTF( 1)("material %s not found.\n", tmpFace->materialString);635 PRINTF(2)("material %s not found.\n", tmpFace->materialString); 634 636 635 637 … … 646 648 647 649 this->currentGroup->faceMode = 3; 648 PRINTF( 3)("found triag.\n");650 PRINTF(5)("found triag.\n"); 649 651 } 650 652 … … 658 660 } 659 661 this->currentGroup->faceMode = 4; 660 PRINTF( 3)("found quad.\n");662 PRINTF(5)("found quad.\n"); 661 663 } 662 664 … … 666 668 glEnd(); 667 669 glBegin(GL_POLYGON); 668 PRINTF( 3)("Polygon with %i faces found.", tmpFace->vertexCount);670 PRINTF(5)("Polygon with %i faces found.", tmpFace->vertexCount); 669 671 this->currentGroup->faceMode = tmpFace->vertexCount; 670 672 } … … 698 700 bool Model::addGLElement (FaceElement* elem) 699 701 { 700 PRINTF( 3)("importing grafical Element to openGL.\n");702 PRINTF(5)("importing grafical Element to openGL.\n"); 701 703 702 704 if (elem->texCoordNumber != -1) … … 721 723 { 722 724 723 PRINTF( 2)("Normals are being calculated.\n");725 PRINTF(4)("Normals are being calculated.\n"); 724 726 725 727 Vector* normArray = new Vector [vertices->getCount()/3]; … … 778 780 { 779 781 normArray[i].normalize(); 780 PRINTF( 3)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);782 PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z); 781 783 782 784 this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z); … … 881 883 //printf ("%f %f\n", vz, sin (vz)); 882 884 if (i==0.0) 883 printf("%f, %f\n", j/df*2.0*PI, cos(j/df*PI));885 PRINTF(0)("%f, %f\n", j/df*2.0*PI, cos(j/df*PI)); 884 886 } 885 887 }
Note: See TracChangeset
for help on using the changeset viewer.