diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-13 20:55:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-13 20:55:07 +0400 |
commit | 16710fb3c21f1e405fee58640f3e68f2e1fa6251 (patch) | |
tree | 240ca993013b827569b9543147e18a1235b2d9f8 /source/blender/blenlib | |
parent | 068c62701375e51445a768ab69b74802338f57c1 (diff) | |
parent | 62cd927f57b94292139348b0a803288e8eafe850 (diff) |
svn merge -r36651:36672 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_scanfill.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/scanfill.c | 27 |
2 files changed, 16 insertions, 13 deletions
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index b0ed9271132..0c5e6db1826 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -55,7 +55,7 @@ struct EditVert *BLI_addfillvert(float *vec); struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2); int BLI_begin_edgefill(void); -int BLI_edgefill(int mat_nr); +int BLI_edgefill(short mat_nr); void BLI_end_edgefill(void); /* These callbacks are needed to make the lib finction properly */ diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 908e6918250..c5a5cdeb5b0 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -27,6 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** * (uit traces) maart 95 */ + /** \file blender/blenlib/intern/scanfill.c * \ingroup bli */ @@ -90,7 +91,6 @@ typedef struct PolyFill { typedef struct ScFillVert { EditVert *v1; EditEdge *first,*last; - short f,f1; } ScFillVert; @@ -100,9 +100,9 @@ typedef struct ScFillVert { static ScFillVert *scdata; -ListBase fillvertbase = {0,0}; -ListBase filledgebase = {0,0}; -ListBase fillfacebase = {0,0}; +ListBase fillvertbase = {NULL, NULL}; +ListBase filledgebase = {NULL, NULL}; +ListBase fillfacebase = {NULL, NULL}; static short cox, coy; @@ -236,7 +236,7 @@ EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2) return newed; } -static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, int mat_nr) +static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, short mat_nr) { /* does not make edges */ EditFace *evl; @@ -512,13 +512,13 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr) } -static void scanfill(PolyFill *pf, int mat_nr) +static int scanfill(PolyFill *pf, short mat_nr) { ScFillVert *sc = NULL, *sc1; EditVert *eve,*v1,*v2,*v3; EditEdge *eed,*nexted,*ed1,*ed2,*ed3; float miny = 0.0; - int a,b,verts, maxface, totface; + int a,b,verts, maxface, totface; short nr, test, twoconnected=0; nr= pf->nr; @@ -765,6 +765,8 @@ static void scanfill(PolyFill *pf, int mat_nr) } MEM_freeN(scdata); + + return totface; } @@ -775,7 +777,7 @@ int BLI_begin_edgefill(void) return 1; } -int BLI_edgefill(int mat_nr) +int BLI_edgefill(short mat_nr) { /* - fill works with its own lists, so create that first (no faces!) @@ -783,7 +785,7 @@ int BLI_edgefill(int mat_nr) - struct elements xs en ys are not used here: don't hide stuff in it - edge flag ->f becomes 2 when it's a new edge - mode: & 1 is check for crossings, then create edges (TO DO ) - - mode: & 2 is enable shortest diagonal test for quads + - returns number of triangle faces added. */ ListBase tempve, temped; EditVert *eve; @@ -791,6 +793,7 @@ int BLI_edgefill(int mat_nr) PolyFill *pflist,*pf; float limit, *minp, *maxp, *v1, *v2, norm[3], len; short a,c,poly=0,ok=0,toggle=0; + int totfaces= 0; /* total faces added */ /* reset variables */ eve= fillvertbase.first; @@ -829,7 +832,7 @@ int BLI_edgefill(int mat_nr) addfillface(eve, eve->next, eve->next->next, 0); addfillface(eve->next->next, eve->next->next->next, eve, 0); } - return 1; + return 2; } /* first test vertices if they are in edges */ @@ -1093,7 +1096,7 @@ int BLI_edgefill(int mat_nr) for(a=0;a<poly;a++) { if(pf->edges>1) { splitlist(&tempve,&temped,pf->nr); - scanfill(pf, mat_nr); + totfaces += scanfill(pf, mat_nr); } pf++; } @@ -1103,6 +1106,6 @@ int BLI_edgefill(int mat_nr) /* FREE */ MEM_freeN(pflist); - return 1; + return totfaces; } |