Merge pull request #839 from boxdot/master

Import reflectance factor from Blender.
pull/846/head
Kim Kulling 2016-03-30 00:11:38 +02:00
commit 0a002986e2
3 changed files with 12 additions and 0 deletions

View File

@ -631,6 +631,12 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
col = aiColor3D(mat->ambr,mat->ambg,mat->ambb);
mout->AddProperty(&col,1,AI_MATKEY_COLOR_AMBIENT);
// is mirror enabled?
if( mat->mode & MA_RAYMIRROR ) {
const float ray_mirror = mat->ray_mirror;
mout->AddProperty(&ray_mirror,1,AI_MATKEY_REFLECTIVITY);
}
col = aiColor3D(mat->mirr,mat->mirg,mat->mirb);
mout->AddProperty(&col,1,AI_MATKEY_COLOR_REFLECTIVE);

View File

@ -313,9 +313,11 @@ template <> void Structure :: Convert<Material> (
ReadField<ErrorPolicy_Igno>(dest.mirg,"mirg",db);
ReadField<ErrorPolicy_Igno>(dest.mirb,"mirb",db);
ReadField<ErrorPolicy_Warn>(dest.emit,"emit",db);
ReadField<ErrorPolicy_Igno>(dest.ray_mirror,"ray_mirror",db);
ReadField<ErrorPolicy_Warn>(dest.alpha,"alpha",db);
ReadField<ErrorPolicy_Igno>(dest.ref,"ref",db);
ReadField<ErrorPolicy_Igno>(dest.translucency,"translucency",db);
ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
ReadField<ErrorPolicy_Igno>(dest.roughness,"roughness",db);
ReadField<ErrorPolicy_Igno>(dest.darkness,"darkness",db);
ReadField<ErrorPolicy_Igno>(dest.refrac,"refrac",db);

View File

@ -239,6 +239,8 @@ struct MDeformVert : ElemBase {
};
// -------------------------------------------------------------------------------
#define MA_RAYMIRROR 0x40000
struct Material : ElemBase {
ID id FAIL;
@ -248,9 +250,11 @@ struct Material : ElemBase {
float ambr,ambg,ambb WARN;
float mirr,mirg,mirb;
float emit WARN;
float ray_mirror;
float alpha WARN;
float ref;
float translucency;
int mode;
float roughness;
float darkness;
float refrac;