From edc5ddce817244111b302e449c28a052f2746cc4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 22 Nov 2012 21:04:15 +0000 Subject: Corrected a bug in the OBJ file reader that prevented it from reading certain OBJ files, thanks to Karvajalka. --- src/model/objfile.cc | 8 +++----- 1 file 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