From 5da2135eef39ac042a8c4babcac7be375e6903d2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 3 May 2012 21:35:04 +0000 Subject: code cleanup: double promotion & some style cleanup --- source/blender/editors/uvedit/uvedit_draw.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 4 ++-- .../blender/editors/uvedit/uvedit_smart_stitch.c | 22 +++++++++++----------- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'source/blender/editors/uvedit') diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index fb7e2254e45..a90f8253654 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -855,7 +855,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) glDisable(GL_BLEND); /* draw vert preview */ - glPointSize(pointsize * 2.0); + glPointSize(pointsize * 2.0f); UI_ThemeColor4(TH_STITCH_PREVIEW_STITCHABLE); glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_stitchable); glDrawArrays(GL_POINTS, 0, stitch_preview->num_stitchable); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 1073369a36d..b515f30e150 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -799,9 +799,9 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em, luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); if (penalty && uvedit_uv_select_test(em, scene, l)) - dist = fabs(co[0] - luv->uv[0]) + penalty[0] + fabs(co[1] - luv->uv[1]) + penalty[1]; + dist = fabsf(co[0] - luv->uv[0]) + penalty[0] + fabsf(co[1] - luv->uv[1]) + penalty[1]; else - dist = fabs(co[0] - luv->uv[0]) + fabs(co[1] - luv->uv[1]); + dist = fabsf(co[0] - luv->uv[0]) + fabsf(co[1] - luv->uv[1]); if (dist <= mindist) { if (dist == mindist) diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 9474ae95c34..b30821dc56a 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -257,8 +257,8 @@ static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2]) uv[0] -= medianPoint[0]; uv[1] -= medianPoint[1]; - uv_rotation_result[0] = cos(rotation) * uv[0] - sin(rotation) * uv[1]; - uv_rotation_result[1] = sin(rotation) * uv[0] + cos(rotation) * uv[1]; + uv_rotation_result[0] = cosf(rotation) * uv[0] - sinf(rotation) * uv[1]; + uv_rotation_result[1] = sinf(rotation) * uv[0] + cosf(rotation) * uv[1]; uv[0] = uv_rotation_result[0] + medianPoint[0]; uv[1] = uv_rotation_result[1] + medianPoint[1]; @@ -286,8 +286,8 @@ static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_it l_iter = element_iter->l; luv_iter = CustomData_bmesh_get(&state->em->bm->ldata, l_iter->head.data, CD_MLOOPUV); - if (fabs(luv_orig->uv[0] - luv_iter->uv[0]) < limit && - fabs(luv_orig->uv[1] - luv_iter->uv[1]) < limit) + if (fabsf(luv_orig->uv[0] - luv_iter->uv[0]) < limit && + fabsf(luv_orig->uv[1] - luv_iter->uv[1]) < limit) { return 1; } @@ -403,7 +403,7 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta edgecos = uv1[0] * uv2[0] + uv1[1] * uv2[1]; edgesin = uv1[0] * uv2[1] - uv2[0] * uv1[1]; - rotation = (edgesin > 0) ? acos(MAX2(-1.0, MIN2(1.0, edgecos))) : -acos(MAX2(-1.0, MIN2(1.0, edgecos))); + rotation = (edgesin > 0.0f) ? acosf(MAX2(-1.0f, MIN2(1.0f, edgecos))) : -acosf(MAX2(-1.0f, MIN2(1.0f, edgecos))); island_stitch_data[element1->island].num_rot_elements++; island_stitch_data[element1->island].rotation += rotation; @@ -412,7 +412,7 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta static void stitch_island_calculate_vert_rotation(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data) { - float edgecos = 1, edgesin = 0; + float edgecos = 1.0f, edgesin = 0.0f; int index; UvElement *element_iter; float rotation = 0; @@ -441,12 +441,12 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat negate_v2_v2(normal, state->normals + index_tmp2 * 2); edgecos = dot_v2v2(normal, state->normals + index_tmp1 * 2); edgesin = cross_v2v2(normal, state->normals + index_tmp1 * 2); - rotation += (edgesin > 0) ? acos(edgecos) : -acos(edgecos); + rotation += (edgesin > 0.0f) ? acosf(edgecos) : -acosf(edgecos); } } if (state->midpoints) - rotation /= 2.0; + rotation /= 2.0f; island_stitch_data[element->island].num_rot_elements++; island_stitch_data[element->island].rotation += rotation; } @@ -1364,7 +1364,7 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event) case PADPLUSKEY: case WHEELUPMOUSE: if (event->alt) { - stitch_state->limit_dist += 0.01; + stitch_state->limit_dist += 0.01f; if (!stitch_process_data(stitch_state, scene, 0)) { return stitch_cancel(C, op); } @@ -1377,8 +1377,8 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event) case PADMINUS: case WHEELDOWNMOUSE: if (event->alt) { - stitch_state->limit_dist -= 0.01; - stitch_state->limit_dist = MAX2(0.01, stitch_state->limit_dist); + stitch_state->limit_dist -= 0.01f; + stitch_state->limit_dist = MAX2(0.01f, stitch_state->limit_dist); if (!stitch_process_data(stitch_state, scene, 0)) { return stitch_cancel(C, op); } diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 743869e82cc..b2c7dd59f1d 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1027,7 +1027,7 @@ static void correct_uv_aspect(BMEditMesh *em) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - luv->uv[0] = ((luv->uv[0] - 0.5) * scale) + 0.5; + luv->uv[0] = ((luv->uv[0] - 0.5f) * scale) + 0.5f; } } } @@ -1040,7 +1040,7 @@ static void correct_uv_aspect(BMEditMesh *em) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - luv->uv[1] = ((luv->uv[1] - 0.5) * scale) + 0.5; + luv->uv[1] = ((luv->uv[1] - 0.5f) * scale) + 0.5f; } } } -- cgit v1.2.3