Browse Source

COLLADA: Add support for <reflectivity> elements. This maps to AI_MATKEY_REFLECTIVITY.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@504 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
aramis_acg 15 years ago
parent
commit
46809f0dfa
4 changed files with 6 additions and 1 deletions
  1. 2 1
      code/ColladaHelper.h
  2. 1 0
      code/ColladaLoader.cpp
  3. 2 0
      code/ColladaParser.cpp
  4. 1 0
      include/aiMaterial.h

+ 2 - 1
code/ColladaHelper.h

@@ -493,7 +493,7 @@ struct Effect
 		mTexTransparent, mTexBump, mTexReflective;
 
 	// Scalar factory
-	float mShininess, mRefractIndex;
+	float mShininess, mRefractIndex, mReflectivity;
 	float mTransparency;
 
 	// local params referring to each other by their SID
@@ -518,6 +518,7 @@ struct Effect
 		, mDoubleSided	(false)
 		, mWireframe    (false)
 		, mFaceted      (false)
+		, mReflectivity (1.f)
 	{ 
 	}
 };

+ 1 - 0
code/ColladaLoader.cpp

@@ -1147,6 +1147,7 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* pScene
 
 		// scalar properties
 		mat.AddProperty( &effect.mShininess, 1, AI_MATKEY_SHININESS);
+		mat.AddProperty( &effect.mReflectivity, 1, AI_MATKEY_REFLECTIVITY);
 		mat.AddProperty( &effect.mRefractIndex, 1, AI_MATKEY_REFRACTI);
 
 		// transparency, a very hard one. seemingly not all files are following the

+ 2 - 0
code/ColladaParser.cpp

@@ -1135,6 +1135,8 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
 			}
 			else if( IsElement( "shininess"))
 				ReadEffectFloat( pEffect.mShininess);
+			else if( IsElement( "reflectivity"))
+				ReadEffectFloat( pEffect.mReflectivity);
 
 			/* Single scalar properties */
 			else if( IsElement( "transparency"))

+ 1 - 0
include/aiMaterial.h

@@ -754,6 +754,7 @@ extern "C" {
 #define AI_MATKEY_OPACITY "$mat.opacity",0,0
 #define AI_MATKEY_BUMPSCALING "$mat.bumpscaling",0,0
 #define AI_MATKEY_SHININESS "$mat.shininess",0,0
+#define AI_MATKEY_REFLECTIVITY "$mat.reflectivity",0,0
 #define AI_MATKEY_SHININESS_STRENGTH "$mat.shinpercent",0,0
 #define AI_MATKEY_REFRACTI "$mat.refracti",0,0
 #define AI_MATKEY_COLOR_DIFFUSE "$clr.diffuse",0,0