Fix T72690: Do not draw points behind the viewport camera in the paint cursor

In some situations the symmetry point may be behind the camera, so the
projection is inverted and it looks wrong. This avoids drawing points in
screen space when they are behind the camera.

Reviewed By: jbakker

Maniphest Tasks: T72690

Differential Revision: https://developer.blender.org/D6487
This commit is contained in:
Pablo Dobarro 2020-01-23 21:41:30 +01:00
parent 08d1df4729
commit 78cf61cc62
Notes: blender-bot 2023-02-14 10:29:32 +01:00
Referenced by issue #72690, Sculpt-Mode Symmetry Cursor Bug
1 changed files with 5 additions and 2 deletions

View File

@ -1103,8 +1103,11 @@ static void cursor_draw_point_screen_space(
copy_v3_v3(location, true_location);
mul_m4_v3(obmat, location);
ED_view3d_project(ar, location, translation_vertex_cursor);
imm_draw_circle_fill_3d(
gpuattr, translation_vertex_cursor[0], translation_vertex_cursor[1], size, 10);
/* Do not draw points behind the view. Z [near, far] is mapped to [-1, 1]. */
if (translation_vertex_cursor[2] <= 1.0f) {
imm_draw_circle_fill_3d(
gpuattr, translation_vertex_cursor[0], translation_vertex_cursor[1], size, 10);
}
}
static void cursor_draw_tiling_preview(const uint gpuattr,