OBJParser: set material index when changing current material

When a new material is parsed from the material library, the name of the current material is set but the old material index remains. This leaves an incorrect material index in the current mesh causing textures to not be associated with the right mesh. This patch updates the material index when changing the material name.

submitted by: Nola Donato nola.donato@samsung.com
pull/1160/head
nola.donato@samsung.com 2017-01-30 20:32:37 -08:00
parent a046268a67
commit fc4243a08f
1 changed files with 1 additions and 0 deletions

View File

@ -302,6 +302,7 @@ void ObjFileMtlImporter::createMaterial()
// New Material created
m_pModel->m_pCurrentMaterial = new ObjFile::Material();
m_pModel->m_pCurrentMaterial->MaterialName.Set( name );
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 {