OpenGEXImporter: Copy materials to scene
parent
b841ed194b
commit
50b43f76e1
|
@ -322,6 +322,7 @@ void OpenGEXImporter::InternReadFile( const std::string &filename, aiScene *pSce
|
||||||
copyMeshes( pScene );
|
copyMeshes( pScene );
|
||||||
copyCameras( pScene );
|
copyCameras( pScene );
|
||||||
copyLights( pScene );
|
copyLights( pScene );
|
||||||
|
copyMaterials( pScene );
|
||||||
resolveReferences();
|
resolveReferences();
|
||||||
createNodeTree( pScene );
|
createNodeTree( pScene );
|
||||||
}
|
}
|
||||||
|
@ -1158,6 +1159,19 @@ void OpenGEXImporter::copyLights( aiScene *pScene ) {
|
||||||
std::copy( m_lightCache.begin(), m_lightCache.end(), pScene->mLights );
|
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() {
|
void OpenGEXImporter::resolveReferences() {
|
||||||
if( m_unresolvedRefStack.empty() ) {
|
if( m_unresolvedRefStack.empty() ) {
|
||||||
|
|
|
@ -133,6 +133,7 @@ protected:
|
||||||
void copyMeshes( aiScene *pScene );
|
void copyMeshes( aiScene *pScene );
|
||||||
void copyCameras( aiScene *pScene );
|
void copyCameras( aiScene *pScene );
|
||||||
void copyLights( aiScene *pScene );
|
void copyLights( aiScene *pScene );
|
||||||
|
void copyMaterials( aiScene *pScene );
|
||||||
void resolveReferences();
|
void resolveReferences();
|
||||||
void pushNode( aiNode *node, aiScene *pScene );
|
void pushNode( aiNode *node, aiScene *pScene );
|
||||||
aiNode *popNode();
|
aiNode *popNode();
|
||||||
|
|
Loading…
Reference in New Issue