OpenGEXImporter: Copy materials to scene

This commit is contained in:
Turo Lamminen
2017-10-05 12:51:08 +03:00
parent b841ed194b
commit 50b43f76e1
2 changed files with 15 additions and 0 deletions

View File

@@ -322,6 +322,7 @@ void OpenGEXImporter::InternReadFile( const std::string &filename, aiScene *pSce
copyMeshes( pScene );
copyCameras( pScene );
copyLights( pScene );
copyMaterials( pScene );
resolveReferences();
createNodeTree( pScene );
}
@@ -1158,6 +1159,19 @@ void OpenGEXImporter::copyLights( aiScene *pScene ) {
std::copy( m_lightCache.begin(), m_lightCache.end(), pScene->mLights );
}
//------------------------------------------------------------------------------------------------
void OpenGEXImporter::copyMaterials( aiScene *pScene ) {
ai_assert( nullptr != pScene );
if ( m_materialCache.empty() ) {
return;
}
pScene->mNumMaterials = static_cast<unsigned int>(m_materialCache.size());
pScene->mMaterials = new aiMaterial*[ pScene->mNumMaterials ];
std::copy( m_materialCache.begin(), m_materialCache.end(), pScene->mMaterials );
}
//------------------------------------------------------------------------------------------------
void OpenGEXImporter::resolveReferences() {
if( m_unresolvedRefStack.empty() ) {