Compiler warning: double-promotion
authorCampbell Barton <ideasman42@gmail.com>
Sat, 31 Jan 2015 06:23:30 +0000 (17:23 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 31 Jan 2015 14:17:21 +0000 (01:17 +1100)
41 files changed:
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_child.c
source/blender/blenkernel/intern/texture.c
source/blender/blenloader/intern/versioning_270.c
source/blender/bmesh/operators/bmo_dissolve.c
source/blender/bmesh/operators/bmo_extrude.c
source/blender/bmesh/operators/bmo_removedoubles.c
source/blender/bmesh/operators/bmo_similar.c
source/blender/bmesh/tools/bmesh_intersect.c
source/blender/editors/include/BIF_gl.h
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_style.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/view2d.c
source/blender/editors/object/object_add.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/space_graph/graph_draw.c
source/blender/editors/space_sequencer/sequencer_preview.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/transform/transform_constraints.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/uvedit/uvedit_parametrizer.c
source/blender/makesrna/intern/rna_scene.c
source/blender/modifiers/intern/MOD_array.c
source/blender/modifiers/intern/MOD_laplaciansmooth.c
source/blender/nodes/shader/nodes/node_shader_gamma.c
source/blender/physics/intern/implicit_blender.c
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/pixelshading.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/sunsky.c
source/blender/windowmanager/intern/wm_operators.c

index 7d04ab7778fdef5ef6d6258d2c44dd302a9e74cb..31695b0535298b5108a3e8b2213577e53fbbfcfa 100644 (file)
@@ -2206,7 +2206,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
                                                        
                                                        float range = bulge_max - 1.0f;
                                                        float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
-                                                       float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (0.5f * M_PI);
+                                                       float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (float)M_PI_2;
                                                        
                                                        bulge = interpf(soft, hard, ikData->bulge_smooth);
                                                }
@@ -2218,7 +2218,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
                                                        
                                                        float range = 1.0f - bulge_min;
                                                        float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
-                                                       float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (0.5f * M_PI);
+                                                       float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (float)M_PI_2;
                                                        
                                                        bulge = interpf(soft, hard, ikData->bulge_smooth);
                                                }
index f591fe857f8c9077eb0debc40ce4141e40a87c34..668b78a08d42ff6936918413dc4f7e67c47b6a11 100644 (file)
@@ -2715,7 +2715,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                
                                float range = bulge_max - 1.0f;
                                float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
-                               float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (0.5f * M_PI);
+                               float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (float)M_PI_2;
                                
                                bulge = interpf(soft, hard, data->bulge_smooth);
                        }
@@ -2727,7 +2727,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
                                
                                float range = 1.0f - bulge_min;
                                float scale = (range > 0.0f) ? 1.0f / range : 0.0f;
-                               float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (0.5f * M_PI);
+                               float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (float)M_PI_2;
                                
                                bulge = interpf(soft, hard, data->bulge_smooth);
                        }
index 51330f27fea434ca06993f51c292ff5475490f0c..e88a8ecde8ea3b9c6d23fd141ec888cfd72cb1c9 100644 (file)
@@ -1742,7 +1742,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp,
 
                        /* half a circle */
                        fp = dl->verts;
-                       dangle = (0.5 * M_PI / (dnr - 1));
+                       dangle = ((float)M_PI_2 / (dnr - 1));
                        angle = -(nr - 1) * dangle;
 
                        for (a = 0; a < nr; a++) {
@@ -1801,7 +1801,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp,
                        /* half a circle */
                        fp = dl->verts;
                        angle = 0.0;
-                       dangle = (0.5 * M_PI / (dnr - 1));
+                       dangle = ((float)M_PI_2 / (dnr - 1));
 
                        for (a = 0; a < nr; a++) {
                                fp[0] = 0.0;
@@ -1943,7 +1943,7 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2,
 
        t02 = x1 * x2 + y1 * y2;
        if (fabsf(t02) >= 1.0f)
-               t02 = 0.5 * M_PI;
+               t02 = M_PI_2;
        else
                t02 = (saacos(t02)) / 2.0f;
 
@@ -2476,7 +2476,7 @@ static void make_bevel_list_2D(BevList *bl)
 
                /* first */
                bevp = bl->bevpoints;
-               angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)(M_PI / 2.0f);
+               angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)M_PI_2;
                bevp->sina = sinf(angle);
                bevp->cosa = cosf(angle);
                vec_to_quat(bevp->quat, bevp->dir, 5, 1);
@@ -2484,7 +2484,7 @@ static void make_bevel_list_2D(BevList *bl)
                /* last */
                bevp = bl->bevpoints;
                bevp += (bl->nr - 1);
-               angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)(M_PI / 2.0f);
+               angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)M_PI_2;
                bevp->sina = sinf(angle);
                bevp->cosa = cosf(angle);
                vec_to_quat(bevp->quat, bevp->dir, 5, 1);
index b5004b9451751c49397480ae5f3ebd0028dade04..b817b72f1805618885bcf5623d9669f72c71f07a 100644 (file)
@@ -4059,8 +4059,8 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
                normalize_v3(nor);
 
                /* make sure that we get a proper side vector */
