git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@160 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
parent
7d665832f6
commit
23ec92092a
|
@ -45,6 +45,9 @@ ObjFileParser::ObjFileParser(std::vector<char> &Data,
|
||||||
ObjFileParser::~ObjFileParser()
|
ObjFileParser::~ObjFileParser()
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
|
if(m_pModel->m_pDefaultMaterial) delete m_pModel->m_pDefaultMaterial;
|
||||||
|
if(m_pModel) delete m_pModel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
@ -223,6 +226,9 @@ void ObjFileParser::getFace()
|
||||||
std::vector<unsigned int> *pIndices = new std::vector<unsigned int>;
|
std::vector<unsigned int> *pIndices = new std::vector<unsigned int>;
|
||||||
std::vector<unsigned int> *pTexID = new std::vector<unsigned int>;
|
std::vector<unsigned int> *pTexID = new std::vector<unsigned int>;
|
||||||
std::vector<unsigned int> *pNormalID = new std::vector<unsigned int>;
|
std::vector<unsigned int> *pNormalID = new std::vector<unsigned int>;
|
||||||
|
bool hasNormal = false;
|
||||||
|
|
||||||
|
|
||||||
bool vt = (!m_pModel->m_TextureCoord.empty());
|
bool vt = (!m_pModel->m_TextureCoord.empty());
|
||||||
bool vn = (!m_pModel->m_Normals.empty());
|
bool vn = (!m_pModel->m_Normals.empty());
|
||||||
int iStep = 0, iPos = 0;
|
int iStep = 0, iPos = 0;
|
||||||
|
@ -273,6 +279,7 @@ void ObjFileParser::getFace()
|
||||||
else if ( 2 == iPos )
|
else if ( 2 == iPos )
|
||||||
{
|
{
|
||||||
pNormalID->push_back( iVal-1 );
|
pNormalID->push_back( iVal-1 );
|
||||||
|
hasNormal = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -310,7 +317,9 @@ void ObjFileParser::getFace()
|
||||||
m_pModel->m_pCurrentMesh->m_Faces.push_back( face );
|
m_pModel->m_pCurrentMesh->m_Faces.push_back( face );
|
||||||
m_pModel->m_pCurrentMesh->m_uiNumIndices += (unsigned int)face->m_pVertices->size();
|
m_pModel->m_pCurrentMesh->m_uiNumIndices += (unsigned int)face->m_pVertices->size();
|
||||||
m_pModel->m_pCurrentMesh->m_uiUVCoordinates[ 0 ] += (unsigned int)face->m_pTexturCoords[0].size();
|
m_pModel->m_pCurrentMesh->m_uiUVCoordinates[ 0 ] += (unsigned int)face->m_pTexturCoords[0].size();
|
||||||
|
if(!m_pModel->m_pCurrentMesh->m_hasNormals && hasNormal) {
|
||||||
|
m_pModel->m_pCurrentMesh->m_hasNormals = true;
|
||||||
|
}
|
||||||
// Skip the rest of the line
|
// Skip the rest of the line
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
}
|
}
|
||||||
|
@ -330,7 +339,7 @@ void ObjFileParser::getMaterialDesc()
|
||||||
|
|
||||||
// Get name
|
// Get name
|
||||||
std::string strName(pStart, &(*m_DataIt));
|
std::string strName(pStart, &(*m_DataIt));
|
||||||
if ( strName.empty() )
|
if ( strName.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Search for material
|
// Search for material
|
||||||
|
|
Loading…
Reference in New Issue