BUGFIX: Add defaultmaterial to obj-model data structure, when no materials are loaded
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@58 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
e834a044db
commit
d6fc5de7d5
|
@ -29,6 +29,11 @@ ObjFileParser::ObjFileParser(std::vector<char> &Data,
|
|||
m_pModel = new ObjFile::Model();
|
||||
m_pModel->m_ModelName = strModelName;
|
||||
|
||||
const std::string DEFAULT_MATERIAL = "defaultmaterial";
|
||||
m_pModel->m_pDefaultMaterial = new ObjFile::Material();
|
||||
m_pModel->m_MaterialLib.push_back( DEFAULT_MATERIAL );
|
||||
m_pModel->m_MaterialMap[ DEFAULT_MATERIAL ] = m_pModel->m_pDefaultMaterial;
|
||||
|
||||
// Start parsing the file
|
||||
parseFile();
|
||||
}
|
||||
|
@ -288,6 +293,11 @@ void ObjFileParser::getFace()
|
|||
m_pModel->m_pCurrent->m_Faces.push_back(face);
|
||||
|
||||
// Assign face to mesh
|
||||
if ( NULL == m_pModel->m_pCurrentMesh )
|
||||
{
|
||||
m_pModel->m_pCurrentMesh = new ObjFile::Mesh();
|
||||
m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh );
|
||||
}
|
||||
m_pModel->m_pCurrentMesh->m_Faces.push_back( face );
|
||||
|
||||
// Skip the rest of the line
|
||||
|
|
Loading…
Reference in New Issue