BUGFIX: Correct handling of not stored texture coordinates

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@125 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
kimmi 2008-09-09 22:32:04 +00:00
parent af18307f95
commit d4d9d016d1
2 changed files with 18 additions and 15 deletions

View File

@ -366,6 +366,8 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
// Copy all texture coordinates
if ( !pModel->m_TextureCoord.empty() )
{
if ( !pSourceFace->m_pTexturCoords->empty() )
{
const unsigned int tex = pSourceFace->m_pTexturCoords->at( vertexIndex );
ai_assert( tex < pModel->m_TextureCoord.size() );
@ -378,6 +380,7 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
}
}
}
}
ai_assert( pMesh->mNumVertices > newIndex );
pDestFace->mIndices[ vertexIndex ] = newIndex;

View File

@ -252,25 +252,25 @@ void ObjFileParser::getFace()
else
{
//OBJ USES 1 Base ARRAYS!!!!
const int iVal = atoi(pPtr);
const int iVal = atoi( pPtr );
int tmp = iVal;
while ((tmp = tmp / 10)!=0)
++iStep;
if (0 != iVal)
if ( 0 != iVal )
{
// Store parsed index
if (0 == iPos)
if ( 0 == iPos )
{
pIndices->push_back(iVal-1);
pIndices->push_back( iVal-1 );
}
else if (1 == iPos)
else if ( 1 == iPos )
{
pTexID->push_back(iVal-1);
pTexID->push_back( iVal-1 );
}
else if (2 == iPos)
else if ( 2 == iPos )
{
pNormalID->push_back(iVal-1);
pNormalID->push_back( iVal-1 );
}
else
{
@ -278,7 +278,7 @@ void ObjFileParser::getFace()
}
}
}
for (int i=0; i<iStep; i++)
for ( int i=0; i<iStep; i++ )
++pPtr;
}