diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-18 02:22:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-18 02:22:06 +0400 |
commit | aff591c6e1233248ad8b4f37c87d6e5ea406a35d (patch) | |
tree | 4fad1a569b55c85141dd5c8250cf5c45140f2dff /source | |
parent | 7f32f412ad404b0bfa1d04681f9d88fefee9c2ad (diff) |
code cleanup: typos and set exceptional cases of zero length normals as UNLIKELY().
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 2 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_screw.c | 8 |
4 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 8c3ec7e2e40..c0705d677a9 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1944,8 +1944,9 @@ void BKE_mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpo MVert *mv = &mverts[i]; float *no = tnorms[i]; - if (normalize_v3(no) == 0.0f) + if (UNLIKELY(normalize_v3(no) == 0.0f)) { normalize_v3_v3(no, mv->co); + } normal_float_to_short_v3(mv->no, no); } @@ -1981,8 +1982,9 @@ void BKE_mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces, MVert *mv = &mverts[i]; float *no = tnorms[i]; - if (normalize_v3(no) == 0.0f) + if (UNLIKELY(normalize_v3(no) == 0.0f)) { normalize_v3_v3(no, mv->co); + } normal_float_to_short_v3(mv->no, no); } diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 882dcce3ae7..734f08142b1 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -282,7 +282,7 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden) if (skip_hidden && BM_elem_flag_test(v, BM_ELEM_HIDDEN)) continue; - if (normalize_v3(v->no) == 0.0f) { + if (UNLIKELY(normalize_v3(v->no) == 0.0f)) { normalize_v3_v3(v->no, v->co); } } diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 53b95c97c8b..2100cd2bd0b 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -1253,7 +1253,7 @@ int BMO_error_occurred(BMesh *bm) return bm->errorstack.first != NULL; } -/* returns error code or 0 if no erro */ +/* returns error code or 0 if no error */ int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op) { BMOpError *err = bm->errorstack.first; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 4fd2c658380..a94b4834d18 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -393,7 +393,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, mul_m4_v3(mtx_tx, vc->co); /* length in 2d, don't sqrt because this is only for comparison */ - vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + + vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + vc->co[other_axis_2] * vc->co[other_axis_2]; /* printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist);*/ @@ -410,7 +410,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, vc->v[0] = vc->v[1] = -1; /* length in 2d, don't sqrt because this is only for comparison */ - vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + + vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + vc->co[other_axis_2] * vc->co[other_axis_2]; /* printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist);*/ @@ -430,7 +430,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, vc->e[1] = med_new; } else { - vc->v[0] = vc->v[1] = -2; /* erro value - don't use, 3 edges on vert */ + vc->v[0] = vc->v[1] = -2; /* error value - don't use, 3 edges on vert */ } vc = &vert_connect[med_new->v2]; @@ -445,7 +445,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, vc->e[1] = med_new; } else { - vc->v[0] = vc->v[1] = -2; /* erro value - don't use, 3 edges on vert */ + vc->v[0] = vc->v[1] = -2; /* error value - don't use, 3 edges on vert */ } } |