Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-05-07 22:07:34 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-07 22:07:34 +0400
commit353ef9541a37faa009e62a2969fc96d160260c6b (patch)
tree7cec698980fe944fe7e6ffa1c95b69c45378c67f /source/blender/modifiers
parentd5b53420f61b1fd9020465c5c6603d82b93cc97d (diff)
fix [#31347] solidify modifier > even thickness parameter weired
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 163c3979bfe..b45304a315f 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -451,8 +451,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* same as EM_solidify() in editmesh_lib.c */
float *vert_angles = MEM_callocN(sizeof(float) * numVerts * 2, "mod_solid_pair"); /* 2 in 1 */
float *vert_accum = vert_angles + numVerts;
- float *face_angles = NULL;
- BLI_array_staticdeclare(face_angles, 16); /* BM_NGON_STACK_SIZE */
int j, vidx;
face_nors = CustomData_get_layer(&dm->polyData, CD_NORMAL);
@@ -473,28 +471,28 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
mesh_calc_poly_normal(mp, &mloop[mp->loopstart], mvert, face_nors[i]);
/* just added, calc the normal */
- BLI_array_empty(face_angles);
- BLI_array_reserve(face_angles, mp->totloop);
for (j = 0, ml = mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
MLoop *ml_prev = ME_POLY_LOOP_PREV(mloop, mp, j);
MLoop *ml_next = ME_POLY_LOOP_NEXT(mloop, mp, j);
float e1[3], e2[3];
+ float angle;
+ /* TODO - we could speed this up by _not_ normalizing both verts each time
+ * and always re-usingthe last vector. */
sub_v3_v3v3(e1, mvert[ml_next->v].co, mvert[ml->v].co);
sub_v3_v3v3(e2, mvert[ml_prev->v].co, mvert[ml->v].co);
- face_angles[j] = (float)M_PI - angle_v3v3(e1, e2);
- }
-
- for (j = 0, ml = mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
+
+ angle = (float)M_PI - angle_v3v3(e1, e2);
+ if (angle < FLT_EPSILON) {
+ angle = FLT_EPSILON;
+ }
+
vidx = ml->v;
- vert_accum[vidx] += face_angles[j];
- vert_angles[vidx] += shell_angle_to_dist(angle_normalized_v3v3(vert_nors[vidx], face_nors[i])) *
- face_angles[j];
+ vert_accum[vidx] += angle;
+ vert_angles[vidx] += shell_angle_to_dist(angle_normalized_v3v3(vert_nors[vidx], face_nors[i])) * angle;
}
}
-
- BLI_array_free(face_angles);
/* vertex group support */
if (dvert) {