diff options
author | Stijn Buys <ingar@osirion.org> | 2012-11-22 21:04:15 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-11-22 21:04:15 +0000 |
commit | edc5ddce817244111b302e449c28a052f2746cc4 (patch) | |
tree | fb58a102cdae3c5729245c6671b1f2b3c3c76088 /src/model | |
parent | 43b435c8488501d62fb15940eb551db30db3b898 (diff) |
Corrected a bug in the OBJ file reader that prevented it from reading certain OBJ files, thanks to Karvajalka.
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/objfile.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/model/objfile.cc b/src/model/objfile.cc index 56d3692..489da2c 100644 --- a/src/model/objfile.cc +++ b/src/model/objfile.cc @@ -121,7 +121,7 @@ bool OBJFile::read() con_warn << objfile_name << " invalid material definition at line " << index_line << std::endl; - } else if( word.compare("v") == 0) { /* New wertex */ + } else if( word.compare("v") == 0) { /* new wertex */ float x, y, z; line >> x >> y >> z; @@ -145,7 +145,7 @@ bool OBJFile::read() obj_normallist[obj_normalcount] = nm; obj_normalcount++; - } else if( word.compare("f") == 0) { /* Face/Polygon */ + } else if( word.compare("f") == 0) { /* face/polygon */ size_t v[4]; size_t uv[4]; size_t vn[4]; @@ -167,9 +167,7 @@ bool OBJFile::read() have_uv[i] = 0; std::string point; - tmp >> point; - - if(point.compare(" ") == 0) //bordercase for space at end of face definition + if (!(tmp >> point)) // bordercase for space at end of face definition continue; for(size_t c=0; c<point.length(); c++) { |