T55456 EditMeshMode
- see the face selection color when face is active - test different masks for active face, finally chosen for no mask at all.
This commit is contained in:
parent
158930228d
commit
277d901274
|
@ -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];
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue