# Collada: allow empty meshes. Thanks to Mark Page for the patch (https://sourceforge.net/projects/assimp/forums/forum/817653/topic/4628297).

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1071 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/2/head
aramis_acg 2011-08-23 16:27:07 +00:00
parent df63b4b3ed
commit ff705e6fa4
1 changed files with 24 additions and 18 deletions

View File

@ -1878,6 +1878,8 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
else if( IsElement( "vcount"))
{
if( !mReader->isEmptyElement())
{
if (numPrimitives) // It is possible to define a mesh without any primitives
{
// case <polylist> - specifies the number of indices for each polygon
const char* content = GetTextContent();
@ -1891,6 +1893,7 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
// skip whitespace after it
SkipSpacesAndLineEnd( &content);
}
}
TestClosing( "vcount");
}
@ -2002,6 +2005,8 @@ void ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pPer
if( expectedPointCount > 0)
indices.reserve( expectedPointCount * numOffsets);
if (pNumPrimitives > 0) // It is possible to not contain any indicies
{
const char* content = GetTextContent();
while( *content != 0)
{
@ -2012,6 +2017,7 @@ void ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pPer
// skip whitespace after it
SkipSpacesAndLineEnd( &content);
}
}
// complain if the index count doesn't fit
if( expectedPointCount > 0 && indices.size() != expectedPointCount * numOffsets)