style cleanup: formatting and some float/double promotion
authorCampbell Barton <ideasman42@gmail.com>
Thu, 3 May 2012 19:57:24 +0000 (19:57 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 3 May 2012 19:57:24 +0000 (19:57 +0000)
17 files changed:
source/blender/bmesh/intern/bmesh_construct.c
source/blender/bmesh/intern/bmesh_interp.c
source/blender/bmesh/intern/bmesh_mesh.c
source/blender/bmesh/intern/bmesh_mesh_validate.c
source/blender/bmesh/intern/bmesh_mods.c
source/blender/bmesh/intern/bmesh_operators.c
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/operators/bmo_bevel.c
source/blender/bmesh/operators/bmo_create.c
source/blender/bmesh/operators/bmo_extrude.c
source/blender/bmesh/operators/bmo_hull.c
source/blender/bmesh/operators/bmo_inset.c
source/blender/bmesh/operators/bmo_removedoubles.c
source/blender/bmesh/operators/bmo_subdivide.c
source/blender/bmesh/operators/bmo_triangulate.c
source/blender/bmesh/operators/bmo_wireframe.c
source/blender/bmesh/tools/BME_bevel.c

index c2d5d93cbc3718a72cd1a4eba479d225cbff4fa4..0169caa8f6125808b088cbeab33652d720ba8ba6 100644 (file)
@@ -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 */
index c774880332bf549ccb340939b621bf84145faf90..f64b55193c57e2274b9be8232b8a067030bd3d91 100644 (file)
@@ -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];
index cb66486cd9e4210746b948a844a5f5749bee423c..fe94983dc88d72de6e24da63d9ab5f788508d546 100644 (file)
@@ -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);
index 3ec3b84c1200391936c9213ea8348a683da4ef37..8ab5f10361f768527f245a7feccec4fe1daa95fc 100644 (file)
@@ -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);
                }
index 5f3836cc413a3309fcfc0e14b0881511e10cd37e..c4cbb19eef7428d346de45b642eaf29d28af63af 100644 (file)
@@ -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;
index dce491efe72a4aab3487953bf54af6f535578248..97347f841c8a7ea0e53466d3f5f8f4d12192343c 100644 (file)
@@ -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)
index e9a35ff70a239f07ea7d2226516c548ae4531a03..8628ed7f9a10f956d53d4522656d4ca18ff37f43 100644 (file)
@@ -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);
index b6b54b82f3d15c6fa0aef25e30ce5c6aac9e87ed..f02b88c5b05c43be380b54a0b736bf0cca85564d 100644 (file)
@@ -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);
index 6f08ab421f341091cc08be8761ec5b906dd31787..85aed6141bbd89de24faddc24d0eaac0e81ca2a3 100644 (file)
@@ -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;
index 4fced09c5888d6c223928c482242e7f958060aef..4bac54794bf34245fa3e71f58c6014246a4378f0 100644 (file)
@@ -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. */
index 700480be01c52835a615410148b6775f3eebb6df..741ec1fe2d04166434cee81de0a9ec6189273453 100644 (file)
@@ -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;
index e08f08baacdca44321151a42b30d7ec3d809f788..26197c43bd03483243cf5c67fe20b3585d9dae79 100644 (file)
@@ -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 */
index 70dcc6fa3ae825df9cac8009b9ff7ea4ea9e14e4..8060c3b5142e88a07ce38b4938c003086a12b9e3 100644 (file)
@@ -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! */
index 736ce3bc0337dc2e3d009c0771dacf95daf673a4..03a691e3e9cd7f2d19fd44267bc890ab059c29bf 100644 (file)
@@ -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 */
index 9632a79b7dd443f405deb577433743fd0730675b..755dceefdc5a25ba72a0482faa1b73e1ed2faf64 100644 (file)
@@ -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);
 }
index 7cb8ac0b66de05956a960101ce920594023ba656..e0dc5cf48c71ce89cfc8e8bb72a4287c57521611 100644 (file)
@@ -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)];
index a357767e1d8bc8ddfe4d92610969969adc318718..e03df77a2900177ec4dfc531810811e0424a966a 100644 (file)
@@ -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);
                }
        }