Support lowercase 'ns' and 'ni' obj material tokens
Previously, the obj material parser would interpret all key tokens starting with 'n' as 'newmtl' tokens. However, there are other tokens that can start with 'n', namely 'ns' and 'ni' for material properties. Make the parser robust to such cases, despite their canonical forms being uppercase. Resolves #410.pull/413/head
parent
94f61300c2
commit
c7b6b5ea2f
|
@ -166,26 +166,28 @@ void ObjFileMtlImporter::load()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N': // Shineness
|
case 'N':
|
||||||
|
case 'n':
|
||||||
{
|
{
|
||||||
++m_DataIt;
|
++m_DataIt;
|
||||||
switch(*m_DataIt)
|
switch(*m_DataIt)
|
||||||
{
|
{
|
||||||
case 's':
|
case 's': // Specular exponent
|
||||||
++m_DataIt;
|
++m_DataIt;
|
||||||
getFloatValue(m_pModel->m_pCurrentMaterial->shineness);
|
getFloatValue(m_pModel->m_pCurrentMaterial->shineness);
|
||||||
break;
|
break;
|
||||||
case 'i': //Index Of refraction
|
case 'i': // Index Of refraction
|
||||||
++m_DataIt;
|
++m_DataIt;
|
||||||
getFloatValue(m_pModel->m_pCurrentMaterial->ior);
|
getFloatValue(m_pModel->m_pCurrentMaterial->ior);
|
||||||
break;
|
break;
|
||||||
|
case 'e': // New material
|
||||||
|
createMaterial();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 'm': // Texture
|
case 'm': // Texture
|
||||||
case 'b': // quick'n'dirty - for 'bump' sections
|
case 'b': // quick'n'dirty - for 'bump' sections
|
||||||
{
|
{
|
||||||
|
@ -194,13 +196,6 @@ void ObjFileMtlImporter::load()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n': // New material name
|
|
||||||
{
|
|
||||||
createMaterial();
|
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'i': // Illumination model
|
case 'i': // Illumination model
|
||||||
{
|
{
|
||||||
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
||||||
|
|
Loading…
Reference in New Issue