dont draw object centers when drawing the depth buffer, grease pencil would get its depth messed up by object centers when with 'Surface' mode.

Also fix own error with drawing grease pencil depths, wasnt setting v3d->zbuf back to its original value.
This commit is contained in:
Campbell Barton 2010-01-03 01:55:20 +00:00
parent 18d37648ba
commit e2f5d31453
2 changed files with 36 additions and 27 deletions

View File

@ -798,25 +798,28 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
curcol[3]= 0.6;
glColor4fv(curcol);
if(ob->id.us>1) {
if (ob==OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
else glColor4ub(0x77, 0xCC, 0xCC, 155);
}
/* Inner Circle */
VECCOPY(vec, ob->obmat[3]);
glEnable(GL_BLEND);
drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
glDisable(GL_BLEND);
drawcircball(GL_POLYGON, vec, lampsize, imat);
/* restore */
if(ob->id.us>1)
glColor4fv(curcol);
if(lampsize > 0.0f) {
if(ob->id.us>1) {
if (ob==OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
else glColor4ub(0x77, 0xCC, 0xCC, 155);
}
/* Outer circle */
circrad = 3.0f*lampsize;
drawcircball(GL_LINE_LOOP, vec, circrad, imat);
/* Inner Circle */
VECCOPY(vec, ob->obmat[3]);
glEnable(GL_BLEND);
drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
glDisable(GL_BLEND);
drawcircball(GL_POLYGON, vec, lampsize, imat);
/* restore */
if(ob->id.us>1)
glColor4fv(curcol);
/* Outer circle */
circrad = 3.0f*lampsize;
drawcircball(GL_LINE_LOOP, vec, circrad, imat);
}
setlinestyle(3);
@ -6154,7 +6157,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
else if((flag & DRAW_CONSTCOLOR)==0) {
/* we don't draw centers for duplicators and sets */
drawcentercircle(v3d, rv3d, ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us>1);
if(U.obcenter_dia > 0) {
/* check > 0 otherwise grease pencil can draw into the circle select which is annoying. */
drawcentercircle(v3d, rv3d, ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us>1);
}
}
}
}

View File

@ -1645,6 +1645,7 @@ void view3d_update_depths(ARegion *ar, View3D *v3d)
void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
{
short zbuf= v3d->zbuf;
RegionView3D *rv3d= ar->regiondata;
setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */
@ -1662,7 +1663,9 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
glEnable(GL_DEPTH_TEST);
draw_gpencil_3dview_ext(scene, ar, 1);
return;
v3d->zbuf= zbuf;
}
void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
@ -1670,17 +1673,16 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
RegionView3D *rv3d= ar->regiondata;
Base *base;
Scene *sce;
short zbuf, flag;
float glalphaclip;
short zbuf= v3d->zbuf;
short flag= v3d->flag;
float glalphaclip= U.glalphaclip;
int obcenter_dia= U.obcenter_dia;
/* temp set drawtype to solid */
/* Setting these temporarily is not nice */
zbuf = v3d->zbuf;
flag = v3d->flag;
glalphaclip = U.glalphaclip;
U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */
v3d->flag &= ~V3D_SELECT_OUTLINE;
U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */
U.obcenter_dia= 0;
setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */
setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */
@ -1764,6 +1766,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
v3d->zbuf = zbuf;
U.glalphaclip = glalphaclip;
v3d->flag = flag;
U.obcenter_dia= obcenter_dia;
}
typedef struct View3DShadow {