code cleanup: avoid confusion with incorrectly named argument to BLI_edgefill(), was 'mat_nr', now 'do_quad_tri_speedup'

This commit is contained in:
Campbell Barton
2012-04-16 05:03:04 +00:00
parent d89db25c53
commit 79693e4543
9 changed files with 21 additions and 28 deletions

View File

@@ -472,7 +472,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
dl= dl->next;
}
if (totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
if (totvert && (tot= BLI_edgefill(FALSE))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
if (tot) {
dlnew= MEM_callocN(sizeof(DispList), "filldisplist");
dlnew->type= DL_INDEX3;

View File

@@ -216,7 +216,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
/*complete the loop*/
BLI_addfilledge(firstv, v);
totfilltri = BLI_edgefill(2);
totfilltri = BLI_edgefill(FALSE);
BLI_array_growitems(looptris, totfilltri);
for (efa = fillfacebase.first; efa; efa=efa->next) {

View File

@@ -2478,7 +2478,7 @@ int mesh_recalcTessellation(CustomData *fdata,
}
BLI_addfilledge(lastv, firstv);
totfilltri = BLI_edgefill(2);
totfilltri = BLI_edgefill(FALSE);
if (totfilltri) {
BLI_array_growitems(mface_to_poly_map, totfilltri);
BLI_array_growitems(mface, totfilltri);

View File

@@ -86,7 +86,7 @@ struct ScanFillEdge *BLI_addfilledge(struct ScanFillVert *v1, struct ScanFillVer
#define FILLBOUNDARY 1
int BLI_begin_edgefill(void);
int BLI_edgefill(short mat_nr);
int BLI_edgefill(const short do_quad_tri_speedup);
void BLI_end_edgefill(void);
/* These callbacks are needed to make the lib finction properly */

View File

@@ -792,7 +792,7 @@ int BLI_begin_edgefill(void)
return 1;
}
int BLI_edgefill(short mat_nr)
int BLI_edgefill(const short do_quad_tri_speedup)
{
/*
* - fill works with its own lists, so create that first (no faces!)
@@ -821,34 +821,28 @@ int BLI_edgefill(short mat_nr)
a += 1;
}
if (a == 3 && (mat_nr & 2)) {
if (do_quad_tri_speedup && (a == 3)) {
eve = fillvertbase.first;
addfillface(eve, eve->next, eve->next->next);
return 1;
}
else if (a == 4 && (mat_nr & 2)) {
else if (do_quad_tri_speedup && (a == 4)) {
float vec1[3], vec2[3];
eve = fillvertbase.first;
/* no need to check 'eve->next->next->next' is valid, already counted */
if (1) { //BMESH_TODO) {
/*use shortest diagonal for quad*/
sub_v3_v3v3(vec1, eve->co, eve->next->next->co);
sub_v3_v3v3(vec2, eve->next->co, eve->next->next->next->co);
if (dot_v3v3(vec1, vec1) < dot_v3v3(vec2, vec2)) {
addfillface(eve, eve->next, eve->next->next);
addfillface(eve->next->next, eve->next->next->next, eve);
}
else {
addfillface(eve->next, eve->next->next, eve->next->next->next);
addfillface(eve->next->next->next, eve, eve->next);
}
/*use shortest diagonal for quad*/
sub_v3_v3v3(vec1, eve->co, eve->next->next->co);
sub_v3_v3v3(vec2, eve->next->co, eve->next->next->next->co);
if (dot_v3v3(vec1, vec1) < dot_v3v3(vec2, vec2)) {
addfillface(eve, eve->next, eve->next->next);
addfillface(eve->next->next, eve->next->next->next, eve);
}
else {
addfillface(eve, eve->next, eve->next->next);
addfillface(eve->next->next, eve->next->next->next, eve);
addfillface(eve->next, eve->next->next, eve->next->next->next);
addfillface(eve->next->next->next, eve, eve->next);
}
return 2;
}

View File

@@ -194,7 +194,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
/* eed->tmp.p = e; */ /* UNUSED */
}
BLI_edgefill(0);
BLI_edgefill(FALSE);
for (efa = fillfacebase.first; efa; efa = efa->next) {
BMFace *f = BM_face_create_quad_tri(bm,

View File

@@ -1873,7 +1873,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
}
}
BLI_edgefill(0);
BLI_edgefill(FALSE);
for (efa = fillfacebase.first; efa; efa = efa->next) {
BMVert *v1 = efa->v3->tmp.p, *v2 = efa->v2->tmp.p, *v3 = efa->v1->tmp.p;

View File

@@ -286,9 +286,8 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
}
BLI_addfilledge(firstv, v);
/* mode 2 enables faster handling of tri/quads */
BLI_edgefill(2);
BLI_edgefill(TRUE);
for (sefa = fillfacebase.first; sefa; sefa = sefa->next) {
ls[0] = sefa->v1->tmp.p;
ls[1] = sefa->v2->tmp.p;

View File

@@ -253,7 +253,7 @@ static void draw_filled_lasso(wmGesture *gt)
/* highly unlikely this will fail, but could crash if (gt->points == 0) */
if (firstv) {
BLI_addfilledge(firstv, v);
BLI_edgefill(0);
BLI_edgefill(FALSE);
glEnable(GL_BLEND);
glColor4f(1.0, 1.0, 1.0, 0.05);