Merge pull request #208 from NickNick/master

Add support for emissive and gloss-maps
pull/210/head
Kim Kulling 2013-12-18 06:53:36 -08:00
commit 6d630bec50
4 changed files with 15 additions and 1 deletions

View File

@ -156,6 +156,7 @@ struct Material
aiString texture; aiString texture;
aiString textureSpecular; aiString textureSpecular;
aiString textureAmbient; aiString textureAmbient;
aiString textureEmissive;
aiString textureBump; aiString textureBump;
aiString textureNormal; aiString textureNormal;
aiString textureSpecularity; aiString textureSpecularity;
@ -166,6 +167,7 @@ struct Material
TextureDiffuseType = 0, TextureDiffuseType = 0,
TextureSpecularType, TextureSpecularType,
TextureAmbientType, TextureAmbientType,
TextureEmissiveType,
TextureBumpType, TextureBumpType,
TextureNormalType, TextureNormalType,
TextureSpecularityType, TextureSpecularityType,

View File

@ -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 ) if ( 0 != pCurrentMaterial->textureSpecular.length )
{ {
mat->AddProperty( &pCurrentMaterial->textureSpecular, AI_MATKEY_TEXTURE_SPECULAR(0)); mat->AddProperty( &pCurrentMaterial->textureSpecular, AI_MATKEY_TEXTURE_SPECULAR(0));

View File

@ -302,6 +302,10 @@ void ObjFileMtlImporter::getTexture() {
// Ambient texture // Ambient texture
out = & m_pModel->m_pCurrentMaterial->textureAmbient; out = & m_pModel->m_pCurrentMaterial->textureAmbient;
clampIndex = ObjFile::Material::TextureAmbientType; 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() ) || } else if ( !ASSIMP_strincmp( pPtr, BumpTexture1.c_str(), BumpTexture1.size() ) ||
!ASSIMP_strincmp( pPtr, BumpTexture2.c_str(), BumpTexture2.size() ) || !ASSIMP_strincmp( pPtr, BumpTexture2.c_str(), BumpTexture2.size() ) ||
!ASSIMP_strincmp( pPtr, BumpTexture3.c_str(), BumpTexture3.size() ) ) { !ASSIMP_strincmp( pPtr, BumpTexture3.c_str(), BumpTexture3.size() ) ) {

View File

@ -8,6 +8,7 @@
// MSVC 7,8,9 // MSVC 7,8,9
// GCC // GCC
// BORLAND (complains about 'pack state changed but not reverted', but works) // BORLAND (complains about 'pack state changed but not reverted', but works)
// Clang
// //
// //
// USAGE: // USAGE:
@ -25,7 +26,11 @@
# pragma pack(push,1) # pragma pack(push,1)
# define PACK_STRUCT # define PACK_STRUCT
#elif defined( __GNUC__ ) #elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((gcc_struct, __packed__)) # if defined(__clang__)
# define PACK_STRUCT __attribute__((__packed__))
# else
# define PACK_STRUCT __attribute__((gcc_struct, __packed__))
# endif
#else #else
# error Compiler not supported # error Compiler not supported
#endif #endif