From 5e1fc3944899af747d74a67a914f01fe2c5e74c9 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 29 May 2015 20:45:31 +0200 Subject: [PATCH] Add parsing of texture nodes of OpenGEX-format importer. --- code/OpenGEXImporter.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index fde5e3d45..20da427fd 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -83,6 +83,7 @@ namespace Grammar { static const std::string DiffuseColorToken = "diffuse"; static const std::string SpecularColorToken = "specular"; static const std::string EmissionColorToken = "emission"; + static const std::string DiffuseTextureToken = "diffuse"; static const char *TextureType = "Texture"; @@ -808,7 +809,23 @@ void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene *pScen //------------------------------------------------------------------------------------------------ void OpenGEXImporter::handleTextureNode( ODDLParser::DDLNode *node, aiScene *pScene ) { + if( NULL == node ) { + return; + } + Property *prop = node->findPropertyByName( "attrib" ); + if( NULL != prop ) { + if( NULL != prop->m_value ) { + if( prop->m_value->getString() == Grammar::DiffuseTextureToken ) { + aiString tex; + Value *val( node->getValue() ); + if( NULL != val ) { + tex.Set( val->getString() ); + m_currentMaterial->AddProperty( &tex, AI_MATKEY_TEXTURE_DIFFUSE( 0 ) ); + } + } + } + } } //------------------------------------------------------------------------------------------------