* ***** END GPL LICENSE BLOCK *****
* (uit traces) maart 95
*/
+
/** \file blender/blenlib/intern/scanfill.c
* \ingroup bli
*/
typedef struct ScFillVert {
EditVert *v1;
EditEdge *first,*last;
- short f,f1;
} 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;
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;
}
-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;
}
MEM_freeN(scdata);
+
+ return totface;
}
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!)
- 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;
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;
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 */
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++;
}
/* FREE */
MEM_freeN(pflist);
- return 1;
+ return totfaces;
}