diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-25 20:33:55 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-25 20:33:55 +0300 |
commit | bcc020b1bc1b60f6cbd6d2c9bf400744931e57e1 (patch) | |
tree | fef4d83d0e5addb59c8389adf125281a4c7e35f8 /source/blender/collada | |
parent | 99bb1accbbb8e1ba38f30b073b22deb107bf3220 (diff) | |
parent | 3f36cd3f33e52d53d82a3a221e2a576cf26390a5 (diff) |
Merge branch 'asset-engine' into asset-experimentsasset-experiments
Conflicts:
source/blender/blenloader/intern/readfile.c
Diffstat (limited to 'source/blender/collada')
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 36 | ||||
-rw-r--r-- | source/blender/collada/EffectExporter.cpp | 7 | ||||
-rw-r--r-- | source/blender/collada/ErrorHandler.cpp | 2 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 4 |
4 files changed, 25 insertions, 24 deletions
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index f06f299d381..226f319cefd 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,22 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia i++; } } - - if (ef->getOpacity().isTexture()) { + + // TRANSPARENT + // color + if (ef->getOpacity().isColor()) { + col = ef->getTransparent().getColor(); + float alpha = ef->getTransparency().getFloatValue(); + if (col.isValid()) { + alpha *= col.getAlpha(); // Assuming A_ONE opaque mode + } + if (col.isValid() || alpha < 1.0) { + 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 +945,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; } diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index 13dc1eda580..76b51148509 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -30,6 +30,7 @@ #include <set> #include "COLLADASWEffectProfile.h" +#include "COLLADAFWColorOrTexture.h" #include "EffectExporter.h" #include "DocumentExporter.h" @@ -217,9 +218,9 @@ void EffectsExporter::operator()(Material *ma, Object *ob) // transparency if (ma->mode & MA_TRANSP) { // Tod: because we are in A_ONE mode transparency is calculated like this: - ep.setTransparency(ma->alpha, false, "transparency"); - // cot = getcol(1.0f, 1.0f, 1.0f, 1.0f); - // ep.setTransparent(cot); + cot = getcol(1.0f, 1.0f, 1.0f, ma->alpha); + ep.setTransparent(cot); + ep.setOpaque(COLLADASW::EffectProfile::A_ONE); } // emission diff --git a/source/blender/collada/ErrorHandler.cpp b/source/blender/collada/ErrorHandler.cpp index b271604f839..98aa85f8a9b 100644 --- a/source/blender/collada/ErrorHandler.cpp +++ b/source/blender/collada/ErrorHandler.cpp @@ -79,7 +79,7 @@ bool ErrorHandler::handleError(const COLLADASaxFWL::IError *error) COLLADASaxFWL::SaxFWLError *saxFWLError = (COLLADASaxFWL::SaxFWLError *) error; /* * Accept non critical errors as warnings (i.e. texture not found) - * This makes the importer more gracefull, so it now imports what makes sense. + * This makes the importer more graceful, so it now imports what makes sense. */ if (saxFWLError->getSeverity() == COLLADASaxFWL::IError::SEVERITY_ERROR_NONCRITICAL) { isError = false; diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 649c86edd25..abe5130b9c1 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -539,8 +539,8 @@ void BoneExtended::set_bone_layers(std::string layerString, std::vector<std::str } /* If numeric layers and labeled layers are used in parallel (unlikely), - we get a potential mixup. Just leave as is for now. - */ + * we get a potential mixup. Just leave as is for now. + */ this->bone_layers = bc_set_layer(this->bone_layers, pos); } |