Properly build path to the mtl file when loading loading obj

This commit is contained in:
Łukasz Twarduś
2015-10-19 22:07:32 +02:00
parent 282a913b7f
commit 3274bcf8d6
2 changed files with 6 additions and 3 deletions

View File

@@ -414,7 +414,7 @@ void ObjFileParser::getFace(aiPrimitiveType type)
if ( pIndices->empty() ) {
DefaultLogger::get()->error("Obj: Ignoring empty face");
// skip line and clean up
// skip line and clean up
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
delete pNormalID;
delete pTexID;
@@ -539,7 +539,10 @@ void ObjFileParser::getMaterialLib()
const std::string strMatName(pStart, &(*m_DataIt));
std::string absName;
if ( m_pIO->StackSize() > 0 ) {
const std::string &path = m_pIO->CurrentDirectory();
std::string path = m_pIO->CurrentDirectory();
if ( '/' != *path.rbegin() ) {
path += '/';
}
absName = path + strMatName;
} else {
absName = strMatName;