Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-01-23 23:41:30 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-02-10 21:39:26 +0300
commit78cf61cc6292eb66c5835cf337ad8fb3e1c259b2 (patch)
tree7d65265d2a312445024eeb8c15506004026ab0db
parent08d1df4729b670962ce0d61b275f9c5efe05c761 (diff)
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
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 19b4b9f569c..cf796c7dd3c 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -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,