BUGFIX: Correct handling of not stored texture coordinates
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@125 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
af18307f95
commit
d4d9d016d1
|
@ -367,14 +367,17 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
|
|||
// Copy all texture coordinates
|
||||
if ( !pModel->m_TextureCoord.empty() )
|
||||
{
|
||||
const unsigned int tex = pSourceFace->m_pTexturCoords->at( vertexIndex );
|
||||
ai_assert( tex < pModel->m_TextureCoord.size() );
|
||||
for ( size_t i=0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; i++)
|
||||
if ( !pSourceFace->m_pTexturCoords->empty() )
|
||||
{
|
||||
if ( pMesh->mNumUVComponents[ i ] > 0 )
|
||||
const unsigned int tex = pSourceFace->m_pTexturCoords->at( vertexIndex );
|
||||
ai_assert( tex < pModel->m_TextureCoord.size() );
|
||||
for ( size_t i=0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; i++)
|
||||
{
|
||||
aiVector2D coord2d = *pModel->m_TextureCoord[ tex ];
|
||||
pMesh->mTextureCoords[ i ][ newIndex ] = aiVector3D( coord2d.x, coord2d.y, 0.0 );
|
||||
if ( pMesh->mNumUVComponents[ i ] > 0 )
|
||||
{
|
||||
aiVector2D coord2d = *pModel->m_TextureCoord[ tex ];
|
||||
pMesh->mTextureCoords[ i ][ newIndex ] = aiVector3D( coord2d.x, coord2d.y, 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue