Edit Mesh Mode: Improve edge drawing
Make edge decoration a bit thinner and try to reduce missing edge segment due to triangle barycentrics. This invert the "edge fix" strip offset direction, meanning there is now the possibility that these triangles poke through nearby geometry depending on the viewport near/far clips distances.
This commit is contained in:
parent
819e6745b0
commit
46d88c5850
|
@ -28,7 +28,10 @@ out vec4 FragColor;
|
|||
/* Vertex flag is shifted and combined with the edge flag */
|
||||
#define FACE_ACTIVE_ (FACE_ACTIVE << 8)
|
||||
|
||||
#define LARGE_EDGE_SIZE 3.0
|
||||
#define LARGE_EDGE_SIZE 2.15
|
||||
|
||||
/* Enough to visually fill gaps and not enough to mess the AA gradient too much. */
|
||||
#define EDGE_FIX_ALPHA 0.6
|
||||
|
||||
/* Style Parameters in pixel */
|
||||
|
||||
|
@ -103,7 +106,9 @@ void main()
|
|||
float largeEdge = e[v] - sizeEdgeFinal * LARGE_EDGE_SIZE;
|
||||
|
||||
vec4 large_edge_color = EDIT_MESH_edge_color_outer(flag[v], (flag[0] & FACE_ACTIVE_) != 0, edgesCrease[v], edgesBweight[v]);
|
||||
|
||||
#ifdef EDGE_FIX
|
||||
large_edge_color *= EDGE_FIX_ALPHA;
|
||||
#endif
|
||||
if (large_edge_color.a != 0.0) {
|
||||
colorDistEdge(large_edge_color, largeEdge);
|
||||
}
|
||||
|
@ -115,9 +120,16 @@ void main()
|
|||
#endif
|
||||
|
||||
#ifdef VERTEX_SELECTION
|
||||
vec4 inner_edge_color = vec4(vertexColor, 1.0);
|
||||
# ifdef EDGE_FIX
|
||||
inner_edge_color *= EDGE_FIX_ALPHA;
|
||||
# endif
|
||||
colorDistEdge(vec4(vertexColor, 1.0), innerEdge);
|
||||
#else
|
||||
vec4 inner_edge_color = EDIT_MESH_edge_color_inner(flag[v], (flag[0] & FACE_ACTIVE_) != 0);
|
||||
# ifdef EDGE_FIX
|
||||
inner_edge_color *= EDGE_FIX_ALPHA;
|
||||
# endif
|
||||
colorDistEdge(inner_edge_color, innerEdge);
|
||||
#endif
|
||||
}
|
||||
|
@ -135,7 +147,9 @@ void main()
|
|||
vec4 point_color = colorVertex;
|
||||
point_color = ((flag[v] & EDGE_VERTEX_SELECTED) != 0) ? colorVertexSelect : point_color;
|
||||
point_color = ((flag[v] & EDGE_VERTEX_ACTIVE) != 0) ? vec4(colorEditMeshActive.xyz, 1.0) : point_color;
|
||||
|
||||
# ifdef EDGE_FIX
|
||||
point_color.a *= EDGE_FIX_ALPHA;
|
||||
# endif
|
||||
colorDist(point_color, size);
|
||||
}
|
||||
}
|
||||
|
@ -144,6 +158,7 @@ void main()
|
|||
#ifdef VERTEX_FACING
|
||||
FragColor.a *= 1.0 - abs(facing) * 0.4;
|
||||
#endif
|
||||
|
||||
/* don't write depth if not opaque */
|
||||
if (FragColor.a == 0.0) discard;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ out float facing;
|
|||
#endif
|
||||
|
||||
#ifdef ANTI_ALIASING
|
||||
#define Z_OFFSET 0.008
|
||||
#define Z_OFFSET -0.0013
|
||||
#else
|
||||
#define Z_OFFSET 0.0
|
||||
#endif
|
||||
|
@ -175,6 +175,7 @@ void main()
|
|||
doVertexOfs(0, fixvec);
|
||||
doVertexOfs(1, fixvec);
|
||||
}
|
||||
|
||||
doVertex(0);
|
||||
doVertex(1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue