Changeset 2794 in orxonox.OLD for orxonox/branches/importer
- Timestamp:
- Nov 10, 2004, 10:47:40 PM (20 years ago)
- Location:
- orxonox/branches/importer/importer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/importer/importer/framework.cc
r2780 r2794 15 15 glLoadIdentity(); // Reset the view 16 16 17 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix17 glMatrixMode(GL_PROJECTION); 18 18 glLoadIdentity(); 19 19 gluPerspective(45.0f,500/375,0.1f,100.0f); … … 21 21 whiteLight[1] = .5+.5*sin(rotator*10); 22 22 whiteLight[2] = .5+.5*sin(rotator*10); 23 24 GLfloat lightPosition[] = {10.0*sin(rotator*10), 10, 19.0, 0.0}; 25 glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); 26 23 27 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight); 24 28 obj->draw(); … … 46 50 obj = new Object (argv[1]); 47 51 48 GLfloat lightPosition[] = {10.0, 5.0, 19.0, 0.0};49 52 GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0}; 50 glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);51 53 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight); 52 54 glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight); -
orxonox/branches/importer/importer/object.cc
r2779 r2794 37 37 glNewList (listNumber, GL_COMPILE); 38 38 glEnableClientState (GL_VERTEX_ARRAY); 39 glEnableClientState (GL_NORMAL_ARRAY); 40 // glEnableClientState (GL_TEXTURE_COORD_ARRAY); 39 41 40 42 return true; … … 64 66 char Buffer[500]; 65 67 vertices = new Array(); 66 faces = new Array();68 normals = new Array(); 67 69 while(!OBJ_FILE->eof()) 68 70 { … … 92 94 readUseMtl (Buffer+7); 93 95 } 96 97 // case VertexNormal 98 else if (!strncmp(Buffer, "vn ", 2)) 99 { 100 readVertexNormal(Buffer+3); 101 } 102 94 103 // case vt 95 104 else if (!strncmp(Buffer, "vt ", 2)) … … 126 135 vertices->finalizeArray(); 127 136 glVertexPointer(3, GL_FLOAT, 0, vertices->getArray()); 137 normals->finalizeArray(); 138 glNormalPointer(GL_FLOAT, 0, normals->getArray()); 128 139 } 129 140 … … 134 145 char subbuffer4[20] =""; 135 146 sscanf (faceString, "%s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4); 136 // vertices->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));147 // printf("%s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3); 137 148 if (!strcmp(subbuffer4, "")) 138 149 { … … 171 182 bool Object::addGLElement (char* elementString) 172 183 { 173 char* pointTo; 174 pointTo = strstr (elementString, "/"); 175 pointTo[0] = '\0'; 176 // printf ("f: %s\n", elementString); 177 glArrayElement(atoi(elementString)-1); 178 184 char* vertex = elementString; 185 char* texture; 186 char* normal; 187 texture = strstr (vertex, "/"); 188 texture[0] = '\0'; 189 texture ++; 190 normal = strstr (texture, "/"); 191 normal[0] = '\0'; 192 normal ++; 193 194 //glArrayElement(atoi(vertex)-1); 195 glNormal3fv(normals->getArray() +(atoi(normal)-1)*3); 196 glVertex3fv(vertices->getArray() +(atoi(vertex)-1)*3); 197 198 } 199 200 bool Object::readVertexNormal (char* normalString) 201 { 202 readVertices = true; 203 char subbuffer1[20]; 204 char subbuffer2[20]; 205 char subbuffer3[20]; 206 sscanf (normalString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3); 207 // printf("%s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3); 208 normals->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3)); 209 return true; 179 210 } 180 211 … … 190 221 char Buffer[500]; 191 222 vertices = new Array(); 192 faces = new Array();193 223 material = new Material(); 194 224 Material* tmpMat = material; -
orxonox/branches/importer/importer/object.h
r2776 r2794 29 29 int verticesCount; 30 30 Array* colors; 31 Array* faces;31 Array* normals; 32 32 char* objFile; 33 33 int faceMode; … … 41 41 bool readFace (char* faceString); 42 42 bool readVT (char* vtString); 43 bool readVertexNormal (char* normalString); 43 44 bool readMtlLib (char* matFile); 44 45 bool readUseMtl (char* mtlString);
Note: See TracChangeset
for help on using the changeset viewer.