- ColladaExporter filters empty meshes which fooled certain loaders - specifically Assimp's Collada Loader :-)

- Bugfix: ColladaExporter now writes proper URLs when referencing materials in meshes

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1170 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/5/head
ulfjorensen 2012-02-17 10:48:25 +00:00
parent 08fe2e7d20
commit f41e106efc
1 changed files with 9 additions and 2 deletions

View File

@ -298,6 +298,9 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
const aiMesh* mesh = mScene->mMeshes[pIndex];
std::string idstr = GetMeshId( pIndex);
if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 )
return;
// opening tag
mOutput << startstr << "<geometry id=\"" << idstr << "\" name=\"" << idstr << "_name\" >" << endstr;
PushTag();
@ -503,14 +506,18 @@ void ColladaExporter::WriteNode( const aiNode* pNode)
// instance every geometry
for( size_t a = 0; a < pNode->mNumMeshes; ++a )
{
// const aiMesh* mesh = mScene->mMeshes[pNode->mMeshes[a]];
const aiMesh* mesh = mScene->mMeshes[pNode->mMeshes[a]];
// do not instanciate mesh if empty. I wonder how this could happen
if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 )
continue;
mOutput << startstr << "<instance_geometry url=\"#" << GetMeshId( pNode->mMeshes[a]) << "\">" << endstr;
PushTag();
mOutput << startstr << "<bind_material>" << endstr;
PushTag();
mOutput << startstr << "<technique_common>" << endstr;
PushTag();
mOutput << startstr << "<instance_material symbol=\"theresonlyone\" target=\"" << materials[mScene->mMeshes[pNode->mMeshes[a]]->mMaterialIndex].name << "\" />" << endstr;
mOutput << startstr << "<instance_material symbol=\"theresonlyone\" target=\"#" << materials[mesh->mMaterialIndex].name << "\" />" << endstr;
PopTag();
mOutput << startstr << "</technique_common>" << endstr;
PopTag();