diff options
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Dome.cpp | 16 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_GameObject.cpp | 68 |
3 files changed, 46 insertions, 46 deletions
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index b28b8c86d33..b602ba447ad 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -130,10 +130,10 @@ unsigned int* KX_BlenderMaterial::GetMCol(void) const void KX_BlenderMaterial::GetMaterialRGBAColor(unsigned char *rgba) const { if (mMaterial) { - *rgba++ = (unsigned char) (mMaterial->matcolor[0]*255.0); - *rgba++ = (unsigned char) (mMaterial->matcolor[1]*255.0); - *rgba++ = (unsigned char) (mMaterial->matcolor[2]*255.0); - *rgba++ = (unsigned char) (mMaterial->matcolor[3]*255.0); + *rgba++ = (unsigned char)(mMaterial->matcolor[0] * 255.0f); + *rgba++ = (unsigned char)(mMaterial->matcolor[1] * 255.0f); + *rgba++ = (unsigned char)(mMaterial->matcolor[2] * 255.0f); + *rgba++ = (unsigned char)(mMaterial->matcolor[3] * 255.0f); } else RAS_IPolyMaterial::GetMaterialRGBAColor(rgba); } diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index d87bb937b41..44c9cb1dab8 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -748,10 +748,10 @@ void KX_Dome::CreateMeshDome250(void) * Once we take the tangent of that angle, you have the verts coordinate corresponding to the verts on the side faces. * Then we need to multiply it by sqrt(2.0) to get the coordinate of the verts on the diagonal of the original cube. */ - verts_height = tan((rad_ang/2) - (MT_PI/2))*M_SQRT2; + verts_height = tanf((rad_ang / 2.0f) - (float)(MT_PI / 2.0)) * (float)M_SQRT2; - uv_height = uv_ratio * ((verts_height/2) + 0.5); - uv_base = uv_ratio * (1.0 - ((verts_height/2) + 0.5)); + uv_height = uv_ratio * ( (verts_height / 2.0f) + 0.5f); + uv_base = uv_ratio * (1.0 - ((verts_height / 2.0f) + 0.5f)); //creating faces for the env mapcube 180deg Dome // Front Face - 2 triangles @@ -1325,7 +1325,7 @@ void KX_Dome::FlattenDome(MT_Vector3 verts[3]) for (int i=0;i<3;i++) { r = atan2(sqrt(verts[i][0]*verts[i][0] + verts[i][2]*verts[i][2]), verts[i][1]); - r /= m_radangle/2; + r /= (double)this->m_radangle / 2.0; phi = atan2(verts[i][2], verts[i][0]); @@ -1818,13 +1818,13 @@ void KX_Dome::DrawDomeFisheye(void) else if (m_mode == DOME_TRUNCATED_FRONT) { ortho_width = 1.0; - ortho_height = 2 * ((float)can_height / can_width) - 1.0; + ortho_height = 2.0f * ((float)can_height / can_width) - 1.0f; glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_width, -20.0, 10.0); } else { //m_mode == DOME_TRUNCATED_REAR ortho_width = 1.0; - ortho_height = 2 * ((float)can_height / can_width) - 1.0; + ortho_height = 2.0f * ((float)can_height / can_width) - 1.0f; glOrtho((-ortho_width), ortho_width, (-ortho_width), ortho_height, -20.0, 10.0); } @@ -1905,8 +1905,8 @@ void KX_Dome::DrawPanorama(void) ortho_height = (float)can_height/can_width; } else { - ortho_width = (float)can_width/can_height * 0.5; - ortho_height = 0.5; + ortho_width = (float)can_width / can_height * 0.5f; + ortho_height = 0.5f; } glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0); diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 496b3925456..04a806dfd92 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -261,12 +261,12 @@ void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCom // Make sure the objects have some scale MT_Vector3 scale1 = NodeGetWorldScaling(); MT_Vector3 scale2 = obj->NodeGetWorldScaling(); - if (fabs(scale2[0]) < FLT_EPSILON || - fabs(scale2[1]) < FLT_EPSILON || - fabs(scale2[2]) < FLT_EPSILON || - fabs(scale1[0]) < FLT_EPSILON || - fabs(scale1[1]) < FLT_EPSILON || - fabs(scale1[2]) < FLT_EPSILON) { return; } + if (fabs(scale2[0]) < (MT_Scalar)FLT_EPSILON || + fabs(scale2[1]) < (MT_Scalar)FLT_EPSILON || + fabs(scale2[2]) < (MT_Scalar)FLT_EPSILON || + fabs(scale1[0]) < (MT_Scalar)FLT_EPSILON || + fabs(scale1[1]) < (MT_Scalar)FLT_EPSILON || + fabs(scale1[2]) < (MT_Scalar)FLT_EPSILON) { return; } // Remove us from our old parent and set our new parent RemoveParent(scene); @@ -931,7 +931,7 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) return; } - if (fac<=0.0) { + if (fac <= 0.0f) { return; } @@ -944,10 +944,10 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) ori.setValue(orimat[0][2], orimat[1][2], orimat[2][2]); //pivot axis if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) //is the vector parallel to the pivot? ori.setValue(orimat[0][1], orimat[1][1], orimat[2][1]); //change the pivot! - if (fac == 1.0) { + if (fac == 1.0f) { x = vect; } else { - x = (vect * fac) + ((orimat * MT_Vector3(1.0, 0.0, 0.0)) * (1-fac)); + x = (vect * fac) + ((orimat * MT_Vector3(1.0, 0.0, 0.0)) * (1.0f - fac)); len = x.length(); if (MT_fuzzyZero(len)) x = vect; else x /= len; @@ -959,10 +959,10 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) ori.setValue(orimat[0][0], orimat[1][0], orimat[2][0]); if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) ori.setValue(orimat[0][2], orimat[1][2], orimat[2][2]); - if (fac == 1.0) { + if (fac == 1.0f) { y = vect; } else { - y = (vect * fac) + ((orimat * MT_Vector3(0.0, 1.0, 0.0)) * (1-fac)); + y = (vect * fac) + ((orimat * MT_Vector3(0.0, 1.0, 0.0)) * (1.0f - fac)); len = y.length(); if (MT_fuzzyZero(len)) y = vect; else y /= len; @@ -974,10 +974,10 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) ori.setValue(orimat[0][1], orimat[1][1], orimat[2][1]); if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) ori.setValue(orimat[0][0], orimat[1][0], orimat[2][0]); - if (fac == 1.0) { + if (fac == 1.0f) { z = vect; } else { - z = (vect * fac) + ((orimat * MT_Vector3(0.0, 0.0, 1.0)) * (1-fac)); + z = (vect * fac) + ((orimat * MT_Vector3(0.0, 0.0, 1.0)) * (1.0f - fac)); len = z.length(); if (MT_fuzzyZero(len)) z = vect; else z /= len; @@ -1162,9 +1162,9 @@ void KX_GameObject::NodeSetWorldScale(const MT_Vector3& scale) { // Make sure the objects have some scale MT_Vector3 p_scale = parent->GetWorldScaling(); - if (fabs(p_scale[0]) < FLT_EPSILON || - fabs(p_scale[1]) < FLT_EPSILON || - fabs(p_scale[2]) < FLT_EPSILON) + if (fabs(p_scale[0]) < (MT_Scalar)FLT_EPSILON || + fabs(p_scale[1]) < (MT_Scalar)FLT_EPSILON || + fabs(p_scale[2]) < (MT_Scalar)FLT_EPSILON) { return; } @@ -1190,9 +1190,9 @@ void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans) { // Make sure the objects have some scale MT_Vector3 scale = parent->GetWorldScaling(); - if (fabs(scale[0]) < FLT_EPSILON || - fabs(scale[1]) < FLT_EPSILON || - fabs(scale[2]) < FLT_EPSILON) + if (fabs(scale[0]) < (MT_Scalar)FLT_EPSILON || + fabs(scale[1]) < (MT_Scalar)FLT_EPSILON || + fabs(scale[2]) < (MT_Scalar)FLT_EPSILON) { return; } @@ -1940,7 +1940,7 @@ PyObject* KX_GameObject::pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF { KX_GameObject* self= static_cast<KX_GameObject*>(self_v); KX_IPhysicsController *spc = self->GetPhysicsController(); - return PyFloat_FromDouble(spc ? spc->GetMass() : 0.0f); + return PyFloat_FromDouble(spc ? spc->GetMass() : 0.0); } int KX_GameObject::pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) @@ -1948,7 +1948,7 @@ int KX_GameObject::pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrd KX_GameObject* self= static_cast<KX_GameObject*>(self_v); KX_IPhysicsController *spc = self->GetPhysicsController(); MT_Scalar val = PyFloat_AsDouble(value); - if (val < 0.0f) { /* also accounts for non float */ + if (val < 0.0) { /* also accounts for non float */ PyErr_SetString(PyExc_AttributeError, "gameOb.mass = float: KX_GameObject, expected a float zero or above"); return PY_SET_ATTR_FAIL; } @@ -1971,7 +1971,7 @@ int KX_GameObject::pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF KX_GameObject* self= static_cast<KX_GameObject*>(self_v); KX_IPhysicsController *spc = self->GetPhysicsController(); MT_Scalar val = PyFloat_AsDouble(value); - if (val < 0.0f) { /* also accounts for non float */ + if (val < 0.0) { /* also accounts for non float */ PyErr_SetString(PyExc_AttributeError, "gameOb.linVelocityMin = float: KX_GameObject, expected a float zero or above"); return PY_SET_ATTR_FAIL; } @@ -1994,7 +1994,7 @@ int KX_GameObject::pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF KX_GameObject* self= static_cast<KX_GameObject*>(self_v); KX_IPhysicsController *spc = self->GetPhysicsController(); MT_Scalar val = PyFloat_AsDouble(value); - if (val < 0.0f) { /* also accounts for non float */ + if (val < 0.0) { /* also accounts for non float */ PyErr_SetString(PyExc_AttributeError, "gameOb.linVelocityMax = float: KX_GameObject, expected a float zero or above"); return PY_SET_ATTR_FAIL; } @@ -2360,8 +2360,8 @@ int KX_GameObject::pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF KX_GameObject* self= static_cast<KX_GameObject*>(self_v); if (self->GetSGNode()) { MT_Scalar val = PyFloat_AsDouble(value); - SG_Node* sg_parent= self->GetSGNode()->GetSGParent(); - if (val < 0.0f) { /* also accounts for non float */ + SG_Node *sg_parent= self->GetSGNode()->GetSGParent(); + if (val < 0.0) { /* also accounts for non float */ PyErr_SetString(PyExc_AttributeError, "gameOb.timeOffset = float: KX_GameObject, expected a float zero or above"); return PY_SET_ATTR_FAIL; } @@ -2644,7 +2644,7 @@ PyObject* KX_GameObject::PyGetReactionForce() return PyObjectFrom(dummy_point); */ - return Py_BuildValue("fff", 0.0f, 0.0f, 0.0f); + return Py_BuildValue("fff", 0.0, 0.0, 0.0); } @@ -2761,18 +2761,18 @@ PyObject* KX_GameObject::PyAlignAxisToVect(PyObject* args) { PyObject* pyvect; int axis = 2; //z axis is the default - float fac = 1.0; + float fac = 1.0f; if (PyArg_ParseTuple(args,"O|if:alignAxisToVect",&pyvect,&axis, &fac)) { MT_Vector3 vect; - if (PyVecTo(pyvect, vect)) - { - if (fac<=0.0) Py_RETURN_NONE; // Nothing to do. - if (fac> 1.0) fac= 1.0; - - AlignAxisToVect(vect,axis,fac); - NodeUpdateGS(0.f); + if (PyVecTo(pyvect, vect)) { + if (fac > 0.0f) { + if (fac> 1.0f) fac = 1.0f; + + AlignAxisToVect(vect, axis, fac); + NodeUpdateGS(0.f); + } Py_RETURN_NONE; } } |