Fixed OBJ reader not reading materials which start with a leading space
This commit is contained in:
@@ -188,23 +188,24 @@ read_material(std::fstream& _in)
|
||||
|
||||
stream >> keyWrd;
|
||||
|
||||
if( ( isspace(line[0]) && line[0] != '\t' ) || line[0] == '#' )
|
||||
if (keyWrd == "newmtl") // begin new material definition
|
||||
{
|
||||
// If we are in a material definition (Already reading a material)
|
||||
// And a material name has been set
|
||||
// And the current material definition is valid
|
||||
// Then Store the current material in our lookup table
|
||||
if (indef && !key.empty() && mat.is_valid())
|
||||
{
|
||||
materials_[key] = mat;
|
||||
mat.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
else if (keyWrd == "newmtl") // begin new material definition
|
||||
{
|
||||
stream >> key;
|
||||
indef = true;
|
||||
}
|
||||
|
||||
else if (keyWrd == "Kd") // diffuse color
|
||||
{
|
||||
{
|
||||
stream >> f1; stream >> f2; stream >> f3;
|
||||
|
||||
if( !stream.fail() )
|
||||
|
||||
Reference in New Issue
Block a user