-               if (fabsf(dot_v3v3(nor, vec)) > 0.999999) {
-                       if (fabsf(dot_v3v3(nor, xvec)) > 0.999999) {
+               if (fabsf(dot_v3v3(nor, vec)) > 0.999999f) {
+                       if (fabsf(dot_v3v3(nor, xvec)) > 0.999999f) {
                                nor[0] = 0.0f;
                                nor[1] = 1.0f;
                                nor[2] = 0.0f;
index df03f39f62a7278a291fa876629d1ad868826e79..24fba604d1ec6173e6c720405872a202ad4d2af0 100644 (file)
@@ -138,14 +138,15 @@ static void do_kink_spiral_deform(ParticleKey *state, const float dir[3], const
                 * and goes up to the Golden Spiral for 1.0
                 * http://en.wikipedia.org/wiki/Golden_spiral
                 */
-               const float b = shape * (1.0f + sqrtf(5.0f)) / M_PI * 0.25f;
+               const float b = shape * (1.0f + sqrtf(5.0f)) / (float)M_PI * 0.25f;
                /* angle of the spiral against the curve (rotated opposite to make a smooth transition) */
-               const float start_angle = (b != 0.0f ? atanf(1.0f / b) : -M_PI*0.5f) + (b > 0.0f ? -M_PI*0.5f : M_PI*0.5f);
+               const float start_angle = ((b != 0.0f) ? atanf(1.0f / b) :
+                                          (float)-M_PI_2) + (b > 0.0f ? -(float)M_PI_2 : (float)M_PI_2);
                
                float spiral_axis[3], rot[3][3];
                float vec[3];
                
-               float theta = freq * time * 2.0f*M_PI;
+               float theta = freq * time * 2.0f * (float)M_PI;
                float radius = amplitude * expf(b * theta);
                
                /* a bit more intuitive than using negative frequency for this */
@@ -269,7 +270,7 @@ static void do_kink_spiral(ParticleThreadContext *ctx, ParticleTexture *ptex, co
                        normalize_v3(kink);
                        
                        if (kink_axis_random > 0.0f) {
-                               float a = kink_axis_random * (psys_frand(ctx->sim.psys, 7112 + seed) * 2.0f - 1.0f) * M_PI;
+                               float a = kink_axis_random * (psys_frand(ctx->sim.psys, 7112 + seed) * 2.0f - 1.0f) * (float)M_PI;
                                float rot[3][3];
                                
                                axis_angle_normalized_to_mat3(rot, dir, a);
index c7d7ae10ba8f7d43d67adb7a00039dcf9e4a991a..6c4cbcf931627a71549c7f7ccfb602941462d0f0 100644 (file)
@@ -760,7 +760,7 @@ void default_mtex(MTex *mtex)
        mtex->fieldfac = 1.0f;
        mtex->normapspace = MTEX_NSPACE_TANGENT;
        mtex->brush_map_mode = MTEX_MAP_MODE_TILED;
-       mtex->random_angle = 2.0f * M_PI;
+       mtex->random_angle = 2.0f * (float)M_PI;
        mtex->brush_angle_mode = 0;
 }
 
index 652a4525a7ea2bf96b13089567f3b1cefae516ba..6f33cab203e58fbf4c7fa1af954ada4045c3589b 100644 (file)
@@ -451,8 +451,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
                                br->mtex.brush_angle_mode |= MTEX_ANGLE_RANDOM;
                                br->mask_mtex.brush_angle_mode |= MTEX_ANGLE_RANDOM;
                        }
-                       br->mtex.random_angle = 2.0f * M_PI;
-                       br->mask_mtex.random_angle = 2.0f * M_PI;
+                       br->mtex.random_angle = 2.0 * M_PI;
+                       br->mask_mtex.random_angle = 2.0 * M_PI;
                }
 
 #undef BRUSH_RAKE
index 8cd9ee14bcbb3644bb8a6c28ac5275be585e9d50..ecb4136376122dc41d2a25e51836c1f55acf8975 100644 (file)
@@ -475,7 +475,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
 {
        BMOpSlot *einput = BMO_slot_get(op->slots_in, "edges");
        BMOpSlot *vinput = BMO_slot_get(op->slots_in, "verts");
-       const float angle_max = (float)M_PI / 2.0f;
+       const float angle_max = M_PI_2;
        const float angle_limit = min_ff(angle_max, BMO_slot_float_get(op->slots_in, "angle_limit"));
        const bool do_dissolve_boundaries = BMO_slot_bool_get(op->slots_in, "use_dissolve_boundaries");
        const BMO_Delimit delimit = BMO_slot_int_get(op->slots_in, "delimit");
index 88b53b63abb859ed85a9b114892827fcaa2bed59..aa92c3054cd6f797827835374ad33277d791ec18 100644 (file)
@@ -608,10 +608,10 @@ static void calc_solidify_normals(BMesh *bm)
                }
                else {
                        /* only one face attached to that edge */
-                       /* an edge without another attached- the weight on this is
-                        * undefined, M_PI / 2 is 90d in radians and that seems good enough */
+                       /* an edge without another attached- the weight on this is undefined,
+                        * M_PI_2 is 90d in radians and that seems good enough */
                        copy_v3_v3(edge_normal, f1->no);
-                       mul_v3_fl(edge_normal, M_PI / 2);
+                       mul_v3_fl(edge_normal, M_PI_2);
                }
 
                add_v3_v3(e->v1->no, edge_normal);
index 9c8b9ca160db622581dbec91c6fdcf1128df4e38..871bee64c19398d3afd2fb7f020d9a56cf2f5261 100644 (file)
@@ -529,7 +529,7 @@ static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op,
 
        const float dist  = BMO_slot_float_get(op->slots_in, "dist");
        const float dist_sq = dist * dist;
-       const float dist3 = (M_SQRT3 + 0.00005f) * dist;   /* Just above sqrt(3) */
+       const float dist3 = ((float)M_SQRT3 + 0.00005f) * dist;   /* Just above sqrt(3) */
 
        /* Test whether keep_verts arg exists and is non-empty */
        if (BMO_slot_exists(op->slots_in, "keep_verts")) {
index 02462e380b4c56afa0bd6ef8ad532b32ca32cc81..5f8438919dfebf8434d5f3844bca6244f37c71d7 100644 (file)
@@ -412,10 +412,10 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op)
                                                /* compute the angle between the two edges */
                                                angle = angle_normalized_v3v3(e_ext[i].dir, e_ext[indices[idx]].dir);
 
-                                               if (angle > (float)(M_PI / 2.0)) /* use the smallest angle between the edges */
+                                               if (angle > (float)M_PI_2) /* use the smallest angle between the edges */
                                                        angle = fabsf(angle - (float)M_PI);
 
-                                               if (angle / (float)(M_PI / 2.0) <= thresh) {
+                                               if (angle / (float)M_PI_2 <= thresh) {
                                                        BMO_elem_flag_enable(bm, e, EDGE_MARK);
                                                        cont = false;
                                                }
index 8a1569630fa670d17f3d1afdf3801b223ec015f5..26b53a2170921444689440fee0e005dc2beda74e 100644 (file)
@@ -541,7 +541,7 @@ static void bm_isect_tri_tri(
                                        if (((1 << i_b_e0) | (1 << i_b_e1)) & b_mask)
                                                continue;
                                        fac = line_point_factor_v3(fv_a[i_a]->co, fv_b[i_b_e0]->co, fv_b[i_b_e1]->co);
-                                       if ((fac > 0.0f - s->epsilon.eps) && (fac < 1.0 + s->epsilon.eps)) {
+                                       if ((fac > 0.0f - s->epsilon.eps) && (fac < 1.0f + s->epsilon.eps)) {
                                                float ix[3];
                                                interp_v3_v3v3(ix, fv_b[i_b_e0]->co, fv_b[i_b_e1]->co, fac);
                                                if (len_squared_v3v3(ix, fv_a[i_a]->co) <= s->epsilon.eps2x_sq) {
@@ -579,7 +579,7 @@ static void bm_isect_tri_tri(
                                        if (((1 << i_a_e0) | (1 << i_a_e1)) & a_mask)
                                                continue;
                                        fac = line_point_factor_v3(fv_b[i_b]->co, fv_a[i_a_e0]->co, fv_a[i_a_e1]->co);
-                                       if ((fac > 0.0 - s->epsilon.eps) && (fac < 1.0 + s->epsilon.eps)) {
+                                       if ((fac > 0.0f - s->epsilon.eps) && (fac < 1.0f + s->epsilon.eps)) {
                                                float ix[3];
                                                interp_v3_v3v3(ix, fv_a[i_a_e0]->co, fv_a[i_a_e1]->co, fac);
                                                if (len_squared_v3v3(ix, fv_b[i_b]->co) <= s->epsilon.eps2x_sq) {
index b06af01bab640b01b0b3b314f26cd939e67d30c3..3b7d7bac44f0be464dcdf78935ee4dc73f3aa3b3 100644 (file)
 
 #include "GPU_glew.h"
 
-/* hacking pointsize and linewidth */
-#define glPointSize(f) glPointSize(U.pixelsize * (f))
-#define glLineWidth(f) glLineWidth(U.pixelsize * (f))
-
 /*
  * these should be phased out. cpack should be replaced in
  * code with calls to glColor3ub. - zr
@@ -51,7 +47,6 @@
  * */
 void cpack(unsigned int x);
 
-
 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
 #  define glMultMatrixf(x)  \
        glMultMatrixf(_Generic((x), \
@@ -71,9 +66,14 @@ void cpack(unsigned int x);
                float (*)[4]: (float *)(x), \
                float [4][4]: (float *)(x)) \
 )
+/* hacking pointsize and linewidth */
+#define glPointSize(f)  glPointSize(U.pixelsize * _Generic((f), double: (float)(f), default: (f)))
+#define glLineWidth(f)  glLineWidth(U.pixelsize * _Generic((f), double: (float)(f), default: (f)))
 #else
 #  define glMultMatrixf(x)  glMultMatrixf((float *)(x))
 #  define glLoadMatrixf(x)  glLoadMatrixf((float *)(x))
+#define glPointSize(f)  glPointSize(U.pixelsize * (f))
+#define glLineWidth(f)  glLineWidth(U.pixelsize * (f))
 #endif
 
 #define GLA_PIXEL_OFS 0.375f
index 5c5bd2c7584971da17794c2620cbdf8976baacd2..e03ea5efba4f20ec15bddde3b48e1b4d479f513d 100644 (file)
@@ -822,8 +822,8 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, co
        if (u > 0 && v >= 0) tangle = atanf(v / u);
        else if (u > 0 && v < 0) tangle = atanf(v / u) + 2.0f * (float)M_PI;
        else if (u < 0) tangle = atanf(v / u) + (float)M_PI;
-       else if (u == 0 && v > 0.0f) tangle = (float)M_PI / 2.0f;
-       else if (u == 0 && v < 0.0f) tangle = -(float)M_PI / 2.0f;
+       else if (u == 0 && v > 0.0f) tangle = M_PI_2;
+       else if (u == 0 && v < 0.0f) tangle = -M_PI_2;
        tampli = sqrtf(u * u + v * v);
 
        /* small target vary by 2.5 degree and 2.5 IRE unit */
index 4b62d16a982da1b2c82364991a63cff6b9426b07..96973194576985b40ba90d3450480ec1e0b6c40f 100644 (file)
@@ -8906,7 +8906,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
                                block->pie_data.duration_gesture = duration;
                        }
 
-                       if (len_sq < 1.0) {
+                       if (len_sq < 1.0f) {
                                uiBut *but = ui_but_find_active_in_region(menu->region);
 
                                if (but) {
index d0637a23a7026c66259e77d62b5c26935b6a10d0..d165e2719c5156e4b9d0558e12dab32e2129ecf9 100644 (file)
@@ -1490,7 +1490,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
        }
 
        BLF_enable(fontid, BLF_ROTATION);
-       BLF_rotation(fontid, M_PI / 2);
+       BLF_rotation(fontid, M_PI_2);
        //UI_fontstyle_set(&style->widget);
        ui_fontscale(&fstyle_points, aspect / (U.pixelsize * 1.1f));
        BLF_size(fontid, fstyle_points, U.dpi);
index c42c911cd5c1a49f8e738df03d4fc090d1ca438b..2f46c0906aec8d7ca1a3896e45b1f3a70e2d1ffa 100644 (file)
@@ -224,7 +224,7 @@ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const ch
        /* rotate counter-clockwise for now (assumes left-to-right language)*/
        xofs += height;
        yofs = BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX) + 5;
-       angle = (float)M_PI / 2.0f;
+       angle = M_PI_2;
 
        /* translate rect to vertical */
        txtrect.xmin = rect->xmin - BLI_rcti_size_y(rect);
index f1a495f248fccbad260c0024b5fc7f0303f7f249..9b22f8a1e7ff93c429834fe0182a05c569a5d267 100644 (file)
@@ -2210,7 +2210,7 @@ void ui_hsvcircle_pos_from_vals(uiBut *but, const rcti *rect, float *hsv, float
        float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
        float ang, radius_t;
        
-       ang = 2.0f * (float)M_PI * hsv[0] + 0.5f * (float)M_PI;
+       ang = 2.0f * (float)M_PI * hsv[0] + (float)M_PI_2;
        
        if ((but->flag & UI_BUT_COLOR_CUBIC) && (U.color_picker_type == USER_CP_CIRCLE_HSV))
                radius_t = (1.0f - pow3f(1.0f - hsv[1]));
@@ -3007,11 +3007,8 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
                float height = rect->ymax - rect->ymin;
                /* find color luminance and change it slightly */
                float bw = rgb_to_bw(col);
-               
-               if (bw > 0.5)
-                       bw -= 0.5;
-               else
-                       bw += 0.5;
+
+               bw += (bw < 0.5f) ? 0.5f : -0.5f;
                
                glColor4f(bw, bw, bw, 1.0);
                glBegin(GL_TRIANGLES);
@@ -3947,7 +3944,7 @@ void ui_draw_pie_center(uiBlock *block)
        int subd = 40;
 
        float angle = atan2f(pie_dir[1], pie_dir[0]);
-       float range = (block->pie_data.flags & UI_PIE_DEGREES_RANGE_LARGE) ? ((float)M_PI / 2.0f) : ((float)M_PI / 4.0f);
+       float range = (block->pie_data.flags & UI_PIE_DEGREES_RANGE_LARGE) ? M_PI_2 : M_PI_4;
 
        glPushMatrix();
        glTranslatef(cx, cy, 0.0f);
index de46d47e5a3a96ee3fb1ad0cb09fd7b1e92124de..12ee3199f432193d5556f2edd788a72148532ae0 100644 (file)
@@ -1851,7 +1851,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
                        /* draw vertical steps */
                        if (dfac > 0.0f) {
                                
-                               BLF_rotation_default(M_PI / 2);
+                               BLF_rotation_default(M_PI_2);
                                BLF_enable_default(BLF_ROTATION);
 
                                for (; fac < vert.ymax - 10; fac += dfac, val += grid->dy) {
index c3edd63b2d4e6e90ccb9594712f20b27ba8c1dc1..2fde09570c0fa4c818401e40a1ace6c8e616d6c2 100644 (file)
@@ -162,14 +162,13 @@ void ED_object_rotation_from_view(bContext *C, float rot[3], const char align_ax
        BLI_assert(align_axis >= 'X' && align_axis <= 'Z');
 
        if (rv3d) {
-               const float pi_2 = (float)M_PI / 2.0f;
                float quat[4];
 
                switch (align_axis) {
                        case 'X':
                        {
                                float quat_y[4];
-                               axis_angle_to_quat(quat_y, rv3d->viewinv[1], -pi_2);
+                               axis_angle_to_quat(quat_y, rv3d->viewinv[1], -M_PI_2);
                                mul_qt_qtqt(quat, rv3d->viewquat, quat_y);
                                quat[0] = -quat[0];
 
@@ -182,7 +181,7 @@ void ED_object_rotation_from_view(bContext *C, float rot[3], const char align_ax
                                quat[0] = -quat[0];
 
                                quat_to_eul(rot, quat);
-                               rot[0] -= pi_2;
+                               rot[0] -= (float)M_PI_2;
                                break;
                        }
                        case 'Z':
index 79bf8c893df1f12e89eb3897173148fc57854d62..59568789a1b73ef058af2b78d334242ceb50b53e 100644 (file)
@@ -290,7 +290,7 @@ static bool paint_brush_update(bContext *C,
 
                ups->anchored_size = ups->pixel_radius = sqrtf(dx * dx + dy * dy);
 
-               ups->brush_rotation = ups->brush_rotation_sec = atan2f(dx, dy) + M_PI;
+               ups->brush_rotation = ups->brush_rotation_sec = atan2f(dx, dy) + (float)M_PI;
 
                if (brush->flag & BRUSH_EDGE_TO_EDGE) {
                        halfway[0] = dx * 0.5f + stroke->initial_mouse[0];
@@ -999,7 +999,8 @@ static bool paint_stroke_curve_end(bContext *C, wmOperator *op, PaintStroke *str
        return false;
 }
 
-static void paint_stroke_line_constrain (bContext *C, PaintStroke *stroke, float mouse[2]) {
+static void paint_stroke_line_constrain (bContext *C, PaintStroke *stroke, float mouse[2])
+{
        if (stroke->constrain_line) {
                wmWindow *win = CTX_wm_window(C);
                ARegion *ar = CTX_wm_region(C);
@@ -1011,20 +1012,20 @@ static void paint_stroke_line_constrain (bContext *C, PaintStroke *stroke, float
                len = len_v2(line);
                
                /* divide angle by PI/8 */
-               angle = 4.0 * angle / M_PI;
+               angle = 4.0f * angle / (float)M_PI;
                
                /* now take residue, if less than */
-               res = angle - floor(angle);
+               res = angle - floorf(angle);
                
-               if (res <= 0.5) {
-                       angle = floor(angle) * M_PI / 4.0;
+               if (res <= 0.5f) {
+                       angle = floorf(angle) * (float)M_PI_4;
                }
                else {
-                       angle = (floor(angle) + 1.0) * M_PI / 4.0;
+                       angle = (floorf(angle) + 1.0f) * (float)M_PI_4;
                }
                
-               line[0] = len * cos(angle) + stroke->last_mouse_position[0] + ar->winrct.xmin;
-               line[1] = len * sin(angle) + stroke->last_mouse_position[1] + ar->winrct.ymin;
+               line[0] = len * cosf(angle) + stroke->last_mouse_position[0] + ar->winrct.xmin;
+               line[1] = len * sinf(angle) + stroke->last_mouse_position[1] + ar->winrct.ymin;
                
                WM_cursor_warp(win, line[0], line[1]);
        }
index 9093734f25fef0ddf4b9937fa5e3e8cf1fecdd7b..2d8a0a3da29ecebbe779a630a212ec9e4d2b2a1b 100644 (file)
@@ -848,11 +848,13 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
                 * NOTE: we need to scale the y-values to be valid for the units
                 */
                glBegin(GL_LINES);
+               {
                        t = v2d->cur.xmin;
                        glVertex2f(t, t * unitfac);
                        
                        t = v2d->cur.xmax;
                        glVertex2f(t, t * unitfac); 
+               }
                glEnd();
                
                /* cleanup line drawing */
@@ -875,6 +877,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
                        setlinestyle(5);
                        
                        glBegin(GL_LINES);
+                       {
                                /* x-axis lookup */
                                co[0] = x;
                                
@@ -894,6 +897,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
                                
                                co[0] = x;
                                glVertex2fv(co);
+                       }
                        glEnd();
                        
                        setlinestyle(0);
index 57c81e919e5f9d75f34ed4cf31b5a6fb5418d4fb..c8834d394f5d3d5945eca2415cbe71f6e4bfdad0 100644 (file)
@@ -117,7 +117,7 @@ static void preview_startjob(void *data, short *stop, short *do_update, float *p
                BLI_freelinkN(&pj->previews, previewjb);
                previewjb = preview_next;
                pj->processed++;                
-               *progress = (pj->total > 0) ? (float)pj->processed / (float)pj->total : 1.0;
+               *progress = (pj->total > 0) ? (float)pj->processed / (float)pj->total : 1.0f;
                *do_update = true;
                BLI_mutex_unlock(pj->mutex);
        }
index 691da78f26bf2e09b3030b59cc7814da6fa57924..f33f074e6c576e011629b1744e818a192ac0210c 100644 (file)
@@ -1619,7 +1619,7 @@ static void draw_pose_dofs(Object *ob)
                                                                for (a = -16; a <= 16; a++) {
                                                                        /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
                                                                        float fac = ((float)a) / 16.0f * 0.5f;
-                                                                       phi = (float)(0.5 * M_PI) + fac * (pchan->limitmax[0] - pchan->limitmin[0]);
+                                                                       phi = (float)M_PI_2 + fac * (pchan->limitmax[0] - pchan->limitmin[0]);
                                                                        
                                                                        i = (a == -16) ? 2 : 3;
                                                                        corner[i][0] = 0.0f;
index b810783478208dac941c9b7ff0d2e14fed86a1e3..67c6eb405d721dad74209c8a41a16ff16940771b 100644 (file)
@@ -2822,7 +2822,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar, bool
 {
        /* clear background */
        if (scene->world && ((v3d->flag3 & V3D_SHOW_WORLD) || force)) {
-               float alpha = (force) ? 1.0f : 0.0;
+               float alpha = (force) ? 1.0f : 0.0f;
                bool glsl = GPU_glsl_support() && BKE_scene_use_new_shading_nodes(scene) && scene->world->nodetree && scene->world->use_nodes;
                
                if (glsl) {
index 4b1d99b61657c9b7936b56c70645bea459fd29c9..7a1cd88ba49c3309ce2726949e9f2ef54226bb83 100644 (file)
@@ -1034,7 +1034,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
                 * - of rotation is linearly proportional
                 * - to the distance that the mouse is
                 * - dragged. */
-               phi = si * (float)(M_PI / 2.0);
+               phi = si * (float)M_PI_2;
 
                q1[0] = cosf(phi);
                mul_v3_fl(q1 + 1, sinf(phi));
index 5df348408dfee4eba1edce94b8bb82c19bccfe21..0457f5f2d526ca9bbd84ce8d6f9bc85db98cca92 100644 (file)
@@ -344,8 +344,8 @@ void view3d_keymap(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "VIEW3D_OT_ndof_all", NDOF_MOTION, 0, KM_CTRL | KM_SHIFT, 0);
        kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_selected", NDOF_BUTTON_FIT, KM_PRESS, 0, 0);
        RNA_boolean_set(kmi->ptr, "use_all_regions", false);
-       RNA_float_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", NDOF_BUTTON_ROLL_CCW, KM_PRESS, 0, 0)->ptr, "angle", M_PI / -2);
-       RNA_float_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", NDOF_BUTTON_ROLL_CW, KM_PRESS, 0, 0)->ptr, "angle", M_PI / 2);
+       RNA_float_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", NDOF_BUTTON_ROLL_CCW, KM_PRESS, 0, 0)->ptr, "angle", -M_PI_2);
+       RNA_float_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", NDOF_BUTTON_ROLL_CW, KM_PRESS, 0, 0)->ptr, "angle", M_PI_2);
 
 
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
index d8f17315c0103c7f6409435740b215bbb861972f..ccb81c7342bd375fb89b855f4ce02d707c1c4efa 100644 (file)
@@ -208,7 +208,7 @@ static void axisProjection(TransInfo *t, const float axis[3], const float in[3],
        viewAxisCorrectCenter(t, t_con_center);
        
        angle = fabsf(angle_v3v3(axis, t->viewinv[2]));
-       if (angle > (float)M_PI / 2.0f) {
+       if (angle > (float)M_PI_2) {
                angle = (float)M_PI - angle;
        }
        angle = RAD2DEGF(angle);
index f2869843dd5e40aa2a0ee9830d2cdfe3509c1e60..38190d407ab24bba64a37ff7d9fb0a74f5c0aa26 100644 (file)
@@ -177,7 +177,7 @@ static void axis_angle_to_gimbal_axis(float gmat[3][3], const float axis[3], con
        mul_qt_v3(quat, gmat[0]);
 
        /* Y-axis */
-       axis_angle_to_quat(quat, axis, M_PI / 2.0);
+       axis_angle_to_quat(quat, axis, M_PI_2);
        copy_v3_v3(gmat[1], gmat[0]);
        mul_qt_v3(quat, gmat[1]);
 
index 569fe1c326d42bcf927da008f6534156a5842780..00615f9bef798034501edc52db2c924a1d1701e9 100644 (file)
@@ -2672,8 +2672,8 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart)
                }
 
                for (i = 0; i < ninterior; i++) {
-                       sys->lambdaPlanar[i] += nlGetVariable(0, i);
-                       sys->lambdaLength[i] += nlGetVariable(0, ninterior + i);
+                       sys->lambdaPlanar[i] += (float)nlGetVariable(0, i);
+                       sys->lambdaLength[i] += (float)nlGetVariable(0, ninterior + i);
                }
        }
 
@@ -4561,7 +4561,7 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
                box->index = i; /* warning this index skips PCHART_NOPACK boxes */
                
                if (margin > 0.0f)
-                       area += sqrtf(box->w * box->h);
+                       area += (double)sqrtf(box->w * box->h);
        }
        
        if (margin > 0.0f) {
index 1cc9ef15f08d9996428d8a2c51087c0ba810c743..e830e86a57328c6d6788998d641dbf1f17bbe90e 100644 (file)
@@ -3207,7 +3207,7 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna)
 
        prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE);
        RNA_def_property_float_sdna(prop, NULL, "agentmaxslope");
-       RNA_def_property_range(prop, 0, M_PI / 2);
+       RNA_def_property_range(prop, 0, M_PI_2);
        RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle");
        RNA_def_property_update(prop, NC_SCENE, NULL);
 
index b6d75afaf23923665e3fcc71df8dc375fc3cbcb9..7430a4300a5bc8ba659af460aef23507678c2f5f 100644 (file)
@@ -201,7 +201,7 @@ static void dm_mvert_map_doubles(
         const float dist,
         const bool with_follow)
 {
-       const float dist3 = (M_SQRT3 + 0.00005f) * dist;   /* Just above sqrt(3) */
+       const float dist3 = ((float)M_SQRT3 + 0.00005f) * dist;   /* Just above sqrt(3) */
        int i_source, i_target, i_target_low_bound, target_end, source_end;
        SortVertsElem *sorted_verts_target, *sorted_verts_source;
        SortVertsElem *sve_source, *sve_target, *sve_target_low_bound;
index 6f33bfa73fc87ba0d1541b76358a10a6e25dc20b..93cd92196b222044039819426064950d7f09a81d 100644 (file)
@@ -466,13 +466,13 @@ static void validate_solution(LaplacianSystem *sys, short flag, float lambda, fl
                if (sys->zerola[i] == 0) {
                        lam = sys->numNeEd[i] == sys->numNeFa[i] ? (lambda >= 0.0f ? 1.0f : -1.0f) : (lambda_border >= 0.0f ? 1.0f : -1.0f);
                        if (flag & MOD_LAPLACIANSMOOTH_X) {
-                               sys->vertexCos[i][0] += lam * (nlGetVariable(0, i) - sys->vertexCos[i][0]);
+                               sys->vertexCos[i][0] += lam * ((float)nlGetVariable(0, i) - sys->vertexCos[i][0]);
                        }
                        if (flag & MOD_LAPLACIANSMOOTH_Y) {
-                               sys->vertexCos[i][1] += lam * (nlGetVariable(1, i) - sys->vertexCos[i][1]);
+                               sys->vertexCos[i][1] += lam * ((float)nlGetVariable(1, i) - sys->vertexCos[i][1]);
                        }
                        if (flag & MOD_LAPLACIANSMOOTH_Z) {
-                               sys->vertexCos[i][2] += lam * (nlGetVariable(2, i) - sys->vertexCos[i][2]);
+                               sys->vertexCos[i][2] += lam * ((float)nlGetVariable(2, i) - sys->vertexCos[i][2]);
                        }
                }
        }
index 503fe034754f12c0a1b902e205558783bac17120..0264abe451ff4bf42e80f2baf7d23fddaba9059d 100644 (file)
@@ -48,9 +48,9 @@ static void node_shader_exec_gamma(void *UNUSED(data), int UNUSED(thread), bNode
        nodestack_get_vec(col, SOCK_VECTOR, in[0]);
        nodestack_get_vec(&gamma, SOCK_FLOAT, in[1]);
 
-       out[0]->vec[0] = col[0] > 0.0 ? pow(col[0], gamma) : col[0];
-       out[0]->vec[1] = col[1] > 0.0 ? pow(col[1], gamma) : col[1];
-       out[0]->vec[2] = col[2] > 0.0 ? pow(col[2], gamma) : col[2];
+       out[0]->vec[0] = col[0] > 0.0f ? powf(col[0], gamma) : col[0];
+       out[0]->vec[1] = col[1] > 0.0f ? powf(col[1], gamma) : col[1];
+       out[0]->vec[2] = col[2] > 0.0f ? powf(col[2], gamma) : col[2];
 }
 
 static int node_shader_gpu_gamma(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
index cdc3bda3b111a11243ebf9da33d4f284922bf77d..e6ba55ab60531f5f2c8fae8c64107ac6d5fb7a37 100644 (file)
@@ -941,7 +941,7 @@ static int cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z,
 
        result->status = conjgrad_loopcount < conjgrad_looplimit ? BPH_SOLVER_SUCCESS : BPH_SOLVER_NO_CONVERGENCE;
        result->iterations = conjgrad_loopcount;
-       result->error = bnorm2 > 0.0f ? sqrt(delta_new / bnorm2) : 0.0f;
+       result->error = bnorm2 > 0.0f ? sqrtf(delta_new / bnorm2) : 0.0f;
 
        return conjgrad_loopcount < conjgrad_looplimit;  // true means we reached desired accuracy in given time - ie stable
 }
@@ -1470,8 +1470,8 @@ static void edge_wind_vertex(const float dir[3], float length, float radius, con
        
        /* angle of wind direction to edge */
        cos_alpha = dot_v3v3(wind, dir) / windlen;
-       sin_alpha = sqrt(1.0 - cos_alpha*cos_alpha);
-       cross_section = radius * (M_PI * radius * sin_alpha + length * cos_alpha);
+       sin_alpha = sqrtf(1.0f - cos_alpha * cos_alpha);
+       cross_section = radius * ((float)M_PI * radius * sin_alpha + length * cos_alpha);
        
        mul_v3_v3fl(f, wind, density * cross_section);
 }
index b5b75f471938f9f55091b5dc33b874bb52005731..a0fcc7cdcd21e50be1e11ece1989718f53933e6f 100644 (file)
@@ -157,7 +157,7 @@ float RE_filter_value(int type, float x)
                {
                        const float two_gaussfac2 = 2.0f * gaussfac * gaussfac;
                        x *= 3.0f * gaussfac;
-                       return 1.0f / sqrtf(M_PI * two_gaussfac2) * expf(-x*x / two_gaussfac2);
+                       return 1.0f / sqrtf((float)M_PI * two_gaussfac2) * expf(-x*x / two_gaussfac2);
                }
                        
                case R_FILTER_MITCH:
index ac4a7dbdccd6e483b99424173ece044b695adbf4..104cde0a0b5cd055eb7fcf39f41144c8cf54ec86 100644 (file)
@@ -155,7 +155,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
                                        x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2]));
                                        /* 1.0/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */
                                        
-                                       inpr = 1.0 / (sqrtf(1.0f + x * x));
+                                       inpr = 1.0f / (sqrtf(1.0f + x * x));
                                }
                                else inpr= 0.0;
                        }
@@ -201,7 +201,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
                
                /* dot product and  reflectivity*/
                
-               inp = 1.0 - fabsf(dot_v3v3(vn, lv));
+               inp = 1.0f - fabsf(dot_v3v3(vn, lv));
                
                /* inp= cos(0.5*M_PI-acos(inp)); */
                
@@ -361,7 +361,7 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz,
        else dist= dist/har->radsq;
 
        if (har->type & HA_FLARECIRC) {
-               dist = 0.5 + fabsf(dist - 0.5f);
+               dist = 0.5f + fabsf(dist - 0.5f);
        }
 
        if (har->hard>=30) {
index 3575b78f95f76b4b12621e31665e89febdc3a14e..065cdeab61c30eb1c377a00305a5146565450579 100644 (file)
@@ -1273,7 +1273,7 @@ static float get_avg_speed(ShadeInput *shi)
        post_x = (shi->winspeed[2] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[2];
        post_y = (shi->winspeed[3] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[3];
        
-       speedavg = (sqrtf(pre_x * pre_x + pre_y * pre_y) + sqrtf(post_x * post_x + post_y * post_y)) / 2.0;
+       speedavg = (sqrtf(pre_x * pre_x + pre_y * pre_y) + sqrtf(post_x * post_x + post_y * post_y)) / 2.0f;
        
        return speedavg;
 }
index 049823ec9ad2c0735ed658b4bf187e27db2acad6..17039bca63a134ec99ac8f4feed5f3fb159af1da 100644 (file)
@@ -220,10 +220,10 @@ static int blend(Tex *tex, const float texvec[3], TexResult *texres)
                texres->tin= (2.0f+x+y)/4.0f;
        }
        else if (tex->stype==TEX_RAD) { /* radial */
-               texres->tin = (atan2f(y, x) / (2 * M_PI) + 0.5f);
+               texres->tin = (atan2f(y, x) / (float)(2 * M_PI) + 0.5f);
        }
        else {  /* sphere TEX_SPHERE */
-               texres->tin = 1.0 - sqrtf(x * x + y * y + texvec[2] * texvec[2]);
+               texres->tin = 1.0f - sqrtf(x * x + y * y + texvec[2] * texvec[2]);
                if (texres->tin<0.0f) texres->tin= 0.0f;
                if (tex->stype==TEX_HALO) texres->tin*= texres->tin;  /* halo */
        }
@@ -274,7 +274,7 @@ static int clouds(Tex *tex, const float texvec[3], TexResult *texres)
 /* creates a sine wave */
 static float tex_sin(float a)
 {
-       a = 0.5 + 0.5 * sinf(a);
+       a = 0.5f + 0.5f * sinf(a);
 
        return a;
 }
index 6078989f9f6f39e2d2e71ba341a5661ccee0ef05..d4e53eb73050d054fde6a14c7729c25a7b69c45b 100644 (file)
@@ -254,14 +254,14 @@ void GetSkyXYZRadiance(struct SunSky *sunsky, float theta, float phi, float colo
        float hfade = 1, nfade = 1;
 
 
-       if (theta > (0.5f * (float)M_PI)) {
+       if (theta > (float)M_PI_2) {
                hfade = 1.0f - (theta * (float)M_1_PI - 0.5f) * 2.0f;
                hfade = hfade * hfade * (3.0f - 2.0f * hfade);
-               theta = 0.5 * M_PI;
+               theta = M_PI_2;
        }
 
-       if (sunsky->theta > (0.5f * (float)M_PI)) {
-               if (theta <= 0.5f * (float)M_PI) {
+       if (sunsky->theta > (float)M_PI_2) {
+               if (theta <= (float)M_PI_2) {
                        nfade = 1.0f - (0.5f - theta * (float)M_1_PI) * 2.0f;
                        nfade *= 1.0f - (sunsky->theta * (float)M_1_PI - 0.5f) * 2.0f;
                        nfade = nfade * nfade * (3.0f - 2.0f * nfade);
index 3097ad41a6f04ac69f452dea9b2e43449628824c..631201befc4c6360dd3557390849ff8a4e9ad3b8 100644 (file)
@@ -4423,7 +4423,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
                                                        if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
                                                        break;
                                                case PROP_ANGLE:
-                                                       new_value = atan2f(delta[1], delta[0]) + M_PI + angle_precision;
+                                                       new_value = atan2f(delta[1], delta[0]) + (float)M_PI + angle_precision;
                                                        new_value = fmod(new_value, 2.0f * (float)M_PI);
                                                        if (new_value < 0.0f)
                                                                new_value += 2.0f * (float)M_PI;