From 558f85473eb894588dde1240b2eca9d7d0ed1647 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Thu, 14 Jul 2016 21:42:44 +0200 Subject: fix T48857: Added support for transparency (used Patch D1949 from bwrsandman with some slight changes) --- source/blender/collada/DocumentImporter.cpp | 32 +++++++++++++---------------- 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'source/blender/collada') diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index f06f299d381..b91039fe012 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -904,6 +904,7 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia i++; } } + // EMISSION // color if (ef->getEmission().isColor()) { @@ -919,8 +920,18 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia i++; } } - - if (ef->getOpacity().isTexture()) { + + // TRANSPARENT + // color + if (ef->getOpacity().isColor()) { + float alpha = ef->getOpacity().getColor().getAlpha(); + if (alpha < 1) { + ma->alpha = alpha; + ma->mode |= MA_ZTRANSP | MA_TRANSP; + } + } + // texture + else if (ef->getOpacity().isTexture()) { COLLADAFW::Texture ctex = ef->getOpacity().getTexture(); mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); if (mtex != NULL) { @@ -930,22 +941,7 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia ma->mode |= MA_ZTRANSP | MA_TRANSP; } } - // TRANSPARENT - // color -#if 0 - if (ef->getOpacity().isColor()) { - // XXX don't know what to do here - } - // texture - else if (ef->getOpacity().isTexture()) { - ctex = ef->getOpacity().getTexture(); - if (mtex != NULL) mtex->mapto &= MAP_ALPHA; - else { - mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); - if (mtex != NULL) mtex->mapto = MAP_ALPHA; - } - } -#endif + material_texture_mapping_map[ma] = texindex_texarray_map; } -- cgit v1.2.3