OpenGL: delete bl_debug_draw

Eliminating this chunk of legacy GL as part of T49043.

We can introduce some sort of "debug plate" to fill this need in the future.
This commit is contained in:
Mike Erwin 2016-12-04 20:34:44 -05:00
parent 5de33c3b64
commit 6ab42eb0bd
3 changed files with 1 additions and 152 deletions

View File

@ -95,20 +95,6 @@ void BLI_scanfill_obj_dump(ScanFillContext *sf_ctx)
}
#endif
#if 0
void BLI_scanfill_view3d_dump(ScanFillContext *sf_ctx)
{
ScanFillEdge *eed;
bl_debug_draw_quad_clear();
bl_debug_color_set(0x0000ff);
for (eed = sf_ctx->filledgebase.first; eed; eed = eed->next) {
bl_debug_draw_edge_add(eed->v1->co, eed->v2->co);
}
}
#endif
static ListBase *edge_isect_ls_ensure(GHash *isect_hash, ScanFillEdge *eed)
{
ListBase *e_ls;

View File

@ -81,12 +81,6 @@
/* use accelerated overlap check */
#define USE_BVH
// #define USE_BOOLEAN_RAYCAST_DRAW
#ifdef USE_BOOLEAN_RAYCAST_DRAW
/* insert bl_debug_draw_quad_clear... here */
#endif
// #define USE_DUMP
static void tri_v3_scale(
@ -1006,10 +1000,6 @@ bool BM_mesh_intersect(
int i_a, i_b;
#endif
#ifdef USE_BOOLEAN_RAYCAST_DRAW
bl_debug_draw_quad_clear();
#endif
s.bm = bm;
s.edgetri_cache = BLI_ghash_new(BLI_ghashutil_inthash_v4_p, BLI_ghashutil_inthash_v4_cmp, __func__);
@ -1607,17 +1597,6 @@ bool BM_mesh_intersect(
do_flip = (side == 0);
break;
}
#ifdef USE_BOOLEAN_RAYCAST_DRAW
{
unsigned int colors[4] = {0x00000000, 0xffffffff, 0xff000000, 0x0000ff};
float co_other[3] = {UNPACK3(co)};
co_other[0] += 1000.0f;
bl_debug_color_set(colors[(hits & 1) == 1]);
bl_debug_draw_edge_add(co, co_other);
}
#endif
}
if (do_remove) {

View File

@ -108,18 +108,6 @@
static void view3d_stereo3d_setup_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
float winmat[4][4], const char *viewname);
/* handy utility for drawing shapes in the viewport for arbitrary code.
* could add lines and points too */
// #define DEBUG_DRAW
#ifdef DEBUG_DRAW
static void bl_debug_draw(void);
/* add these locally when using these functions for testing */
extern void bl_debug_draw_quad_clear(void);
extern void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2[3], const float v3[3]);
extern void bl_debug_draw_edge_add(const float v0[3], const float v1[3]);
extern void bl_debug_color_set(const unsigned int col);
#endif
void circ(float x, float y, float rad)
{
glBegin(GL_LINE_LOOP);
@ -2997,10 +2985,7 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar)
/* draw viewport using opengl */
if (v3d->drawtype != OB_RENDER || !view3d_main_region_do_render_draw(scene) || clip_border) {
view3d_main_region_draw_objects(C, scene, v3d, ar, &grid_unit);
#ifdef DEBUG_DRAW
bl_debug_draw();
#endif
if (G.debug & G_DEBUG_SIMDATA)
draw_sim_debug_data(scene, v3d, ar);
@ -3019,104 +3004,3 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar)
BLI_assert(BLI_listbase_is_empty(&v3d->afterdraw_xray));
BLI_assert(BLI_listbase_is_empty(&v3d->afterdraw_xraytransp));
}
#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;
static unsigned int _bl_debug_draw_quads_color[_DEBUG_DRAW_QUAD_TOT];
static unsigned int _bl_debug_draw_edges_color[_DEBUG_DRAW_EDGE_TOT];
static unsigned int _bl_debug_draw_color;
void bl_debug_draw_quad_clear(void)
{
_bl_debug_draw_quads_tot = 0;
_bl_debug_draw_edges_tot = 0;
_bl_debug_draw_color = 0x00FF0000;
}
void bl_debug_color_set(const unsigned int color)
{
_bl_debug_draw_color = color;
}
void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2[3], const float v3[3])
{
if (_bl_debug_draw_quads_tot >= _DEBUG_DRAW_QUAD_TOT) {
printf("%s: max quad count hit %d!", __func__, _bl_debug_draw_quads_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;
copy_v3_v3(pt, v2); pt += 3;
copy_v3_v3(pt, v3); pt += 3;
_bl_debug_draw_quads_color[_bl_debug_draw_quads_tot] = _bl_debug_draw_color;
_bl_debug_draw_quads_tot++;
}
}
void bl_debug_draw_edge_add(const float v0[3], const float v1[3])
{
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_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_edges_color[_bl_debug_draw_edges_tot] = _bl_debug_draw_color;
_bl_debug_draw_edges_tot++;
}
}
static void bl_debug_draw(void)
{
unsigned int color;
if (_bl_debug_draw_quads_tot) {
int i;
color = _bl_debug_draw_quads_color[0];
cpack(color);
for (i = 0; i < _bl_debug_draw_quads_tot; i ++) {
if (_bl_debug_draw_quads_color[i] != color) {
color = _bl_debug_draw_quads_color[i];
cpack(color);
}
glBegin(GL_LINE_LOOP);
glVertex3fv(_bl_debug_draw_quads[i][0]);
glVertex3fv(_bl_debug_draw_quads[i][1]);
glVertex3fv(_bl_debug_draw_quads[i][2]);
glVertex3fv(_bl_debug_draw_quads[i][3]);
glEnd();
}
}
if (_bl_debug_draw_edges_tot) {
int i;
color = _bl_debug_draw_edges_color[0];
cpack(color);
glBegin(GL_LINES);
for (i = 0; i < _bl_debug_draw_edges_tot; i ++) {
if (_bl_debug_draw_edges_color[i] != color) {
color = _bl_debug_draw_edges_color[i];
cpack(color);
}
glVertex3fv(_bl_debug_draw_edges[i][0]);
glVertex3fv(_bl_debug_draw_edges[i][1]);
}
glEnd();
color = _bl_debug_draw_edges_color[0];
cpack(color);
glPointSize(4.0f);
glBegin(GL_POINTS);
for (i = 0; i < _bl_debug_draw_edges_tot; i ++) {
if (_bl_debug_draw_edges_color[i] != color) {
color = _bl_debug_draw_edges_color[i];
cpack(color);
}
glVertex3fv(_bl_debug_draw_edges[i][0]);
glVertex3fv(_bl_debug_draw_edges[i][1]);
}
glEnd();
}
}
#endif