diff --git a/code/ObjFileParser.cpp b/code/ObjFileParser.cpp index a13a82e0d..5ee1b8ac1 100644 --- a/code/ObjFileParser.cpp +++ b/code/ObjFileParser.cpp @@ -14,6 +14,8 @@ namespace Assimp { +// ------------------------------------------------------------------- +const std::string ObjFileParser::DEFAULT_MATERIAL = "defaultmaterial"; // ------------------------------------------------------------------- ObjFileParser::ObjFileParser(std::vector &Data, @@ -29,8 +31,8 @@ ObjFileParser::ObjFileParser(std::vector &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_pDefaultMaterial->MaterialName.Set( DEFAULT_MATERIAL ); m_pModel->m_MaterialLib.push_back( DEFAULT_MATERIAL ); m_pModel->m_MaterialMap[ DEFAULT_MATERIAL ] = m_pModel->m_pDefaultMaterial; @@ -332,7 +334,9 @@ void ObjFileParser::getMaterialDesc() { // Not found, use default material m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial; - m_pModel->m_MaterialMap[ strName ] = m_pModel->m_pCurrentMaterial; + m_pModel->m_pCurrentMesh = new ObjFile::Mesh(); + m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh ); + m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( DEFAULT_MATERIAL ); } else { diff --git a/code/ObjFileParser.h b/code/ObjFileParser.h index 4ddf384ff..dc18bd720 100644 --- a/code/ObjFileParser.h +++ b/code/ObjFileParser.h @@ -98,6 +98,7 @@ private: void extractExtension(const std::string strFile, std::string &strExt); private: + static const std::string DEFAULT_MATERIAL;/* = "defaultmaterial";*/ //! Absolute filepath to model std::string m_strAbsPath; //! Iterator to current position in buffer