|
@@ -83,7 +83,6 @@ static const aiImporterDesc desc = {
|
|
|
ColladaLoader::ColladaLoader()
|
|
|
: noSkeletonMesh()
|
|
|
, ignoreUpDirection(false)
|
|
|
- , invertTransparency(false)
|
|
|
, mNodeNameCounter()
|
|
|
{}
|
|
|
|
|
@@ -120,7 +119,6 @@ void ColladaLoader::SetupProperties(const Importer* pImp)
|
|
|
{
|
|
|
noSkeletonMesh = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_NO_SKELETON_MESHES,0) != 0;
|
|
|
ignoreUpDirection = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION,0) != 0;
|
|
|
- invertTransparency = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_COLLADA_INVERT_TRANSPARENCY,0) != 0;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1341,7 +1339,6 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
|
|
|
mat.AddProperty( &effect.mDiffuse, 1, AI_MATKEY_COLOR_DIFFUSE);
|
|
|
mat.AddProperty( &effect.mSpecular, 1,AI_MATKEY_COLOR_SPECULAR);
|
|
|
mat.AddProperty( &effect.mEmissive, 1, AI_MATKEY_COLOR_EMISSIVE);
|
|
|
- mat.AddProperty( &effect.mTransparent, 1, AI_MATKEY_COLOR_TRANSPARENT);
|
|
|
mat.AddProperty( &effect.mReflective, 1, AI_MATKEY_COLOR_REFLECTIVE);
|
|
|
|
|
|
// scalar properties
|
|
@@ -1354,20 +1351,29 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
|
|
|
// therefore, we let the opportunity for the user to manually invert
|
|
|
// the transparency if necessary and we add preliminary support for RGB_ZERO mode
|
|
|
if(effect.mTransparency >= 0.f && effect.mTransparency <= 1.f) {
|
|
|
- // Trying some support for RGB_ZERO mode
|
|
|
+ // handle RGB transparency completely, cf Collada specs 1.5.0 pages 249 and 304
|
|
|
if(effect.mRGBTransparency) {
|
|
|
- effect.mTransparency = 1.f - effect.mTransparent.a;
|
|
|
+ // use luminance as defined by ISO/CIE color standards (see ITU-R Recommendation BT.709-4)
|
|
|
+ effect.mTransparency *= (
|
|
|
+ 0.212671f * effect.mTransparent.r +
|
|
|
+ 0.715160f * effect.mTransparent.g +
|
|
|
+ 0.072169 * effect.mTransparent.b
|
|
|
+ );
|
|
|
+
|
|
|
+ effect.mTransparent.a = 1.f;
|
|
|
+
|
|
|
+ mat.AddProperty( &effect.mTransparent, 1, AI_MATKEY_COLOR_TRANSPARENT );
|
|
|
+ } else {
|
|
|
+ effect.mTransparency *= effect.mTransparent.a;
|
|
|
}
|
|
|
|
|
|
- // Global option
|
|
|
- if(invertTransparency) {
|
|
|
+ if(effect.mInvertTransparency) {
|
|
|
effect.mTransparency = 1.f - effect.mTransparency;
|
|
|
}
|
|
|
|
|
|
// Is the material finally transparent ?
|
|
|
if (effect.mHasTransparency || effect.mTransparency < 1.f) {
|
|
|
mat.AddProperty( &effect.mTransparency, 1, AI_MATKEY_OPACITY );
|
|
|
- mat.AddProperty( &effect.mTransparent, 1, AI_MATKEY_COLOR_TRANSPARENT );
|
|
|
}
|
|
|
}
|
|
|
|