add imported meshes from OpenGEX-importer to scene.

Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>
pull/521/head
Kim Kulling 2015-03-30 23:54:32 +02:00
parent 8857f26efb
commit 754897d1aa
2 changed files with 16 additions and 0 deletions

View File

@ -238,6 +238,7 @@ void OpenGEXImporter::InternReadFile( const std::string &filename, aiScene *pSce
handleNodes( m_ctx->m_root, pScene );
}
copyMeshes( pScene );
resolveReferences();
}
@ -678,6 +679,20 @@ void OpenGEXImporter::handleMaterialNode( ODDLParser::DDLNode *node, aiScene *pS
}
//------------------------------------------------------------------------------------------------
void OpenGEXImporter::copyMeshes( aiScene *pScene ) {
if( m_meshCache.empty() ) {
return;
}
pScene->mNumMeshes = m_meshCache.size();
pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes ];
size_t i( 0 );
for( std::vector<aiMesh*>::iterator it = m_meshCache.begin(); it != m_meshCache.end(); it++ ) {
pScene->mMeshes[ i ] = *it;
i++;
}
}
//------------------------------------------------------------------------------------------------
void OpenGEXImporter::resolveReferences() {
if( m_unresolvedRefStack.empty() ) {

View File

@ -114,6 +114,7 @@ protected:
void handleMaterialNode( ODDLParser::DDLNode *node, aiScene *pScene );
void handleColorNode( ODDLParser::DDLNode *node, aiScene *pScene );
void handleTextureNode( ODDLParser::DDLNode *node, aiScene *pScene );
void copyMeshes( aiScene *pScene );
void resolveReferences();
void pushNode( aiNode *node, aiScene *pScene );
aiNode *popNode();