diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index 782392bde..a9e415f52 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -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::iterator it = m_meshCache.begin(); it != m_meshCache.end(); it++ ) { + pScene->mMeshes[ i ] = *it; + i++; + } +} + //------------------------------------------------------------------------------------------------ void OpenGEXImporter::resolveReferences() { if( m_unresolvedRefStack.empty() ) { diff --git a/code/OpenGEXImporter.h b/code/OpenGEXImporter.h index d890bde76..2e26a8e18 100644 --- a/code/OpenGEXImporter.h +++ b/code/OpenGEXImporter.h @@ -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();