diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-14 15:13:00 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-14 15:13:00 +0300 |
commit | 37f87ae81bc31134cf985277d877afb7b922dbbc (patch) | |
tree | d7914790229ec87633b39d176c44a4264b9842e0 /source/blender/draw | |
parent | 9bb42de82878f69b4066167ec8bdc9760b59d2eb (diff) |
Fix zfighting from edit mode face overlays
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl | 10 |
1 files changed, 5 insertions, 5 deletions
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 9711c9feeb8..9aa656818cb 100644 --- a/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl +++ b/source/blender/draw/modes/shaders/edit_mesh_overlay_vert.glsl @@ -20,17 +20,17 @@ out int selectOveride; void main() { - vec4 world_pos = ModelMatrix * vec4(pos, 1.0); + vec3 world_pos = point_object_to_world(pos); #if !defined(FACE) /* TODO override the ViewProjection Matrix for this case. */ mat4 projmat = ProjectionMatrix; projmat[3][2] -= ofs; - gl_Position = projmat * (ViewMatrix * world_pos); + gl_Position = projmat * (ViewMatrix * vec4(world_pos, 1.0)); #else - gl_Position = ViewProjectionMatrix * world_pos; + gl_Position = point_world_to_ndc(world_pos); #endif ivec4 m_data = data & dataMask; @@ -74,7 +74,7 @@ void main() #if !defined(FACE) /* Facing based color blend */ - vec3 vpos = point_world_to_view(world_pos.xyz); + vec3 vpos = point_world_to_view(world_pos); vec3 view_normal = normalize(normal_object_to_view(vnor) + 1e-4); vec3 view_vec = (ProjectionMatrix[3][3] == 0.0) ? normalize(vpos) : vec3(0.0, 0.0, 1.0); float facing = dot(view_vec, view_normal); @@ -84,6 +84,6 @@ void main() #endif #ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance(world_pos.xyz); + world_clip_planes_calc_clip_distance(world_pos); #endif } |