[Bf-blender-cvs] [fd0b012] wiggly-widgets: Tweaks for shaded widget drawing

Julian Eisel noreply at git.blender.org
Fri Aug 28 04:08:17 CEST 2015


Commit: fd0b0124c3ba2983409aa85c25d1449c32c6556b
Author: Julian Eisel
Date:   Fri Aug 28 04:01:42 2015 +0200
Branches: wiggly-widgets
https://developer.blender.org/rBfd0b0124c3ba2983409aa85c25d1449c32c6556b

Tweaks for shaded widget drawing

And cleanup :)

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

M	source/blender/windowmanager/intern/wm_generic_widgets.c

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

diff --git a/source/blender/windowmanager/intern/wm_generic_widgets.c b/source/blender/windowmanager/intern/wm_generic_widgets.c
index c4f7814..2bf47d1 100644
--- a/source/blender/windowmanager/intern/wm_generic_widgets.c
+++ b/source/blender/windowmanager/intern/wm_generic_widgets.c
@@ -253,15 +253,24 @@ static void arrow_draw_geom(const ArrowWidget *arrow, const bool select)
 			GLUquadricObj *qobj = gluNewQuadric();
 			const float len = 0.25f;
 			const float width = 0.06f;
+			const bool use_lighting = !select && ((U.tw_flag & V3D_SHADED_WIDGETS) != 0);
 
 			glPushMatrix();
 			glMultMatrixf(mat);
 
+			if (use_lighting) {
+				glShadeModel(GL_SMOOTH);
+			}
+
 			gluQuadricDrawStyle(qobj, GLU_FILL);
-			gluCylinder(qobj, width, 0.0, len, 8, 1);
 			gluQuadricOrientation(qobj, GLU_INSIDE);
 			gluDisk(qobj, 0.0, width, 8, 1);
 			gluQuadricOrientation(qobj, GLU_OUTSIDE);
+			gluCylinder(qobj, width, 0.0, len, 8, 1);
+
+			if (use_lighting) {
+				glShadeModel(GL_FLAT);
+			}
 
 			glPopMatrix();
 		}
@@ -623,18 +632,17 @@ typedef struct DialWidget {
 
 static void dial_draw_geom(const DialWidget *dial, const bool select)
 {
+#ifdef WIDGET_USE_CUSTOM_DIAS
+	glEnable(GL_MULTISAMPLE_ARB);
+
+	widget_draw_intern(&dial_draw_info, select);
+#else
 	GLUquadricObj *qobj = gluNewQuadric();
 	const float width = 1.0f;
 	const int resol = 32;
 
 	glEnable(GL_MULTISAMPLE_ARB);
 
-#ifdef WIDGET_USE_CUSTOM_DIAS
-	widget_draw_intern(&dial_draw_info, select);
-
-	(void)qobj; (void)width; (void)resol;
-#else
-
 	glLineWidth(dial->widget.line_width);
 	gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
 	gluDisk(qobj, 0.0, width, resol, 1);




More information about the Bf-blender-cvs mailing list