Edit Mesh Overlay: Fix floating point instability artifacts

This was visible when vertices were very close to the near clip plane.
This commit is contained in:
Clément Foucault 2018-07-03 15:38:21 +02:00
parent 1c5b375390
commit 14b0510d21
1 changed files with 3 additions and 4 deletions

View File

@ -36,11 +36,10 @@ out vec4 FragColor;
void distToEdgeAndPoint(vec2 dir, vec2 ori, out float edge, out float point)
{
dir = normalize(dir.xy);
dir = vec2(-dir.y, dir.x);
vec2 of = gl_FragCoord.xy - ori;
point = dot(of, of);
float dof = dot(dir, of);
edge = sqrt(abs(point - dof * dof));
point = sqrt(point);
point = sqrt(dot(of, of));
edge = abs(dot(dir, of));
}
void colorDist(vec4 color, float dist)