diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-02-23 07:44:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-02-23 07:44:28 +0300 |
commit | 64b328f22b3fbeeae5ef40c2eb9fd7ca5141bb8c (patch) | |
tree | e8577f56ad12f45e99f661c577c37edeb035fc8e /source/blender/bmesh | |
parent | bc876f9ea401f2de404fbf303038a0185d0a77ba (diff) |
Edge/Vert Slide: avoid redundant loop angle calls
No need to calculate loop angle for each layer
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.h | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 0c27da36448..b7a72e2e2ae 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -921,6 +921,7 @@ struct LoopWalkCtx { /* same for all groups */ int type; int cd_layer_offset; + const float *loop_weights; MemArena *arena; /* --- Per loop fan vars --- */ @@ -953,10 +954,11 @@ struct LoopGroupCD { static void bm_loop_walk_add(struct LoopWalkCtx *lwc, BMLoop *l) { - const float w = BM_loop_calc_face_angle(l); + const int i = BM_elem_index_get(l); + const float w = lwc->loop_weights[i]; BM_elem_flag_enable(l, BM_ELEM_INTERNAL_TAG); lwc->data_array[lwc->data_len] = BM_ELEM_CD_GET_VOID_P(l, lwc->cd_layer_offset); - lwc->data_index_array[lwc->data_len] = BM_elem_index_get(l); + lwc->data_index_array[lwc->data_len] = i; lwc->weight_array[lwc->data_len] = w; lwc->weight_accum += w; @@ -994,7 +996,8 @@ static void bm_loop_walk_data(struct LoopWalkCtx *lwc, BMLoop *l_walk) } } -LinkNode *BM_vert_loop_groups_data_layer_create(BMesh *bm, BMVert *v, int layer_n, MemArena *arena) +LinkNode *BM_vert_loop_groups_data_layer_create( + BMesh *bm, BMVert *v, int layer_n, const float *loop_weights, MemArena *arena) { struct LoopWalkCtx lwc; LinkNode *groups = NULL; @@ -1005,6 +1008,7 @@ LinkNode *BM_vert_loop_groups_data_layer_create(BMesh *bm, BMVert *v, int layer_ lwc.type = bm->ldata.layers[layer_n].type; lwc.cd_layer_offset = bm->ldata.layers[layer_n].offset; + lwc.loop_weights = loop_weights; lwc.arena = arena; loop_num = 0; diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h index 117333b52e3..8493d401a32 100644 --- a/source/blender/bmesh/intern/bmesh_interp.h +++ b/source/blender/bmesh/intern/bmesh_interp.h @@ -56,7 +56,8 @@ void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source, void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f); struct LinkNode *BM_vert_loop_groups_data_layer_create( - BMesh *bm, BMVert *v, const int layer_n, struct MemArena *arena); + BMesh *bm, BMVert *v, const int layer_n, + const float *loop_weights, struct MemArena *arena); void BM_vert_loop_groups_data_layer_merge( BMesh *bm, struct LinkNode *groups, const int layer_n); void BM_vert_loop_groups_data_layer_merge_weights( |