+ Blender: read specular hardness. Thanks to Marvin for the patch.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1032 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2011-06-09 15:10:54 +00:00
parent 3db25db8e2
commit ffdb479411
3 changed files with 10 additions and 2 deletions

View File

@ -557,14 +557,20 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
aiColor3D col(mat->r,mat->g,mat->b); aiColor3D col(mat->r,mat->g,mat->b);
if (mat->r || mat->g || mat->b ) { if (mat->r || mat->g || mat->b ) {
// Usually, zero diffuse color means no diffuse color at all in the equation - seemingly. // Usually, zero diffuse color means no diffuse color at all in the equation.
// So we ommit this member to express this intent. // So we omit this member to express this intent.
mout->AddProperty(&col,1,AI_MATKEY_COLOR_DIFFUSE); mout->AddProperty(&col,1,AI_MATKEY_COLOR_DIFFUSE);
} }
col = aiColor3D(mat->specr,mat->specg,mat->specb); col = aiColor3D(mat->specr,mat->specg,mat->specb);
mout->AddProperty(&col,1,AI_MATKEY_COLOR_SPECULAR); mout->AddProperty(&col,1,AI_MATKEY_COLOR_SPECULAR);
// is hardness/shininess set?
if( mat->har ) {
const float har = mat->har;
mout->AddProperty(&har,1,AI_MATKEY_SHININESS);
}
col = aiColor3D(mat->ambr,mat->ambg,mat->ambb); col = aiColor3D(mat->ambr,mat->ambg,mat->ambb);
mout->AddProperty(&col,1,AI_MATKEY_COLOR_AMBIENT); mout->AddProperty(&col,1,AI_MATKEY_COLOR_AMBIENT);

View File

@ -275,6 +275,7 @@ template <> void Structure :: Convert<Material> (
ReadField<ErrorPolicy_Warn>(dest.specr,"specr",db); ReadField<ErrorPolicy_Warn>(dest.specr,"specr",db);
ReadField<ErrorPolicy_Warn>(dest.specg,"specg",db); ReadField<ErrorPolicy_Warn>(dest.specg,"specg",db);
ReadField<ErrorPolicy_Warn>(dest.specb,"specb",db); ReadField<ErrorPolicy_Warn>(dest.specb,"specb",db);
ReadField<ErrorPolicy_Igno>(dest.har,"har",db);
ReadField<ErrorPolicy_Warn>(dest.ambr,"ambr",db); ReadField<ErrorPolicy_Warn>(dest.ambr,"ambr",db);
ReadField<ErrorPolicy_Warn>(dest.ambg,"ambg",db); ReadField<ErrorPolicy_Warn>(dest.ambg,"ambg",db);
ReadField<ErrorPolicy_Warn>(dest.ambb,"ambb",db); ReadField<ErrorPolicy_Warn>(dest.ambb,"ambb",db);

View File

@ -208,6 +208,7 @@ struct Material : ElemBase {
float r,g,b WARN; float r,g,b WARN;
float specr,specg,specb WARN; float specr,specg,specb WARN;
short har;
float ambr,ambg,ambb WARN; float ambr,ambg,ambb WARN;
float mirr,mirg,mirb; float mirr,mirg,mirb;
float emit WARN; float emit WARN;