[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17385] trunk/blender/source/blender/src/ interface_draw.c: Patch #17971 by Nathan Vegdahl:

Matt Ebb matt at mke3.net
Mon Nov 10 06:42:08 CET 2008


Revision: 17385
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17385
Author:   broken
Date:     2008-11-10 06:42:07 +0100 (Mon, 10 Nov 2008)

Log Message:
-----------
Patch #17971 by Nathan Vegdahl:
Makes colorband GUI display proper color interpolation

(for real this time)

Modified Paths:
--------------
    trunk/blender/source/blender/src/interface_draw.c

Modified: trunk/blender/source/blender/src/interface_draw.c
===================================================================
--- trunk/blender/source/blender/src/interface_draw.c	2008-11-10 05:06:09 UTC (rev 17384)
+++ trunk/blender/source/blender/src/interface_draw.c	2008-11-10 05:42:07 UTC (rev 17385)
@@ -68,6 +68,7 @@
 #include "BKE_global.h"
 #include "BKE_key.h"
 #include "BKE_utildefines.h"
+#include "BKE_texture.h"
 
 #include "datatoc.h"            /* std font */
 
@@ -1978,6 +1979,7 @@
 	CBData *cbd;
 	float x1, y1, sizex, sizey;
 	float dx, v3[2], v1[2], v2[2], v1a[2], v2a[2];
+	float pos, colf[4];
 	int a;
 		
 	if(coba==NULL) return;
@@ -1998,7 +2000,7 @@
 		v1[0]+= dx;
 	}
 	
-	glShadeModel(GL_SMOOTH);
+	glShadeModel(GL_FLAT);
 	glEnable(GL_BLEND);
 	
 	cbd= coba->data;
@@ -2012,17 +2014,16 @@
 	glColor4fv( &cbd->r );
 	glVertex2fv(v1); glVertex2fv(v2);
 	
-	for(a=0; a<coba->tot; a++, cbd++) {
-		
-		v1[0]=v2[0]= x1+ cbd->pos*sizex;
-		
-		glColor4fv( &cbd->r );
+	for( a = 1; a < sizex; a++ ) {
+		pos = ((float)a) / (sizex-1);
+		do_colorband( coba, pos, colf );
+
+		v1[0]=v2[0]= x1 + a;
+
+		glColor4fv( colf );
 		glVertex2fv(v1); glVertex2fv(v2);
 	}
-	
-	v1[0]=v2[0]= x1+ sizex;
-	glVertex2fv(v1); glVertex2fv(v2);
-	
+
 	glEnd();
 	glShadeModel(GL_FLAT);
 	glDisable(GL_BLEND);





More information about the Bf-blender-cvs mailing list