Changeset 3909 in orxonox.OLD for orxonox/trunk/src/lib/graphics/importer/objModel.cc
- Timestamp:
- Apr 21, 2005, 12:27:19 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/objModel.cc
r3908 r3909 23 23 24 24 #define PARSELINELENGTH 8192 25 26 #include <fstream>27 25 28 26 #include "debug.h" … … 69 67 this->objFileName = NULL; 70 68 this->mtlFileName = NULL; 71 72 this->initialize();73 69 } 74 70 … … 135 131 char readLine[PARSELINELENGTH]; 136 132 char buffer[PARSELINELENGTH]; 137 int i = 0;138 133 while(fgets(readLine, PARSELINELENGTH, stream)) 139 134 { 140 135 strcpy(buffer, readLine); 141 i++;142 136 // case vertice 143 137 if (!strncmp(buffer, "v ", 2)) … … 206 200 207 201 208 PRINTF(4)("Opening mtlFile: %s\n", fileName); 209 210 ifstream* MTL_FILE = new ifstream (fileName); 211 if (MTL_FILE->fail()) 212 { 213 PRINTF(2)("unable to open file: %s\n", fileName); 214 MTL_FILE->close(); 215 delete []fileName; 216 delete MTL_FILE; 202 FILE* stream; 203 if( (stream = fopen (fileName, "r")) == NULL) 204 { 205 printf("IniParser could not open %s\n", fileName); 217 206 return false; 218 207 } 219 char buffer[500]; 208 209 char readLine[PARSELINELENGTH]; 210 char buffer[PARSELINELENGTH]; 220 211 Material* tmpMat = material; 221 while(!MTL_FILE->eof()) 222 { 223 MTL_FILE->getline(buffer, 500); 212 while(fgets(readLine, PARSELINELENGTH, stream)) 213 { 224 214 PRINTF(5)("found line in mtlFile: %s\n", buffer); 225 226 215 227 216 // create new Material … … 286 275 287 276 } 288 MTL_FILE->close();277 fclose(stream); 289 278 delete []fileName; 290 delete MTL_FILE;291 279 return true; 292 280 }
Note: See TracChangeset
for help on using the changeset viewer.