More bugfixes from Jonathan:
- fixed material loading in OBJ importer - Bugfix: loads obj files without texture coords correctly now git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@144 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
f784382a9f
commit
b776f04251
|
@ -106,14 +106,17 @@ void ObjFileMtlImporter::load()
|
||||||
++m_DataIt;
|
++m_DataIt;
|
||||||
if (*m_DataIt == 'a') // Ambient color
|
if (*m_DataIt == 'a') // Ambient color
|
||||||
{
|
{
|
||||||
|
++m_DataIt;
|
||||||
getColorRGBA( &m_pModel->m_pCurrentMaterial->ambient );
|
getColorRGBA( &m_pModel->m_pCurrentMaterial->ambient );
|
||||||
}
|
}
|
||||||
else if (*m_DataIt == 'd') // Diffuse color
|
else if (*m_DataIt == 'd') // Diffuse color
|
||||||
{
|
{
|
||||||
|
++m_DataIt;
|
||||||
getColorRGBA( &m_pModel->m_pCurrentMaterial->diffuse );
|
getColorRGBA( &m_pModel->m_pCurrentMaterial->diffuse );
|
||||||
}
|
}
|
||||||
else if (*m_DataIt == 's')
|
else if (*m_DataIt == 's')
|
||||||
{
|
{
|
||||||
|
++m_DataIt;
|
||||||
getColorRGBA( &m_pModel->m_pCurrentMaterial->specular );
|
getColorRGBA( &m_pModel->m_pCurrentMaterial->specular );
|
||||||
}
|
}
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
|
@ -122,6 +125,7 @@ void ObjFileMtlImporter::load()
|
||||||
|
|
||||||
case 'd': // Alpha value
|
case 'd': // Alpha value
|
||||||
{
|
{
|
||||||
|
++m_DataIt;
|
||||||
getFloatValue( m_pModel->m_pCurrentMaterial->alpha );
|
getFloatValue( m_pModel->m_pCurrentMaterial->alpha );
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
}
|
}
|
||||||
|
@ -129,13 +133,25 @@ void ObjFileMtlImporter::load()
|
||||||
|
|
||||||
case 'N': // Shineness
|
case 'N': // Shineness
|
||||||
{
|
{
|
||||||
getIlluminationModel( m_pModel->m_pCurrentMaterial->illumination_model );
|
++m_DataIt;
|
||||||
|
switch(*m_DataIt)
|
||||||
|
{
|
||||||
|
case 's':
|
||||||
|
++m_DataIt;
|
||||||
|
getFloatValue(m_pModel->m_pCurrentMaterial->shineness);
|
||||||
|
break;
|
||||||
|
case 'i': //Index Of refraction
|
||||||
|
//TODO
|
||||||
|
break;
|
||||||
|
}
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case 'm': // Texture
|
case 'm': // Texture
|
||||||
{
|
{
|
||||||
|
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
||||||
getTexture();
|
getTexture();
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
}
|
}
|
||||||
|
@ -150,6 +166,8 @@ void ObjFileMtlImporter::load()
|
||||||
|
|
||||||
case 'i': // Illumination model
|
case 'i': // Illumination model
|
||||||
{
|
{
|
||||||
|
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
||||||
|
getIlluminationModel( m_pModel->m_pCurrentMaterial->illumination_model );
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -240,8 +240,10 @@ void ObjFileParser::getFace()
|
||||||
if (iPos == 0)
|
if (iPos == 0)
|
||||||
{
|
{
|
||||||
//if there are no texturecoordinates in the obj file but normals
|
//if there are no texturecoordinates in the obj file but normals
|
||||||
if (!vt && vn)
|
if (!vt && vn) {
|
||||||
iPos = 1;
|
iPos = 1;
|
||||||
|
iStep++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
iPos++;
|
iPos++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue