[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17087] branches/etch-a-ton/source/blender /src/editarmature_sketch.c: Color fade out to indicate the direction of a stroke.

Martin Poirier theeth at yahoo.com
Wed Oct 15 23:25:42 CEST 2008


Revision: 17087
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17087
Author:   theeth
Date:     2008-10-15 23:25:42 +0200 (Wed, 15 Oct 2008)

Log Message:
-----------
Color fade out to indicate the direction of a stroke.

Modified Paths:
--------------
    branches/etch-a-ton/source/blender/src/editarmature_sketch.c

Modified: branches/etch-a-ton/source/blender/src/editarmature_sketch.c
===================================================================
--- branches/etch-a-ton/source/blender/src/editarmature_sketch.c	2008-10-15 19:31:32 UTC (rev 17086)
+++ branches/etch-a-ton/source/blender/src/editarmature_sketch.c	2008-10-15 21:25:42 UTC (rev 17087)
@@ -536,38 +536,59 @@
 	if (id != -1)
 	{
 		glLoadName(id);
+		
+		glBegin(GL_LINE_STRIP);
+		
+		for (i = 0; i < stk->nb_points; i++)
+		{
+			glVertex3fv(stk->points[i].p);
+		}
+		
+		glEnd();
+		
 	}
-	
-	if (stk->selected)
-	{
-		glColor3f(1, 0, 0);
-	}
 	else
 	{
-		glColor3f(1, 0.5, 0);
-	}
-	glBegin(GL_LINE_STRIP);
-	
-	for (i = 0; i < stk->nb_points; i++)
-	{
-		glVertex3fv(stk->points[i].p);
-	}
-	
-	glEnd();
-	
-	glColor3f(0, 0, 0);
-	glBegin(GL_POINTS);
+		float r, g, b;
+		
+		if (stk->selected)
+		{
+			r = 1;
+			g = 0;
+			b = 0;
+		}
+		else
+		{
+			r = 1;
+			g = 0.5;
+			b = 0;
+		}
+		
+		glBegin(GL_LINE_STRIP);
 
-	for (i = 0; i < stk->nb_points; i++)
-	{
-		if (stk->points[i].type == PT_EXACT)
+		for (i = 0; i < stk->nb_points; i++)
 		{
+			float f = (float)i / (float)stk->nb_points;
+			glColor3f(r + (1 - r) * f, g + (1 - g) * f, b + (1 - b) * f);
 			glVertex3fv(stk->points[i].p);
 		}
+		
+		glEnd();
+	
+		glColor3f(0, 0, 0);
+		glBegin(GL_POINTS);
+	
+		for (i = 0; i < stk->nb_points; i++)
+		{
+			if (stk->points[i].type == PT_EXACT)
+			{
+				glVertex3fv(stk->points[i].p);
+			}
+		}
+		
+		glEnd();
 	}
 
-	glEnd();
-
 //	glColor3f(1, 1, 1);
 //	glBegin(GL_POINTS);
 //





More information about the Bf-blender-cvs mailing list