From 0d444793999885666c609b6d5abc37e45f1be491 Mon Sep 17 00:00:00 2001 From: boxdot Date: Tue, 29 Mar 2016 21:10:15 +0200 Subject: [PATCH] Import reflectance factor from Blender. --- code/BlenderLoader.cpp | 6 ++++++ code/BlenderScene.cpp | 2 ++ code/BlenderScene.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/code/BlenderLoader.cpp b/code/BlenderLoader.cpp index abf6bb9c0..8df2f50fb 100644 --- a/code/BlenderLoader.cpp +++ b/code/BlenderLoader.cpp @@ -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); diff --git a/code/BlenderScene.cpp b/code/BlenderScene.cpp index 1273de81e..2ebc13f21 100644 --- a/code/BlenderScene.cpp +++ b/code/BlenderScene.cpp @@ -313,9 +313,11 @@ template <> void Structure :: Convert ( ReadField(dest.mirg,"mirg",db); ReadField(dest.mirb,"mirb",db); ReadField(dest.emit,"emit",db); + ReadField(dest.ray_mirror,"ray_mirror",db); ReadField(dest.alpha,"alpha",db); ReadField(dest.ref,"ref",db); ReadField(dest.translucency,"translucency",db); + ReadField(dest.mode,"mode",db); ReadField(dest.roughness,"roughness",db); ReadField(dest.darkness,"darkness",db); ReadField(dest.refrac,"refrac",db); diff --git a/code/BlenderScene.h b/code/BlenderScene.h index c7d5f7eb7..768435f98 100644 --- a/code/BlenderScene.h +++ b/code/BlenderScene.h @@ -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;