[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56225] trunk/blender/source/blender/ blenkernel/intern/cdderivedmesh.c: Fix part of #34882: mesh active face not drawing stippled with the mirror modifier.

Brecht Van Lommel brechtvanlommel at pandora.be
Mon Apr 22 23:12:11 CEST 2013


Revision: 56225
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56225
Author:   blendix
Date:     2013-04-22 21:12:11 +0000 (Mon, 22 Apr 2013)
Log Message:
-----------
Fix part of #34882: mesh active face not drawing stippled with the mirror modifier.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c

Modified: trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c	2013-04-22 21:10:50 UTC (rev 56224)
+++ trunk/blender/source/blender/blenkernel/intern/cdderivedmesh.c	2013-04-22 21:12:11 UTC (rev 56225)
@@ -69,6 +69,8 @@
 #include <limits.h>
 #include <math.h>
 
+extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
+
 typedef struct {
 	DerivedMesh dm;
 
@@ -907,6 +909,11 @@
 			if (draw_option != DM_DRAW_OPTION_SKIP) {
 				unsigned char *cp = NULL;
 
+				if (draw_option == DM_DRAW_OPTION_STIPPLE) {
+					glEnable(GL_POLYGON_STIPPLE);
+					glPolygonStipple(stipple_quarttone);
+				}
+
 				if (useColors && mcol)
 					cp = (unsigned char *)&mcol[i * 4];
 
@@ -959,6 +966,9 @@
 				}
 
 				glEnd();
+
+				if (draw_option == DM_DRAW_OPTION_STIPPLE)
+					glDisable(GL_POLYGON_STIPPLE);
 			}
 			
 			if (nors) nors += 3;
@@ -1003,13 +1013,18 @@
 						draw_option = setMaterial(mface->mat_nr + 1, NULL);
 					else if (setDrawOptions != NULL)
 						draw_option = setDrawOptions(userData, orig);
+
+					if (draw_option == DM_DRAW_OPTION_STIPPLE) {
+						glEnable(GL_POLYGON_STIPPLE);
+						glPolygonStipple(stipple_quarttone);
+					}
 	
 					/* Goal is to draw as long of a contiguous triangle
 					 * array as possible, so draw when we hit either an
 					 * invisible triangle or at the end of the array */
 
 					/* flush buffer if current triangle isn't drawable or it's last triangle... */
-					flush = (draw_option == DM_DRAW_OPTION_SKIP) || (i == tottri - 1);
+					flush = (ELEM(draw_option, DM_DRAW_OPTION_SKIP, DM_DRAW_OPTION_STIPPLE)) || (i == tottri - 1);
 
 					/* ... or when material setting is dissferent  */
 					flush |= mf[actualFace].mat_nr != mf[next_actualFace].mat_nr;
@@ -1027,6 +1042,9 @@
 							glDrawArrays(GL_TRIANGLES, first, count);
 
 						prevstart = i + 1;
+
+						if (draw_option == DM_DRAW_OPTION_STIPPLE)
+							glDisable(GL_POLYGON_STIPPLE);
 					}
 				}
 			}




More information about the Bf-blender-cvs mailing list