change edge split modifier to loop over all edges and compare the face angles, rather then looping over all faces and looking at every faces-edges-fance which would compare faces twice.

This commit is contained in:
Campbell Barton 2011-11-28 03:41:14 +00:00
parent 8aeaa442bc
commit 9776f56a39

@ -67,9 +67,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
BMesh *bm; BMesh *bm;
BMEditMesh *em; BMEditMesh *em;
DerivedMesh *cddm; DerivedMesh *cddm;
BMIter iter, liter; BMIter iter;
BMFace *f;
BMLoop *l;
BMEdge *e; BMEdge *e;
/* int allocsize[] = {512, 512, 2048, 512}; */ /* UNUSED */ /* int allocsize[] = {512, 512, 2048, 512}; */ /* UNUSED */
float threshold = cos((emd->split_angle + 0.00001) * M_PI / 180.0); float threshold = cos((emd->split_angle + 0.00001) * M_PI / 180.0);
@ -85,16 +83,14 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
BMO_push(bm, NULL); BMO_push(bm, NULL);
if (emd->flags & MOD_EDGESPLIT_FROMANGLE) { if (emd->flags & MOD_EDGESPLIT_FROMANGLE) {
BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) { BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) { /* check for 1 edge having 2 face users */
float edge_angle_cos; BMLoop *l1, *l2;
if ( (l1= e->l) &&
if (l->radial_next == l) (l2= e->l->radial_next) != l1)
continue; {
if (dot_v3v3(l1->f->no, l2->f->no) < threshold) {
edge_angle_cos = dot_v3v3(f->no, l->radial_next->f->no); BMO_SetFlag(bm, e, EDGE_MARK);
if (edge_angle_cos < threshold) {
BMO_SetFlag(bm, l->e, EDGE_MARK);
} }
} }
} }