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.compull/1160/head
parent
a046268a67
commit
fc4243a08f
|
@ -302,6 +302,7 @@ void ObjFileMtlImporter::createMaterial()
|
||||||
// New Material created
|
// New Material created
|
||||||
m_pModel->m_pCurrentMaterial = new ObjFile::Material();
|
m_pModel->m_pCurrentMaterial = new ObjFile::Material();
|
||||||
m_pModel->m_pCurrentMaterial->MaterialName.Set( name );
|
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_MaterialLib.push_back( name );
|
||||||
m_pModel->m_MaterialMap[ name ] = m_pModel->m_pCurrentMaterial;
|
m_pModel->m_MaterialMap[ name ] = m_pModel->m_pCurrentMaterial;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue