Changeset 4112 in orxonox.OLD for orxonox/trunk/src/lib/graphics/importer
- Timestamp:
- May 7, 2005, 6:19:59 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/framework.cc
r3910 r4112 79 79 obj = new OBJModel(argv[1]); 80 80 else 81 obj = new PrimitiveModel( SPHERE);81 obj = new PrimitiveModel(CYLINDER); 82 82 83 83 M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0); -
orxonox/trunk/src/lib/graphics/importer/model.cc
r4110 r4112 523 523 524 524 If a face line is found this function will add it to the glList. 525 526 String is different from the argument addFace, in this that the first Vertex/Normal/Texcoord is 1 instead of 0 525 527 */ 526 528 bool Model::addFace (const char* faceString) … … 577 579 \brief adds a new Face 578 580 \param faceElemCount the number of Vertices to add to the Face. 579 \param type 0: vertex only, 1: vertex and normal, 2: vertex and Texture, 3 vertex, normal and texture581 \param type The information Passed with each Vertex 580 582 */ 581 583 bool Model::addFace(int faceElemCount, VERTEX_FORMAT type, ...) … … 594 596 tmpElem = tmpElem->next = new ModelFaceElement; 595 597 596 tmpElem->vertexNumber = va_arg (itemlist, int) -1;598 tmpElem->vertexNumber = va_arg (itemlist, int); 597 599 if (type & TEXCOORD) 598 tmpElem->texCoordNumber = va_arg (itemlist, int) -1;600 tmpElem->texCoordNumber = va_arg (itemlist, int); 599 601 if (type & NORMAL) 600 tmpElem->normalNumber = va_arg(itemlist, int) -1;602 tmpElem->normalNumber = va_arg(itemlist, int); 601 603 this->currentGroup->currentFace->vertexCount++; 602 604 } … … 924 926 this->addVertexNormal (-1.0, 0.0, 0.0); 925 927 926 /* normaleLess-testingMode 927 this->addFace ("1 2 4 3"); 928 this->addFace ("3 4 6 5"); 929 this->addFace ("5 6 8 7"); 930 this->addFace ("7 8 2 1"); 931 this->addFace ("2 8 6 4"); 932 this->addFace ("7 1 3 5"); 933 */ 934 935 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,1, 2,2,2, 4,4,3, 3,3,4); 936 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 3,3,5, 4,4,6, 6,6,7, 5,5,8); 937 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 5,5,9, 6,6,10, 8,8,11, 7,7,12); 938 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,7,13, 8,8,14, 2,10,15, 1,9,16); 939 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,2,17, 8,11,18, 6,12,19, 4,4,20); 940 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,13,21, 1,1,22, 3,3,23, 5,14,24); 941 942 } 928 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,1, 3,3,2, 2,2,3); 929 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,2,4, 3,3,5, 5,5,6, 4,4,7); 930 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,4,8, 5,5,9, 7,7,10, 6,6,11); 931 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,6,12, 7,7,13, 1,9,14, 0,8,15); 932 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,16, 7,10,17, 5,11,18, 3,3,19); 933 this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,12,20, 0,0,21, 2,2,22, 4,13,23); 934 935 } -
orxonox/trunk/src/lib/graphics/importer/primitive_model.cc
r3911 r4112 71 71 void PrimitiveModel::sphereModel(float size, unsigned int detail) 72 72 { 73 int vertexCount = 0;74 73 if (detail <= 0) 75 74 detail = 1; … … 89 88 size * sin(vi) * cos(vj)); 90 89 this->addVertexTexture(i / (df *2.0), (j-1.0)/(df)+.5); 91 vertexCount++;92 90 } 93 91 } 94 92 this->addVertex(0, -size, 0); 93 this->addVertexTexture(0,0); 95 94 this->addVertex(0, size, 0); 95 this->addVertexTexture(0 ,1); 96 96 97 97 // defining the binding Faces. … … 102 102 { 103 103 104 v1 = i*detail + j ;105 v4 = i*detail + (j+1);104 v1 = i*detail + j-1; 105 v4 = i*detail + j; 106 106 107 107 if (i == detail*2 -1) 108 108 { 109 v2 = j ;110 v3 = j +1;109 v2 = j-1; 110 v3 = j; 111 111 } 112 112 else 113 113 { 114 v2 = (i+1)*detail + j ;115 v3 = (i+1)*detail + (j+1);116 } 117 114 v2 = (i+1)*detail + j-1; 115 v3 = (i+1)*detail + j; 116 } 117 118 118 if (j == 0) 119 119 { 120 v1 = vertexCount+1;120 v1 = this->getVertexCount()-2; 121 121 this->addFace(3, VERTEX_TEXCOORD, v1, v1, v3, v3, v4, v4); 122 122 } 123 123 else if (j == detail) 124 124 { 125 v3 = vertexCount+2;125 v3 = this->getVertexCount()-1; 126 126 this->addFace(3, VERTEX_TEXCOORD, v1, v1, v2, v2, v3, v3); 127 127 } … … 157 157 { 158 158 int p1, p2, p3, p4; 159 p1 = 2*i +1;160 p2 = 2*i+ 2;161 p3 = 2*i+ 4;162 p4 = 2*i+ 3;159 p1 = 2*i; 160 p2 = 2*i+1; 161 p3 = 2*i+3; 162 p4 = 2*i+2; 163 163 // something is wrong here 164 164 this->addFace(4, VERTEX_ONLY, p1, p2, p3, p4); 165 this->addFace(3, VERTEX_ONLY, p4, p1, 2*detail +1);166 this->addFace(3, VERTEX_ONLY, p2, p3, 2*detail+ 2);165 this->addFace(3, VERTEX_ONLY, p4, p1, 2*detail); 166 this->addFace(3, VERTEX_ONLY, p2, p3, 2*detail+1); 167 167 } 168 168 // caps 169 this->addFace(4, VERTEX_ONLY, 2*detail- 1, 2*detail, 2, 1);170 this->addFace(3, VERTEX_ONLY, 1, 2*detail-1, 2*detail+1);171 this->addFace(3, VERTEX_ONLY, 2*detail , 2, 2*detail+2);169 this->addFace(4, VERTEX_ONLY, 2*detail-2, 2*detail-1, 1, 0); 170 this->addFace(3, VERTEX_ONLY, 0, 2*detail-2, 2*detail); 171 this->addFace(3, VERTEX_ONLY, 2*detail-1, 1, 2*detail+1); 172 172 } 173 173 … … 198 198 { 199 199 unsigned int v1, v2; 200 v1 = i+ 3;200 v1 = i+2; 201 201 if (i == detail -1) 202 v2 = 3;202 v2 = 2; 203 203 else 204 v2 = i+ 4;205 this->addFace(3, VERTEX_ONLY, 1, v1, v2);206 this->addFace(3, VERTEX_ONLY, 2, v1, v2);204 v2 = i+3; 205 this->addFace(3, VERTEX_ONLY, 0, v1, v2); 206 this->addFace(3, VERTEX_ONLY, 1, v1, v2); 207 207 } 208 208 } … … 228 228 unsigned int v1, v2, v3, v4; 229 229 for (int i = 0; i < detail-1; i++) 230 for (int j = 1; j < detail; j++)230 for (int j = 0; j < detail-1; j++) 231 231 { 232 232 v1 = i*detail + j;
Note: See TracChangeset
for help on using the changeset viewer.