diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-14 09:51:42 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-14 15:18:52 +0300 |
commit | 277d90127417881a13be6b8c8db46fb4339391e9 (patch) | |
tree | cb77c17d0a29b0f46cee4fffc702ffe0559aabe3 /source/blender/draw/modes | |
parent | 158930228d6b4a62e74d836803793ff5b1a309d7 (diff) |
T55456 EditMeshMode
- see the face selection color when face is active
- test different masks for active face, finally chosen for no mask at
all.
Diffstat (limited to 'source/blender/draw/modes')
5 files changed, 22 insertions, 63 deletions
diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c index 5be98b12bb7..d51f3a85105 100644 --- a/source/blender/draw/modes/edit_mesh_mode.c +++ b/source/blender/draw/modes/edit_mesh_mode.c @@ -156,29 +156,29 @@ static char *EDIT_MESH_sh_defines(ToolSettings *tsettings, RegionView3D *rv3d, b if (selectmode & SCE_SELECT_VERTEX) { - BLI_dynstr_appendf(ds, "#define VERTEX_SELECTION\n"); + BLI_dynstr_append(ds, "#define VERTEX_SELECTION\n"); } if (selectmode & SCE_SELECT_EDGE) { - BLI_dynstr_appendf(ds, "#define EDGE_SELECTION\n"); + BLI_dynstr_append(ds, "#define EDGE_SELECTION\n"); } if (selectmode & SCE_SELECT_FACE) { - BLI_dynstr_appendf(ds, "#define FACE_SELECTION\n"); + BLI_dynstr_append(ds, "#define FACE_SELECTION\n"); } if (!fast_mode) { - BLI_dynstr_appendf(ds, "#define EDGE_FIX\n"); + BLI_dynstr_append(ds, "#define EDGE_FIX\n"); } if (anti_alias) { - BLI_dynstr_appendf(ds, "#define ANTI_ALIASING\n"); + BLI_dynstr_append(ds, "#define ANTI_ALIASING\n"); } - BLI_dynstr_appendf(ds, "#define VERTEX_FACING\n"); + BLI_dynstr_append(ds, "#define VERTEX_FACING\n"); str = BLI_dynstr_get_cstring(ds); BLI_dynstr_free(ds); @@ -213,7 +213,6 @@ static GPUShader *EDIT_MESH_ensure_shader(ToolSettings *tsettings, RegionView3D datatoc_edit_mesh_overlay_frag_glsl, datatoc_common_globals_lib_glsl, defines); - MEM_freeN(defines); } return e_data.overlay_tri_sh_cache[index]; diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl index 23b794d9b8b..2e729009a38 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_frag.glsl @@ -1,29 +1,7 @@ - -/* Solid Wirefram implementation - * Mike Erwin, Clément Foucault */ - -/* This shader follows the principles of - * http://developer.download.nvidia.com/SDK/10/direct3d/Source/SolidWireframe/Doc/SolidWireframe.pdf */ - flat in vec4 faceColor; -flat in int faceActive; - out vec4 FragColor; -const vec4 stipple_matrix[4] = vec4[4]( - vec4(1.0, 0.0, 0.0, 0.0), - vec4(0.0, 0.0, 0.0, 0.0), - vec4(0.0, 0.0, 1.0, 0.0), - vec4(0.0, 0.0, 0.0, 0.0) -); - void main() { FragColor = faceColor; - - if (faceActive == 1) { - int x = int(gl_FragCoord.x) & 0x3; /* mod 4 */ - int y = int(gl_FragCoord.y) & 0x3; /* mod 4 */ - FragColor *= stipple_matrix[x][y]; - } } diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl index 3b9aa77306f..c9de6d29524 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_facefill_vert.glsl @@ -5,25 +5,11 @@ in vec3 pos; in ivec4 data; flat out vec4 faceColor; -flat out int faceActive; -#define FACE_ACTIVE (1 << 2) #define FACE_SELECTED (1 << 3) void main() { gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); - - if ((data.x & FACE_ACTIVE) != 0) { - faceColor = colorEditMeshActive; - faceActive = 1; - } - else if ((data.x & FACE_SELECTED) != 0) { - faceColor = colorFaceSelect; - faceActive = 0; - } - else { - faceColor = colorFace; - faceActive = 0; - } + faceColor = ((data.x & FACE_SELECTED) != 0)? colorFaceSelect: colorFace; } 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 4bf5f348c27..b7935d43bff 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_frag.glsl @@ -54,6 +54,10 @@ out vec4 FragColor; #define VERTEX_SELECTED (1 << (1 + 8)) #define FACE_ACTIVE (1 << (2 + 8)) +#define LARGE_EDGE_SIZE 3.0 +#define LARGE_EDGE_SIZE_ACTIVE_FACE 5.0 + + /* Style Parameters in pixel */ /* Array to retrieve vert/edge indices */ @@ -75,13 +79,6 @@ const ivec3 clipPointIdx[6] = ivec3[6]( ivec3(2, 1, 0) ); -const vec4 stipple_matrix[4] = vec4[4]( - vec4(1.0, 0.0, 0.0, 0.0), - vec4(0.0, 0.0, 0.0, 0.0), - vec4(0.0, 0.0, 1.0, 0.0), - vec4(0.0, 0.0, 0.0, 0.0) -); - void colorDist(vec4 color, float dist) { FragColor = (dist < 0) ? color : FragColor; @@ -145,21 +142,13 @@ void main() /* First */ FragColor = faceColor; - - if ((flag[0] & FACE_ACTIVE) != 0) { - int x = int(gl_FragCoord.x) & 0x3; /* mod 4 */ - int y = int(gl_FragCoord.y) & 0x3; /* mod 4 */ - FragColor *= stipple_matrix[x][y]; - } - else { - FragColor.a *= faceAlphaMod; - } + FragColor.a *= faceAlphaMod; /* Edges */ for (int v = 0; v < 3; ++v) { if ((flag[v] & EDGE_EXISTS) != 0) { /* Outer large edge */ - float largeEdge = e[v] - sizeEdge * 3.0; + float largeEdge = e[v] - sizeEdge * LARGE_EDGE_SIZE; vec4 large_edge_color = vec4(0.0); large_edge_color = ((flag[v] & EDGE_SHARP) != 0) ? colorEdgeSharp : large_edge_color; @@ -167,6 +156,12 @@ void main() large_edge_color = (edgesBweight[v] > 0.0) ? vec4(colorEdgeBWeight.rgb, edgesBweight[v]) : large_edge_color; large_edge_color = ((flag[v] & EDGE_SEAM) != 0) ? colorEdgeSeam : large_edge_color; + if ((flag[0] & FACE_ACTIVE) != 0) + { + large_edge_color = colorEditMeshActive; + largeEdge = e[v] - sizeEdge * LARGE_EDGE_SIZE_ACTIVE_FACE; + } + if (large_edge_color.a != 0.0) { colorDistEdge(large_edge_color, largeEdge); } @@ -183,7 +178,8 @@ void main() # ifdef EDGE_SELECTION vec4 inner_edge_color = colorWireEdit; inner_edge_color = ((flag[v] & EDGE_SELECTED) != 0) ? colorEdgeSelect : inner_edge_color; - inner_edge_color = ((flag[v] & EDGE_ACTIVE) != 0) ? vec4(colorEditMeshActive.xyz, 1.0) : inner_edge_color; + inner_edge_color = ((flag[v] & EDGE_ACTIVE) != 0) ? vec4(colorEditMeshActive.rgb, 1.0) : inner_edge_color; + # else vec4 inner_edge_color = colorWireInactive; # endif diff --git a/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl b/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl index a22cc56c74f..7e778c325a6 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl @@ -167,7 +167,7 @@ void main() /* Face */ if ((vData[0].x & FACE_ACTIVE) != 0) - faceColor = colorEditMeshActive; + faceColor = colorFaceSelect; else if ((vData[0].x & FACE_SELECTED) != 0) faceColor = colorFaceSelect; else |