From f433746bfaac05fe463c27fc52cec303af6a5d90 Mon Sep 17 00:00:00 2001 From: Nick Overdijk Date: Fri, 29 Mar 2013 16:12:22 +0100 Subject: [PATCH] Add support for emissive and gloss-maps Conflicts: code/ObjFileMtlImporter.cpp Someone added support for loading more bump maps, I added support for emmissive-maps. Easy merge. --- code/ObjFileData.h | 2 ++ code/ObjFileImporter.cpp | 3 +++ code/ObjFileMtlImporter.cpp | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/code/ObjFileData.h b/code/ObjFileData.h index 7b2b6cf12..79605ef00 100755 --- a/code/ObjFileData.h +++ b/code/ObjFileData.h @@ -156,6 +156,7 @@ struct Material aiString texture; aiString textureSpecular; aiString textureAmbient; + aiString textureEmissive; aiString textureBump; aiString textureNormal; aiString textureSpecularity; @@ -166,6 +167,7 @@ struct Material TextureDiffuseType = 0, TextureSpecularType, TextureAmbientType, + TextureEmissiveType, TextureBumpType, TextureNormalType, TextureSpecularityType, diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index 13dfee203..1eec92f70 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -575,6 +575,9 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc } } + if ( 0 != pCurrentMaterial->textureEmissive.length ) + mat->AddProperty( &pCurrentMaterial->textureEmissive, AI_MATKEY_TEXTURE_EMISSIVE(0)); + if ( 0 != pCurrentMaterial->textureSpecular.length ) { mat->AddProperty( &pCurrentMaterial->textureSpecular, AI_MATKEY_TEXTURE_SPECULAR(0)); diff --git a/code/ObjFileMtlImporter.cpp b/code/ObjFileMtlImporter.cpp index f0d2f1795..8ba19efd2 100644 --- a/code/ObjFileMtlImporter.cpp +++ b/code/ObjFileMtlImporter.cpp @@ -302,6 +302,10 @@ void ObjFileMtlImporter::getTexture() { // Ambient texture out = & m_pModel->m_pCurrentMaterial->textureAmbient; clampIndex = ObjFile::Material::TextureAmbientType; + } else if (!ASSIMP_strincmp(&(*m_DataIt),"map_emissive",6)) { + // Emissive texture + out = & m_pModel->m_pCurrentMaterial->textureEmissive; + clampIndex = ObjFile::Material::TextureEmissiveType; } else if ( !ASSIMP_strincmp( pPtr, BumpTexture1.c_str(), BumpTexture1.size() ) || !ASSIMP_strincmp( pPtr, BumpTexture2.c_str(), BumpTexture2.size() ) || !ASSIMP_strincmp( pPtr, BumpTexture3.c_str(), BumpTexture3.size() ) ) {