diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-12 11:53:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-12 11:53:54 +0400 |
commit | 0b316d72cabb0d604587f98c37c394b4cac35189 (patch) | |
tree | 1b62dd6fca857cfa81f5cfb5cd4a99cf80a152f6 /source/blender | |
parent | 293b3f0bdff8ca5368ee4625ae9fb8470973e28b (diff) |
change to solidify modifiers own normal calculation function, dont attempt to calculate normals for edges with 3+ face users.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/modifiers/intern/MOD_solidify.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 7ca187aa039..6d5dda61f23 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -122,9 +122,13 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) edge_ref->f1 = i; edge_ref->f2 = -1; } - else { + else if ((edge_ref->f1 != -1) && (edge_ref->f2 == -1)) { edge_ref->f2 = i; } + else { + /* 3+ faces using an edge, we can't handle this usefully */ + edge_ref->f1 = edge_ref->f2 = -1; + } /* --- done --- */ } } @@ -132,25 +136,27 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) for (i = 0, ed = medge, edge_ref = edge_ref_array; i < numEdges; i++, ed++, edge_ref++) { /* Get the edge vert indices, and edge value (the face indices that use it) */ - if (edgeref_is_init(edge_ref) && (edge_ref->f2 != -1)) { - /* We have 2 faces using this edge, calculate the edges normal - * using the angle between the 2 faces as a weighting */ + if (edgeref_is_init(edge_ref) && (edge_ref->f1 != -1)) { + if (edge_ref->f2 != -1) { + /* We have 2 faces using this edge, calculate the edges normal + * using the angle between the 2 faces as a weighting */ #if 0 - add_v3_v3v3(edge_normal, face_nors[edge_ref->f1], face_nors[edge_ref->f2]); - normalize_v3(edge_normal); + add_v3_v3v3(edge_normal, face_nors[edge_ref->f1], face_nors[edge_ref->f2]); + normalize_v3(edge_normal); - mul_v3_fl(edge_normal, angle_normalized_v3v3(face_nors[edge_ref->f1], face_nors[edge_ref->f2])); + mul_v3_fl(edge_normal, angle_normalized_v3v3(face_nors[edge_ref->f1], face_nors[edge_ref->f2])); #else - mid_v3_v3v3_angle_weighted(edge_normal, face_nors[edge_ref->f1], face_nors[edge_ref->f2]); + mid_v3_v3v3_angle_weighted(edge_normal, face_nors[edge_ref->f1], face_nors[edge_ref->f2]); #endif + } + else { + /* only one face attached to that edge */ + /* an edge without another attached- the weight on this is undefined */ + copy_v3_v3(edge_normal, face_nors[edge_ref->f1]); + } + add_v3_v3(temp_nors[ed->v1], edge_normal); + add_v3_v3(temp_nors[ed->v2], edge_normal); } - else { - /* only one face attached to that edge */ - /* an edge without another attached- the weight on this is undefined */ - copy_v3_v3(edge_normal, face_nors[edge_ref->f1]); - } - add_v3_v3(temp_nors[ed->v1], edge_normal); - add_v3_v3(temp_nors[ed->v2], edge_normal); } MEM_freeN(edge_ref_array); } |