diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-04-19 16:08:46 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-04-19 16:19:43 +0300 |
commit | 6c83c928620ec06301b46f57a1bbb9b694933519 (patch) | |
tree | 0c4e8fd68eef6568d2c0a1be0d48fa5fb5f3f0b5 /source/blender/draw | |
parent | 223f7e79f9fa221f60841afcff9a9ed8a97d9306 (diff) |
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.
Diffstat (limited to 'source/blender/draw')
3 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_common_lib.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_common_lib.glsl index 50e9c3677f9..7d4cba66933 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_common_lib.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_common_lib.glsl @@ -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; diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl index 5f1008b2f72..2c2cd1f0610 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl @@ -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; } diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl index 6b93193c9ae..d700e69fb57 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl @@ -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 |