Changeset 3400 in orxonox.OLD for orxonox/trunk/src/importer/model.cc
- Timestamp:
- Feb 7, 2005, 12:34:47 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/importer/model.cc
r3398 r3400 15 15 16 16 #include "model.h" 17 #include <math.h> 17 18 18 19 using namespace std; … … 39 40 this->initialize(); 40 41 41 if (type == CUBE) 42 this->BoxModel(); 43 42 switch (type) 43 { 44 default: 45 case CUBE: 46 this->cubeModel(); 47 break; 48 case SPHERE: 49 break; 50 case CYLINDER: 51 break; 52 53 } 44 54 this->importToGL (); 45 55 … … 369 379 370 380 /** 381 \brief parses a vertex-String 382 \param x the X-coordinate of the Vertex to add. 383 \param y the Y-coordinate of the Vertex to add. 384 \param z the Z-coordinate of the Vertex to add. 385 386 */ 387 bool Model::addVertex(const float x, const float y, const float z) 388 { 389 PRINTF(4)("reading in a vertex: %f %f %f\n", x, y, z); 390 this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*scaleFactor); 391 return true; 392 } 393 394 /** 371 395 \brief parses a face-string 372 396 \param faceString The String that will be parsed. 373 397 374 398 If a face line is found this function will add it to the glList. 375 The function makes a difference between QUADS and TRIANGLES, and will if changed re-open, set and re-close the gl-processe.376 399 */ 377 400 bool Model::addFace (char* faceString) … … 433 456 434 457 /** 458 \brief imports a new Face. 459 \param faceElemCount The Cout of Vertices this Face has. 460 \param ... The Elements by number. 461 462 \todo hmmpf... this also has to parse normals and vertices... sounds like stress... 463 */ 464 bool Model::addFace(const float faceElemCount, ...) 465 { 466 // TODO 467 468 } 469 470 /** 435 471 \brief parses a vertexNormal-String 436 472 \param normalString The String that will be parsed. … … 450 486 451 487 /** 488 \brief adds a VertexNormal. 489 \param x The x coordinate of the Normal. 490 \param y The y coordinate of the Normal. 491 \param z The z coordinate of the Normal. 492 493 If a vertexNormal line is found this function will inject it into the vertexNormal-Array 494 */ 495 bool Model::addVertexNormal(const float x, const float y, const float z) 496 { 497 PRINTF(3)("found vertex-Normal %f, %f, %f\n", x, y, z); 498 this->normals->addEntry(x, y, z); 499 } 500 501 /** 452 502 \brief parses a vertexTextureCoordinate-String 453 503 \param vTextureString The String that will be parsed. … … 465 515 this->vTexture->addEntry(subbuffer2); 466 516 return true; 517 } 518 519 /** 520 \brief adds a Texture Coordinate 521 \param u The u coordinate of the TextureCoordinate. 522 \param v The y coordinate of the TextureCoordinate. 523 524 If a TextureCoordinate line is found this function will inject it into the TextureCoordinate-Array 525 */ 526 bool Model::addVertexTexture(const float u, const float v) 527 { 528 PRINTF(3)("found vertex-Texture %f, %f\n", u, v); 529 this->vTexture->addEntry(u); 530 this->vTexture->addEntry(v); 467 531 } 468 532 … … 696 760 This will inject a Cube, because this is the most basic model. 697 761 */ 698 void Model:: BoxModel(void)762 void Model::cubeModel(void) 699 763 { 700 764 this->addVertex ("-0.5 -0.5 0.5"); … … 764 828 765 829 } 830 831 832 void Model::cylinderModel() 833 { 834 int detailLevel = 10; 835 float size; 836 for (int i = 0; i < detailLevel; i++) 837 { 838 this->addVertex(sin((float)i/detailLevel), -size/2, cos((float)i/detailLevel)); 839 } 840 }
Note: See TracChangeset
for help on using the changeset viewer.