Improved reader for textureMaps. Now ignoring empty testure definitions.
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@124 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -69,8 +69,8 @@ _OBJReader_& OBJReader() { return __OBJReaderInstance; }
|
|||||||
void trimString( std::string& _string) {
|
void trimString( std::string& _string) {
|
||||||
// Trim Both leading and trailing spaces
|
// Trim Both leading and trailing spaces
|
||||||
|
|
||||||
size_t start = _string.find_first_not_of(" \t");
|
size_t start = _string.find_first_not_of(" \t\r\n");
|
||||||
size_t end = _string.find_last_not_of(" \t");
|
size_t end = _string.find_last_not_of(" \t\r\n");
|
||||||
|
|
||||||
if(( std::string::npos == start ) || ( std::string::npos == end))
|
if(( std::string::npos == start ) || ( std::string::npos == end))
|
||||||
_string = "";
|
_string = "";
|
||||||
@@ -215,10 +215,12 @@ read_material(std::fstream& _in)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (keyWrd == "map_Kd" ) {
|
else if (keyWrd == "map_Kd" ) {
|
||||||
// Get the rest of the line, removeing leading or trailing spaces
|
// Get the rest of the line, removing leading or trailing spaces
|
||||||
|
// This will define the filename of the texture
|
||||||
std::getline(stream,textureName);
|
std::getline(stream,textureName);
|
||||||
trimString(textureName);
|
trimString(textureName);
|
||||||
mat.set_map_Kd( textureName, textureId++ );
|
if ( ! textureName.empty() )
|
||||||
|
mat.set_map_Kd( textureName, textureId++ );
|
||||||
}
|
}
|
||||||
else if (keyWrd == "Tr") // transparency value
|
else if (keyWrd == "Tr") // transparency value
|
||||||
{
|
{
|
||||||
@@ -316,7 +318,6 @@ read(std::fstream& _in, BaseImporter& _bi, Options& _opt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mat.has_map_Kd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// usemtl
|
// usemtl
|
||||||
|
|||||||
Reference in New Issue
Block a user