- finalized Collada mesh part - can read static models now, using dummy materials

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@246 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
ulfjorensen
2008-11-25 17:58:11 +00:00
parent fe3c008301
commit 78969d0a95
4 changed files with 166 additions and 2 deletions

View File

@@ -747,7 +747,7 @@ void ColladaParser::ReadSceneNode( Node* pNode)
child->mName = mReader->getAttributeValue( attrName);
// TODO: (thom) support SIDs
assert( TestAttribute( "sid") == -1);
// assert( TestAttribute( "sid") == -1);
pNode->mChildren.push_back( child);
child->mParent = pNode;
@@ -759,6 +759,10 @@ void ColladaParser::ReadSceneNode( Node* pNode)
// test for it, in case we need to implement it
assert( false);
SkipElement();
} else if( IsElement( "instance_geometry"))
{
// Reference to a mesh, we possible material associations
ReadNodeGeometry( pNode);
} else
{
// skip everything else for the moment
@@ -800,6 +804,23 @@ void ColladaParser::ReadNodeTransformation( Node* pNode, TransformType pType)
TestClosing( tagName.c_str());
}
// ------------------------------------------------------------------------------------------------
// Reads a mesh reference in a node and adds it to the node's mesh list
void ColladaParser::ReadNodeGeometry( Node* pNode)
{
// referred mesh is given as an attribute of the <instance_geometry> element
int attrUrl = GetAttribute( "url");
const char* url = mReader->getAttributeValue( attrUrl);
if( url[0] != '#')
ThrowException( "Unknown reference format");
// store the mesh ID
pNode->mMeshes.push_back( std::string( url+1));
// for the moment, skip the rest
SkipElement();
}
// ------------------------------------------------------------------------------------------------
// Reads the collada scene
void ColladaParser::ReadScene()