diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-28 00:11:12 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-28 00:11:12 +0400 |
commit | a70fa65592f7acd2f903156a62ba250f1e77efc3 (patch) | |
tree | 93bf2cbc0f013bdb481892e1e65ce78d4fd7b21f /source/blender/modifiers/intern/MOD_mirror.c | |
parent | 44b3735078c291291604671f198d8ae701f684e2 (diff) |
optimize mirror merging, remove array reallocation, replace with fixed size arrays.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_mirror.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_mirror.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 00c343d1918..b85ca2c1532 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -99,7 +99,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd, { const float tolerance_sq = mmd->tolerance * mmd->tolerance; const int do_vtargetmap = !(mmd->flag & MOD_MIR_NO_MERGE); - int is_vtargetmap = FALSE; /* true when it should be used */ + int tot_vtargetmap = 0; /* total merge vertices */ DerivedMesh *result; const int maxVerts = dm->getNumVerts(dm); @@ -187,7 +187,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd, * should be mapped for merging */ if (UNLIKELY(len_squared_v3v3(mv_prev->co, mv->co) < tolerance_sq)) { *vtmap_a = maxVerts + i; - is_vtargetmap = TRUE; + tot_vtargetmap++; } else { *vtmap_a = -1; @@ -288,8 +288,8 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd, if (do_vtargetmap) { /* slow - so only call if one or more merge verts are found, * users may leave this on and not realize there is nothing to merge - campbell */ - if (is_vtargetmap) { - result = CDDM_merge_verts(result, vtargetmap); + if (tot_vtargetmap) { + result = CDDM_merge_verts(result, vtargetmap, tot_vtargetmap); } MEM_freeN(vtargetmap); } |