Object Drawing: minor refactor, don't check glsl in wire-mode

also don't call glBlendFunc for hidden objects.
This commit is contained in:
Campbell Barton 2014-06-16 17:12:08 +10:00
parent 5ca44ff952
commit 3f444d9984

@ -3869,12 +3869,14 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
else { else {
/* ob->bb was set by derived mesh system, do NULL check just to be sure */ /* ob->bb was set by derived mesh system, do NULL check just to be sure */
if (me->totpoly <= 4 || (!ob->bb || ED_view3d_boundbox_clip(rv3d, ob->bb))) { if (me->totpoly <= 4 || (!ob->bb || ED_view3d_boundbox_clip(rv3d, ob->bb))) {
const bool glsl = draw_glsl_material(scene, ob, v3d, dt); if (dt > OB_WIRE) {
const bool check_alpha = check_alpha_pass(base); const bool glsl = draw_glsl_material(scene, ob, v3d, dt);
if (dt == OB_SOLID || glsl) { if (dt == OB_SOLID || glsl) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, const bool check_alpha = check_alpha_pass(base);
(check_alpha) ? &do_alpha_after : NULL); GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl,
(check_alpha) ? &do_alpha_after : NULL);
}
} }
draw_mesh_fancy(scene, ar, v3d, rv3d, base, dt, ob_wire_col, dflag); draw_mesh_fancy(scene, ar, v3d, rv3d, base, dt, ob_wire_col, dflag);
@ -6907,18 +6909,15 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
unsigned int col = 0; unsigned int col = 0;
unsigned char _ob_wire_col[4]; /* dont initialize this */ unsigned char _ob_wire_col[4]; /* dont initialize this */
const unsigned char *ob_wire_col = NULL; /* dont initialize this, use NULL crashes as a way to find invalid use */ const unsigned char *ob_wire_col = NULL; /* dont initialize this, use NULL crashes as a way to find invalid use */
int i, selstart, selend, empty_object = 0; int i, selstart, selend;
short dtx; short dtx;
char dt; char dt;
bool zbufoff = false, is_paint = false; bool zbufoff = false, is_paint = false, empty_object = false;
const bool is_obact = (ob == OBACT); const bool is_obact = (ob == OBACT);
const bool render_override = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0; const bool render_override = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0;
const bool is_picking = (G.f & G_PICKSEL) != 0; const bool is_picking = (G.f & G_PICKSEL) != 0;
bool particle_skip_object = false; /* Draw particles but not their emitter object. */ bool particle_skip_object = false; /* Draw particles but not their emitter object. */
/* only once set now, will be removed too, should become a global standard */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (ob != scene->obedit) { if (ob != scene->obedit) {
if (ob->restrictflag & OB_RESTRICT_VIEW) { if (ob->restrictflag & OB_RESTRICT_VIEW) {
return; return;
@ -6970,7 +6969,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
} }
} }
/* -------------------------------------------------------------------- */
/* no return after this point, otherwise leaks */ /* no return after this point, otherwise leaks */
/* only once set now, will be removed too, should become a global standard */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
view3d_cached_text_draw_begin(); view3d_cached_text_draw_begin();
/* draw motion paths (in view space) */ /* draw motion paths (in view space) */