From 2a1ba8c85bd21d0eac3d348b162347da3b2171e2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 3 May 2012 19:57:24 +0000 Subject: style cleanup: formatting and some float/double promotion --- source/blender/bmesh/intern/bmesh_construct.c | 2 +- source/blender/bmesh/intern/bmesh_interp.c | 35 ++++++++-------------- source/blender/bmesh/intern/bmesh_mesh.c | 12 +++++--- source/blender/bmesh/intern/bmesh_mesh_validate.c | 6 ++-- source/blender/bmesh/intern/bmesh_mods.c | 2 +- source/blender/bmesh/intern/bmesh_operators.c | 6 ++-- source/blender/bmesh/intern/bmesh_queries.c | 2 +- source/blender/bmesh/operators/bmo_bevel.c | 18 +++++------ source/blender/bmesh/operators/bmo_create.c | 2 +- source/blender/bmesh/operators/bmo_extrude.c | 2 +- source/blender/bmesh/operators/bmo_hull.c | 4 +-- source/blender/bmesh/operators/bmo_inset.c | 3 +- source/blender/bmesh/operators/bmo_removedoubles.c | 2 +- source/blender/bmesh/operators/bmo_subdivide.c | 6 ++-- source/blender/bmesh/operators/bmo_triangulate.c | 10 +++---- source/blender/bmesh/operators/bmo_wireframe.c | 12 ++++---- source/blender/bmesh/tools/BME_bevel.c | 30 +++++++++++-------- 17 files changed, 79 insertions(+), 75 deletions(-) (limited to 'source/blender/bmesh') diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index c2d5d93cbc3..0169caa8f61 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -384,7 +384,7 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int n /* more of a weight then a distance */ far_cross_dist = (/* first we want to have a value close to zero mapped to 1 */ - 1.0 - fabsf(dot_v3v3(far_vec, far_cross_vec)) * + 1.0f - fabsf(dot_v3v3(far_vec, far_cross_vec)) * /* second we multiply by the distance * so points close to the center are not preferred */ diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index c774880332b..f64b55193c5 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -78,7 +78,7 @@ void BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, con src[0] = v1->head.data; src[1] = v2->head.data; - w[0] = 1.0f-fac; + w[0] = 1.0f - fac; w[1] = fac; CustomData_bmesh_interp(&bm->vdata, src, w, NULL, 2, v->head.data); } @@ -198,20 +198,11 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source) static int compute_mdisp_quad(BMLoop *l, float v1[3], float v2[3], float v3[3], float v4[3], float e1[3], float e2[3]) { - float cent[3] = {0.0f, 0.0f, 0.0f}, n[3], p[3]; - BMLoop *l_first; - BMLoop *l_iter; - + float cent[3], n[3], p[3]; + /* computer center */ - l_iter = l_first = BM_FACE_FIRST_LOOP(l->f); - do { - cent[0] += (float)l_iter->v->co[0]; - cent[1] += (float)l_iter->v->co[1]; - cent[2] += (float)l_iter->v->co[2]; - } while ((l_iter = l_iter->next) != l_first); - - mul_v3_fl(cent, (1.0 / (float)l->f->len)); - + BM_face_calc_center_mean(l->f, cent); + add_v3_v3v3(p, l->prev->v->co, l->v->co); mul_v3_fl(p, 0.5); add_v3_v3v3(n, l->next->v->co, l->v->co); @@ -240,8 +231,8 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int if (fabsf(2.0f * (x - y + z)) > FLT_EPSILON * 10.0f) { float f2; - f1 = (sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z)); - f2 = (-sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z)); + f1 = ( sqrtf(y * y - 4.0f * x * z) - y + 2.0f * z) / (2.0f * (x - y + z)); + f2 = (-sqrtf(y * y - 4.0f * x * z) - y + 2.0f * z) / (2.0f * (x - y + z)); f1 = fabsf(f1); f2 = fabsf(f2); @@ -252,7 +243,7 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int f1 = -z / (y - 2 * z); CLAMP(f1, 0.0f, 1.0f + FLT_EPSILON); - if (isnan(f1) || f1 > 1.0 || f1 < 0.0f) { + if (isnan(f1) || f1 > 1.0f || f1 < 0.0f) { int i; for (i = 0; i < 2; i++) { @@ -345,8 +336,8 @@ static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float sub_v3_v3(v1, c); sub_v3_v3(v2, c); sub_v3_v3(v3, c); sub_v3_v3(v4, c); - mul_v3_fl(v1, 1.0 + eps); mul_v3_fl(v2, 1.0 + eps); - mul_v3_fl(v3, 1.0 + eps); mul_v3_fl(v4, 1.0 + eps); + mul_v3_fl(v1, 1.0f + eps); mul_v3_fl(v2, 1.0f + eps); + mul_v3_fl(v3, 1.0f + eps); mul_v3_fl(v4, 1.0f + eps); add_v3_v3(v1, c); add_v3_v3(v2, c); add_v3_v3(v3, c); add_v3_v3(v4, c); @@ -392,9 +383,9 @@ static void bm_loop_flip_disp(float source_axis_x[3], float source_axis_y[3], d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 0, 1); - if (fabsf(d) < 1e-4) { + if (fabsf(d) < 1e-4f) { d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 0, 2); - if (fabsf(d) < 1e-4) + if (fabsf(d) < 1e-4f) d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 1, 2); } @@ -439,7 +430,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y); res = (int)sqrt(mdisps->totdisp); - d = 1.0 / (float)(res - 1); + d = 1.0f / (float)(res - 1); for (x = 0.0f, ix = 0; ix < res; x += d, ix++) { for (y = 0.0f, iy = 0; iy < res; y += d, iy++) { float co1[3], co2[3], co[3]; diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index cb66486cd9e..fe94983dc88 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -47,10 +47,14 @@ BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512}; static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize) { - bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize->totvert, bm_mesh_chunksize_default.totvert, BLI_MEMPOOL_ALLOW_ITER); - bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize->totedge, bm_mesh_chunksize_default.totedge, BLI_MEMPOOL_ALLOW_ITER); - bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize->totloop, bm_mesh_chunksize_default.totloop, 0); - bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize->totface, bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER); + bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize->totvert, + bm_mesh_chunksize_default.totvert, BLI_MEMPOOL_ALLOW_ITER); + bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize->totedge, + bm_mesh_chunksize_default.totedge, BLI_MEMPOOL_ALLOW_ITER); + bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize->totloop, + bm_mesh_chunksize_default.totloop, 0); + bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize->totface, + bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER); #ifdef USE_BMESH_HOLES bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), allocsize[3], allocsize[3], FALSE, FALSE); diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.c b/source/blender/bmesh/intern/bmesh_mesh_validate.c index 3ec3b84c120..8ab5f10361f 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_validate.c +++ b/source/blender/bmesh/intern/bmesh_mesh_validate.c @@ -107,10 +107,12 @@ int BM_mesh_validate(BMesh *bm) ERRMSG("edge %d: has invalid loop, loop is of face %d", i, BM_elem_index_get(l_iter->f)); } else if (BM_vert_in_edge(e, l_iter->v) == FALSE) { - ERRMSG("edge %d: has invalid loop with vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f)); + ERRMSG("edge %d: has invalid loop with vert not in edge, loop is of face %d", + i, BM_elem_index_get(l_iter->f)); } else if (BM_vert_in_edge(e, l_iter->next->v) == FALSE) { - ERRMSG("edge %d: has invalid loop with next vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f)); + ERRMSG("edge %d: has invalid loop with next vert not in edge, loop is of face %d", + i, BM_elem_index_get(l_iter->f)); } } while ((l_iter = l_iter->radial_next) != l_first); } diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 5f3836cc413..c4cbb19eef7 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -1053,7 +1053,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_ /* first create the new edge, this is so we can copy the customdata from the old one * if splice if disabled, always add in a new edge even if theres one there. */ - e_new = BM_edge_create(bm, v1, v2, e, (check_flag & BM_EDGEROT_CHECK_SPLICE)!=0); + e_new = BM_edge_create(bm, v1, v2, e, (check_flag & BM_EDGEROT_CHECK_SPLICE) != 0); f_hflag_prev_1 = l1->f->head.hflag; f_hflag_prev_2 = l2->f->head.hflag; diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index dce491efe72..97347f841c8 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -1054,7 +1054,7 @@ static void bmo_flag_layer_alloc(BMesh *bm) BM_elem_index_set(ele, i); /* set_inline */ } - bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE); + bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE); BLI_mempool_destroy(oldpool); } @@ -1099,7 +1099,7 @@ static void bmo_flag_layer_free(BMesh *bm) BM_elem_index_set(ele, i); /* set_inline */ } - bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE); + bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE); BLI_mempool_destroy(oldpool); } @@ -1128,7 +1128,7 @@ static void bmo_flag_layer_clear(BMesh *bm) BM_elem_index_set(ele, i); /* set_inline */ } - bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE); + bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE); } void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slotname) diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index e9a35ff70a2..8628ed7f9a1 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -900,7 +900,7 @@ float BM_vert_calc_edge_angle(BMVert *v) BMVert *v1 = BM_edge_other_vert(e1, v); BMVert *v2 = BM_edge_other_vert(e2, v); - return M_PI - angle_v3v3v3(v1->co, v->co, v2->co); + return (float)M_PI - angle_v3v3v3(v1->co, v->co, v2->co); } else { return DEG2RADF(90.0f); diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c index b6b54b82f3d..f02b88c5b05 100644 --- a/source/blender/bmesh/operators/bmo_bevel.c +++ b/source/blender/bmesh/operators/bmo_bevel.c @@ -151,10 +151,10 @@ static void calc_corner_co(BMLoop *l, const float fac, float r_co[3], /* done */ if (do_even) { - mul_v3_fl(co_ofs, (fac * 0.5) * shell_angle_to_dist(0.5f * angle)); + mul_v3_fl(co_ofs, (fac * 0.5f) * shell_angle_to_dist(0.5f * angle)); } else { - mul_v3_fl(co_ofs, fac * 0.5); + mul_v3_fl(co_ofs, fac * 0.5f); } } @@ -208,9 +208,9 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BLI_smallhash_init(&hash); BMO_ITER (e, &siter, bm, op, "geom", BM_EDGE) { - BMO_elem_flag_enable(bm, e, BEVEL_FLAG|BEVEL_DEL); - BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG|BEVEL_DEL); - BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG|BEVEL_DEL); + BMO_elem_flag_enable(bm, e, BEVEL_FLAG | BEVEL_DEL); + BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG | BEVEL_DEL); + BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG | BEVEL_DEL); if (BM_edge_face_count(e) < 2) { BMO_elem_flag_disable(bm, e, BEVEL_DEL); @@ -281,8 +281,8 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) BMLoop *l; BMIter liter; - BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG|BEVEL_DEL); - BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG|BEVEL_DEL); + BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG | BEVEL_DEL); + BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG | BEVEL_DEL); if (BM_edge_face_count(e) < 2) { BMO_elem_flag_disable(bm, e, BEVEL_DEL); @@ -597,7 +597,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) continue; } - BMO_elem_flag_enable(bm, f, FACE_NEW|FACE_SPAN); + BMO_elem_flag_enable(bm, f, FACE_NEW | FACE_SPAN); /* un-tag edges in f for deletio */ BM_ITER_ELEM (l2, &liter2, f, BM_LOOPS_OF_FACE) { @@ -775,7 +775,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op) fprintf(stderr, "%s: in bevel vert fill! (bmesh internal error)\n", __func__); } else { - BMO_elem_flag_enable(bm, f, FACE_NEW|FACE_HOLE); + BMO_elem_flag_enable(bm, f, FACE_NEW | FACE_HOLE); } } BLI_smallhash_release(&tmphash); diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 6f08ab421f3..85aed6141bb 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -1285,7 +1285,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) const short use_smooth = BMO_slot_bool_get(op, "use_smooth"); /* count number of each element type we were passe */ - BMO_ITER (h, &oiter, bm, op, "geom", BM_VERT|BM_EDGE|BM_FACE) { + BMO_ITER (h, &oiter, bm, op, "geom", BM_VERT | BM_EDGE | BM_FACE) { switch (h->htype) { case BM_VERT: totv++; break; case BM_EDGE: tote++; break; diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 4fced09c588..4bac54794bf 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -251,7 +251,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) /* initialize our sub-operators */ BMO_op_init(bm, &dupeop, "dupe"); - BMO_slot_buffer_flag_enable(bm, op, "edgefacein", BM_EDGE|BM_FACE, EXT_INPUT); + BMO_slot_buffer_flag_enable(bm, op, "edgefacein", BM_EDGE | BM_FACE, EXT_INPUT); /* if one flagged face is bordered by an un-flagged face, then we delete * original geometry unless caller explicitly asked to keep it. */ diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index 700480be01c..741ec1fe2d0 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -470,7 +470,7 @@ static int hull_find_large_tetrahedron(BMesh *bm, BMOperator *op, } /* Check for colinear vertices */ - if (largest_dist < 0.0001) + if (largest_dist < 0.0001f) return TRUE; /* Choose fourth point farthest from existing plane */ @@ -493,7 +493,7 @@ static int hull_find_large_tetrahedron(BMesh *bm, BMOperator *op, return TRUE; } - if (largest_dist < 0.0001) + if (largest_dist < 0.0001f) return TRUE; return FALSE; diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index e08f08baacd..26197c43bd0 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -313,7 +313,8 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op) /* scale by edge angle */ if (use_even_offset) { - mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(e_info_a->no, e_info_b->no) / 2.0f)); + mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(e_info_a->no, + e_info_b->no) / 2.0f)); } /* scale relative to edge lengths */ diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index 70dcc6fa3ae..8060c3b5142 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -147,7 +147,7 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op) BM_elem_index_set(f, 0); /* set_dirty! */ BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { if (BMO_elem_flag_test(bm, l->v, ELE_DEL)) { - BMO_elem_flag_enable(bm, f, FACE_MARK|ELE_DEL); + BMO_elem_flag_enable(bm, f, FACE_MARK | ELE_DEL); } if (BMO_elem_flag_test(bm, l->e, EDGE_COL)) { BM_elem_index_set(f, BM_elem_index_get(f) + 1); /* set_dirty! */ diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 736ce3bc033..03a691e3e9c 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -132,7 +132,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar madd_v3_v3fl(tvec, nor2, fac); /* falloff for multi subdivide */ - smooth *= sqrtf(fabsf(1.0f - 2.0f * fabsf(0.5f-perc))); + smooth *= sqrtf(fabsf(1.0f - 2.0f * fabsf(0.5f - perc))); mul_v3_fl(tvec, smooth * len); @@ -225,7 +225,7 @@ static BMVert *subdivideedgenum(BMesh *bm, BMEdge *edge, BMEdge *oedge, if (BMO_elem_flag_test(bm, edge, EDGE_PERCENT) && totpoint == 1) percent = BMO_slot_map_float_get(bm, params->op, "edgepercents", edge); else { - percent = 1.0f / (float)(totpoint + 1-curpoint); + percent = 1.0f / (float)(totpoint + 1 - curpoint); percent2 = (float)(curpoint + 1) / (float)(totpoint + 1); } @@ -1023,7 +1023,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_from_enabled_flag(bm, op, "outinner", BM_ALL, ELE_INNER); BMO_slot_buffer_from_enabled_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT); - BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, ELE_INNER|ELE_SPLIT|SUBD_SPLIT); + BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, ELE_INNER | ELE_SPLIT | SUBD_SPLIT); } /* editmesh-emulating function */ diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index 9632a79b7dd..755dceefdc5 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -143,8 +143,8 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) if (e) { BMO_elem_flag_enable(bm, e, ELE_NEW); - BMO_elem_flag_enable(bm, e->l->f, FACE_MARK|ELE_NEW); - BMO_elem_flag_enable(bm, e->l->radial_next->f, FACE_MARK|ELE_NEW); + BMO_elem_flag_enable(bm, e->l->f, FACE_MARK | ELE_NEW); + BMO_elem_flag_enable(bm, e->l->radial_next->f, FACE_MARK | ELE_NEW); stop = 0; } } @@ -152,7 +152,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) } } - BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE|BM_FACE, ELE_NEW); + BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW); } void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) @@ -214,8 +214,8 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) /* clean up fill */ BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff constrain_edges=%fe", ELE_NEW, EDGE_MARK); BMO_op_exec(bm, &bmop); - BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE|BM_EDGE, ELE_NEW); + BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE | BM_EDGE, ELE_NEW); BMO_op_finish(bm, &bmop); - BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE|BM_FACE, ELE_NEW); + BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW); } diff --git a/source/blender/bmesh/operators/bmo_wireframe.c b/source/blender/bmesh/operators/bmo_wireframe.c index 7cb8ac0b66d..e0dc5cf48c7 100644 --- a/source/blender/bmesh/operators/bmo_wireframe.c +++ b/source/blender/bmesh/operators/bmo_wireframe.c @@ -103,7 +103,7 @@ static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3 BM_edge_calc_face_tangent(e_b, l_b, tvec_b); add_v3_v3(tvec_a, tvec_b); - if (dot_v3v3(r_no, tvec_a) > 0.0) { + if (dot_v3v3(r_no, tvec_a) > 0.0f) { negate_v3(r_no); } @@ -239,7 +239,7 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op) /* create offset vert */ fac = inset; if (use_even_offset) { - fac *= shell_angle_to_dist((M_PI - BM_loop_calc_face_angle(l)) * 0.5f); + fac *= shell_angle_to_dist(((float)M_PI - BM_loop_calc_face_angle(l)) * 0.5f); } if (use_relative_offset) { fac *= verts_relfac[BM_elem_index_get(l->v)]; @@ -269,10 +269,10 @@ void bmo_wireframe_exec(BMesh *bm, BMOperator *op) /* similar to code above but different angle calc */ fac = inset; if (use_even_offset) { - fac *= shell_angle_to_dist((M_PI - angle_on_axis_v3v3v3_v3(va_other->co, - l_pair[i]->v->co, - vb_other->co, - no_face)) * 0.5f); + fac *= shell_angle_to_dist(((float)M_PI - angle_on_axis_v3v3v3_v3(va_other->co, + l_pair[i]->v->co, + vb_other->co, + no_face)) * 0.5f); } if (use_relative_offset) { fac *= verts_relfac[BM_elem_index_get(l_pair[i]->v)]; diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index a357767e1d8..e03df77a290 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -234,7 +234,8 @@ static int BME_bevel_get_vec(float *vec, BMVert *v1, BMVert *v2, BME_TransData_H * vec2 is the direction of projection (pointing away from vec1) * up_vec is used for orientation (expected to be normalized) * returns the length of the projected vector that lies along vec1 */ -static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td)) +static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, + int is_forward, BME_TransData_Head *UNUSED(td)) { float factor, vec3[3], tmp[3], c1, c2; @@ -264,7 +265,8 @@ static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int * using the vert and the loop passed, get or make the split vert, set its coordinates * and transform properties, and set the max limits. * Finally, return the split vert. */ -static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, float *up_vec, float value, BME_TransData_Head *td) +static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, + float *up_vec, float value, BME_TransData_Head *td) { BME_TransData *vtd, *vtd1, *vtd2; BMVert *sv, *v2, *v3, *ov; @@ -496,7 +498,8 @@ static BMVert *BME_bevel_wire(BMesh *bm, BMVert *v, float value, int res, int UN } #endif -static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) +static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(options), + float *up_vec, BME_TransData_Head *td) { BMVert *v1, *v2, *kv; BMLoop *kl = NULL, *nl; @@ -617,7 +620,8 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti return l; } -static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) +static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(options), + float up_vec[3], BME_TransData_Head *td) { BMVert *v1, *v2; /* BMFace *f; */ /* UNUSED */ @@ -810,7 +814,7 @@ static float BME_bevel_get_angle_vert(BMVert *v) } /* return cosf(angle_diff + 0.001f); */ /* compare with dot product */ - return (angle_diff / tot_angle) * (M_PI / 2); + return (angle_diff / tot_angle) * (float)(M_PI / 2.0); } static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v, float weight, float factor, int options) @@ -894,7 +898,7 @@ static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_ int count; float weight; BMIter iter; - const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f; + const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001f) : 0.0f; BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { weight = 0.0f; @@ -945,7 +949,8 @@ static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_ } } -static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_index), float angle, BME_TransData_Head *td) +static BMesh *BME_bevel_initialize(BMesh *bm, int options, + int UNUSED(defgrp_index), float angle, BME_TransData_Head *td) { BMVert *v /*, *v2 */; BMEdge *e /*, *curedg */; @@ -1037,7 +1042,8 @@ static BMesh *BME_bevel_reinitialize(BMesh *bm) * A BMesh pointer to the BM passed as a parameter. */ -static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int options, int UNUSED(defgrp_index), BME_TransData_Head *td) +static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int options, + int UNUSED(defgrp_index), BME_TransData_Head *td) { BMVert *v; BMEdge *e, *curedge; @@ -1102,14 +1108,14 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i BME_TransData_Head *td; BME_TransData *vtd; int i; - double fac = 1, d; + double fac = 1.0, d; td = BME_init_transdata(BLI_MEMARENA_STD_BUFSIZE); /* recursion math courtesy of Martin Poirier (theeth) */ for (i = 0; i < res - 1; i++) { - if (i == 0) fac += 1.0f / 3.0f; else fac += 1.0f / (3 * i * 2.0f); + if (i == 0) fac += 1.0 / 3.0; else fac += 1.0 / (3.0 * i * 2.0); } - d = 1.0f / fac; + d = 1.0 / fac; for (i = 0; i < res || (res == 0 && i == 0); i++) { BMO_push(bm, NULL); @@ -1143,7 +1149,7 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i else { d = value; } - madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor * d); + madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor * (float)d); } } -- cgit v1.2.3