[Bf-blender-cvs] [49c81e234a1] master: Fix vertex paint w/ subsurf drawing

Campbell Barton noreply at git.blender.org
Sat Sep 30 11:21:13 CEST 2017


Commit: 49c81e234a12cf119362ec23c0bd4ab10a35482d
Author: Campbell Barton
Date:   Sat Sep 30 19:20:04 2017 +1000
Branches: master
https://developer.blender.org/rB49c81e234a12cf119362ec23c0bd4ab10a35482d

Fix vertex paint w/ subsurf drawing

Only use alpha blending when in vertex paint mode.

===================================================================

M	source/blender/blenkernel/intern/cdderivedmesh.c
M	source/blender/blenkernel/intern/editderivedmesh.c
M	source/blender/blenkernel/intern/subsurf_ccg.c
M	source/blender/editors/space_view3d/drawmesh.c

===================================================================

diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 2ed5cc450a4..13949e6777d 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -752,18 +752,8 @@ static void cdDM_drawMappedFaces(
 		/* avoid buffer problems in following code */
 	}
 	else if (setDrawOptions == NULL) {
-		const bool show_alpha = true;
-		if (show_alpha) {
-			glEnable(GL_BLEND);
-			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-		}
-
 		/* just draw the entire face array */
 		GPU_buffer_draw_elements(dm->drawObject->triangles, GL_TRIANGLES, 0, tot_tri_elem);
-
-		if (show_alpha) {
-			glDisable(GL_BLEND);
-		}
 	}
 	else {
 		for (mat_index = 0; mat_index < dm->drawObject->totmaterial; mat_index++) {
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index d810dac7365..be8fcaa6863 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -1036,11 +1036,11 @@ static void emDM_drawMappedFaces(
 						if (poly_prev != GL_ZERO) glEnd();
 						glBegin((poly_prev = poly_type)); /* BMesh: will always be GL_TRIANGLES */
 					}
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 					glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 					glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 					glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
 				}
 				else {
@@ -1057,23 +1057,23 @@ static void emDM_drawMappedFaces(
 
 					if (!drawSmooth) {
 						glNormal3fv(polyNos[BM_elem_index_get(efa)]);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 						glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 						glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 						glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
 					}
 					else {
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 						if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[0])]);
 						else glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
 						glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 						if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[1])]);
 						else glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]);
 						glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 						if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[2])]);
 						else glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]);
 						glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
@@ -1138,11 +1138,11 @@ static void emDM_drawMappedFaces(
 						if (poly_prev != GL_ZERO) glEnd();
 						glBegin((poly_prev = poly_type)); /* BMesh: will always be GL_TRIANGLES */
 					}
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 					glVertex3fv(ltri[0]->v->co);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 					glVertex3fv(ltri[1]->v->co);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 					glVertex3fv(ltri[2]->v->co);
 				}
 				else {
@@ -1159,23 +1159,23 @@ static void emDM_drawMappedFaces(
 
 					if (!drawSmooth) {
 						glNormal3fv(efa->no);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 						glVertex3fv(ltri[0]->v->co);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 						glVertex3fv(ltri[1]->v->co);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 						glVertex3fv(ltri[2]->v->co);
 					}
 					else {
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 						if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[0])]);
 						else glNormal3fv(ltri[0]->v->no);
 						glVertex3fv(ltri[0]->v->co);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 						if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[1])]);
 						else glNormal3fv(ltri[1]->v->no);
 						glVertex3fv(ltri[1]->v->co);
-						if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+						if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 						if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[2])]);
 						else glNormal3fv(ltri[2]->v->no);
 						glVertex3fv(ltri[2]->v->co);
@@ -1298,32 +1298,32 @@ static void emDM_drawFacesTex_common(
 					glNormal3fv(polyNos[BM_elem_index_get(efa)]);
 
 					glTexCoord2fv(luv[0]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 					glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
 
 					glTexCoord2fv(luv[1]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 					glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
 
 					glTexCoord2fv(luv[2]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 					glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
 				}
 				else {
 					glTexCoord2fv(luv[0]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 					if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[0])]);
 					else glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
 					glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
 
 					glTexCoord2fv(luv[1]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 					if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[1])]);
 					else glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]);
 					glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
 
 					glTexCoord2fv(luv[2]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 					if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[2])]);
 					else glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]);
 					glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
@@ -1362,32 +1362,32 @@ static void emDM_drawFacesTex_common(
 					glNormal3fv(efa->no);
 
 					glTexCoord2fv(luv[0]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 					glVertex3fv(ltri[0]->v->co);
 
 					glTexCoord2fv(luv[1]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 					glVertex3fv(ltri[1]->v->co);
 
 					glTexCoord2fv(luv[2]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 					glVertex3fv(ltri[2]->v->co);
 				}
 				else {
 					glTexCoord2fv(luv[0]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[0]->r));
 					if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[0])]);
 					else glNormal3fv(ltri[0]->v->no);
 					glVertex3fv(ltri[0]->v->co);
 
 					glTexCoord2fv(luv[1]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[1]->r));
 					if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[1])]);
 					else glNormal3fv(ltri[1]->v->no);
 					glVertex3fv(ltri[1]->v->co);
 
 					glTexCoord2fv(luv[2]->uv);
-					if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
 					if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[2])]);
 					else glNormal3fv(ltri[2]->v->no);
 					glVertex3fv(ltri[2]->v->co);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 7c5ee42b7bc..0cdc97c829f 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2198,12 +2198,12 @@ static void ccgDM_buffer_copy_color(
 		for (S = 0; S < numVerts; S++) {
 			for (y = 0; y < gridFaces; y++) {
 				for (x = 0; x < gridFaces; x++) {
-					copy_v3_v3_uchar(&varray[start + 0], &mloopcol[iface * 16 + 0]);
-					copy_v3_v3_uchar(&varray[start + 3], &mloopcol[iface * 16 + 12]);
-					copy_v3_v3_uchar(&varray[start + 6], &mloopcol[iface * 16 + 8]);
-					copy_v3_v3_uchar(&varray[start + 9], &mloopcol[iface * 16 + 4]);
+					copy_v4_v4_uchar(&va

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list