Edit Mode: Draw Vertices after edges

This avoid edges covering a part of vertices.

This comes at a (very minor) perf cost as vertices can cover some edges
pixels and early discard them with the depth test. But this only happens
in artificialy dense mesh and is not a real problem for common cases.
This commit is contained in:
Clément Foucault 2019-02-07 20:40:54 +01:00
parent a04dd15193
commit d2afa51ddc
1 changed files with 13 additions and 13 deletions

View File

@ -321,19 +321,6 @@ static DRWPass *edit_mesh_create_overlay_pass(
grp = *r_face_cage_shgrp = DRW_shgroup_create_sub(*r_face_shgrp);
DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE);
/* Verts */
if (select_vert) {
grp = *r_vert_shgrp = DRW_shgroup_create(vert_sh, pass);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
DRW_shgroup_uniform_float_copy(grp, "ofs", depth_ofs * 1.5f);
DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE | DRW_STATE_WRITE_DEPTH);
DRW_shgroup_state_disable(grp, DRW_STATE_BLEND);
if (rv3d->rflag & RV3D_CLIPPING) {
DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
}
}
/* Edges */
grp = *r_edge_shgrp = DRW_shgroup_create(edge_sh, pass);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
@ -350,6 +337,19 @@ static DRWPass *edit_mesh_create_overlay_pass(
DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
}
/* Verts */
if (select_vert) {
grp = *r_vert_shgrp = DRW_shgroup_create(vert_sh, pass);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
DRW_shgroup_uniform_float_copy(grp, "ofs", depth_ofs * 1.5f);
DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE | DRW_STATE_WRITE_DEPTH);
DRW_shgroup_state_disable(grp, DRW_STATE_BLEND);
if (rv3d->rflag & RV3D_CLIPPING) {
DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
}
}
return pass;
}