From 7d1a704ed793faaaea3b1e24b48f6f33e4c239da Mon Sep 17 00:00:00 2001 From: Judith Hartmann Date: Sun, 16 Mar 2014 21:30:10 +0100 Subject: [PATCH] saves value in the 'Ke'-Attribute in ObjMtl Files in COLOR_EMISSIVE --- code/ObjExporter.cpp | 3 +++ code/ObjFileData.h | 2 ++ code/ObjFileImporter.cpp | 1 + code/ObjFileMtlImporter.cpp | 5 +++++ 4 files changed, 11 insertions(+) diff --git a/code/ObjExporter.cpp b/code/ObjExporter.cpp index b680abb74..ff9fa4b25 100644 --- a/code/ObjExporter.cpp +++ b/code/ObjExporter.cpp @@ -152,6 +152,9 @@ void ObjExporter :: WriteMaterialFile() if(AI_SUCCESS == mat->Get(AI_MATKEY_COLOR_SPECULAR,c)) { mOutputMat << "ks " << c.r << " " << c.g << " " << c.b << endl; } + if(AI_SUCCESS == mat->Get(AI_MATKEY_COLOR_EMISSIVE,c)) { + mOutputMat << "ke " << c.r << " " << c.g << " " << c.b << endl; + } float o; if(AI_SUCCESS == mat->Get(AI_MATKEY_OPACITY,o)) { diff --git a/code/ObjFileData.h b/code/ObjFileData.h index 79605ef00..76448b763 100755 --- a/code/ObjFileData.h +++ b/code/ObjFileData.h @@ -183,6 +183,8 @@ struct Material aiColor3D diffuse; //! Specular color aiColor3D specular; + //! Emissive color + aiColor3D emissive; //! Alpha value float alpha; //! Shineness factor diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index 1eec92f70..b1d93202c 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -550,6 +550,7 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc mat->AddProperty( &pCurrentMaterial->ambient, 1, AI_MATKEY_COLOR_AMBIENT ); mat->AddProperty( &pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE ); mat->AddProperty( &pCurrentMaterial->specular, 1, AI_MATKEY_COLOR_SPECULAR ); + mat->AddProperty( &pCurrentMaterial->emissive, 1, AI_MATKEY_COLOR_EMISSIVE ); mat->AddProperty( &pCurrentMaterial->shineness, 1, AI_MATKEY_SHININESS ); mat->AddProperty( &pCurrentMaterial->alpha, 1, AI_MATKEY_OPACITY ); diff --git a/code/ObjFileMtlImporter.cpp b/code/ObjFileMtlImporter.cpp index 8ba19efd2..8424995c0 100644 --- a/code/ObjFileMtlImporter.cpp +++ b/code/ObjFileMtlImporter.cpp @@ -146,6 +146,11 @@ void ObjFileMtlImporter::load() ++m_DataIt; getColorRGBA( &m_pModel->m_pCurrentMaterial->specular ); } + else if (*m_DataIt == 'e') + { + ++m_DataIt; + getColorRGBA( &m_pModel->m_pCurrentMaterial->emissive ); + } m_DataIt = skipLine( m_DataIt, m_DataItEnd, m_uiLine ); } break;