diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2016-12-20 13:01:08 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2016-12-20 13:02:40 +0300 |
commit | 4d5cd638ffba6854bfcee2ee7eb836f446b087ca (patch) | |
tree | 9e3101018c85e10d3ee1a1029ccc0c7b9314a57d /source/blender/editors/space_view3d/drawsimdebug.c | |
parent | bd42987399f1e2decf259cce21a91e39c7a0a50d (diff) |
String drawing function for the "simdebug" utilities.
Simple string drawing API for debug drawing, in addition to basic primitives.
Diffstat (limited to 'source/blender/editors/space_view3d/drawsimdebug.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawsimdebug.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c index 91adc905816..9414d39467d 100644 --- a/source/blender/editors/space_view3d/drawsimdebug.c +++ b/source/blender/editors/space_view3d/drawsimdebug.c @@ -136,9 +136,23 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) glVertex3f(t[0], t[1], t[2]); } glEnd(); + + /**** strings ****/ + + for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { + SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); + if (elem->type != SIM_DEBUG_ELEM_STRING) + continue; + + unsigned char col[4]; + rgb_float_to_uchar(col, elem->color); + col[3] = 255; + view3d_cached_text_draw_add(elem->v1, elem->str, strlen(elem->str), + 0, V3D_CACHE_TEXT_GLOBALSPACE, col); + } } -void draw_sim_debug_data(Scene *UNUSED(scene), View3D *UNUSED(v3d), ARegion *ar) +void draw_sim_debug_data(Scene *UNUSED(scene), View3D *v3d, ARegion *ar) { RegionView3D *rv3d = ar->regiondata; /*Object *ob = base->object;*/ @@ -153,9 +167,11 @@ void draw_sim_debug_data(Scene *UNUSED(scene), View3D *UNUSED(v3d), ARegion *ar) // glEnable(GL_BLEND); glPushMatrix(); - glLoadMatrixf(rv3d->viewmat); + + view3d_cached_text_draw_begin(); draw_sim_debug_elements(_sim_debug_data, imat); + view3d_cached_text_draw_end(v3d, ar, false, NULL); glPopMatrix(); |