diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 86e3560786c..4793c9af068 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -105,8 +105,8 @@ typedef enum eWireDrawMode { typedef struct drawDMVerts_userData { BMEditMesh *em; - int sel; BMVert *eve_act; + char sel; /* cached theme values */ unsigned char th_editmesh_active[4]; @@ -2038,13 +2038,13 @@ static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv static void draw_dm_face_centers__mapFunc(void *userData, int index, const float cent[3], const float UNUSED(no[3])) { BMFace *efa = EDBM_face_at_index(((void **)userData)[0], index); - int sel = *(((int **)userData)[1]); + const char sel = *(((char **)userData)[1]); if (efa && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BM_elem_flag_test(efa, BM_ELEM_SELECT) == sel) { bglVertex3fv(cent); } } -static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, int sel) +static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, char sel) { void *ptrs[2] = {em, &sel}; @@ -2065,9 +2065,7 @@ static void draw_dm_vert_normals__mapFunc(void *userData, int index, const float copy_v3_v3(no, no_f); } else { - no[0] = no_s[0] / 32767.0f; - no[1] = no_s[1] / 32767.0f; - no[2] = no_s[2] / 32767.0f; + normal_short_to_float_v3(no, no_s); } if (!data->uniform_scale) { @@ -2147,7 +2145,7 @@ static void draw_dm_verts__mapFunc(void *userData, int index, const float co[3], } } -static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, int sel, BMVert *eve_act, +static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVert *eve_act, RegionView3D *rv3d) { drawDMVerts_userData data; @@ -5092,7 +5090,7 @@ static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, flo /* place to add drawers */ -static void drawhandlesN(Nurb *nu, short sel, short hide_handles) +static void drawhandlesN(Nurb *nu, const char sel, const bool hide_handles) { BezTriple *bezt; float *fp; @@ -5187,7 +5185,7 @@ static void drawhandlesN_active(Nurb *nu) glLineWidth(1); } -static void drawvertsN(Nurb *nu, short sel, short hide_handles, void *lastsel) +static void drawvertsN(Nurb *nu, const char sel, const bool hide_handles, void *lastsel) { BezTriple *bezt; BPoint *bp; @@ -5450,7 +5448,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Curve *cu = ob->data; Nurb *nu; BevList *bl; - short hide_handles = (cu->drawflag & CU_HIDE_HANDLES); + const bool hide_handles = (cu->drawflag & CU_HIDE_HANDLES) != 0; int index; unsigned char wire_col[3]; @@ -5526,13 +5524,13 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, } } - if (v3d->zbuf) glDisable(GL_DEPTH_TEST); + if (v3d->zbuf) glDepthFunc(GL_ALWAYS); for (nu = nurb; nu; nu = nu->next) { drawvertsN(nu, 1, hide_handles, cu->lastsel); } - if (v3d->zbuf) glEnable(GL_DEPTH_TEST); + if (v3d->zbuf) glDepthFunc(GL_LEQUAL); } /* draw a sphere for use as an empty drawtype */