[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32690] trunk/blender/source/blender/ blenkernel/intern/subsurf_ccg.c: Closing #24367 ( Incorrect behaviour for Optimal Display option) and reopening #22634 ( sculpting/multires and wireframe display mode glitches)

Nicholas Bishop nicholasbishop at gmail.com
Mon Oct 25 04:58:34 CEST 2010


Revision: 32690
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32690
Author:   nicholasbishop
Date:     2010-10-25 04:58:32 +0200 (Mon, 25 Oct 2010)

Log Message:
-----------
Closing #24367 (Incorrect behaviour for Optimal Display option) and reopening #22634 (sculpting/multires and wireframe display mode glitches)

* Reverting my earlier changes to subsurf edge drawing; seems to be causing more bugs than the minor bug it fixed.

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

Modified: trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c	2010-10-25 02:30:16 UTC (rev 32689)
+++ trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c	2010-10-25 02:58:32 UTC (rev 32690)
@@ -1146,74 +1146,71 @@
 	ccgFaceIterator_free(fi);
 	glEnd();
 }
-
 static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) {
 	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
 	CCGSubSurf *ss = ccgdm->ss;
-	CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
 	CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
+	CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
+	int i, edgeSize = ccgSubSurf_getEdgeSize(ss);
 	int gridSize = ccgSubSurf_getGridSize(ss);
-	int edgeSize = ccgSubSurf_getEdgeSize(ss);
-	int step;
 	int useAging;
 
 	ccgSubSurf_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL);
 
-	/* nothing to do */
-	if(!drawLooseEdges && !ccgdm->drawInteriorEdges)
-		return;
+	for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
+		CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
+		DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
 
+		if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e))
+			continue;
+
+		if (useAging && !(G.f&G_BACKBUFSEL)) {
+			int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4;
+			glColor3ub(0, ageCol>0?ageCol:0, 0);
+		}
+
+		glBegin(GL_LINE_STRIP);
+		for (i=0; i<edgeSize-1; i++) {
+			glVertex3fv(edgeData[i].co);
+			glVertex3fv(edgeData[i+1].co);
+		}
+		glEnd();
+	}
+
 	if (useAging && !(G.f&G_BACKBUFSEL)) {
 		glColor3ub(0, 0, 0);
 	}
 
-	if(ccgdm->drawInteriorEdges)
-		step = 1;
-	else
-		step = gridSize - 1;
+	if (ccgdm->drawInteriorEdges) {
+		for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
+			CCGFace *f = ccgFaceIterator_getCurrent(fi);
+			int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-	/* draw edges using face grids */
-	for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
-		CCGFace *f = ccgFaceIterator_getCurrent(fi);
-		int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
+			for (S=0; S<numVerts; S++) {
+				DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 
-		for (S=0; S<numVerts; S++) {
-			DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
-
-			for (y=0; y<gridSize; y+=step) {
 				glBegin(GL_LINE_STRIP);
 				for (x=0; x<gridSize; x++)
-					glVertex3fv(faceGridData[y*gridSize + x].co);
+					glVertex3fv(faceGridData[x].co);
 				glEnd();
+				for (y=1; y<gridSize-1; y++) {
+					glBegin(GL_LINE_STRIP);
+					for (x=0; x<gridSize; x++)
+						glVertex3fv(faceGridData[y*gridSize + x].co);
+					glEnd();
+				}
+				for (x=1; x<gridSize-1; x++) {
+					glBegin(GL_LINE_STRIP);
+					for (y=0; y<gridSize; y++)
+						glVertex3fv(faceGridData[y*gridSize + x].co);
+					glEnd();
+				}
 			}
-			for (x=0; x<gridSize; x+=step) {
-				glBegin(GL_LINE_STRIP);
-				for (y=0; y<gridSize; y++)
-					glVertex3fv(faceGridData[y*gridSize + x].co);
-				glEnd();
-			}
 		}
 	}
 
-	/* draw edges with no adjacent face */
-	if(!drawLooseEdges) return;
-	for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei))  {
-		CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
-
-		if(!ccgSubSurf_getEdgeNumFaces(e)) {
-			DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
-			int i;
-
-			glBegin(GL_LINE_STRIP);
-			for (i=0; i<edgeSize-1; i++) {
-				glVertex3fv(edgeData[i].co);
-				glVertex3fv(edgeData[i+1].co);
-			}
-			glEnd();
-		}
-	}
-
 	ccgFaceIterator_free(fi);
+	ccgEdgeIterator_free(ei);
 }
 static void ccgDM_drawLooseEdges(DerivedMesh *dm) {
 	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;





More information about the Bf-blender-cvs mailing list