set the correct reference to meshes.
Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>pull/531/head
parent
22fc756d4a
commit
ecf390d51f
|
@ -175,6 +175,7 @@ namespace OpenGEX {
|
||||||
|
|
||||||
USE_ODDLPARSER_NS
|
USE_ODDLPARSER_NS
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
OpenGEXImporter::VertexContainer::VertexContainer()
|
OpenGEXImporter::VertexContainer::VertexContainer()
|
||||||
: m_numVerts( 0 )
|
: m_numVerts( 0 )
|
||||||
, m_vertices()
|
, m_vertices()
|
||||||
|
@ -185,6 +186,7 @@ OpenGEXImporter::VertexContainer::VertexContainer()
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
OpenGEXImporter::VertexContainer::~VertexContainer() {
|
OpenGEXImporter::VertexContainer::~VertexContainer() {
|
||||||
delete[] m_vertices;
|
delete[] m_vertices;
|
||||||
delete[] m_normals;
|
delete[] m_normals;
|
||||||
|
@ -536,7 +538,6 @@ void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene
|
||||||
m_currentMesh = new aiMesh;
|
m_currentMesh = new aiMesh;
|
||||||
const size_t meshidx( m_meshCache.size() );
|
const size_t meshidx( m_meshCache.size() );
|
||||||
m_meshCache.push_back( m_currentMesh );
|
m_meshCache.push_back( m_currentMesh );
|
||||||
m_mesh2refMap[ node->getName() ] = meshidx;
|
|
||||||
|
|
||||||
Property *prop = node->getProperties();
|
Property *prop = node->getProperties();
|
||||||
if( NULL != prop ) {
|
if( NULL != prop ) {
|
||||||
|
@ -550,6 +551,12 @@ void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene
|
||||||
}
|
}
|
||||||
|
|
||||||
handleNodes( node, pScene );
|
handleNodes( node, pScene );
|
||||||
|
|
||||||
|
DDLNode *parent( node->getParent() );
|
||||||
|
if( NULL != parent ) {
|
||||||
|
const std::string &name = parent->getName();
|
||||||
|
m_mesh2refMap[ name ] = meshidx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
@ -745,8 +752,12 @@ void OpenGEXImporter::resolveReferences() {
|
||||||
if( RefInfo::MeshRef == currentRefInfo->m_type ) {
|
if( RefInfo::MeshRef == currentRefInfo->m_type ) {
|
||||||
for( size_t i = 0; i < currentRefInfo->m_Names.size(); i++ ) {
|
for( size_t i = 0; i < currentRefInfo->m_Names.size(); i++ ) {
|
||||||
const std::string &name(currentRefInfo->m_Names[ i ] );
|
const std::string &name(currentRefInfo->m_Names[ i ] );
|
||||||
unsigned int meshIdx = m_mesh2refMap[ name ];
|
ReferenceMap::const_iterator it( m_mesh2refMap.find( name ) );
|
||||||
node->mMeshes[ i ] = meshIdx;
|
if( m_mesh2refMap.end() != it ) {
|
||||||
|
unsigned int meshIdx = m_mesh2refMap[ name ];
|
||||||
|
node->mMeshes[ i ] = meshIdx;
|
||||||
|
node->mNumMeshes++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if( RefInfo::MaterialRef == currentRefInfo->m_type ) {
|
} else if( RefInfo::MaterialRef == currentRefInfo->m_type ) {
|
||||||
// ToDo!
|
// ToDo!
|
||||||
|
|
|
@ -157,6 +157,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<aiMesh*> m_meshCache;
|
std::vector<aiMesh*> m_meshCache;
|
||||||
|
typedef std::map<std::string, size_t> ReferenceMap;
|
||||||
std::map<std::string, size_t> m_mesh2refMap;
|
std::map<std::string, size_t> m_mesh2refMap;
|
||||||
|
|
||||||
ODDLParser::Context *m_ctx;
|
ODDLParser::Context *m_ctx;
|
||||||
|
|
Loading…
Reference in New Issue