diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-04 01:35:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-04 01:35:04 +0400 |
commit | 5da2135eef39ac042a8c4babcac7be375e6903d2 (patch) | |
tree | 520282b4cae162503de17481cfbfbe43a93ed073 /source/blender/editors/mesh | |
parent | b075765edd9e8f18b088faf1a55358d0f8a289cd (diff) |
code cleanup: double promotion & some style cleanup
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_slide.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 18 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 6 |
7 files changed, 19 insertions, 19 deletions
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index c2a97b3ea70..60c0ebbc7b3 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -475,7 +475,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op) ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, &view_aligned); if (!view_aligned) - rot[0] += M_PI / 2.0f; + rot[0] += (float)M_PI / 2.0f; make_prim_init(C, "Monkey", &dia, mat, &state, loc, rot, layer); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 2208d96ca46..b215f0ac345 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1412,7 +1412,7 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->ethresh); if (kcd->ignore_vert_snapping) - maxdist *= 0.5; + maxdist *= 0.5f; f = knife_find_closest_face(kcd, co, cageco, NULL); *is_space = !f; @@ -1502,7 +1502,7 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->vthresh); if (kcd->ignore_vert_snapping) - maxdist *= 0.5; + maxdist *= 0.5f; f = knife_find_closest_face(kcd, co, cageco, is_space); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 32e70e798fe..d38ec6436b9 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1129,7 +1129,7 @@ static float edgetag_cut_cost(BMEditMesh *UNUSED(em), BMEdge *e1, BMEdge *e2, BM /* but is biased to give higher values to sharp turns, so that it will take * paths with fewer "turns" when selecting between equal-weighted paths between * the two edges */ - cost = cost + 0.5f * cost * (2.0f - sqrt(fabs(dot_v3v3(d1, d2)))); + cost = cost + 0.5f * cost * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2)))); return cost; } @@ -2294,7 +2294,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op) float sharp = RNA_float_get(op->ptr, "sharpness"); int i; - sharp = (sharp * M_PI) / 180.0; + sharp = (sharp * (float)M_PI) / 180.0f; BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) { BM_elem_flag_disable(f, BM_ELEM_TAG); diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c index 36ce610c64b..a86a274eb70 100644 --- a/source/blender/editors/mesh/editmesh_slide.c +++ b/source/blender/editors/mesh/editmesh_slide.c @@ -279,7 +279,7 @@ static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) /* Get 3d view */ View3D *view3d = CTX_wm_view3d(C); const float outline_w = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.8f; - const float pt_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5; + const float pt_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f; int i = 0; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index c6b899bfd37..524ee029339 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2346,7 +2346,7 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) if (!BM_elem_flag_test(ev, BM_ELEM_HIDDEN)) { switch (mode) { case -1: /* aligned */ - if (fabs(ev->co[axis] - value) < limit) + if (fabsf(ev->co[axis] - value) < limit) BM_vert_select_set(em->bm, ev, TRUE); break; case 0: /* neg */ @@ -2593,21 +2593,21 @@ static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode, m1 = MAXSLOPE; b1 = x12; } - x2max = MAX2(x21, x22) + 0.001; /* prevent missed edges */ - x2min = MIN2(x21, x22) - 0.001; /* due to round off error */ - y2max = MAX2(y21, y22) + 0.001; - y2min = MIN2(y21, y22) - 0.001; + x2max = MAX2(x21, x22) + 0.001f; /* prevent missed edges */ + x2min = MIN2(x21, x22) - 0.001f; /* due to round off error */ + y2max = MAX2(y21, y22) + 0.001f; + y2min = MIN2(y21, y22) - 0.001f; /* Found an intersect, calc intersect point */ if (m1 == m2) { /* co-incident lines */ /* cut at 50% of overlap area */ x1max = MAX2(x11, x12); x1min = MIN2(x11, x12); - xi = (MIN2(x2max, x1max) + MAX2(x2min, x1min)) / 2.0; + xi = (MIN2(x2max, x1max) + MAX2(x2min, x1min)) / 2.0f; y1max = MAX2(y11, y12); y1min = MIN2(y11, y12); - yi = (MIN2(y2max, y1max) + MAX2(y2min, y1min)) / 2.0; + yi = (MIN2(y2max, y1max) + MAX2(y2min, y1min)) / 2.0f; } else if (m2 == MAXSLOPE) { xi = x22; @@ -4034,7 +4034,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op) if (tex->type == TEX_STUCCI) { float b2, vec[3]; - float ofs = tex->turbul / 200.0; + float ofs = tex->turbul / 200.0f; BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { b2 = BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]); @@ -4121,7 +4121,7 @@ static int edbm_bevel_exec(bContext *C, wmOperator *op) w[i] = s; ftot += s; - df *= 2.0; + df *= 2.0f; } mul_vn_fl(w, recursion, 1.0f / (float)ftot); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 2ebeb9ca224..a17f335091b 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -671,7 +671,7 @@ UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx sub_v2_v2v2(uvdiff, uv2, uv); - if (fabs(uvdiff[0]) < limit[0] && fabs(uvdiff[1]) < limit[1]) { + if (fabsf(uvdiff[0]) < limit[0] && fabsf(uvdiff[1]) < limit[1]) { if (lastv) lastv->next = next; else vlist = next; iterv->next = newvlist; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index fb9b012a31a..f611a985797 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -275,11 +275,11 @@ int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int laye else if (len > 2) { float fac = 0.0f, dfac = 1.0f / (float)len; - dfac *= M_PI * 2; + dfac *= (float)M_PI * 2.0f; for (i = 0; i < len; i++) { - fuvs[i][0] = 0.5f * sin(fac) + 0.5f; - fuvs[i][1] = 0.5f * cos(fac) + 0.5f; + fuvs[i][0] = 0.5f * sinf(fac) + 0.5f; + fuvs[i][1] = 0.5f * cosf(fac) + 0.5f; fac += dfac; } |