fix T48857: Added support for transparency (used Patch D1949 from bwrsandman with some slight changes)

This commit is contained in:
Gaia Clary 2016-07-14 21:42:44 +02:00
parent 902d4c92ac
commit 558f85473e
Notes: blender-bot 2023-02-14 07:45:34 +01:00
Referenced by issue #48857, Support Transparency
1 changed files with 14 additions and 18 deletions

View File

@ -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;
}