The current parser for this line uses a function that will parse R G B colors, then attempts to parse an additional number if it's in the same line, which in interprets as A.
Since speculars *also* have a fourth value, but it's not alpha.
The code that parses speculars subsequently attempts to parse another number to get the shininess, but since it's already parsed, it will instead pull in the next token. In most cases, this is a texture_unit structure, which means that most materials with specular highlights will fail to parse the texture.
A typical specular line looks like:
Code: Select all
specular 0.8 0.8 0.8 5.5
Code: Select all
bool COgreMeshFileLoader::readColor(io::IReadFile* file, video::SColor& col)
{
core::stringc token;
getMaterialToken(file, token);
if (token!="vertexcolour")
{
video::SColorf col_f;
col_f.r=core::fast_atof(token.c_str());
getMaterialToken(file, token);
col_f.g=core::fast_atof(token.c_str());
getMaterialToken(file, token);
col_f.b=core::fast_atof(token.c_str());
getMaterialToken(file, token, true);
if (token.size())
col_f.a=core::fast_atof(token.c_str());
else
col_f.a=1.0f;
if ((col_f.r==0.0f)&&(col_f.g==0.0f)&&(col_f.b==0.0f))
col.set(255,255,255,255);
else
col=col_f.toSColor();
return false;
}
return true;
}
Code: Select all
else if (token=="specular")
{
pass.SpecularTokenColor=readColor(file, pass.Material.SpecularColor);
getMaterialToken(file, token);
pass.Material.Shininess=core::fast_atof(token.c_str());
}