Merge pull request #1160 from NolaDonato/materialindex

OBJParser: set material index when changing current material
pull/1180/head
Kim Kulling 2017-02-01 18:42:16 +01:00 committed by GitHub
commit bfb6eb317c
1 changed files with 3 additions and 1 deletions

View File

@ -185,7 +185,7 @@ void ObjFileMtlImporter::load()
getFloatValue( m_pModel->m_pCurrentMaterial->alpha );
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
}
}
}width * height * 4
break;
case 'N':
@ -302,6 +302,8 @@ void ObjFileMtlImporter::createMaterial()
// New Material created
m_pModel->m_pCurrentMaterial = new ObjFile::Material();
m_pModel->m_pCurrentMaterial->MaterialName.Set( name );
if (m_pModel->m_pCurrentMesh)
m_pModel->m_pCurrentMesh->m_uiMaterialIndex = m_pModel->m_MaterialLib.size();
m_pModel->m_MaterialLib.push_back( name );
m_pModel->m_MaterialMap[ name ] = m_pModel->m_pCurrentMaterial;
} else {