diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-19 03:03:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-19 03:03:27 +0400 |
commit | d0e892a7286791a4b2d1c5d7321fe8fe040819dd (patch) | |
tree | 43a9024562d8272d3211e75bea0b614d286196c8 /source/gameengine/Converter | |
parent | db14b97be6917d961c893ba6e0188c927ffa67b0 (diff) |
quiet double promotion warnings for the game engine.
Diffstat (limited to 'source/gameengine/Converter')
5 files changed, 41 insertions, 44 deletions
diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp index f464d6c4b59..7344aa9378e 100644 --- a/source/gameengine/Converter/BL_ArmatureChannel.cpp +++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp @@ -258,7 +258,7 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str joints[2] = -joint_mat[1][0]; norm = normalize_v3(joints); if (norm < FLT_EPSILON) { - norm = (joint_mat[1][1] < 0.f) ? M_PI : 0.f; + norm = (joint_mat[1][1] < 0.0f) ? (float)M_PI : 0.0f; } else { norm = acos(joint_mat[1][1]); } @@ -275,7 +275,7 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str joints[2] = (joint_mat[0][1]-joint_mat[1][0])*0.5f; sa = len_v3(joints); ca = (joint_mat[0][0]+joint_mat[1][1]+joint_mat[1][1]-1.0f)*0.5f; - if (sa > FLT_EPSILON) { + if (sa > (double)FLT_EPSILON) { norm = atan2(sa,ca)/sa; } else { if (ca < 0.0) { diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp index ee78c4deed9..7939d6e9235 100644 --- a/source/gameengine/Converter/BL_ArmatureConstraint.cpp +++ b/source/gameengine/Converter/BL_ArmatureConstraint.cpp @@ -334,7 +334,7 @@ PyObject* BL_ArmatureConstraint::py_attr_getattr(void *self_v, const struct KX_P } switch (attr_order) { case BCA_IKWEIGHT: - return PyFloat_FromDouble((ikconstraint)?ikconstraint->weight:0.0); + return PyFloat_FromDouble((ikconstraint)?ikconstraint->weight : 0.0f); case BCA_IKTYPE: return PyLong_FromLong(ikconstraint->type); case BCA_IKFLAG: @@ -370,7 +370,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI switch (attr_order) { case BCA_ENFORCE: dval = PyFloat_AsDouble(value); - if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */ + if (dval < 0.0 || dval > 1.0) { /* also accounts for non float */ PyErr_SetString(PyExc_AttributeError, "constraint.enforce = float: BL_ArmatureConstraint, expected a float between 0 and 1"); return PY_SET_ATTR_FAIL; } @@ -379,7 +379,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI case BCA_HEADTAIL: dval = PyFloat_AsDouble(value); - if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */ + if (dval < 0.0 || dval > 1.0) { /* also accounts for non float */ PyErr_SetString(PyExc_AttributeError, "constraint.headtail = float: BL_ArmatureConstraint, expected a float between 0 and 1"); return PY_SET_ATTR_FAIL; } @@ -417,7 +417,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI switch (attr_order) { case BCA_IKWEIGHT: dval = PyFloat_AsDouble(value); - if (dval < 0.0f || dval > 1.0f) { /* also accounts for non float */ + if (dval < 0.0 || dval > 1.0) { /* also accounts for non float */ PyErr_SetString(PyExc_AttributeError, "constraint.weight = float: BL_ArmatureConstraint, expected a float between 0 and 1"); return PY_SET_ATTR_FAIL; } @@ -426,7 +426,7 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI case BCA_IKDIST: dval = PyFloat_AsDouble(value); - if (dval < 0.0f) { /* also accounts for non float */ + if (dval < 0.0) { /* also accounts for non float */ PyErr_SetString(PyExc_AttributeError, "constraint.ik_dist = float: BL_ArmatureConstraint, expected a positive float"); return PY_SET_ATTR_FAIL; } diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 3c9ca77b37e..84ad12477d0 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -30,7 +30,6 @@ * \ingroup bgeconv */ - #if defined(WIN32) && !defined(FREE_WINDOWS) #pragma warning (disable : 4786) #endif @@ -186,10 +185,8 @@ extern Material defmaterial; /* material.c */ #ifdef __cplusplus extern "C" { #endif -//XXX #include "BSE_headerbuttons.h" //XXX void update_for_newframe(); //void BKE_scene_update_for_newframe(struct Scene *sce, unsigned int lay); -//#include "BKE_ipo.h" //void do_all_data_ipos(void); #ifdef __cplusplus } @@ -464,10 +461,10 @@ static void GetRGB(short type, unsigned char cp[4]; unsigned int integer; } col_converter; - col_converter.cp[3] = (unsigned char) (mat->r*255.0); - col_converter.cp[2] = (unsigned char) (mat->g*255.0); - col_converter.cp[1] = (unsigned char) (mat->b*255.0); - col_converter.cp[0] = (unsigned char) (mat->alpha*255.0); + col_converter.cp[3] = (unsigned char) (mat->r * 255.0f); + col_converter.cp[2] = (unsigned char) (mat->g * 255.0f); + col_converter.cp[1] = (unsigned char) (mat->b * 255.0f); + col_converter.cp[0] = (unsigned char) (mat->alpha * 255.0f); color = col_converter.integer; } c0 = KX_rgbaint2uint_new(color); @@ -1143,10 +1140,10 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, unsigned int integer; } col_converter; - col_converter.cp[3] = (unsigned char) (ma->r*255.0); - col_converter.cp[2] = (unsigned char) (ma->g*255.0); - col_converter.cp[1] = (unsigned char) (ma->b*255.0); - col_converter.cp[0] = (unsigned char) (ma->alpha*255.0); + col_converter.cp[3] = (unsigned char) (ma->r * 255.0f); + col_converter.cp[2] = (unsigned char) (ma->g * 255.0f); + col_converter.cp[1] = (unsigned char) (ma->b * 255.0f); + col_converter.cp[0] = (unsigned char) (ma->alpha * 255.0f); color = col_converter.integer; } @@ -1330,8 +1327,8 @@ static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blendero MT_assert(0.0f <= blenderobject->damping && blenderobject->damping <= 1.0f); MT_assert(0.0f <= blenderobject->rdamping && blenderobject->rdamping <= 1.0f); - shapeProps->m_lin_drag = 1.0 - blenderobject->damping; - shapeProps->m_ang_drag = 1.0 - blenderobject->rdamping; + shapeProps->m_lin_drag = 1.0f - blenderobject->damping; + shapeProps->m_ang_drag = 1.0f - blenderobject->rdamping; shapeProps->m_friction_scaling[0] = blenderobject->anisotropicFriction[0]; shapeProps->m_friction_scaling[1] = blenderobject->anisotropicFriction[1]; @@ -1456,17 +1453,17 @@ static void my_tex_space_mesh(Mesh *me) copy_v3_v3(me->size, size); me->rot[0]= me->rot[1]= me->rot[2]= 0.0f; - if (me->size[0]==0.0) me->size[0]= 1.0f; - else if (me->size[0]>0.0 && me->size[0]< 0.00001f) me->size[0]= 0.00001f; - else if (me->size[0]<0.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f; + if (me->size[0] == 0.0f) me->size[0] = 1.0f; + else if (me->size[0] > 0.0f && me->size[0]< 0.00001f) me->size[0]= 0.00001f; + else if (me->size[0] < 0.0f && me->size[0]> -0.00001f) me->size[0]= -0.00001f; - if (me->size[1]==0.0) me->size[1]= 1.0f; - else if (me->size[1]>0.0 && me->size[1]< 0.00001f) me->size[1]= 0.00001f; - else if (me->size[1]<0.0 && me->size[1]> -0.00001f) me->size[1]= -0.00001f; + if (me->size[1] == 0.0f) me->size[1]= 1.0f; + else if (me->size[1] > 0.0f && me->size[1]< 0.00001f) me->size[1]= 0.00001f; + else if (me->size[1] < 0.0f && me->size[1]> -0.00001f) me->size[1]= -0.00001f; - if (me->size[2]==0.0) me->size[2]= 1.0f; - else if (me->size[2]>0.0 && me->size[2]< 0.00001f) me->size[2]= 0.00001f; - else if (me->size[2]<0.0 && me->size[2]> -0.00001f) me->size[2]= -0.00001f; + if (me->size[2] == 0.0f) me->size[2]= 1.0f; + else if (me->size[2] > 0.0f && me->size[2]< 0.00001f) me->size[2]= 0.00001f; + else if (me->size[2] < 0.0f && me->size[2]> -0.00001f) me->size[2]= -0.00001f; } } @@ -1522,13 +1519,13 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa } else { - size[0]= 0.5f*fabs(bb->vec[0][0] - bb->vec[4][0]); - size[1]= 0.5f*fabs(bb->vec[0][1] - bb->vec[2][1]); - size[2]= 0.5f*fabs(bb->vec[0][2] - bb->vec[1][2]); + size[0] = 0.5f * fabsf(bb->vec[0][0] - bb->vec[4][0]); + size[1] = 0.5f * fabsf(bb->vec[0][1] - bb->vec[2][1]); + size[2] = 0.5f * fabsf(bb->vec[0][2] - bb->vec[1][2]); - center[0]= 0.5f*(bb->vec[0][0] + bb->vec[4][0]); - center[1]= 0.5f*(bb->vec[0][1] + bb->vec[2][1]); - center[2]= 0.5f*(bb->vec[0][2] + bb->vec[1][2]); + center[0] = 0.5f * (bb->vec[0][0] + bb->vec[4][0]); + center[1] = 0.5f * (bb->vec[0][1] + bb->vec[2][1]); + center[2] = 0.5f * (bb->vec[0][2] + bb->vec[1][2]); } } diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 28e34769ab8..89a3f365140 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -109,7 +109,7 @@ * KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set */ -#define KX_BLENDERTRUNC(x) (( x < 0.0001 && x > -0.0001 ) ? 0.0 : x) +#define KX_BLENDERTRUNC(x) (( x < 0.0001f && x > -0.0001f ) ? 0.0f : x) void BL_ConvertActuators(const char* maggiename, struct Object* blenderobject, @@ -162,7 +162,7 @@ void BL_ConvertActuators(const char* maggiename, KX_BLENDERTRUNC(obact->angularvelocity[1]), KX_BLENDERTRUNC(obact->angularvelocity[2])); short damping = obact->damping; - + /* Blender uses a bit vector internally for the local-flags. In */ /* KX, we have four bools. The compiler should be smart enough */ /* to do the right thing. We need to explicitly convert here! */ @@ -431,7 +431,7 @@ void BL_ConvertActuators(const char* maggiename, new KX_SoundActuator(gameobj, snd_sound, soundact->volume, - (float)(exp((soundact->pitch / 12.0) * M_LN2)), + (float)(expf((soundact->pitch / 12.0f) * (float)M_LN2)), is3d, settings, soundActuatorType); @@ -578,8 +578,8 @@ void BL_ConvertActuators(const char* maggiename, /* convert settings... degrees in the ui become radians */ /* internally */ if (conact->type == ACT_CONST_TYPE_ORI) { - min = (float)((MT_2_PI * conact->minloc[0])/360.0); - max = (float)((MT_2_PI * conact->maxloc[0])/360.0); + min = (float)(((float)MT_2_PI * conact->minloc[0]) / 360.0f); + max = (float)(((float)MT_2_PI * conact->maxloc[0]) / 360.0f); switch (conact->mode) { case ACT_CONST_DIRPX: locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX; diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp index 2bd1688ca6d..93eeaaf05fb 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ b/source/gameengine/Converter/KX_ConvertSensors.cpp @@ -23,14 +23,14 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * Conversion of Blender data blocks to KX sensor system */ /** \file gameengine/Converter/KX_ConvertSensors.cpp * \ingroup bgeconv + * + * Conversion of Blender data blocks to KX sensor system */ - #include <stdio.h> #if defined(WIN32) && !defined(FREE_WINDOWS) @@ -476,7 +476,7 @@ void BL_ConvertSensors(struct Object* blenderobject, // or the blenderradarsensor->angle? // nzc: the angle is the opening angle. We need to init with // the axis-hull angle,so /2.0. - MT_Scalar factor = tan(MT_radians((blenderradarsensor->angle)/2.0)); + MT_Scalar factor = tan(MT_radians((blenderradarsensor->angle) / 2.0f)); //MT_Scalar coneradius = coneheight * (factor / 2); MT_Scalar coneradius = coneheight * factor; @@ -519,7 +519,7 @@ void BL_ConvertSensors(struct Object* blenderobject, STR_String checkname = (bFindMaterial? blenderraysensor->matname : blenderraysensor->propname); // don't want to get rays of length 0.0 or so - double distance = (blenderraysensor->range < 0.01 ? 0.01 : blenderraysensor->range ); + double distance = (blenderraysensor->range < 0.01f ? 0.01f : blenderraysensor->range); int axis = blenderraysensor->axisflag; |