diff options
7 files changed, 32 insertions, 31 deletions
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index c3d95d700a0..1050594318f 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -84,10 +84,11 @@ void DRW_globals_update(void) /* Grid */ UI_GetThemeColorShade4fv(TH_GRID, 10, ts.colorGrid); /* emphasise division lines lighter instead of darker, if background is darker than grid */ - UI_GetThemeColorShade4fv(TH_GRID, - (ts.colorGrid[0] + ts.colorGrid[1] + ts.colorGrid[2] + 0.12 > - ts.colorBackground[0] + ts.colorBackground[1] + ts.colorBackground[2]) - ? 20 : -10, ts.colorGridEmphasise); + UI_GetThemeColorShade4fv( + TH_GRID, + (ts.colorGrid[0] + ts.colorGrid[1] + ts.colorGrid[2] + 0.12f > + ts.colorBackground[0] + ts.colorBackground[1] + ts.colorBackground[2]) ? + 20 : -10, ts.colorGridEmphasise); /* Grid Axis */ UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_X, 0.5f, -10, ts.colorGridAxisX); UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_Y, 0.5f, -10, ts.colorGridAxisY); @@ -102,10 +103,10 @@ void DRW_globals_update(void) ts.sizeLampCircleShadow = ts.sizeLampCircle + U.pixelsize * 3.0f; /* M_SQRT2 to be at least the same size of the old square */ - ts.sizeVertex = ceil(UI_GetThemeValuef(TH_VERTEX_SIZE) * M_SQRT2 / 2.0f); - ts.sizeFaceDot = ceil(UI_GetThemeValuef(TH_FACEDOT_SIZE) * M_SQRT2); + ts.sizeVertex = ceilf(UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f); + ts.sizeFaceDot = ceilf(UI_GetThemeValuef(TH_FACEDOT_SIZE) * (float)M_SQRT2); ts.sizeEdge = 1.0f / 2.0f; /* TODO Theme */ - ts.sizeEdgeFix = 0.5f + 2.0f * (2.0f * (MAX2(ts.sizeVertex, ts.sizeEdge)) * M_SQRT1_2); + ts.sizeEdgeFix = 0.5f + 2.0f * (2.0f * (MAX2(ts.sizeVertex, ts.sizeEdge)) * (float)M_SQRT1_2); /* TODO Waiting for notifiers to invalidate cache */ if (globals_ubo) { diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index ce4390c40fb..d98be8b7835 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -101,7 +101,7 @@ #ifdef USE_PROFILE #include "PIL_time.h" -#define PROFILE_TIMER_FALLOFF 0.1f +#define PROFILE_TIMER_FALLOFF 0.1 #define PROFILE_START(time_start) \ double time_start = PIL_check_seconds_timer(); @@ -113,7 +113,7 @@ /* exp average */ #define PROFILE_END_UPDATE(time_update, time_start) { \ double _time_delta = (PIL_check_seconds_timer() - time_start) * 1e3; \ - time_update = (time_update * (1.0f - PROFILE_TIMER_FALLOFF)) + \ + time_update = (time_update * (1.0 - PROFILE_TIMER_FALLOFF)) + \ (_time_delta * PROFILE_TIMER_FALLOFF); \ } ((void)0) @@ -3081,15 +3081,15 @@ static void DRW_debug_gpu_stats(void) sprintf(stat_string, "GPU Memory"); draw_stat(&rect, 0, v, stat_string, sizeof(stat_string)); - sprintf(stat_string, "%.2fMB", (float)(tex_mem + vbo_mem) / 1000000.0); + sprintf(stat_string, "%.2fMB", (double)(tex_mem + vbo_mem) / 1000000.0); draw_stat(&rect, 1, v++, stat_string, sizeof(stat_string)); sprintf(stat_string, " |--> Textures"); draw_stat(&rect, 0, v, stat_string, sizeof(stat_string)); - sprintf(stat_string, "%.2fMB", (float)tex_mem / 1000000.0); + sprintf(stat_string, "%.2fMB", (double)tex_mem / 1000000.0); draw_stat(&rect, 1, v++, stat_string, sizeof(stat_string)); sprintf(stat_string, " |--> Meshes"); draw_stat(&rect, 0, v, stat_string, sizeof(stat_string)); - sprintf(stat_string, "%.2fMB", (float)vbo_mem / 1000000.0); + sprintf(stat_string, "%.2fMB", (double)vbo_mem / 1000000.0); draw_stat(&rect, 1, v++, stat_string, sizeof(stat_string)); /* Pre offset for stats_draw */ diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index 37c44f33915..e58f7cfbd29 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -680,7 +680,7 @@ void DRW_draw_cursor(void) immAttrib3fv(wpos, co); for (int i = 0; i < segments; ++i) { - float angle = 2 * M_PI * ((float)i / (float)segments); + float angle = (float)(2 * M_PI) * ((float)i / (float)segments); float x = f10 * cosf(angle); float y = f10 * sinf(angle); diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 70ee0dbc48b..8176fbcda5c 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -496,7 +496,7 @@ static void OBJECT_engine_init(void *vedata) e_data.grid_settings[1] = grid_res; /* gridResolution */ e_data.grid_settings[2] = grid_scale; /* gridScale */ e_data.grid_settings[3] = v3d->gridsubdiv; /* gridSubdiv */ - e_data.grid_settings[4] = (v3d->gridsubdiv > 1) ? 1.0f / log(v3d->gridsubdiv) : 0.0; /* 1/log(gridSubdiv) */ + e_data.grid_settings[4] = (v3d->gridsubdiv > 1) ? 1.0f / logf(v3d->gridsubdiv) : 0.0f; /* 1/log(gridSubdiv) */ } } @@ -1147,7 +1147,7 @@ static void DRW_shgroup_lamp(OBJECT_StorageList *stl, Object *ob, SceneLayer *sl size[0] = size[1] = blend; size[2] = 1.0f; size_to_mat4(sizemat, size); translate_m4(sizemat, 0.0f, 0.0f, -1.0f); - rotate_m4(sizemat, 'X', M_PI / 2.0f); + rotate_m4(sizemat, 'X', (float)(M_PI / 2)); mul_m4_m4m4(spotblendmat, shapemat, sizemat); if (la->mode & LA_SQUARE) { diff --git a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c index 101d940cccf..75af5227510 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c @@ -168,7 +168,7 @@ static void rect_transform_draw_interaction( uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - glLineWidth(line_width + 3.0); + glLineWidth(line_width + 3.0f); immBegin(GWN_PRIM_LINE_STRIP, 3); immAttrib3f(color, 0.0f, 0.0f, 0.0f); @@ -457,15 +457,15 @@ static void manipulator_rect_transform_modal( mpr->matrix_offset[3][1] = data->orig_offset[1] + valuey; } else if (mpr->highlight_part == ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_LEFT) { - mpr->matrix_offset[3][0] = data->orig_offset[0] + valuex / 2.0; + mpr->matrix_offset[3][0] = data->orig_offset[0] + valuex / 2.0f; scale[0] = (dims[0] * data->orig_scale[0] - valuex) / dims[0]; } else if (mpr->highlight_part == ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEX_RIGHT) { - mpr->matrix_offset[3][0] = data->orig_offset[0] + valuex / 2.0; + mpr->matrix_offset[3][0] = data->orig_offset[0] + valuex / 2.0f; scale[0] = (dims[0] * data->orig_scale[0] + valuex) / dims[0]; } else if (mpr->highlight_part == ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_DOWN) { - mpr->matrix_offset[3][1] = data->orig_offset[1] + valuey / 2.0; + mpr->matrix_offset[3][1] = data->orig_offset[1] + valuey / 2.0f; if (transform_flag & ED_MANIPULATOR_RECT_TRANSFORM_FLAG_SCALE_UNIFORM) { scale[0] = (dims[1] * data->orig_scale[0] - valuey) / dims[1]; @@ -475,7 +475,7 @@ static void manipulator_rect_transform_modal( } } else if (mpr->highlight_part == ED_MANIPULATOR_RECT_TRANSFORM_INTERSECT_SCALEY_UP) { - mpr->matrix_offset[3][1] = data->orig_offset[1] + valuey / 2.0; + mpr->matrix_offset[3][1] = data->orig_offset[1] + valuey / 2.0f; if (transform_flag & ED_MANIPULATOR_RECT_TRANSFORM_FLAG_SCALE_UNIFORM) { scale[0] = (dims[1] * data->orig_scale[0] + valuey) / dims[1]; diff --git a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c index 98874e5f2e4..7ecb38373e5 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c @@ -317,7 +317,7 @@ static void dial_draw_intern( } } - angle_ofs += M_PI; + angle_ofs += (float)M_PI; } } @@ -366,7 +366,7 @@ static void manipulator_dial_draw(const bContext *C, wmManipulator *mpr) copy_v3_v3(clip_plane, rv3d->viewinv[2]); clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], mpr->matrix_basis[3]); - clip_plane[3] -= 0.02 * mpr->scale_final; + clip_plane[3] -= 0.02f * mpr->scale_final; glEnable(GL_CLIP_DISTANCE0); } diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index a4e54d15034..e6923d38110 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -55,7 +55,7 @@ static void imm_draw_circle(Gwn_PrimType prim_type, const uint shdr_pos, float x { immBegin(prim_type, nsegments); for (int i = 0; i < nsegments; ++i) { - const float angle = 2 * M_PI * ((float)i / (float)nsegments); + const float angle = (float)(2 * M_PI) * ((float)i / (float)nsegments); immVertex2f(shdr_pos, x + rad * cosf(angle), y + rad * sinf(angle)); } immEnd(); @@ -99,7 +99,7 @@ static void imm_draw_disk_partial( float rad_inner, float rad_outer, int nsegments, float start, float sweep) { /* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */ - const float angle_start = -(DEG2RADF(start)) + (M_PI / 2); + const float angle_start = -(DEG2RADF(start)) + (float)(M_PI / 2); const float angle_end = -(DEG2RADF(sweep) - angle_start); nsegments += 1; immBegin(prim_type, nsegments * 2); @@ -141,7 +141,7 @@ static void imm_draw_circle_3D( { immBegin(prim_type, nsegments); for (int i = 0; i < nsegments; ++i) { - float angle = 2 * M_PI * ((float)i / (float)nsegments); + float angle = (float)(2 * M_PI) * ((float)i / (float)nsegments); immVertex3f(pos, x + rad * cosf(angle), y + rad * sinf(angle), 0.0f); } immEnd(); @@ -221,8 +221,8 @@ void imm_draw_cylinder_fill_normal_3d( { immBegin(GWN_PRIM_TRIS, 6 * slices * stacks); for (int i = 0; i < slices; ++i) { - const float angle1 = 2 * M_PI * ((float)i / (float)slices); - const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices); + const float angle1 = (float)(2 * M_PI) * ((float)i / (float)slices); + const float angle2 = (float)(2 * M_PI) * ((float)(i + 1) / (float)slices); const float cos1 = cosf(angle1); const float sin1 = sinf(angle1); const float cos2 = cosf(angle2); @@ -272,8 +272,8 @@ void imm_draw_cylinder_wire_3d(unsigned int pos, float base, float top, float he { immBegin(GWN_PRIM_LINES, 6 * slices * stacks); for (int i = 0; i < slices; ++i) { - const float angle1 = 2 * M_PI * ((float)i / (float)slices); - const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices); + const float angle1 = (float)(2 * M_PI) * ((float)i / (float)slices); + const float angle2 = (float)(2 * M_PI) * ((float)(i + 1) / (float)slices); const float cos1 = cosf(angle1); const float sin1 = sinf(angle1); const float cos2 = cosf(angle2); @@ -309,8 +309,8 @@ void imm_draw_cylinder_fill_3d(unsigned int pos, float base, float top, float he { immBegin(GWN_PRIM_TRIS, 6 * slices * stacks); for (int i = 0; i < slices; ++i) { - const float angle1 = 2 * M_PI * ((float)i / (float)slices); - const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices); + const float angle1 = (float)(2 * M_PI) * ((float)i / (float)slices); + const float angle2 = (float)(2 * M_PI) * ((float)(i + 1) / (float)slices); const float cos1 = cosf(angle1); const float sin1 = sinf(angle1); const float cos2 = cosf(angle2); |