[Bf-blender-cvs] [6252015] cycles-ptex-06: Improve debug drawing output
Nicholas Bishop
noreply at git.blender.org
Thu Jan 15 20:13:03 CET 2015
Commit: 62520155549101405e83864d3a710524a2f09c64
Author: Nicholas Bishop
Date: Thu Jan 8 11:27:23 2015 +0100
Branches: cycles-ptex-06
https://developer.blender.org/rB62520155549101405e83864d3a710524a2f09c64
Improve debug drawing output
===================================================================
M source/blender/editors/space_view3d/drawobject.c
===================================================================
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 25b76ba..2afca0e 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -3672,12 +3672,16 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
}
}
-static void dm_draw_vert_order(DerivedMesh *dm)
+static void dm_draw_vert_order(RegionView3D *rv3d, DerivedMesh *dm)
{
typedef struct {
- float pos[3], col[3];
+ float pos[3], col[4];
} VertCol;
+ const float alpha = 0.5;
+ const float start_col[4] = {1, 0, 0, alpha};
+ const float rest_col[4] = {0, 1, 0, alpha};
+
const MVert *verts = dm->getVertArray(dm);
const MPoly *polys = dm->getPolyArray(dm);
const MLoop *loops = dm->getLoopArray(dm);
@@ -3685,12 +3689,11 @@ static void dm_draw_vert_order(DerivedMesh *dm)
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
+ ED_view3d_polygon_offset(rv3d, 1.0);
glPushAttrib(GL_ENABLE_BIT);
glShadeModel(GL_SMOOTH);
- /* TODO(bishop): should probably leave depth on and do an offset
- * or something */
- glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
+ glEnable(GL_BLEND);
for (a = 0; a < dm->getNumPolys(dm); a++) {
const MPoly *p = &polys[a];
@@ -3703,14 +3706,9 @@ static void dm_draw_vert_order(DerivedMesh *dm)
copy_v3_v3(points[b].pos, v->co);
add_v3_v3(avg, v->co);
- /* First line red, else green */
- if (b <= 1) {
- points[b].col[0] = 1;
- points[b].col[1] = 0;
- } else {
- points[b].col[0] = 0;
- points[b].col[1] = 1;
- }
+ /* First line gets a different color to indicate which
+ * loop the polygon starts at */
+ copy_v4_v4(points[b].col, (b <= 1) ? start_col : rest_col);
}
/* Move points in towards center a bit */
@@ -3720,13 +3718,14 @@ static void dm_draw_vert_order(DerivedMesh *dm)
}
glVertexPointer(3, GL_FLOAT, sizeof(VertCol), points);
- glColorPointer(3, GL_FLOAT, sizeof(VertCol), &points[0].col);
+ glColorPointer(4, GL_FLOAT, sizeof(VertCol), &points[0].col);
glDrawArrays(GL_LINE_STRIP, 0, p->totloop);
MEM_freeN(points);
}
/* Reset all GL state */
+ ED_view3d_polygon_offset(rv3d, 0.0);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glPopAttrib();
@@ -3983,7 +3982,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
}
- dm_draw_vert_order(dm);
+ dm_draw_vert_order(rv3d, dm);
if (is_obact && BKE_paint_select_vert_test(ob)) {
const int use_depth = (v3d->flag & V3D_ZBUF_SELECT);
More information about the Bf-blender-cvs
mailing list