diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 16:56:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 16:56:51 +0400 |
commit | 76b1e8bc09410398192fce47be9ac88a7368085c (patch) | |
tree | 982d4cc4fee0397043117f5b7c54b9b4da89749d /source | |
parent | f433f011cfa55be8bae702c59745d3a2cb9598a4 (diff) |
code clenup: rename BKE_mesh_poly_calc_angles -> BKE_mesh_calc_poly_angles
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 63 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_solidify.c | 2 |
3 files changed, 35 insertions, 35 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index d208a6b919d..4f8823ec46c 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -102,6 +102,9 @@ void BKE_mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart, float BKE_mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart, struct MVert *mvarray, const float polynormal[3]); +void BKE_mesh_calc_poly_angles(struct MPoly *mpoly, struct MLoop *loopstart, + struct MVert *mvarray, float angles[]); + void BKE_mesh_calc_relative_deform( const struct MPoly *mpoly, const int totpoly, const struct MLoop *mloop, const int totvert, @@ -342,8 +345,6 @@ void BKE_mesh_loops_to_mface_corners(struct CustomData *fdata, struct CustomData const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace); void BKE_mesh_poly_edgehash_insert(struct EdgeHash *ehash, const struct MPoly *mp, const struct MLoop *mloop); -void BKE_mesh_poly_calc_angles(struct MVert *mvert, struct MLoop *mloop, - struct MPoly *mp, float angles[]); void BKE_mesh_do_versions_cd_flag_init(struct Mesh *mesh); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 7581aa745ff..0575407937a 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -3462,20 +3462,21 @@ void BKE_mesh_tessface_clear(Mesh *mesh) } #if 0 /* slow version of the function below */ -void BKE_mesh_poly_calc_angles(MVert *mvert, MLoop *mloop, - MPoly *mp, float angles[]) +void BKE_mesh_calc_poly_angles(MPoly *mpoly, MLoop *loopstart, + MVert *mvarray, float angles[]) { MLoop *ml; + MLoop *mloop = &loopstart[-mpoly->loopstart]; int j; - 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); + for (j = 0, ml = loopstart; j < mpoly->totloop; j++, ml++) { + MLoop *ml_prev = ME_POLY_LOOP_PREV(mloop, mpoly, j); + MLoop *ml_next = ME_POLY_LOOP_NEXT(mloop, mpoly, j); float e1[3], e2[3]; - 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); + sub_v3_v3v3(e1, mvarray[ml_next->v].co, mvarray[ml->v].co); + sub_v3_v3v3(e2, mvarray[ml_prev->v].co, mvarray[ml->v].co); angles[j] = (float)M_PI - angle_v3v3(e1, e2); } @@ -3483,39 +3484,20 @@ void BKE_mesh_poly_calc_angles(MVert *mvert, MLoop *mloop, #else /* equivalent the function above but avoid multiple subtractions + normalize */ -void BKE_mesh_poly_edgehash_insert(EdgeHash *ehash, const MPoly *mp, const MLoop *mloop) -{ - const MLoop *ml, *ml_next; - int i = mp->totloop; - - ml_next = mloop; /* first loop */ - ml = &ml_next[i - 1]; /* last loop */ - - while (i-- != 0) { - if (!BLI_edgehash_haskey(ehash, ml->v, ml_next->v)) { - BLI_edgehash_insert(ehash, ml->v, ml_next->v, NULL); - } - - ml = ml_next; - ml_next++; - } -} - -void BKE_mesh_poly_calc_angles(MVert *mvert, MLoop *mloop, - MPoly *mp, float angles[]) +void BKE_mesh_calc_poly_angles(MPoly *mpoly, MLoop *loopstart, + MVert *mvarray, float angles[]) { - MLoop *ml = mloop + mp->loopstart; float nor_prev[3]; float nor_next[3]; - int i_this = mp->totloop - 1; + int i_this = mpoly->totloop - 1; int i_next = 0; - sub_v3_v3v3(nor_prev, mvert[ml[i_this - 1].v].co, mvert[ml[i_this].v].co); + sub_v3_v3v3(nor_prev, mvarray[loopstart[i_this - 1].v].co, mvarray[loopstart[i_this].v].co); normalize_v3(nor_prev); - while (i_next < mp->totloop) { - sub_v3_v3v3(nor_next, mvert[ml[i_this].v].co, mvert[ml[i_next].v].co); + while (i_next < mpoly->totloop) { + sub_v3_v3v3(nor_next, mvarray[loopstart[i_this].v].co, mvarray[loopstart[i_next].v].co); normalize_v3(nor_next); angles[i_this] = angle_normalized_v3v3(nor_prev, nor_next); @@ -3527,6 +3509,23 @@ void BKE_mesh_poly_calc_angles(MVert *mvert, MLoop *mloop, } #endif +void BKE_mesh_poly_edgehash_insert(EdgeHash *ehash, const MPoly *mp, const MLoop *mloop) +{ + const MLoop *ml, *ml_next; + int i = mp->totloop; + + ml_next = mloop; /* first loop */ + ml = &ml_next[i - 1]; /* last loop */ + + while (i-- != 0) { + if (!BLI_edgehash_haskey(ehash, ml->v, ml_next->v)) { + BLI_edgehash_insert(ehash, ml->v, ml_next->v, NULL); + } + + ml = ml_next; + ml_next++; + } +} void BKE_mesh_do_versions_cd_flag_init(Mesh *mesh) { diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 60891328ff6..660e5912388 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -520,7 +520,7 @@ static DerivedMesh *applyModifier( } for (i = 0, mp = mpoly; i < numFaces; i++, mp++) { - /* #BKE_mesh_poly_calc_angles logic is inlined here */ + /* #BKE_mesh_calc_poly_angles logic is inlined here */ float nor_prev[3]; float nor_next[3]; |