diff --git a/code/ColladaHelper.h b/code/ColladaHelper.h index c279c68b9..cff253ad9 100644 --- a/code/ColladaHelper.h +++ b/code/ColladaHelper.h @@ -470,15 +470,6 @@ struct Sampler float mMixWithPrevious; }; -/** Describes different alpha blending modes. */ -enum AlphaMode -{ - AM_RGB_ZERO, - AM_RGB_ONE, - AM_ALPHA_ONE, - AM_ALPHA_ZERO -}; - /** A collada effect. Can contain about anything according to the Collada spec, but we limit our version to a reasonable subset. */ struct Effect @@ -486,9 +477,6 @@ struct Effect // Shading mode ShadeType mShadeType; - // Alpha mode - AlphaMode mAlphaMode; - // Colors aiColor4D mEmissive, mAmbient, mDiffuse, mSpecular, mTransparent, mReflective; @@ -512,7 +500,6 @@ struct Effect Effect() : mShadeType (Shade_Phong) - , mAlphaMode (AM_ALPHA_ZERO) , mEmissive ( 0, 0, 0, 1) , mAmbient ( 0.1f, 0.1f, 0.1f, 1) , mDiffuse ( 0.6f, 0.6f, 0.6f, 1) diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 524feaa1c..0c716fd3a 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -315,18 +315,6 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll if (srcLight->mPenumbraAngle == 10e10f) { // Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess .... - // ci - inner cone angle - // co - outer cone angle - // fe - falloff exponent - // ld - spot direction - normalized - // rd - ray direction - normalized - // - // Formula is: - // 1. (cos(acos (ld dot rd) - ci))^fe == epsilon - // 2. (ld dot rd) == cos(acos(epsilon^(1/fe)) + ci) - // 3. co == acos (ld dot rd) - // 4. co == acos(epsilon^(1/fe)) + ci) - // epsilon chosen to be 0.1 out->mAngleOuterCone = AI_DEG_TO_RAD (acos(pow(0.1f,1.f/srcLight->mFalloffExponent))+ srcLight->mFalloffAngle); @@ -486,10 +474,10 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll // if we already have the mesh at the library, just add its index to the node's array std::map::const_iterator dstMeshIt = mMeshIndexByID.find( index); - if( dstMeshIt != mMeshIndexByID.end()) - { + if( dstMeshIt != mMeshIndexByID.end()) { newMeshRefs.push_back( dstMeshIt->second); - } else + } + else { // else we have to add the mesh to the collection and store its newly assigned index at the node aiMesh* dstMesh = CreateMesh( pParser, srcMesh, submesh, srcController, vertexStart, faceStart); @@ -1166,6 +1154,14 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* pScene mat.AddProperty( &effect.mShininess, 1, AI_MATKEY_SHININESS); mat.AddProperty( &effect.mRefractIndex, 1, AI_MATKEY_REFRACTI); + // transparency, a very hard one. seemingly not all files are following the + // specification here .. but we can trick. + if (effect.mTransparency > 0.f && effect.mTransparency < 1.f) { + effect.mTransparency = 1.f- effect.mTransparency; + mat.AddProperty( &effect.mTransparency, 1, AI_MATKEY_OPACITY ); + mat.AddProperty( &effect.mTransparent, 1, AI_MATKEY_COLOR_TRANSPARENT ); + } + // add textures, if given if( !effect.mTexAmbient.mName.empty()) /* It is merely a lightmap */ diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index 0bacf2275..2bef83f25 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -1070,8 +1070,9 @@ void ColladaParser::ReadEffect( Collada::Effect& pEffect) else if( IsElement( "reflective")) { ReadEffectColor( pEffect.mReflective, pEffect.mTexReflective); } - else if( IsElement( "transparent")) + else if( IsElement( "transparent")) { ReadEffectColor( pEffect.mTransparent,pEffect.mTexTransparent); + } else if( IsElement( "shininess")) ReadEffectFloat( pEffect.mShininess); diff --git a/workspaces/vc8/assimp.vcproj b/workspaces/vc8/assimp.vcproj index 18136461b..8a18b6fd6 100644 --- a/workspaces/vc8/assimp.vcproj +++ b/workspaces/vc8/assimp.vcproj @@ -1352,6 +1352,10 @@ RelativePath="..\..\code\BaseProcess.h" > + +