[Bf-blender-cvs] [cced076] master: Matcaps.

Antony Riakiotakis noreply at git.blender.org
Tue Apr 8 00:26:10 CEST 2014


Commit: cced07661a4fcfd156caec81073d97c060677a15
Author: Antony Riakiotakis
Date:   Tue Apr 8 01:24:45 2014 +0300
https://developer.blender.org/rBcced07661a4fcfd156caec81073d97c060677a15

Matcaps.

Instead of setting color every time, just set it on material enable.
Handles all cases of surfaces. Thanks to Campbell for pointing out!

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

M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/gpu/intern/gpu_draw.c

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

diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index cfb4e1f..61866b6 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -3190,8 +3190,6 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
 		}
 		else if (check_object_draw_texture(scene, v3d, dt)) {
 			if (draw_glsl_material(scene, ob, v3d, dt)) {
-				/* this will be ignored mostly, but is relevant for matcaps */
-				glColor3f(1.0f, 1.0f, 1.0f);
 				glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
 
 				finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material,
@@ -3471,8 +3469,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 			Paint *p;
 
 			glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
-			/* this will get ignored mostly, will only be relevant for matcaps */
-			glColor3f(1.0, 1.0, 1.0);
 
 			if ((v3d->flag2 & V3D_SHOW_SOLID_MATCAP) && ob->sculpt && (p = BKE_paint_get_active(scene))) {
 				GPUVertexAttribs gattribs;
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 64ab701..99f98f7 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1597,6 +1597,9 @@ int GPU_enable_material(int nr, void *attribs)
 				else
 					glDisable(GL_CULL_FACE);
 			}
+
+			if (GMS.use_matcaps)
+				glColor3f(1.0, 1.0, 1.0f);
 		}
 		else {
 			/* or do fixed function opengl material */




More information about the Bf-blender-cvs mailing list