diff options
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index f4547a2ae3b..83572d77479 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -3237,12 +3237,16 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) #ifdef DEBUG_DRAW /* debug drawing */ #define _DEBUG_DRAW_QUAD_TOT 1024 +#define _DEBUG_DRAW_EDGE_TOT 1024 static float _bl_debug_draw_quads[_DEBUG_DRAW_QUAD_TOT][4][3]; static int _bl_debug_draw_quads_tot = 0; +static float _bl_debug_draw_edges[_DEBUG_DRAW_QUAD_TOT][2][3]; +static int _bl_debug_draw_edges_tot = 0; void bl_debug_draw_quad_clear(void) { _bl_debug_draw_quads_tot = 0; + _bl_debug_draw_edges_tot = 0; } void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2[3], const float v3[3]) { @@ -3260,16 +3264,14 @@ void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2 } void bl_debug_draw_edge_add(const float v0[3], const float v1[3]) { - if (_bl_debug_draw_quads_tot >= _DEBUG_DRAW_QUAD_TOT) { - printf("%s: max edge count hit %d!", __func__, _bl_debug_draw_quads_tot); + if (_bl_debug_draw_quads_tot >= _DEBUG_DRAW_EDGE_TOT) { + printf("%s: max edge count hit %d!", __func__, _bl_debug_draw_edges_tot); } else { - float *pt = &_bl_debug_draw_quads[_bl_debug_draw_quads_tot][0][0]; - copy_v3_v3(pt, v0); pt += 3; - copy_v3_v3(pt, v1); pt += 3; + float *pt = &_bl_debug_draw_edges[_bl_debug_draw_edges_tot][0][0]; copy_v3_v3(pt, v0); pt += 3; copy_v3_v3(pt, v1); pt += 3; - _bl_debug_draw_quads_tot++; + _bl_debug_draw_edges_tot++; } } static void bl_debug_draw(void) @@ -3286,5 +3288,22 @@ static void bl_debug_draw(void) } glEnd(); } + if (_bl_debug_draw_edges_tot) { + int i; + cpack(0x00FFFF00); + glBegin(GL_LINES); + for (i = 0; i < _bl_debug_draw_edges_tot; i ++) { + glVertex3fv(_bl_debug_draw_edges[i][0]); + glVertex3fv(_bl_debug_draw_edges[i][1]); + } + glEnd(); + glPointSize(4.0); + glBegin(GL_POINTS); + for (i = 0; i < _bl_debug_draw_edges_tot; i ++) { + glVertex3fv(_bl_debug_draw_edges[i][0]); + glVertex3fv(_bl_debug_draw_edges[i][1]); + } + glEnd(); + } } #endif |