Changeset 9830 in orxonox.OLD for branches/new_class_id/src/lib/graphics/importer/static_model_data.cc
- Timestamp:
- Sep 26, 2006, 2:54:38 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/importer/static_model_data.cc
r9829 r9830 555 555 * @param type The information Passed with each Vertex 556 556 */ 557 bool StaticModelData::addFace(int faceElemCount, VERTEX_FORMAT type, ...)557 bool StaticModelData::addFace(int faceElemCount, VERTEX_FORMAT type, va_list args) 558 558 { 559 559 if (this->currentGroup->faceCount > 0) … … 562 562 ModelFaceElement* tmpElem = this->currentGroup->currentFace->firstElem = new ModelFaceElement; 563 563 564 va_list itemlist;565 va_start (itemlist, type);566 567 564 for (int i = 0; i < faceElemCount; i++) 568 565 { … … 570 567 tmpElem = tmpElem->next = new ModelFaceElement; 571 568 572 tmpElem->vertexNumber = va_arg ( itemlist, int);569 tmpElem->vertexNumber = va_arg (args, int); 573 570 if (type & TEXCOORD) 574 tmpElem->texCoordNumber = va_arg ( itemlist, int);571 tmpElem->texCoordNumber = va_arg (args, int); 575 572 if (type & NORMAL) 576 tmpElem->normalNumber = va_arg( itemlist, int);573 tmpElem->normalNumber = va_arg(args, int); 577 574 this->currentGroup->currentFace->vertexCount++; 578 575 } 579 va_end(itemlist);580 576 581 577 this->currentGroup->faceCount += this->currentGroup->currentFace->vertexCount - 2; … … 846 842 847 843 /* allocate memory for the new triangle structures */ 848 this->triangles.res erve(numTriangles);844 this->triangles.resize(numTriangles); 849 845 850 846 /* now iterate through all groups and build up the triangle list */ … … 951 947 return true; 952 948 } 953 954 /**955 * Includes a default model956 957 This will inject a Cube, because this is the most basic model.958 */959 void StaticModelData::cubeModel()960 {961 this->addVertex (-0.5, -0.5, 0.5);962 this->addVertex (0.5, -0.5, 0.5);963 this->addVertex (-0.5, 0.5, 0.5);964 this->addVertex (0.5, 0.5, 0.5);965 this->addVertex (-0.5, 0.5, -0.5);966 this->addVertex (0.5, 0.5, -0.5);967 this->addVertex (-0.5, -0.5, -0.5);968 this->addVertex (0.5, -0.5, -0.5);969 970 this->addVertexTexture (0.0, 0.0);971 this->addVertexTexture (1.0, 0.0);972 this->addVertexTexture (0.0, 1.0);973 this->addVertexTexture (1.0, 1.0);974 this->addVertexTexture (0.0, 2.0);975 this->addVertexTexture (1.0, 2.0);976 this->addVertexTexture (0.0, 3.0);977 this->addVertexTexture (1.0, 3.0);978 this->addVertexTexture (0.0, 4.0);979 this->addVertexTexture (1.0, 4.0);980 this->addVertexTexture (2.0, 0.0);981 this->addVertexTexture (2.0, 1.0);982 this->addVertexTexture (-1.0, 0.0);983 this->addVertexTexture (-1.0, 1.0);984 985 this->addVertexNormal (0.0, 0.0, 1.0);986 this->addVertexNormal (0.0, 0.0, 1.0);987 this->addVertexNormal (0.0, 0.0, 1.0);988 this->addVertexNormal (0.0, 0.0, 1.0);989 this->addVertexNormal (0.0, 1.0, 0.0);990 this->addVertexNormal (0.0, 1.0, 0.0);991 this->addVertexNormal (0.0, 1.0, 0.0);992 this->addVertexNormal (0.0, 1.0, 0.0);993 this->addVertexNormal (0.0, 0.0, -1.0);994 this->addVertexNormal (0.0, 0.0, -1.0);995 this->addVertexNormal (0.0, 0.0, -1.0);996 this->addVertexNormal (0.0, 0.0, -1.0);997 this->addVertexNormal (0.0, -1.0, 0.0);998 this->addVertexNormal (0.0, -1.0, 0.0);999 this->addVertexNormal (0.0, -1.0, 0.0);1000 this->addVertexNormal (0.0, -1.0, 0.0);1001 this->addVertexNormal (1.0, 0.0, 0.0);1002 this->addVertexNormal (1.0, 0.0, 0.0);1003 this->addVertexNormal (1.0, 0.0, 0.0);1004 this->addVertexNormal (1.0, 0.0, 0.0);1005 this->addVertexNormal (-1.0, 0.0, 0.0);1006 this->addVertexNormal (-1.0, 0.0, 0.0);1007 this->addVertexNormal (-1.0, 0.0, 0.0);1008 this->addVertexNormal (-1.0, 0.0, 0.0);1009 1010 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,1, 3,3,2, 2,2,3);1011 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,2,4, 3,3,5, 5,5,6, 4,4,7);1012 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,4,8, 5,5,9, 7,7,10, 6,6,11);1013 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,6,12, 7,7,13, 1,9,14, 0,8,15);1014 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,16, 7,10,17, 5,11,18, 3,3,19);1015 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,12,20, 0,0,21, 2,2,22, 4,13,23);1016 }
Note: See TracChangeset
for help on using the changeset viewer.