Merge pull request #239 from judithhartmann/master
Load and save Ke-Value of mtl-Filespull/246/head
commit
897fcc7328
|
@ -152,6 +152,9 @@ void ObjExporter :: WriteMaterialFile()
|
||||||
if(AI_SUCCESS == mat->Get(AI_MATKEY_COLOR_SPECULAR,c)) {
|
if(AI_SUCCESS == mat->Get(AI_MATKEY_COLOR_SPECULAR,c)) {
|
||||||
mOutputMat << "ks " << c.r << " " << c.g << " " << c.b << endl;
|
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;
|
float o;
|
||||||
if(AI_SUCCESS == mat->Get(AI_MATKEY_OPACITY,o)) {
|
if(AI_SUCCESS == mat->Get(AI_MATKEY_OPACITY,o)) {
|
||||||
|
|
|
@ -183,6 +183,8 @@ struct Material
|
||||||
aiColor3D diffuse;
|
aiColor3D diffuse;
|
||||||
//! Specular color
|
//! Specular color
|
||||||
aiColor3D specular;
|
aiColor3D specular;
|
||||||
|
//! Emissive color
|
||||||
|
aiColor3D emissive;
|
||||||
//! Alpha value
|
//! Alpha value
|
||||||
float alpha;
|
float alpha;
|
||||||
//! Shineness factor
|
//! Shineness factor
|
||||||
|
|
|
@ -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->ambient, 1, AI_MATKEY_COLOR_AMBIENT );
|
||||||
mat->AddProperty( &pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );
|
mat->AddProperty( &pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );
|
||||||
mat->AddProperty( &pCurrentMaterial->specular, 1, AI_MATKEY_COLOR_SPECULAR );
|
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->shineness, 1, AI_MATKEY_SHININESS );
|
||||||
mat->AddProperty( &pCurrentMaterial->alpha, 1, AI_MATKEY_OPACITY );
|
mat->AddProperty( &pCurrentMaterial->alpha, 1, AI_MATKEY_OPACITY );
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,11 @@ void ObjFileMtlImporter::load()
|
||||||
++m_DataIt;
|
++m_DataIt;
|
||||||
getColorRGBA( &m_pModel->m_pCurrentMaterial->specular );
|
getColorRGBA( &m_pModel->m_pCurrentMaterial->specular );
|
||||||
}
|
}
|
||||||
|
else if (*m_DataIt == 'e')
|
||||||
|
{
|
||||||
|
++m_DataIt;
|
||||||
|
getColorRGBA( &m_pModel->m_pCurrentMaterial->emissive );
|
||||||
|
}
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue