void draw_mesh_paint_weight_edges(RegionView3D *rv3d, DerivedMesh *dm, const bool use_depth, void *edgemask_cb, void *user_data) { /* weight paint in solid mode, special case. focus on making the weights clear * rather than the shading, this is also forced in wire view */ if (use_depth) { ED_view3d_polygon_offset(rv3d, 1.0); glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */ } else { glDisable(GL_DEPTH_TEST); } glEnable(GL_BLEND); glColor4ub(255, 255, 255, 96); glEnable(GL_LINE_STIPPLE); glLineStipple(1, 0xAAAA); dm->drawMappedEdges(dm, (DMSetDrawOptions)edgemask_cb, user_data); if (use_depth) { ED_view3d_polygon_offset(rv3d, 0.0); glDepthMask(1); } else { glEnable(GL_DEPTH_TEST); } glDisable(GL_LINE_STIPPLE); glDisable(GL_BLEND); }
void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) { drawMeshFaceSelect_userData data; data.me = me; data.edge_flags = get_tface_mesh_marked_edge_info(me); glEnable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); ED_view3d_polygon_offset(rv3d, 1.0); /* Draw (Hidden) Edges */ setlinestyle(1); UI_ThemeColor(TH_EDGE_FACESEL); dm->drawMappedEdges(dm, draw_mesh_face_select__setHiddenOpts, &data); setlinestyle(0); /* Draw Selected Faces */ if (me->drawflag & ME_DRAWFACES) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* dull unselected faces so as not to get in the way of seeing color */ glColor4ub(96, 96, 96, 64); dm->drawMappedFaces(dm, draw_mesh_face_select__drawFaceOptsInv, NULL, NULL, (void *)me, 0); glDisable(GL_BLEND); } ED_view3d_polygon_offset(rv3d, 1.0); /* Draw Stippled Outline for selected faces */ glColor3ub(255, 255, 255); setlinestyle(1); dm->drawMappedEdges(dm, draw_mesh_face_select__setSelectOpts, &data); setlinestyle(0); ED_view3d_polygon_offset(rv3d, 0.0); /* resets correctly now, even after calling accumulated offsets */ MEM_freeN(data.edge_flags); }