diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-10 13:37:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-10 13:37:04 +0400 |
commit | 1c6956a4d6b15ddca3588f1838d3b9903e7239af (patch) | |
tree | c8aee4e95b584f4c6f5a46a8a44d1ebcd491ab6b /source/gameengine | |
parent | 2d677efb3b52814d5b96f1aa496d75083187b3fe (diff) |
quiet msvc/mingw compiler warnings.
Diffstat (limited to 'source/gameengine')
6 files changed, 61 insertions, 59 deletions
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 92cb0167192..edf9d244e85 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -171,7 +171,7 @@ void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int /* the actual drawing */ glColor3ub(255, 255, 255); - BLF_draw_default(xco, height-yco, 0.0f, (char *)text, 65535); /* XXX, use real len */ + BLF_draw_default((float)xco, (float)(height-yco), 0.0f, (char *)text, 65535); /* XXX, use real len */ glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -200,9 +200,9 @@ void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int widt /* draw in black first*/ glColor3ub(0, 0, 0); - BLF_draw_default(xco+2, height-yco-2, 0.0f, text, 65535); /* XXX, use real len */ + BLF_draw_default((float)(xco+2), (float)(height-yco-2), 0.0f, text, 65535); /* XXX, use real len */ glColor3ub(255, 255, 255); - BLF_draw_default(xco, height-yco, 0.0f, text, 65535); /* XXX, use real len */ + BLF_draw_default((float)xco, (float)(height-yco), 0.0f, text, 65535); /* XXX, use real len */ glMatrixMode(GL_PROJECTION); glPopMatrix(); diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 494d2853058..34b417238ae 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -964,7 +964,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, if (ma) { polymat->m_specular = MT_Vector3(ma->specr, ma->specg, ma->specb)*ma->spec; - polymat->m_shininess = (float)ma->har/4.0; // 0 < ma->har <= 512 + polymat->m_shininess = (float)ma->har/4.0f; // 0 < ma->har <= 512 polymat->m_diffuse = MT_Vector3(ma->r, ma->g, ma->b)*(ma->emit + ma->ref); } else { @@ -1135,7 +1135,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) { MVert *mvert; BoundBox *bb; - MT_Point3 min, max; + float min[3], max[3]; float mloc[3], msize[3]; float radius=0.0f, vert_radius, *co; int a; @@ -1162,17 +1162,17 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) } if(me->totvert) { - loc[0]= (min[0]+max[0])/2.0; - loc[1]= (min[1]+max[1])/2.0; - loc[2]= (min[2]+max[2])/2.0; + loc[0]= (min[0]+max[0])/2.0f; + loc[1]= (min[1]+max[1])/2.0f; + loc[2]= (min[2]+max[2])/2.0f; - size[0]= (max[0]-min[0])/2.0; - size[1]= (max[1]-min[1])/2.0; - size[2]= (max[2]-min[2])/2.0; + size[0]= (max[0]-min[0])/2.0f; + size[1]= (max[1]-min[1])/2.0f; + size[2]= (max[2]-min[2])/2.0f; } else { - loc[0]= loc[1]= loc[2]= 0.0; - size[0]= size[1]= size[2]= 0.0; + loc[0]= loc[1]= loc[2]= 0.0f; + size[0]= size[1]= size[2]= 0.0f; } bb->vec[0][0]=bb->vec[1][0]=bb->vec[2][0]=bb->vec[3][0]= loc[0]-size[0]; @@ -1210,8 +1210,8 @@ static void my_tex_space_mesh(Mesh *me) DO_MINMAX(fp, min, max); } if(kb->totelem) { - loc[0]= (min[0]+max[0])/2.0; loc[1]= (min[1]+max[1])/2.0; loc[2]= (min[2]+max[2])/2.0; - size[0]= (max[0]-min[0])/2.0; size[1]= (max[1]-min[1])/2.0; size[2]= (max[2]-min[2])/2.0; + loc[0]= (min[0]+max[0])/2.0f; loc[1]= (min[1]+max[1])/2.0f; loc[2]= (min[2]+max[2])/2.0f; + size[0]= (max[0]-min[0])/2.0f; size[1]= (max[1]-min[1])/2.0f; size[2]= (max[2]-min[2])/2.0f; } else { loc[0]= loc[1]= loc[2]= 0.0; @@ -1223,19 +1223,19 @@ static void my_tex_space_mesh(Mesh *me) VECCOPY(me->loc, loc); VECCOPY(me->size, size); - me->rot[0]= me->rot[1]= me->rot[2]= 0.0; + me->rot[0]= me->rot[1]= me->rot[2]= 0.0f; - if(me->size[0]==0.0) me->size[0]= 1.0; - else if(me->size[0]>0.0 && me->size[0]<0.00001) me->size[0]= 0.00001; - else if(me->size[0]<0.0 && me->size[0]> -0.00001) me->size[0]= -0.00001; + 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[1]==0.0) me->size[1]= 1.0; - else if(me->size[1]>0.0 && me->size[1]<0.00001) me->size[1]= 0.00001; - else if(me->size[1]<0.0 && me->size[1]> -0.00001) me->size[1]= -0.00001; + 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[2]==0.0) me->size[2]= 1.0; - else if(me->size[2]>0.0 && me->size[2]<0.00001) me->size[2]= 0.00001; - else if(me->size[2]<0.0 && me->size[2]> -0.00001) me->size[2]= -0.00001; + 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; } } @@ -1252,13 +1252,13 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa float min_r[3], max_r[3]; INIT_MINMAX(min_r, max_r); dm->getMinMax(dm, min_r, max_r); - size[0]= 0.5*fabs(max_r[0] - min_r[0]); - size[1]= 0.5*fabs(max_r[1] - min_r[1]); - size[2]= 0.5*fabs(max_r[2] - min_r[2]); + size[0]= 0.5f*fabsf(max_r[0] - min_r[0]); + size[1]= 0.5f*fabsf(max_r[1] - min_r[1]); + size[2]= 0.5f*fabsf(max_r[2] - min_r[2]); - center[0]= 0.5*(max_r[0] + min_r[0]); - center[1]= 0.5*(max_r[1] + min_r[1]); - center[2]= 0.5*(max_r[2] + min_r[2]); + center[0]= 0.5f*(max_r[0] + min_r[0]); + center[1]= 0.5f*(max_r[1] + min_r[1]); + center[2]= 0.5f*(max_r[2] + min_r[2]); return; } else { @@ -1291,13 +1291,13 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa } else { - size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]); - size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]); - size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]); + 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]); - center[0]= 0.5*(bb->vec[0][0] + bb->vec[4][0]); - center[1]= 0.5*(bb->vec[0][1] + bb->vec[2][1]); - center[2]= 0.5*(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]); } } @@ -1638,7 +1638,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l KX_LightObject *gamelight; lightobj.m_att1 = la->att1; - lightobj.m_att2 = (la->mode & LA_QUAD)?la->att2:0.0; + lightobj.m_att2 = (la->mode & LA_QUAD) ? la->att2 : 0.0f; lightobj.m_red = la->r; lightobj.m_green = la->g; lightobj.m_blue = la->b; diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 0af6470fafc..a0d58ece396 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -778,12 +778,12 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) float tmat[3][3]; for (int r=0;r<3;r++) for (int c=0;c<3;c++) - tmat[r][c] = orn[c][r]; + tmat[r][c] = (float)orn[c][r]; mat3_to_compatible_eul(blenderObject->rot, blenderObject->rot, tmat); - insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "location", -1, frameNumber, INSERTKEY_FAST); - insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "rotation_euler", -1, frameNumber, INSERTKEY_FAST); + insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "location", -1, (float)frameNumber, INSERTKEY_FAST); + insert_keyframe(NULL, &blenderObject->id, NULL, NULL, "rotation_euler", -1, (float)frameNumber, INSERTKEY_FAST); #if 0 const MT_Point3& position = gameObj->NodeGetWorldPosition(); @@ -1195,7 +1195,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) } /* make sure action actuators are not referencing tagged actions */ - for (int act_idx=0; act_idx<gameobj->GetActuators().size(); act_idx++) + for (unsigned int act_idx=0; act_idx<gameobj->GetActuators().size(); act_idx++) { if (gameobj->GetActuators()[act_idx]->IsType(SCA_IActuator::KX_ACT_ACTION)) { diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index b9e41d553b3..01516a24182 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -37,6 +37,8 @@ #pragma warning (disable : 4786) #endif //WIN32 +#include <math.h> + #include "MEM_guardedalloc.h" #include "KX_BlenderSceneConverter.h" @@ -395,7 +397,7 @@ void BL_ConvertActuators(char* maggiename, new KX_SoundActuator(gameobj, snd_sound, soundact->volume, - exp((soundact->pitch / 12.0) * log(2.0)), + (float)(exp((soundact->pitch / 12.0) * log(2.0))), is3d, settings, soundActuatorType); @@ -542,8 +544,8 @@ void BL_ConvertActuators(char* maggiename, /* convert settings... degrees in the ui become radians */ /* internally */ if (conact->type == ACT_CONST_TYPE_ORI) { - min = (MT_2_PI * conact->minloc[0])/360.0; - max = (MT_2_PI * conact->maxloc[0])/360.0; + min = (float)((MT_2_PI * conact->minloc[0])/360.0); + max = (float)((MT_2_PI * conact->maxloc[0])/360.0); switch (conact->mode) { case ACT_CONST_DIRPX: locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ORIX; @@ -642,18 +644,18 @@ void BL_ConvertActuators(char* maggiename, break; case ACT_CONST_ROTX: locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTX; - min = MT_2_PI * conact->minrot[0] / 360.0; - max = MT_2_PI * conact->maxrot[0] / 360.0; + min = conact->minrot[0] * (float)MT_RADS_PER_DEG; + max = conact->maxrot[0] * (float)MT_RADS_PER_DEG; break; case ACT_CONST_ROTY: locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTY; - min = MT_2_PI * conact->minrot[1] / 360.0; - max = MT_2_PI * conact->maxrot[1] / 360.0; + min = conact->minrot[1] * (float)MT_RADS_PER_DEG; + max = conact->maxrot[1] * (float)MT_RADS_PER_DEG; break; case ACT_CONST_ROTZ: locrot = KX_ConstraintActuator::KX_ACT_CONSTRAINT_ROTZ; - min = MT_2_PI * conact->minrot[2] / 360.0; - max = MT_2_PI * conact->maxrot[2] / 360.0; + min = conact->minrot[2] * (float)MT_RADS_PER_DEG; + max = conact->maxrot[2] * (float)MT_RADS_PER_DEG; break; default: ; /* error */ diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp index d0984c161ab..ad6941dcdc7 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ b/source/gameengine/Converter/KX_ConvertSensors.cpp @@ -438,9 +438,9 @@ void BL_ConvertSensors(struct Object* blenderobject, float radius = blendernearsensor->dist; PHY__Vector3 pos; const MT_Vector3& wpos = gameobj->NodeGetWorldPosition(); - pos[0] = wpos[0]; - pos[1] = wpos[1]; - pos[2] = wpos[2]; + pos[0] = (float)wpos[0]; + pos[1] = (float)wpos[1]; + pos[2] = (float)wpos[2]; pos[3] = 0.f; bool bFindMaterial = false; PHY_IPhysicsController* physCtrl = kxscene->GetPhysicsEnvironment()->CreateSphereController(radius,pos); @@ -662,7 +662,7 @@ void BL_ConvertSensors(struct Object* blenderobject, MT_Scalar largemargin = 0.0; bool bFindMaterial = false; - PHY_IPhysicsController* ctrl = kxscene->GetPhysicsEnvironment()->CreateConeController(coneradius,coneheight); + PHY_IPhysicsController* ctrl = kxscene->GetPhysicsEnvironment()->CreateConeController((float)coneradius, (float)coneheight); gamesensor = new KX_RadarSensor( eventmgr, diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 946d2b3c39c..ba698d79fdd 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -943,12 +943,12 @@ static PyObject* gPySetBackgroundColor(PyObject*, PyObject* value) if (gp_Canvas) { - gp_Rasterizer->SetBackColor(vec[0], vec[1], vec[2], vec[3]); + gp_Rasterizer->SetBackColor((float)vec[0], (float)vec[1], (float)vec[2], (float)vec[3]); } KX_WorldInfo *wi = gp_KetsjiScene->GetWorldInfo(); if (wi->hasWorld()) - wi->setBackColor(vec[0], vec[1], vec[2]); + wi->setBackColor((float)vec[0], (float)vec[1], (float)vec[2]); Py_RETURN_NONE; } @@ -966,7 +966,7 @@ static PyObject* gPySetMistColor(PyObject*, PyObject* value) PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setMistColor(color), Rasterizer not available"); return NULL; } - gp_Rasterizer->SetFogColor(vec[0], vec[1], vec[2]); + gp_Rasterizer->SetFogColor((float)vec[0], (float)vec[1], (float)vec[2]); Py_RETURN_NONE; } @@ -1031,7 +1031,7 @@ static PyObject* gPySetAmbientColor(PyObject*, PyObject* value) PyErr_SetString(PyExc_RuntimeError, "Rasterizer.setAmbientColor(color), Rasterizer not available"); return NULL; } - gp_Rasterizer->SetAmbientColor(vec[0], vec[1], vec[2]); + gp_Rasterizer->SetAmbientColor((float)vec[0], (float)vec[1], (float)vec[2]); Py_RETURN_NONE; } |