From e7647e15859f524c1989847656e4ea228507d71b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 22 May 2012 09:53:33 +0000 Subject: solidify modifier - remove a loop on all edges. --- source/blender/modifiers/intern/MOD_solidify.c | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 0ca4d8dcd4f..799c81b3da6 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -240,8 +240,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, float (*face_nors_result)[3] = NULL; - const float ofs_orig = -(((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); - const float ofs_new = smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + const float ofs_orig = -(((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + const float ofs_new = smd->offset - ofs_orig; const float offset_fac_vg = smd->offset_fac_vg; const float offset_fac_vg_inv = 1.0f - smd->offset_fac_vg; @@ -266,22 +266,31 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, unsigned int v1, v2; int eidx; +#define INVALID_UNUSED -1 +#define INVALID_PAIR -2 + + edge_users = MEM_mallocN(sizeof(int) * numEdges, "solid_mod edges"); + edge_order = MEM_mallocN(sizeof(char) * numEdges, "solid_mod eorder"); + for (i = 0, mv = orig_mvert; i < numVerts; i++, mv++) { mv->flag &= ~ME_VERT_TMP_TAG; } + /* save doing 2 loops here... */ +#if 0 + fill_vn_i(edge_users, numEdges, INVALID_UNUSED); +#endif + for (i = 0, ed = orig_medge; i < numEdges; i++, ed++) { BLI_edgehash_insert(edgehash, ed->v1, ed->v2, SET_INT_IN_POINTER(i)); + edge_users[i] = INVALID_UNUSED; } -#define INVALID_UNUSED -1 -#define INVALID_PAIR -2 - #define ADD_EDGE_USER(_v1, _v2, edge_ord) \ { \ const unsigned int ml_v1 = _v1; \ const unsigned int ml_v2 = _v2; \ - eidx= GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, ml_v1, ml_v2)); \ + eidx = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, ml_v1, ml_v2)); \ if (edge_users[eidx] == INVALID_UNUSED) { \ ed= orig_medge + eidx; \ edge_users[eidx] = (ml_v1 < ml_v2) == (ed->v1 < ed->v2) ? i : (i + numFaces); \ @@ -290,13 +299,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, else { \ edge_users[eidx] = INVALID_PAIR; \ } \ - } - + } (void)0 - edge_users = MEM_mallocN(sizeof(int) * numEdges, "solid_mod edges"); - edge_order = MEM_mallocN(sizeof(char) * numEdges, "solid_mod eorder"); - fill_vn_i(edge_users, numEdges, INVALID_UNUSED); - for (i = 0, mp = orig_mpoly; i < numFaces; i++, mp++) { MLoop *ml; -- cgit v1.2.3