Changeset 4106 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- May 7, 2005, 4:26:35 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/model.cc
r4038 r4106 140 140 this->currentGroup = this->firstGroup = new ModelGroup; 141 141 this->groupCount = 0; 142 this->vertexCount = 0; 143 this->normalCount = 0; 144 this->texCoordCount = 0; 142 145 143 146 this->scaleFactor = 1; … … 355 358 Material* Model::addMaterial(const char* materialName) 356 359 { 357 358 360 Material* newMat = new Material(); 359 361 newMat->setName(materialName); … … 424 426 PRINTF(5)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3); 425 427 this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor); 428 this->vertexCount++; 426 429 return true; 427 430 } … … 438 441 PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z); 439 442 this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*scaleFactor); 443 this->vertexCount++; 440 444 return true; 441 445 } … … 455 459 PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3); 456 460 this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3); 461 this->normalCount++; 457 462 return true; 458 463 } … … 470 475 PRINTF(5)("found vertex-Normal %f, %f, %f\n", x, y, z); 471 476 this->normals->addEntry(x, y, z); 477 this->normalCount++; 478 return true; 472 479 } 473 480 … … 487 494 this->vTexture->addEntry(subbuffer1); 488 495 this->vTexture->addEntry(subbuffer2); 496 this->texCoordCount++; 489 497 return true; 490 498 } … … 502 510 this->vTexture->addEntry(u); 503 511 this->vTexture->addEntry(v); 512 this->texCoordCount++; 513 return true; 504 514 } 505 515 … … 583 593 for (int i = 0; i < faceElemCount; i++) 584 594 { 585 if (this->currentGroup->currentFace->vertexCount >0)595 if (this->currentGroup->currentFace->vertexCount > 0) 586 596 tmpElem = tmpElem->next = new ModelFaceElement; 587 597 … … 592 602 tmpElem->normalNumber = va_arg(itemlist, int) -1; 593 603 this->currentGroup->currentFace->vertexCount++; 604 605 if (unlikely(tmpElem->vertexNumber > this->vertexCount)) 606 PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->vertexNumber, this->vertexCount); 607 if (unlikely(tmpElem->normalNumber > this->normalCount)) 608 PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->normalNumber, this->normalCount); 609 if (unlikely(tmpElem->texCoordNumber > this->texCoordCount)) 610 PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->texCoordNumber, this->texCoordCount); 594 611 } 595 612 va_end(itemlist); -
orxonox/trunk/src/lib/graphics/importer/model.h
r4038 r4106 99 99 bool finalized; //!< Sets the Object to be finalized. 100 100 101 int vertexCount; //!< A modelwide Counter for vertices. 102 int normalCount; //!< A modelwide Counter for the normals. 103 int texCoordCount; //!< A modelwide Counter for the texCoord. 101 104 Array* vertices; //!< The Array that handles the Vertices. 102 int verticesCount; //!< A global Counter for vertices.103 105 Array* normals; //!< The Array that handles the Normals. 104 106 Array* vTexture; //!< The Array that handles the VertexTextureCoordinates. … … 158 160 bool setMaterial(Material* mtl); 159 161 void finalize(void); 162 163 /** \returns The number of Vertices of the Model */ 164 inline int getVertexCount(void) const {return this->vertexCount;} 165 /** \returns The number of Normals of the Model */ 166 inline int getNormalCount(void) const {return this->normalCount;} 167 /** \returns The number of Texture Coordinates of the Model*/ 168 inline int getTexCoordCount(void) const {return this->texCoordCount;} 160 169 }; 161 170
Note: See TracChangeset
for help on using the changeset viewer.