Merged changes in the trunk up to revision 32124.
[blender-staging.git] / source / blender / render / intern / source / shadeinput.c
index 4754e0d15f1986e8febb45db861a40424256d25c..e96baf0eab237bc6429d7cc9ee3522c6b723c15d 100644 (file)
@@ -1045,6 +1045,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
                        shi->actcol= obr->actmcol;
 
                        if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
+                               float alpha[8];
                                for (i=0; (mcol=RE_vlakren_get_mcol(obr, vlr, i, &name, 0)); i++) {
                                        ShadeInputCol *scol= &shi->col[i];
                                        char *cp1, *cp2, *cp3;
@@ -1059,13 +1060,15 @@ void shade_input_set_shade_texco(ShadeInput *shi)
                                        scol->col[0]= (l*((float)cp3[3]) - u*((float)cp1[3]) - v*((float)cp2[3]))/255.0f;
                                        scol->col[1]= (l*((float)cp3[2]) - u*((float)cp1[2]) - v*((float)cp2[2]))/255.0f;
                                        scol->col[2]= (l*((float)cp3[1]) - u*((float)cp1[1]) - v*((float)cp2[1]))/255.0f;
+
+                                       alpha[i]= (l*((float)cp3[0]) - u*((float)cp1[0]) - v*((float)cp2[0]))/255.0f;
                                }
 
                                if(shi->totcol) {
                                        shi->vcol[0]= shi->col[shi->actcol].col[0];
                                        shi->vcol[1]= shi->col[shi->actcol].col[1];
                                        shi->vcol[2]= shi->col[shi->actcol].col[2];
-                                       shi->vcol[3]= 1.0f;
+                                       shi->vcol[3]= shi->mat->vcol_alpha ? alpha[shi->actcol] : 1.0f;
                                }
                                else {
                                        shi->vcol[0]= 0.0f;