Handle whitespace in obj files

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@95 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2009-04-17 12:35:44 +00:00
parent f3a77d514a
commit 93f7d0322f

View File

@@ -253,6 +253,16 @@ read(std::fstream& _in, BaseImporter& _bi, Options& _opt)
return false;
}
// Trim Both leading and trailing spaces
size_t start = line.find_first_not_of(" \t");
size_t end = line.find_last_not_of(" \t");
if(( std::string::npos == start ) || ( std::string::npos == end))
line = "";
else
line = line.substr( start, end-start+1 );
// comment
if ( line.size() == 0 || line[0] == '#' || isspace(line[0]) ) {
continue;