From ffdb4794116f811a9b06a7337864fe76e55f4c25 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Thu, 9 Jun 2011 15:10:54 +0000 Subject: [PATCH] + 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 --- code/BlenderLoader.cpp | 10 ++++++++-- code/BlenderScene.cpp | 1 + code/BlenderScene.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/code/BlenderLoader.cpp b/code/BlenderLoader.cpp index 440aee15c..9c233a64e 100644 --- a/code/BlenderLoader.cpp +++ b/code/BlenderLoader.cpp @@ -557,14 +557,20 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data) aiColor3D col(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. - // So we ommit this member to express this intent. + // Usually, zero diffuse color means no diffuse color at all in the equation. + // So we omit this member to express this intent. mout->AddProperty(&col,1,AI_MATKEY_COLOR_DIFFUSE); } col = aiColor3D(mat->specr,mat->specg,mat->specb); 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); mout->AddProperty(&col,1,AI_MATKEY_COLOR_AMBIENT); diff --git a/code/BlenderScene.cpp b/code/BlenderScene.cpp index d52971845..e9caebfac 100644 --- a/code/BlenderScene.cpp +++ b/code/BlenderScene.cpp @@ -275,6 +275,7 @@ template <> void Structure :: Convert ( ReadField(dest.specr,"specr",db); ReadField(dest.specg,"specg",db); ReadField(dest.specb,"specb",db); + ReadField(dest.har,"har",db); ReadField(dest.ambr,"ambr",db); ReadField(dest.ambg,"ambg",db); ReadField(dest.ambb,"ambb",db); diff --git a/code/BlenderScene.h b/code/BlenderScene.h index 77af86101..b93b67388 100644 --- a/code/BlenderScene.h +++ b/code/BlenderScene.h @@ -208,6 +208,7 @@ struct Material : ElemBase { float r,g,b WARN; float specr,specg,specb WARN; + short har; float ambr,ambg,ambb WARN; float mirr,mirg,mirb; float emit WARN;