[Bf-blender-cvs] [9eb1910] master: Fix neg-scaled project-paint in perspective mode

Campbell Barton noreply at git.blender.org
Sat Apr 25 12:48:23 CEST 2015


Commit: 9eb191083ac79121a19ebc970575b10437f669f1
Author: Campbell Barton
Date:   Sat Apr 25 20:47:19 2015 +1000
Branches: master
https://developer.blender.org/rB9eb191083ac79121a19ebc970575b10437f669f1

Fix neg-scaled project-paint in perspective mode

===================================================================

M	source/blender/editors/sculpt_paint/paint_image_proj.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index d75b3f8..3ceaaff 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -1403,6 +1403,9 @@ static float project_paint_uvpixel_mask(
 			viewDirPersp[1] = (ps->viewPos[1] - (w[0] * co1[1] + w[1] * co2[1] + w[2] * co3[1]));
 			viewDirPersp[2] = (ps->viewPos[2] - (w[0] * co1[2] + w[1] * co2[2] + w[2] * co3[2]));
 			normalize_v3(viewDirPersp);
+			if (UNLIKELY(ps->is_flip_object)) {
+				negate_v3(viewDirPersp);
+			}
 
 			angle_cos = dot_v3v3(viewDirPersp, no);
 		}
@@ -3384,6 +3387,9 @@ static void proj_paint_state_vert_flags_init(ProjPaintState *ps)
 			else {
 				sub_v3_v3v3(viewDirPersp, ps->viewPos, mv->co);
 				normalize_v3(viewDirPersp);
+				if (UNLIKELY(ps->is_flip_object)) {
+					negate_v3(viewDirPersp);
+				}
 				if (dot_v3v3(viewDirPersp, no) <= ps->normal_angle__cos) { /* 1 vert of this face is towards us */
 					ps->vertFlags[a] |= PROJ_VERT_CULL;
 				}




More information about the Bf-blender-cvs mailing list