Changeset 2757 in orxonox.OLD for orxonox/branches/importer
- Timestamp:
- Nov 9, 2004, 1:11:17 AM (20 years ago)
- Location:
- orxonox/branches/importer/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/importer/importer/object.cc
r2755 r2757 1 1 #include "object.h" 2 #include <iostream.h> 2 3 3 Object::Object () 4 4 { 5 this->readFromObjFile (" test");5 this->readFromObjFile ("cube.obj"); 6 6 7 7 glEnableClientState (GL_VERTEX_ARRAY); … … 19 19 20 20 21 /*22 glVertex3f(0,0,0);23 glVertex3f(0,1,0);24 glVertex3f(1,0,0);25 */26 21 glEnd(); 27 22 glEndList(); … … 39 34 bool Object::readFromObjFile (char* fileName) 40 35 { 41 vertices = new Array(2000); 42 vertices->addEntry(0,0,0); 43 vertices->addEntry(0,1,0); 44 vertices->addEntry(1,0,1); 45 vertices->finalizeArray(); 46 47 36 if ( (OBJ_FILE = fopen (fileName, "r")) == NULL) 37 { 38 printf ("file: %s not found.\n", fileName); 39 return false; 40 } 41 else 42 { 43 char Buffer[10]; 44 vertices = new Array(); 45 46 while (fscanf (OBJ_FILE, "%s", Buffer) != EOF) 47 { 48 printf ("%s\n",Buffer); 48 49 49 return true; 50 // case we read it is a vertex 51 if (!strcmp (Buffer, "v")) 52 { 53 for (int i=0; i<=2;i++) 54 { 55 fscanf (OBJ_FILE, "%s", Buffer); 56 printf ("float: %f\n", atof(Buffer)); 57 vertices->addEntry(atof(Buffer)); 58 } 59 } 60 } 61 // vertices->addEntry(0,0,0); 62 // vertices->addEntry(0,1,0); 63 // vertices->addEntry(1,0,1); 64 vertices->finalizeArray(); 65 for (int i=0;i<=10;i++) 66 printf("%f\n",vertices->getArray()[i]); 67 fclose (OBJ_FILE); 68 return true; 69 } 50 70 } -
orxonox/branches/importer/importer/object.h
r2754 r2757 18 18 int verticesCount; 19 19 Array* colors; 20 20 FILE* OBJ_FILE; 21 FILE* MTL_FILE; 21 22 22 23
Note: See TracChangeset
for help on using the changeset viewer.