Edit Mode: Change face mode edges display

This improve visibility in edit face select mode by using the face select color
instead of the edge select color (which is in default theme a bit more red). Also
makes the selected edges in this mode a bit more opaque (0.75 instead of  0.4).
Full opacity is still reserved for edge select mode.
This commit is contained in:
Clément Foucault 2019-04-19 15:08:46 +02:00
parent 223f7e79f9
commit 6c83c92862
3 changed files with 13 additions and 8 deletions

View File

@ -17,16 +17,21 @@ vec4 EDIT_MESH_edge_color_outer(int edge_flag, int face_flag, float crease, floa
vec4 EDIT_MESH_edge_color_inner(int edge_flag)
{
vec4 color = colorWireEdit;
color = (doEdges && ((edge_flag & EDGE_SELECTED) != 0)) ? colorEdgeSelect : color;
vec4 color_select = (selectEdges) ? colorEdgeSelect : colorFaceSelect;
color = (doEdges && ((edge_flag & EDGE_SELECTED) != 0)) ? color_select : color;
color = (doEdges && ((edge_flag & EDGE_ACTIVE) != 0)) ? colorEditMeshActive : color;
float non_edge_select_alpha = (selectFaces && (edge_flag & EDGE_SELECTED) != 0) ? 0.75 : 0.4;
color.a = (selectEdges) ? 1.0 : non_edge_select_alpha;
return color;
}
vec4 EDIT_MESH_edge_vertex_color(int vertex_flag)
{
vec4 color = colorWireEdit;
color = (doEdges && (vertex_flag & (VERT_ACTIVE | VERT_SELECTED)) != 0) ? colorEdgeSelect :
color;
vec4 color_select = (selectEdges) ? colorEdgeSelect : colorFaceSelect;
color = (doEdges && (vertex_flag & (VERT_ACTIVE | VERT_SELECTED)) != 0) ? color_select : color;
color.a = (selectEdges) ? 1.0 : 0.4;
return color;
}
@ -46,10 +51,10 @@ vec4 EDIT_MESH_vertex_color(int vertex_flag)
vec4 EDIT_MESH_face_color(int face_flag)
{
vec4 color = colorFace;
vec4 color_active = mix(colorFaceSelect, colorEditMeshActive, 0.5);
color = ((face_flag & FACE_FREESTYLE) != 0) ? colorFaceFreestyle : color;
color = ((face_flag & FACE_SELECTED) != 0) ? colorFaceSelect : color;
color = ((face_flag & FACE_ACTIVE) != 0) ? mix(colorFaceSelect, colorEditMeshActive, 0.5) :
color;
color = ((face_flag & FACE_ACTIVE) != 0) ? color_active : color;
color.a *= ((face_flag & (FACE_FREESTYLE | FACE_SELECTED | FACE_ACTIVE)) == 0 || selectFaces) ?
1.0 :
0.5;

View File

@ -29,7 +29,8 @@ void main()
float mix_w = step(0.5, dist);
float mix_w_outer = step(0.5, dist_outer);
#endif
/* Line color & alpha. */
FragColor = mix(finalColorOuter_f, finalColor_f, 1.0 - mix_w * finalColorOuter_f.a);
/* Line edges shape. */
FragColor.a *= 1.0 - (finalColorOuter_f.a > 0.0 ? mix_w_outer : mix_w);
FragColor.a *= (selectEdges) ? 1.0 : 0.4;
}

View File

@ -82,8 +82,7 @@ void main()
float facing = dot(view_vec, view_normal);
facing = 1.0 - abs(facing) * 0.2;
finalColor = mix(colorEditMeshMiddle, finalColor, facing);
finalColor.a = 1.0;
finalColor.rgb = mix(colorEditMeshMiddle.rgb, finalColor.rgb, facing);
#endif