From 6f38938a64178f0a3ed6a4b96e4bf459c9076468 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 21 Nov 2009 16:44:05 +0000 Subject: [#19930] Nurb CV select is failing because of view clipping - the clipping test function was using the rv3d->viewmatob where it needed to use the object matrix. - added a local clipping member to rv3d, the clipping planes in object-space, avoids many matrix multiplications when testing verts or clipping pixels when projection painting. --- source/blender/editors/sculpt_paint/paint_image.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index ef036da6d7b..55f7a6a23b9 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -861,8 +861,7 @@ static int project_paint_occlude_ptv_clip( if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w); else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w); - mul_m4_v3(ps->ob->obmat, wco); - if(!view3d_test_clipping(ps->rv3d, wco)) { + if(!view3d_test_clipping(ps->rv3d, wco, 1)) { return 1; } @@ -2446,8 +2445,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i /* a pitty we need to get the worldspace pixel location here */ if(ps->rv3d->rflag & RV3D_CLIPPING) { interp_v3_v3v3v3(wco, ps->dm_mvert[ (*(&mf->v1 + i1)) ].co, ps->dm_mvert[ (*(&mf->v1 + i2)) ].co, ps->dm_mvert[ (*(&mf->v1 + i3)) ].co, w); - mul_m4_v3(ps->ob->obmat, wco); - if(view3d_test_clipping(ps->rv3d, wco)) { + if(view3d_test_clipping(ps->rv3d, wco, 1)) { continue; /* Watch out that no code below this needs to run */ } } @@ -2663,9 +2661,8 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i if(ps->rv3d->rflag & RV3D_CLIPPING) { if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w); else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w); - - mul_m4_v3(ps->ob->obmat, wco); - if(view3d_test_clipping(ps->rv3d, wco)) { + + if(view3d_test_clipping(ps->rv3d, wco, 1)) { continue; /* Watch out that no code below this needs to run */ } } @@ -2934,6 +2931,8 @@ static void project_paint_begin(ProjPaintState *ps) /* ---- end defines ---- */ + ED_view3d_local_clipping(ps->rv3d, ps->ob->obmat); /* faster clipping lookups */ + /* paint onto the derived mesh */ /* Workaround for subsurf selection, try the display mesh first */ -- cgit v1.2.3