From 0c19a043e8198018ae794145fc4f1e78d5f00923 Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Wed, 16 Dec 2015 01:31:38 +0100 Subject: BGE Ketsji clean-up: double-promotion warnings --- source/gameengine/Ketsji/BL_Action.cpp | 8 +- source/gameengine/Ketsji/BL_Texture.cpp | 2 +- source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 4 +- source/gameengine/Ketsji/KX_Camera.cpp | 34 +- source/gameengine/Ketsji/KX_ConstraintActuator.cpp | 46 +- source/gameengine/Ketsji/KX_Dome.cpp | 770 ++++++++++----------- source/gameengine/Ketsji/KX_FontObject.cpp | 2 +- source/gameengine/Ketsji/KX_GameObject.cpp | 70 +- source/gameengine/Ketsji/KX_IPOTransform.h | 18 +- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 28 +- source/gameengine/Ketsji/KX_Light.cpp | 18 +- source/gameengine/Ketsji/KX_MouseActuator.cpp | 78 +-- source/gameengine/Ketsji/KX_MouseFocusSensor.cpp | 16 +- source/gameengine/Ketsji/KX_ObjectActuator.cpp | 32 +- source/gameengine/Ketsji/KX_ObjectActuator.h | 4 +- source/gameengine/Ketsji/KX_ObstacleSimulation.cpp | 8 +- source/gameengine/Ketsji/KX_RadarSensor.cpp | 14 +- source/gameengine/Ketsji/KX_RayCast.cpp | 4 +- .../gameengine/Ketsji/KX_SCA_DynamicActuator.cpp | 2 +- .../Ketsji/KX_SG_BoneParentNodeRelationship.cpp | 4 +- source/gameengine/Ketsji/KX_Scene.cpp | 14 +- source/gameengine/Ketsji/KX_SoundActuator.cpp | 12 +- source/gameengine/Ketsji/KX_SteeringActuator.cpp | 20 +- source/gameengine/Ketsji/KX_TimeLogger.cpp | 2 +- source/gameengine/Ketsji/KX_TrackToActuator.cpp | 8 +- source/gameengine/Ketsji/KX_VertexProxy.cpp | 10 +- 26 files changed, 614 insertions(+), 614 deletions(-) (limited to 'source') diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 89d8ec0d4ca..45946f30827 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -342,7 +342,7 @@ void BL_Action::SetTimes(float start, float end) void BL_Action::SetLocalTime(float curtime) { - float dt = (curtime-m_starttime)*KX_KetsjiEngine::GetAnimFrameRate()*m_speed; + float dt = (curtime-m_starttime)*(float)KX_KetsjiEngine::GetAnimFrameRate()*m_speed; if (m_endframe < m_startframe) dt = -dt; @@ -354,7 +354,7 @@ void BL_Action::ResetStartTime(float curtime) { float dt = (m_localframe > m_startframe) ? m_localframe - m_startframe : m_startframe - m_localframe; - m_starttime = curtime - dt / (KX_KetsjiEngine::GetAnimFrameRate()*m_speed); + m_starttime = curtime - dt / ((float)KX_KetsjiEngine::GetAnimFrameRate()*m_speed); SetLocalTime(curtime); } @@ -365,7 +365,7 @@ void BL_Action::IncrementBlending(float curtime) m_blendstart = curtime; // Bump the blend frame - m_blendframe = (curtime - m_blendstart)*KX_KetsjiEngine::GetAnimFrameRate(); + m_blendframe = (curtime - m_blendstart)*(float)KX_KetsjiEngine::GetAnimFrameRate(); // Clamp if (m_blendframe>m_blendin) @@ -398,7 +398,7 @@ void BL_Action::Update(float curtime) if (m_done) return; - curtime -= KX_KetsjiEngine::GetSuspendedDelta(); + curtime -= (float)KX_KetsjiEngine::GetSuspendedDelta(); // Grab the start time here so we don't end up with a negative m_localframe when // suspending and resuming scenes. diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index d14b9cc57b8..0b0a0f5d403 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -685,7 +685,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); } break; } - glTexEnvf( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0); + glTexEnvf( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f); glEndList(); } diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index a10bdf4ac98..1d185d52dc8 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -675,13 +675,13 @@ void KX_BlenderMaterial::ActivatGLMaterials( RAS_IRasterizer* rasty )const mMaterial->matcolor[0]*mMaterial->emit, mMaterial->matcolor[1]*mMaterial->emit, mMaterial->matcolor[2]*mMaterial->emit, - 1.0 ); + 1.0f ); rasty->SetAmbient(mMaterial->amb); } if (mMaterial->material) - rasty->SetPolygonOffset(-mMaterial->material->zoffs, 0.0); + rasty->SetPolygonOffset(-mMaterial->material->zoffs, 0.0f); } diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 644c71a68e4..76c7b4a222c 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -318,21 +318,21 @@ void KX_Camera::ExtractFrustumSphere() MT_Matrix4x4 clip_camcs_matrix = m_projection_matrix; clip_camcs_matrix.invert(); - if (m_projection_matrix[3][3] == MT_Scalar(0.0)) + if (m_projection_matrix[3][3] == MT_Scalar(0.0f)) { // frustrum projection // detect which of the corner of the far clipping plane is the farthest to the origin MT_Vector4 nfar; // far point in device normalized coordinate MT_Point3 farpoint; // most extreme far point in camera coordinate MT_Point3 nearpoint;// most extreme near point in camera coordinate - MT_Point3 farcenter(0.0, 0.0, 0.0);// center of far cliping plane in camera coordinate - MT_Scalar F=-1.0, N; // square distance of far and near point to origin + MT_Point3 farcenter(0.0f, 0.0f, 0.0f);// center of far cliping plane in camera coordinate + MT_Scalar F=-1.0f, N; // square distance of far and near point to origin MT_Scalar f, n; // distance of far and near point to z axis. f is always > 0 but n can be < 0 MT_Scalar e, s; // far and near clipping distance (<0) MT_Scalar c; // slope of center line = distance of far clipping center to z axis / far clipping distance MT_Scalar z; // projection of sphere center on z axis (<0) // tmp value - MT_Vector4 npoint(1.0, 1.0, 1.0, 1.0); + MT_Vector4 npoint(1.0f, 1.0f, 1.0f, 1.0f); MT_Vector4 hpoint; MT_Point3 point; MT_Scalar len; @@ -354,9 +354,9 @@ void KX_Camera::ExtractFrustumSphere() farcenter += point; } // the far center is the average of the far clipping points - farcenter *= 0.25; + farcenter *= 0.25f; // the extreme near point is the opposite point on the near clipping plane - nfar.setValue(-nfar[0], -nfar[1], -1.0, 1.0); + nfar.setValue(-nfar[0], -nfar[1], -1.0f, 1.0f); nfar = clip_camcs_matrix*nfar; nearpoint.setValue(nfar[0]/nfar[3], nfar[1]/nfar[3], nfar[2]/nfar[3]); // this is a frustrum projection @@ -373,7 +373,7 @@ void KX_Camera::ExtractFrustumSphere() n = f*s/e - MT_Point2(nearpoint[0]-farxy[0], nearpoint[1]-farxy[1]).length(); c = MT_Point2(farcenter[0], farcenter[1]).length()/e; // the big formula, it simplifies to (F-N)/(2(e-s)) for the symmetric case - z = (F-N)/(2.0*(e-s+c*(f-n))); + z = (F-N)/(2.0f*(e-s+c*(f-n))); m_frustum_center = MT_Point3(farcenter[0]*z/e, farcenter[1]*z/e, z); m_frustum_radius = m_frustum_center.distance(farpoint); } @@ -381,7 +381,7 @@ void KX_Camera::ExtractFrustumSphere() { // orthographic projection // The most extreme points on the near and far plane. (normalized device coords) - MT_Vector4 hnear(1.0, 1.0, 1.0, 1.0), hfar(-1.0, -1.0, -1.0, 1.0); + MT_Vector4 hnear(1.0f, 1.0f, 1.0f, 1.0f), hfar(-1.0f, -1.0f, -1.0f, 1.0f); // Transform to hom camera local space hnear = clip_camcs_matrix*hnear; @@ -392,12 +392,12 @@ void KX_Camera::ExtractFrustumSphere() MT_Point3 farpoint(hfar[0]/hfar[3], hfar[1]/hfar[3], hfar[2]/hfar[3]); // just use mediant point - m_frustum_center = (farpoint + nearpoint)*0.5; + m_frustum_center = (farpoint + nearpoint)*0.5f; m_frustum_radius = m_frustum_center.distance(farpoint); } // Transform to world space. m_frustum_center = GetCameraToWorld()(m_frustum_center); - m_frustum_radius /= fabs(NodeGetWorldScaling()[NodeGetWorldScaling().closestAxis()]); + m_frustum_radius /= fabsf(NodeGetWorldScaling()[NodeGetWorldScaling().closestAxis()]); m_set_frustum_center = true; } @@ -408,7 +408,7 @@ bool KX_Camera::PointInsideFrustum(const MT_Point3& x) for ( unsigned int i = 0; i < 6 ; i++ ) { - if (m_planes[i][0] * x[0] + m_planes[i][1] * x[1] + m_planes[i][2] * x[2] + m_planes[i][3] < 0.0) + if (m_planes[i][0] * x[0] + m_planes[i][1] * x[1] + m_planes[i][2] * x[2] + m_planes[i][3] < 0.0f) return false; } return true; @@ -426,7 +426,7 @@ int KX_Camera::BoxInsideFrustum(const MT_Point3 *box) // 8 box vertices. for (unsigned int v = 0; v < 8 ; v++) { - if (m_planes[p][0] * box[v][0] + m_planes[p][1] * box[v][1] + m_planes[p][2] * box[v][2] + m_planes[p][3] < 0.0) + if (m_planes[p][0] * box[v][0] + m_planes[p][1] * box[v][1] + m_planes[p][2] * box[v][2] + m_planes[p][3] < 0.0f) behindCount++; } @@ -463,7 +463,7 @@ int KX_Camera::SphereInsideFrustum(const MT_Point3& center, const MT_Scalar &rad for (p = 0; p < 6; p++) { distance = m_planes[p][0]*center[0] + m_planes[p][1]*center[1] + m_planes[p][2]*center[2] + m_planes[p][3]; - if (fabs(distance) <= radius) + if (fabsf(distance) <= radius) intersect = INTERSECT; else if (distance < -radius) return OUTSIDE; @@ -781,7 +781,7 @@ PyObject *KX_Camera::pyattr_get_fov(void *self_v, const KX_PYATTRIBUTE_DEF *attr float lens = self->m_camdata.m_lens; float width = self->m_camdata.m_sensor_x; - float fov = 2.0 * atan(0.5 * width / lens); + float fov = 2.0f * atanf(0.5f * width / lens); return PyFloat_FromDouble(fov * MT_DEGS_PER_RAD); } @@ -790,14 +790,14 @@ int KX_Camera::pyattr_set_fov(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, P { KX_Camera* self = static_cast(self_v); float fov = PyFloat_AsDouble(value); - if (fov <= 0.0) { + if (fov <= 0.0f) { PyErr_SetString(PyExc_AttributeError, "camera.fov = float: KX_Camera, expected a float greater than zero"); return PY_SET_ATTR_FAIL; } fov *= MT_RADS_PER_DEG; float width = self->m_camdata.m_sensor_x; - float lens = width / (2.0 * tan(0.5 * fov)); + float lens = width / (2.0f * tanf(0.5f * fov)); self->m_camdata.m_lens= lens; self->m_set_projection_matrix = false; @@ -1065,7 +1065,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition, vect[0] = (win[0] - viewport[0]) / viewport[2]; vect[1] = (win[1] - viewport[1]) / viewport[3]; - vect[1] = 1.0 - vect[1]; //to follow Blender window coordinate system (Top-Down) + vect[1] = 1.0f - vect[1]; //to follow Blender window coordinate system (Top-Down) PyObject *ret = PyTuple_New(2); if (ret) { diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp index fecd60eb212..8f15955fba6 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp @@ -188,9 +188,9 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) int axis, sign; if (m_posDampTime) { - filter = m_posDampTime/(1.0+m_posDampTime); + filter = m_posDampTime/(1.0f+m_posDampTime); } else { - filter = 0.0; + filter = 0.0f; } switch (m_locrot) { case KX_ACT_CONSTRAINT_ORIX: @@ -232,10 +232,10 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) if (MT_fuzzyZero2(zaxis.length2())) { // direction and refDirection are identical, // choose any other direction to define plane - if (direction[0] < 0.9999) - zaxis = m_refDirVector.cross(MT_Vector3(1.0,0.0,0.0)); + if (direction[0] < 0.9999f) + zaxis = m_refDirVector.cross(MT_Vector3(1.0f,0.0f,0.0f)); else - zaxis = m_refDirVector.cross(MT_Vector3(0.0,1.0,0.0)); + zaxis = m_refDirVector.cross(MT_Vector3(0.0f,1.0f,0.0f)); } MT_Vector3 yaxis = zaxis.cross(m_refDirVector); yaxis.normalize(); @@ -251,7 +251,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) refDirection = m_refDirVector; } // apply damping on the direction - direction = filter*direction + (1.0-filter)*refDirection; + direction = filter*direction + (1.0f-filter)*refDirection; obj->AlignAxisToVect(direction, axis); result = true; goto CHECK_TIME; @@ -312,22 +312,22 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) } else { switch (m_locrot) { case KX_ACT_CONSTRAINT_DIRPX: - direction = MT_Vector3(1.0,0.0,0.0); + direction = MT_Vector3(1.0f,0.0f,0.0f); break; case KX_ACT_CONSTRAINT_DIRPY: - direction = MT_Vector3(0.0,1.0,0.0); + direction = MT_Vector3(0.0f,1.0f,0.0f); break; case KX_ACT_CONSTRAINT_DIRPZ: - direction = MT_Vector3(0.0,0.0,1.0); + direction = MT_Vector3(0.0f,0.0f,1.0f); break; case KX_ACT_CONSTRAINT_DIRNX: - direction = MT_Vector3(-1.0,0.0,0.0); + direction = MT_Vector3(-1.0f,0.0f,0.0f); break; case KX_ACT_CONSTRAINT_DIRNY: - direction = MT_Vector3(0.0,-1.0,0.0); + direction = MT_Vector3(0.0f,-1.0f,0.0f); break; case KX_ACT_CONSTRAINT_DIRNZ: - direction = MT_Vector3(0.0,0.0,-1.0); + direction = MT_Vector3(0.0f,0.0f,-1.0f); break; } } @@ -361,11 +361,11 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) MT_Scalar rotFilter; // apply damping on the direction if (m_rotDampTime) { - rotFilter = m_rotDampTime/(1.0+m_rotDampTime); + rotFilter = m_rotDampTime/(1.0f+m_rotDampTime); } else { rotFilter = filter; } - newnormal = rotFilter*normal - (1.0-rotFilter)*newnormal; + newnormal = rotFilter*normal - (1.0f-rotFilter)*newnormal; obj->AlignAxisToVect((sign)?-newnormal:newnormal, axis); if (m_option & KX_ACT_CONSTRAINT_LOCAL) { direction = newnormal; @@ -374,7 +374,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) } if (m_option & KX_ACT_CONSTRAINT_DISTANCE) { if (m_posDampTime) { - newdistance = filter*(position-callback.m_hitPoint).length()+(1.0-filter)*m_minimumBound; + newdistance = filter*(position-callback.m_hitPoint).length()+(1.0f-filter)*m_minimumBound; } else { newdistance = m_minimumBound; } @@ -410,37 +410,37 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) normal[0] = -rotation[0][0]; normal[1] = -rotation[1][0]; normal[2] = -rotation[2][0]; - direction = MT_Vector3(1.0,0.0,0.0); + direction = MT_Vector3(1.0f,0.0f,0.0f); break; case KX_ACT_CONSTRAINT_FHPY: normal[0] = -rotation[0][1]; normal[1] = -rotation[1][1]; normal[2] = -rotation[2][1]; - direction = MT_Vector3(0.0,1.0,0.0); + direction = MT_Vector3(0.0f,1.0f,0.0f); break; case KX_ACT_CONSTRAINT_FHPZ: normal[0] = -rotation[0][2]; normal[1] = -rotation[1][2]; normal[2] = -rotation[2][2]; - direction = MT_Vector3(0.0,0.0,1.0); + direction = MT_Vector3(0.0f,0.0f,1.0f); break; case KX_ACT_CONSTRAINT_FHNX: normal[0] = rotation[0][0]; normal[1] = rotation[1][0]; normal[2] = rotation[2][0]; - direction = MT_Vector3(-1.0,0.0,0.0); + direction = MT_Vector3(-1.0f,0.0f,0.0f); break; case KX_ACT_CONSTRAINT_FHNY: normal[0] = rotation[0][1]; normal[1] = rotation[1][1]; normal[2] = rotation[2][1]; - direction = MT_Vector3(0.0,-1.0,0.0); + direction = MT_Vector3(0.0f,-1.0f,0.0f); break; case KX_ACT_CONSTRAINT_FHNZ: normal[0] = rotation[0][2]; normal[1] = rotation[1][2]; normal[2] = rotation[2][2]; - direction = MT_Vector3(0.0,0.0,-1.0); + direction = MT_Vector3(0.0f,0.0f,-1.0f); break; } normal.normalize(); @@ -475,7 +475,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) MT_Vector3 velocityHitPoint = m_hitObject->GetVelocity(relativeHitPoint); MT_Vector3 relativeVelocity = spc->GetLinearVelocity() - velocityHitPoint; MT_Scalar relativeVelocityRay = direction.dot(relativeVelocity); - MT_Scalar springExtent = 1.0 - distance/m_minimumBound; + MT_Scalar springExtent = 1.0f - distance/m_minimumBound; // Fh force is stored in m_maximum MT_Scalar springForce = springExtent * m_maximumBound; // damping is stored in m_refDirection [0] = damping, [1] = rot damping @@ -520,7 +520,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame) } result = true; if (m_posDampTime) { - newposition = filter*position + (1.0-filter)*newposition; + newposition = filter*position + (1.0f-filter)*newposition; } obj->NodeSetLocalPosition(newposition); goto CHECK_TIME; diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 07bed647b29..08cdc108c64 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -400,19 +400,19 @@ void KX_Dome::GLDrawWarpQuads(void) glColor3f(warp.nodes[i][j+1].i, warp.nodes[i][j+1].i, warp.nodes[i][j+1].i); glTexCoord2f((warp.nodes[i][j+1].u * uv_width), (warp.nodes[i][j+1].v * uv_height)); - glVertex3f(warp.nodes[i][j+1].x, warp.nodes[i][j+1].y,0.0); + glVertex3f(warp.nodes[i][j+1].x, warp.nodes[i][j+1].y,0.0f); glColor3f(warp.nodes[i+1][j+1].i, warp.nodes[i+1][j+1].i, warp.nodes[i+1][j+1].i); glTexCoord2f((warp.nodes[i+1][j+1].u * uv_width), (warp.nodes[i+1][j+1].v * uv_height)); - glVertex3f(warp.nodes[i+1][j+1].x, warp.nodes[i+1][j+1].y,0.0); + glVertex3f(warp.nodes[i+1][j+1].x, warp.nodes[i+1][j+1].y,0.0f); glColor3f(warp.nodes[i+1][j].i, warp.nodes[i+1][j].i, warp.nodes[i+1][j].i); glTexCoord2f((warp.nodes[i+1][j].u * uv_width), (warp.nodes[i+1][j].v * uv_height)); - glVertex3f(warp.nodes[i+1][j].x, warp.nodes[i+1][j].y,0.0); + glVertex3f(warp.nodes[i+1][j].x, warp.nodes[i+1][j].y,0.0f); glColor3f(warp.nodes[i][j].i, warp.nodes[i][j].i, warp.nodes[i][j].i); glTexCoord2f((warp.nodes[i][j].u * uv_width), (warp.nodes[i][j].v * uv_height)); - glVertex3f(warp.nodes[i][j].x, warp.nodes[i][j].y,0.0); + glVertex3f(warp.nodes[i][j].x, warp.nodes[i][j].y,0.0f); } } glEnd(); @@ -428,19 +428,19 @@ void KX_Dome::GLDrawWarpQuads(void) glColor3f(warp.nodes[i][j].i,warp.nodes[i][j].i,warp.nodes[i][j].i); glTexCoord2f((warp.nodes[i][j].u * uv_width), (warp.nodes[i][j].v * uv_height)); - glVertex3f(warp.nodes[i][j].x,warp.nodes[i][j].y,0.0); + glVertex3f(warp.nodes[i][j].x,warp.nodes[i][j].y,0.0f); glColor3f(warp.nodes[i2][j].i,warp.nodes[i2][j].i,warp.nodes[i2][j].i); glTexCoord2f((warp.nodes[i2][j].u * uv_width), (warp.nodes[i2][j].v * uv_height)); - glVertex3f(warp.nodes[i2][j].x,warp.nodes[i2][j].y,0.0); + glVertex3f(warp.nodes[i2][j].x,warp.nodes[i2][j].y,0.0f); glColor3f(warp.nodes[i2][j+1].i,warp.nodes[i2][j+1].i,warp.nodes[i2][j+1].i); glTexCoord2f((warp.nodes[i2][j+1].u * uv_width), (warp.nodes[i2][j+1].v * uv_height)); - glVertex3f(warp.nodes[i2][j+1].x,warp.nodes[i2][j+1].y,0.0); + glVertex3f(warp.nodes[i2][j+1].x,warp.nodes[i2][j+1].y,0.0f); glColor3f(warp.nodes[i2][j+1].i,warp.nodes[i2][j+1].i,warp.nodes[i2][j+1].i); glTexCoord2f((warp.nodes[i2][j+1].u * uv_width), (warp.nodes[i2][j+1].v * uv_height)); - glVertex3f(warp.nodes[i2][j+1].x,warp.nodes[i2][j+1].y,0.0); + glVertex3f(warp.nodes[i2][j+1].x,warp.nodes[i2][j+1].y,0.0f); } } @@ -551,42 +551,42 @@ void KX_Dome::CreateMeshDome180(void) //creating faces for the env mapcube 180deg Dome // Top Face - just a triangle - cubetop[0].verts[0][0] = -M_SQRT2 / 2.0; - cubetop[0].verts[0][1] = 0.0; - cubetop[0].verts[0][2] = 0.5; + cubetop[0].verts[0][0] = (float)(-M_SQRT2) / 2.0f; + cubetop[0].verts[0][1] = 0.0f; + cubetop[0].verts[0][2] = 0.5f; cubetop[0].u[0] = 0.0; cubetop[0].v[0] = uv_ratio; - cubetop[0].verts[1][0] = 0.0; - cubetop[0].verts[1][1] = M_SQRT2 / 2.0; - cubetop[0].verts[1][2] = 0.5; + cubetop[0].verts[1][0] = 0.0f; + cubetop[0].verts[1][1] = (float)M_SQRT2 / 2.0f; + cubetop[0].verts[1][2] = 0.5f; cubetop[0].u[1] = 0.0; cubetop[0].v[1] = 0.0; - cubetop[0].verts[2][0] = M_SQRT2 / 2.0; - cubetop[0].verts[2][1] = 0.0; - cubetop[0].verts[2][2] = 0.5; + cubetop[0].verts[2][0] = (float)M_SQRT2 / 2.0f; + cubetop[0].verts[2][1] = 0.0f; + cubetop[0].verts[2][2] = 0.5f; cubetop[0].u[2] = uv_ratio; cubetop[0].v[2] = 0.0; nfacestop = 1; /* Bottom face - just a triangle */ - cubebottom[0].verts[0][0] = -M_SQRT2 / 2.0; - cubebottom[0].verts[0][1] = 0.0; - cubebottom[0].verts[0][2] = -0.5; + cubebottom[0].verts[0][0] = (float)(-M_SQRT2) / 2.0f; + cubebottom[0].verts[0][1] = 0.0f; + cubebottom[0].verts[0][2] = -0.5f; cubebottom[0].u[0] = uv_ratio; cubebottom[0].v[0] = 0.0; - cubebottom[0].verts[1][0] = M_SQRT2 / 2.0; + cubebottom[0].verts[1][0] = (float)M_SQRT2 / 2.0f; cubebottom[0].verts[1][1] = 0; - cubebottom[0].verts[1][2] = -0.5; + cubebottom[0].verts[1][2] = -0.5f; cubebottom[0].u[1] = 0.0; cubebottom[0].v[1] = uv_ratio; - cubebottom[0].verts[2][0] = 0.0; - cubebottom[0].verts[2][1] = M_SQRT2 / 2.0; - cubebottom[0].verts[2][2] = -0.5; + cubebottom[0].verts[2][0] = 0.0f; + cubebottom[0].verts[2][1] = (float)M_SQRT2 / 2.0f; + cubebottom[0].verts[2][2] = -0.5f; cubebottom[0].u[2] = 0.0; cubebottom[0].v[2] = 0.0; @@ -594,80 +594,80 @@ void KX_Dome::CreateMeshDome180(void) /* Left face - two triangles */ - cubeleft[0].verts[0][0] = -M_SQRT2 / 2.0; - cubeleft[0].verts[0][1] = 0.0; - cubeleft[0].verts[0][2] = -0.5; + cubeleft[0].verts[0][0] = (float)(-M_SQRT2) / 2.0f; + cubeleft[0].verts[0][1] = 0.0f; + cubeleft[0].verts[0][2] = -0.5f; cubeleft[0].u[0] = 0.0; cubeleft[0].v[0] = 0.0; - cubeleft[0].verts[1][0] = 0.0; - cubeleft[0].verts[1][1] = M_SQRT2 / 2.0; - cubeleft[0].verts[1][2] = -0.5; + cubeleft[0].verts[1][0] = 0.0f; + cubeleft[0].verts[1][1] = (float)M_SQRT2 / 2.0f; + cubeleft[0].verts[1][2] = -0.5f; cubeleft[0].u[1] = uv_ratio; cubeleft[0].v[1] = 0.0; - cubeleft[0].verts[2][0] = -M_SQRT2 / 2.0; - cubeleft[0].verts[2][1] = 0.0; - cubeleft[0].verts[2][2] = 0.5; + cubeleft[0].verts[2][0] = (float)(-M_SQRT2) / 2.0f; + cubeleft[0].verts[2][1] = 0.0f; + cubeleft[0].verts[2][2] = 0.5f; cubeleft[0].u[2] = 0.0; cubeleft[0].v[2] = uv_ratio; //second triangle - cubeleft[1].verts[0][0] = -M_SQRT2 / 2.0; - cubeleft[1].verts[0][1] = 0.0; - cubeleft[1].verts[0][2] = 0.5; + cubeleft[1].verts[0][0] = (float)(-M_SQRT2) / 2.0f; + cubeleft[1].verts[0][1] = 0.0f; + cubeleft[1].verts[0][2] = 0.5f; cubeleft[1].u[0] = 0.0; cubeleft[1].v[0] = uv_ratio; - cubeleft[1].verts[1][0] = 0.0; - cubeleft[1].verts[1][1] = M_SQRT2 / 2.0; - cubeleft[1].verts[1][2] = -0.5; + cubeleft[1].verts[1][0] = 0.0f; + cubeleft[1].verts[1][1] = (float)M_SQRT2 / 2.0f; + cubeleft[1].verts[1][2] = -0.5f; cubeleft[1].u[1] = uv_ratio; cubeleft[1].v[1] = 0.0; - cubeleft[1].verts[2][0] = 0.0; - cubeleft[1].verts[2][1] = M_SQRT2 / 2.0; - cubeleft[1].verts[2][2] = 0.5; + cubeleft[1].verts[2][0] = 0.0f; + cubeleft[1].verts[2][1] = (float)M_SQRT2 / 2.0f; + cubeleft[1].verts[2][2] = 0.5f; cubeleft[1].u[2] = uv_ratio; cubeleft[1].v[2] = uv_ratio; nfacesleft = 2; /* Right face - two triangles */ - cuberight[0].verts[0][0] = 0.0; - cuberight[0].verts[0][1] = M_SQRT2 / 2.0; - cuberight[0].verts[0][2] = -0.5; + cuberight[0].verts[0][0] = 0.0f; + cuberight[0].verts[0][1] = (float)M_SQRT2 / 2.0f; + cuberight[0].verts[0][2] = -0.5f; cuberight[0].u[0] = 0.0; cuberight[0].v[0] = 0.0; - cuberight[0].verts[1][0] = M_SQRT2 / 2.0; - cuberight[0].verts[1][1] = 0.0; - cuberight[0].verts[1][2] = -0.5; + cuberight[0].verts[1][0] = (float)M_SQRT2 / 2.0f; + cuberight[0].verts[1][1] = 0.0f; + cuberight[0].verts[1][2] = -0.5f; cuberight[0].u[1] = uv_ratio; cuberight[0].v[1] = 0.0; - cuberight[0].verts[2][0] = M_SQRT2 / 2.0; - cuberight[0].verts[2][1] = 0.0; - cuberight[0].verts[2][2] = 0.5; + cuberight[0].verts[2][0] = (float)M_SQRT2 / 2.0f; + cuberight[0].verts[2][1] = 0.0f; + cuberight[0].verts[2][2] = 0.5f; cuberight[0].u[2] = uv_ratio; cuberight[0].v[2] = uv_ratio; //second triangle - cuberight[1].verts[0][0] = 0.0; - cuberight[1].verts[0][1] = M_SQRT2 / 2.0; - cuberight[1].verts[0][2] = -0.5; + cuberight[1].verts[0][0] = 0.0f; + cuberight[1].verts[0][1] = (float)M_SQRT2 / 2.0f; + cuberight[1].verts[0][2] = -0.5f; cuberight[1].u[0] = 0.0; cuberight[1].v[0] = 0.0; - cuberight[1].verts[1][0] = M_SQRT2 / 2.0; - cuberight[1].verts[1][1] = 0.0; - cuberight[1].verts[1][2] = 0.5; + cuberight[1].verts[1][0] = (float)M_SQRT2 / 2.0f; + cuberight[1].verts[1][1] = 0.0f; + cuberight[1].verts[1][2] = 0.5f; cuberight[1].u[1] = uv_ratio; cuberight[1].v[1] = uv_ratio; - cuberight[1].verts[2][0] = 0.0; - cuberight[1].verts[2][1] = M_SQRT2 / 2.0; - cuberight[1].verts[2][2] = 0.5; + cuberight[1].verts[2][0] = 0.0f; + cuberight[1].verts[2][1] = (float)M_SQRT2 / 2.0f; + cuberight[1].verts[2][2] = 0.5f; cuberight[1].u[2] = 0.0; cuberight[1].v[2] = uv_ratio; @@ -728,10 +728,10 @@ void KX_Dome::CreateMeshDome250(void) float uv_height, uv_base; float verts_height; - float rad_ang = m_angle * MT_PI / 180.0; + float rad_ang = m_angle * MT_PI / 180.0f; float uv_ratio = (float)(m_buffersize-1) / m_imagesize; - m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening + m_radangle = m_angle * (float)M_PI/180.0f;//calculates the radians angle, used for flattening /* * verts_height is the exactly needed height of the cube faces (not always 1.0). * When we want some horizontal information (e.g. for horizontal 220deg domes) we don't need to create and tessellate the whole cube. @@ -746,207 +746,207 @@ 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 = tanf((rad_ang / 2.0f) - (float)(MT_PI / 2.0)) * (float)M_SQRT2; + verts_height = tanf((rad_ang / 2.0f) - (MT_PI / 2.0f)) * (float)M_SQRT2; uv_height = uv_ratio * ( (verts_height / 2.0f) + 0.5f); - uv_base = uv_ratio * (1.0 - ((verts_height / 2.0f) + 0.5f)); + uv_base = uv_ratio * (1.0f - ((verts_height / 2.0f) + 0.5f)); //creating faces for the env mapcube 180deg Dome // Front Face - 2 triangles - cubefront[0].verts[0][0] =-1.0; - cubefront[0].verts[0][1] = 1.0; - cubefront[0].verts[0][2] =-1.0; + cubefront[0].verts[0][0] =-1.0f; + cubefront[0].verts[0][1] = 1.0f; + cubefront[0].verts[0][2] =-1.0f; cubefront[0].u[0] = 0.0; cubefront[0].v[0] = 0.0; - cubefront[0].verts[1][0] = 1.0; - cubefront[0].verts[1][1] = 1.0; - cubefront[0].verts[1][2] = 1.0; + cubefront[0].verts[1][0] = 1.0f; + cubefront[0].verts[1][1] = 1.0f; + cubefront[0].verts[1][2] = 1.0f; cubefront[0].u[1] = uv_ratio; cubefront[0].v[1] = uv_ratio; - cubefront[0].verts[2][0] =-1.0; - cubefront[0].verts[2][1] = 1.0; - cubefront[0].verts[2][2] = 1.0; + cubefront[0].verts[2][0] =-1.0f; + cubefront[0].verts[2][1] = 1.0f; + cubefront[0].verts[2][2] = 1.0f; cubefront[0].u[2] = 0.0; cubefront[0].v[2] = uv_ratio; //second triangle - cubefront[1].verts[0][0] = 1.0; - cubefront[1].verts[0][1] = 1.0; - cubefront[1].verts[0][2] = 1.0; + cubefront[1].verts[0][0] = 1.0f; + cubefront[1].verts[0][1] = 1.0f; + cubefront[1].verts[0][2] = 1.0f; cubefront[1].u[0] = uv_ratio; cubefront[1].v[0] = uv_ratio; - cubefront[1].verts[1][0] =-1.0; - cubefront[1].verts[1][1] = 1.0; - cubefront[1].verts[1][2] =-1.0; + cubefront[1].verts[1][0] =-1.0f; + cubefront[1].verts[1][1] = 1.0f; + cubefront[1].verts[1][2] =-1.0f; cubefront[1].u[1] = 0.0; cubefront[1].v[1] = 0.0; - cubefront[1].verts[2][0] = 1.0; - cubefront[1].verts[2][1] = 1.0; - cubefront[1].verts[2][2] =-1.0; + cubefront[1].verts[2][0] = 1.0f; + cubefront[1].verts[2][1] = 1.0f; + cubefront[1].verts[2][2] =-1.0f; cubefront[1].u[2] = uv_ratio; cubefront[1].v[2] = 0.0; nfacesfront = 2; // Left Face - 2 triangles - cubeleft[0].verts[0][0] =-1.0; - cubeleft[0].verts[0][1] = 1.0; - cubeleft[0].verts[0][2] =-1.0; + cubeleft[0].verts[0][0] =-1.0f; + cubeleft[0].verts[0][1] = 1.0f; + cubeleft[0].verts[0][2] =-1.0f; cubeleft[0].u[0] = uv_ratio; cubeleft[0].v[0] = 0.0; - cubeleft[0].verts[1][0] =-1.0; + cubeleft[0].verts[1][0] =-1.0f; cubeleft[0].verts[1][1] =-verts_height; - cubeleft[0].verts[1][2] = 1.0; + cubeleft[0].verts[1][2] = 1.0f; cubeleft[0].u[1] = uv_base; cubeleft[0].v[1] = uv_ratio; - cubeleft[0].verts[2][0] =-1.0; + cubeleft[0].verts[2][0] =-1.0f; cubeleft[0].verts[2][1] =-verts_height; - cubeleft[0].verts[2][2] =-1.0; + cubeleft[0].verts[2][2] =-1.0f; cubeleft[0].u[2] = uv_base; cubeleft[0].v[2] = 0.0; //second triangle - cubeleft[1].verts[0][0] =-1.0; + cubeleft[1].verts[0][0] =-1.0f; cubeleft[1].verts[0][1] =-verts_height; - cubeleft[1].verts[0][2] = 1.0; + cubeleft[1].verts[0][2] = 1.0f; cubeleft[1].u[0] = uv_base; cubeleft[1].v[0] = uv_ratio; - cubeleft[1].verts[1][0] =-1.0; - cubeleft[1].verts[1][1] = 1.0; - cubeleft[1].verts[1][2] =-1.0; + cubeleft[1].verts[1][0] =-1.0f; + cubeleft[1].verts[1][1] = 1.0f; + cubeleft[1].verts[1][2] =-1.0f; cubeleft[1].u[1] = uv_ratio; cubeleft[1].v[1] = 0.0; - cubeleft[1].verts[2][0] =-1.0; - cubeleft[1].verts[2][1] = 1.0; - cubeleft[1].verts[2][2] = 1.0; + cubeleft[1].verts[2][0] =-1.0f; + cubeleft[1].verts[2][1] = 1.0f; + cubeleft[1].verts[2][2] = 1.0f; cubeleft[1].u[2] = uv_ratio; cubeleft[1].v[2] = uv_ratio; nfacesleft = 2; // right Face - 2 triangles - cuberight[0].verts[0][0] = 1.0; - cuberight[0].verts[0][1] = 1.0; - cuberight[0].verts[0][2] = 1.0; + cuberight[0].verts[0][0] = 1.0f; + cuberight[0].verts[0][1] = 1.0f; + cuberight[0].verts[0][2] = 1.0f; cuberight[0].u[0] = 0.0; cuberight[0].v[0] = uv_ratio; - cuberight[0].verts[1][0] = 1.0; + cuberight[0].verts[1][0] = 1.0f; cuberight[0].verts[1][1] =-verts_height; - cuberight[0].verts[1][2] =-1.0; + cuberight[0].verts[1][2] =-1.0f; cuberight[0].u[1] = uv_height; cuberight[0].v[1] = 0.0; - cuberight[0].verts[2][0] = 1.0; + cuberight[0].verts[2][0] = 1.0f; cuberight[0].verts[2][1] =-verts_height; - cuberight[0].verts[2][2] = 1.0; + cuberight[0].verts[2][2] = 1.0f; cuberight[0].u[2] = uv_height; cuberight[0].v[2] = uv_ratio; //second triangle - cuberight[1].verts[0][0] = 1.0; + cuberight[1].verts[0][0] = 1.0f; cuberight[1].verts[0][1] =-verts_height; - cuberight[1].verts[0][2] =-1.0; + cuberight[1].verts[0][2] =-1.0f; cuberight[1].u[0] = uv_height; cuberight[1].v[0] = 0.0; - cuberight[1].verts[1][0] = 1.0; - cuberight[1].verts[1][1] = 1.0; - cuberight[1].verts[1][2] = 1.0; + cuberight[1].verts[1][0] = 1.0f; + cuberight[1].verts[1][1] = 1.0f; + cuberight[1].verts[1][2] = 1.0f; cuberight[1].u[1] = 0.0; cuberight[1].v[1] = uv_ratio; - cuberight[1].verts[2][0] = 1.0; - cuberight[1].verts[2][1] = 1.0; - cuberight[1].verts[2][2] =-1.0; + cuberight[1].verts[2][0] = 1.0f; + cuberight[1].verts[2][1] = 1.0f; + cuberight[1].verts[2][2] =-1.0f; cuberight[1].u[2] = 0.0; cuberight[1].v[2] = 0.0; nfacesright = 2; // top Face - 2 triangles - cubetop[0].verts[0][0] =-1.0; - cubetop[0].verts[0][1] = 1.0; - cubetop[0].verts[0][2] = 1.0; + cubetop[0].verts[0][0] =-1.0f; + cubetop[0].verts[0][1] = 1.0f; + cubetop[0].verts[0][2] = 1.0f; cubetop[0].u[0] = 0.0; cubetop[0].v[0] = 0.0; - cubetop[0].verts[1][0] = 1.0; + cubetop[0].verts[1][0] = 1.0f; cubetop[0].verts[1][1] =-verts_height; - cubetop[0].verts[1][2] = 1.0; + cubetop[0].verts[1][2] = 1.0f; cubetop[0].u[1] = uv_ratio; cubetop[0].v[1] = uv_height; - cubetop[0].verts[2][0] =-1.0; + cubetop[0].verts[2][0] =-1.0f; cubetop[0].verts[2][1] =-verts_height; - cubetop[0].verts[2][2] = 1.0; + cubetop[0].verts[2][2] = 1.0f; cubetop[0].u[2] = 0.0; cubetop[0].v[2] = uv_height; //second triangle - cubetop[1].verts[0][0] = 1.0; + cubetop[1].verts[0][0] = 1.0f; cubetop[1].verts[0][1] =-verts_height; - cubetop[1].verts[0][2] = 1.0; + cubetop[1].verts[0][2] = 1.0f; cubetop[1].u[0] = uv_ratio; cubetop[1].v[0] = uv_height; - cubetop[1].verts[1][0] =-1.0; - cubetop[1].verts[1][1] = 1.0; - cubetop[1].verts[1][2] = 1.0; + cubetop[1].verts[1][0] =-1.0f; + cubetop[1].verts[1][1] = 1.0f; + cubetop[1].verts[1][2] = 1.0f; cubetop[1].u[1] = 0.0; cubetop[1].v[1] = 0.0; - cubetop[1].verts[2][0] = 1.0; - cubetop[1].verts[2][1] = 1.0; - cubetop[1].verts[2][2] = 1.0; + cubetop[1].verts[2][0] = 1.0f; + cubetop[1].verts[2][1] = 1.0f; + cubetop[1].verts[2][2] = 1.0f; cubetop[1].u[2] = uv_ratio; cubetop[1].v[2] = 0.0; nfacestop = 2; // bottom Face - 2 triangles - cubebottom[0].verts[0][0] =-1.0; + cubebottom[0].verts[0][0] =-1.0f; cubebottom[0].verts[0][1] =-verts_height; - cubebottom[0].verts[0][2] =-1.0; + cubebottom[0].verts[0][2] =-1.0f; cubebottom[0].u[0] = 0.0; cubebottom[0].v[0] = uv_base; - cubebottom[0].verts[1][0] = 1.0; - cubebottom[0].verts[1][1] = 1.0; - cubebottom[0].verts[1][2] =-1.0; + cubebottom[0].verts[1][0] = 1.0f; + cubebottom[0].verts[1][1] = 1.0f; + cubebottom[0].verts[1][2] =-1.0f; cubebottom[0].u[1] = uv_ratio; cubebottom[0].v[1] = uv_ratio; - cubebottom[0].verts[2][0] =-1.0; - cubebottom[0].verts[2][1] = 1.0; - cubebottom[0].verts[2][2] =-1.0; + cubebottom[0].verts[2][0] =-1.0f; + cubebottom[0].verts[2][1] = 1.0f; + cubebottom[0].verts[2][2] =-1.0f; cubebottom[0].u[2] = 0.0; cubebottom[0].v[2] = uv_ratio; //second triangle - cubebottom[1].verts[0][0] = 1.0; - cubebottom[1].verts[0][1] = 1.0; - cubebottom[1].verts[0][2] =-1.0; + cubebottom[1].verts[0][0] = 1.0f; + cubebottom[1].verts[0][1] = 1.0f; + cubebottom[1].verts[0][2] =-1.0f; cubebottom[1].u[0] = uv_ratio; cubebottom[1].v[0] = uv_ratio; - cubebottom[1].verts[1][0] =-1.0; + cubebottom[1].verts[1][0] =-1.0f; cubebottom[1].verts[1][1] =-verts_height; - cubebottom[1].verts[1][2] =-1.0; + cubebottom[1].verts[1][2] =-1.0f; cubebottom[1].u[1] = 0.0; cubebottom[1].v[1] = uv_base; - cubebottom[1].verts[2][0] = 1.0; + cubebottom[1].verts[2][0] = 1.0f; cubebottom[1].verts[2][1] =-verts_height; - cubebottom[1].verts[2][2] =-1.0; + cubebottom[1].verts[2][2] =-1.0f; cubebottom[1].u[2] = uv_ratio; cubebottom[1].v[2] = uv_base; @@ -1012,80 +1012,80 @@ void KX_Dome::CreateMeshPanorama(void) float uv_ratio = (float)(m_buffersize-1) / m_imagesize; /* Top face - two triangles */ - cubetop[0].verts[0][0] = -M_SQRT2; - cubetop[0].verts[0][1] = 0.0; - cubetop[0].verts[0][2] = 1.0; + cubetop[0].verts[0][0] = (float)(-M_SQRT2); + cubetop[0].verts[0][1] = 0.0f; + cubetop[0].verts[0][2] = 1.0f; cubetop[0].u[0] = 0.0; cubetop[0].v[0] = uv_ratio; - cubetop[0].verts[1][0] = 0.0; - cubetop[0].verts[1][1] = M_SQRT2; - cubetop[0].verts[1][2] = 1.0; + cubetop[0].verts[1][0] = 0.0f; + cubetop[0].verts[1][1] = (float)M_SQRT2; + cubetop[0].verts[1][2] = 1.0f; cubetop[0].u[1] = 0.0; cubetop[0].v[1] = 0.0; //second triangle - cubetop[0].verts[2][0] = M_SQRT2; - cubetop[0].verts[2][1] = 0.0; - cubetop[0].verts[2][2] = 1.0; + cubetop[0].verts[2][0] = (float)M_SQRT2; + cubetop[0].verts[2][1] = 0.0f; + cubetop[0].verts[2][2] = 1.0f; cubetop[0].u[2] = uv_ratio; cubetop[0].v[2] = 0.0; - cubetop[1].verts[0][0] = M_SQRT2; - cubetop[1].verts[0][1] = 0.0; - cubetop[1].verts[0][2] = 1.0; + cubetop[1].verts[0][0] = (float)M_SQRT2; + cubetop[1].verts[0][1] = 0.0f; + cubetop[1].verts[0][2] = 1.0f; cubetop[1].u[0] = uv_ratio; cubetop[1].v[0] = 0.0; - cubetop[1].verts[1][0] = 0.0; - cubetop[1].verts[1][1] = -M_SQRT2; - cubetop[1].verts[1][2] = 1.0; + cubetop[1].verts[1][0] = 0.0f; + cubetop[1].verts[1][1] = (float)(-M_SQRT2); + cubetop[1].verts[1][2] = 1.0f; cubetop[1].u[1] = uv_ratio; cubetop[1].v[1] = uv_ratio; - cubetop[1].verts[2][0] = -M_SQRT2; - cubetop[1].verts[2][1] = 0.0; - cubetop[1].verts[2][2] = 1.0; + cubetop[1].verts[2][0] = (float)(-M_SQRT2); + cubetop[1].verts[2][1] = 0.0f; + cubetop[1].verts[2][2] = 1.0f; cubetop[1].u[2] = 0.0; cubetop[1].v[2] = uv_ratio; nfacestop = 2; /* Bottom face - two triangles */ - cubebottom[0].verts[0][0] = -M_SQRT2; - cubebottom[0].verts[0][1] = 0.0; - cubebottom[0].verts[0][2] = -1.0; + cubebottom[0].verts[0][0] = (float)(-M_SQRT2); + cubebottom[0].verts[0][1] = 0.0f; + cubebottom[0].verts[0][2] = -1.0f; cubebottom[0].u[0] = uv_ratio; cubebottom[0].v[0] = 0.0; - cubebottom[0].verts[1][0] = M_SQRT2; - cubebottom[0].verts[1][1] = 0.0; - cubebottom[0].verts[1][2] = -1.0; + cubebottom[0].verts[1][0] = (float)M_SQRT2; + cubebottom[0].verts[1][1] = 0.0f; + cubebottom[0].verts[1][2] = -1.0f; cubebottom[0].u[1] = 0.0; cubebottom[0].v[1] = uv_ratio; - cubebottom[0].verts[2][0] = 0.0; - cubebottom[0].verts[2][1] = M_SQRT2; - cubebottom[0].verts[2][2] = -1.0; + cubebottom[0].verts[2][0] = 0.0f; + cubebottom[0].verts[2][1] = (float)M_SQRT2; + cubebottom[0].verts[2][2] = -1.0f; cubebottom[0].u[2] = 0.0; cubebottom[0].v[2] = 0.0; //second triangle - cubebottom[1].verts[0][0] = M_SQRT2; - cubebottom[1].verts[0][1] = 0.0; - cubebottom[1].verts[0][2] = -1.0; + cubebottom[1].verts[0][0] = (float)M_SQRT2; + cubebottom[1].verts[0][1] = 0.0f; + cubebottom[1].verts[0][2] = -1.0f; cubebottom[1].u[0] = 0.0; cubebottom[1].v[0] = uv_ratio; - cubebottom[1].verts[1][0] = -M_SQRT2; - cubebottom[1].verts[1][1] = 0.0; - cubebottom[1].verts[1][2] = -1.0; + cubebottom[1].verts[1][0] = (float)(-M_SQRT2); + cubebottom[1].verts[1][1] = 0.0f; + cubebottom[1].verts[1][2] = -1.0f; cubebottom[1].u[1] = uv_ratio; cubebottom[1].v[1] = 0.0; - cubebottom[1].verts[2][0] = 0.0; - cubebottom[1].verts[2][1] = -M_SQRT2; - cubebottom[1].verts[2][2] = -1.0; + cubebottom[1].verts[2][0] = 0.0f; + cubebottom[1].verts[2][1] = (float)(-M_SQRT2); + cubebottom[1].verts[2][2] = -1.0f; cubebottom[1].u[2] = uv_ratio; cubebottom[1].v[2] = uv_ratio; @@ -1093,40 +1093,40 @@ void KX_Dome::CreateMeshPanorama(void) /* Left Back (135deg) face - two triangles */ - cubeleftback[0].verts[0][0] = 0; - cubeleftback[0].verts[0][1] = -M_SQRT2; - cubeleftback[0].verts[0][2] = -1.0; - cubeleftback[0].u[0] = 0; - cubeleftback[0].v[0] = 0; + cubeleftback[0].verts[0][0] = 0.0f; + cubeleftback[0].verts[0][1] = (float)(-M_SQRT2); + cubeleftback[0].verts[0][2] = -1.0f; + cubeleftback[0].u[0] = 0.0; + cubeleftback[0].v[0] = 0.0; - cubeleftback[0].verts[1][0] = -M_SQRT2; - cubeleftback[0].verts[1][1] = 0; - cubeleftback[0].verts[1][2] = -1.0; + cubeleftback[0].verts[1][0] = (float)(-M_SQRT2); + cubeleftback[0].verts[1][1] = 0.0f; + cubeleftback[0].verts[1][2] = -1.0f; cubeleftback[0].u[1] = uv_ratio; - cubeleftback[0].v[1] = 0; + cubeleftback[0].v[1] = 0.0; - cubeleftback[0].verts[2][0] = 0; - cubeleftback[0].verts[2][1] = -M_SQRT2; - cubeleftback[0].verts[2][2] = 1.0; - cubeleftback[0].u[2] = 0; + cubeleftback[0].verts[2][0] = 0.0f; + cubeleftback[0].verts[2][1] = (float)(-M_SQRT2); + cubeleftback[0].verts[2][2] = 1.0f; + cubeleftback[0].u[2] = 0.0; cubeleftback[0].v[2] = uv_ratio; //second triangle - cubeleftback[1].verts[0][0] = 0; - cubeleftback[1].verts[0][1] = -M_SQRT2; - cubeleftback[1].verts[0][2] = 1.0; - cubeleftback[1].u[0] = 0; + cubeleftback[1].verts[0][0] = 0.0f; + cubeleftback[1].verts[0][1] = (float)(-M_SQRT2); + cubeleftback[1].verts[0][2] = 1.0f; + cubeleftback[1].u[0] = 0.0; cubeleftback[1].v[0] = uv_ratio; - cubeleftback[1].verts[1][0] = -M_SQRT2; - cubeleftback[1].verts[1][1] = 0; - cubeleftback[1].verts[1][2] = -1.0; + cubeleftback[1].verts[1][0] = (float)(-M_SQRT2); + cubeleftback[1].verts[1][1] = 0.0f; + cubeleftback[1].verts[1][2] = -1.0f; cubeleftback[1].u[1] = uv_ratio; - cubeleftback[1].v[1] = 0; + cubeleftback[1].v[1] = 0.0; - cubeleftback[1].verts[2][0] = -M_SQRT2; - cubeleftback[1].verts[2][1] = 0; - cubeleftback[1].verts[2][2] = 1.0; + cubeleftback[1].verts[2][0] = (float)(-M_SQRT2); + cubeleftback[1].verts[2][1] = 0.0f; + cubeleftback[1].verts[2][2] = 1.0f; cubeleftback[1].u[2] = uv_ratio; cubeleftback[1].v[2] = uv_ratio; @@ -1134,121 +1134,121 @@ void KX_Dome::CreateMeshPanorama(void) /* Left face - two triangles */ - cubeleft[0].verts[0][0] = -M_SQRT2; - cubeleft[0].verts[0][1] = 0; - cubeleft[0].verts[0][2] = -1.0; - cubeleft[0].u[0] = 0; - cubeleft[0].v[0] = 0; - - cubeleft[0].verts[1][0] = 0; - cubeleft[0].verts[1][1] = M_SQRT2; - cubeleft[0].verts[1][2] = -1.0; + cubeleft[0].verts[0][0] = (float)(-M_SQRT2); + cubeleft[0].verts[0][1] = 0.0f; + cubeleft[0].verts[0][2] = -1.0f; + cubeleft[0].u[0] = 0.0; + cubeleft[0].v[0] = 0.0; + + cubeleft[0].verts[1][0] = 0.0f; + cubeleft[0].verts[1][1] = (float)M_SQRT2; + cubeleft[0].verts[1][2] = -1.0f; cubeleft[0].u[1] = uv_ratio; - cubeleft[0].v[1] = 0; + cubeleft[0].v[1] = 0.0; - cubeleft[0].verts[2][0] = -M_SQRT2; - cubeleft[0].verts[2][1] = 0; - cubeleft[0].verts[2][2] = 1.0; - cubeleft[0].u[2] = 0; + cubeleft[0].verts[2][0] = (float)(-M_SQRT2); + cubeleft[0].verts[2][1] = 0.0f; + cubeleft[0].verts[2][2] = 1.0f; + cubeleft[0].u[2] = 0.0; cubeleft[0].v[2] = uv_ratio; //second triangle - cubeleft[1].verts[0][0] = -M_SQRT2; - cubeleft[1].verts[0][1] = 0; - cubeleft[1].verts[0][2] = 1.0; - cubeleft[1].u[0] = 0; + cubeleft[1].verts[0][0] = (float)(-M_SQRT2); + cubeleft[1].verts[0][1] = 0.0f; + cubeleft[1].verts[0][2] = 1.0f; + cubeleft[1].u[0] = 0.0; cubeleft[1].v[0] = uv_ratio; - cubeleft[1].verts[1][0] = 0; - cubeleft[1].verts[1][1] = M_SQRT2; - cubeleft[1].verts[1][2] = -1.0; + cubeleft[1].verts[1][0] = 0.0f; + cubeleft[1].verts[1][1] = (float)M_SQRT2; + cubeleft[1].verts[1][2] = -1.0f; cubeleft[1].u[1] = uv_ratio; - cubeleft[1].v[1] = 0; + cubeleft[1].v[1] = 0.0; - cubeleft[1].verts[2][0] = 0; - cubeleft[1].verts[2][1] = M_SQRT2; - cubeleft[1].verts[2][2] = 1.0; + cubeleft[1].verts[2][0] = 0.0f; + cubeleft[1].verts[2][1] = (float)M_SQRT2; + cubeleft[1].verts[2][2] = 1.0f; cubeleft[1].u[2] = uv_ratio; cubeleft[1].v[2] = uv_ratio; nfacesleft = 2; /* Right face - two triangles */ - cuberight[0].verts[0][0] = 0; - cuberight[0].verts[0][1] = M_SQRT2; - cuberight[0].verts[0][2] = -1.0; - cuberight[0].u[0] = 0; - cuberight[0].v[0] = 0; - - cuberight[0].verts[1][0] = M_SQRT2; - cuberight[0].verts[1][1] = 0; - cuberight[0].verts[1][2] = -1.0; + cuberight[0].verts[0][0] = 0.0f; + cuberight[0].verts[0][1] = (float)M_SQRT2; + cuberight[0].verts[0][2] = -1.0f; + cuberight[0].u[0] = 0.0; + cuberight[0].v[0] = 0.0; + + cuberight[0].verts[1][0] = (float)M_SQRT2; + cuberight[0].verts[1][1] = 0.0f; + cuberight[0].verts[1][2] = -1.0f; cuberight[0].u[1] = uv_ratio; - cuberight[0].v[1] = 0; + cuberight[0].v[1] = 0.0; - cuberight[0].verts[2][0] = M_SQRT2; - cuberight[0].verts[2][1] = 0; - cuberight[0].verts[2][2] = 1.0; + cuberight[0].verts[2][0] = (float)M_SQRT2; + cuberight[0].verts[2][1] = 0.0f; + cuberight[0].verts[2][2] = 1.0f; cuberight[0].u[2] = uv_ratio; cuberight[0].v[2] = uv_ratio; //second triangle - cuberight[1].verts[0][0] = 0; - cuberight[1].verts[0][1] = M_SQRT2; - cuberight[1].verts[0][2] = -1.0; - cuberight[1].u[0] = 0; - cuberight[1].v[0] = 0; - - cuberight[1].verts[1][0] = M_SQRT2; - cuberight[1].verts[1][1] = 0; - cuberight[1].verts[1][2] = 1.0; + cuberight[1].verts[0][0] = 0.0f; + cuberight[1].verts[0][1] = (float)M_SQRT2; + cuberight[1].verts[0][2] = -1.0f; + cuberight[1].u[0] = 0.0; + cuberight[1].v[0] = 0.0; + + cuberight[1].verts[1][0] = (float)M_SQRT2; + cuberight[1].verts[1][1] = 0.0f; + cuberight[1].verts[1][2] = 1.0f; cuberight[1].u[1] = uv_ratio; cuberight[1].v[1] = uv_ratio; - cuberight[1].verts[2][0] = 0; - cuberight[1].verts[2][1] = M_SQRT2; - cuberight[1].verts[2][2] = 1.0; - cuberight[1].u[2] = 0; + cuberight[1].verts[2][0] = 0.0f; + cuberight[1].verts[2][1] = (float)M_SQRT2; + cuberight[1].verts[2][2] = 1.0f; + cuberight[1].u[2] = 0.0f; cuberight[1].v[2] = uv_ratio; nfacesright = 2; /* Right Back (-135deg) face - two triangles */ - cuberightback[0].verts[0][0] = M_SQRT2; - cuberightback[0].verts[0][1] = 0; - cuberightback[0].verts[0][2] = -1.0; - cuberightback[0].u[0] = 0; - cuberightback[0].v[0] = 0; - - cuberightback[0].verts[1][0] = 0; - cuberightback[0].verts[1][1] = -M_SQRT2; - cuberightback[0].verts[1][2] = -1.0; + cuberightback[0].verts[0][0] = (float)M_SQRT2; + cuberightback[0].verts[0][1] = 0.0f; + cuberightback[0].verts[0][2] = -1.0f; + cuberightback[0].u[0] = 0.0; + cuberightback[0].v[0] = 0.0; + + cuberightback[0].verts[1][0] = 0.0f; + cuberightback[0].verts[1][1] = (float)(-M_SQRT2); + cuberightback[0].verts[1][2] = -1.0f; cuberightback[0].u[1] = uv_ratio; - cuberightback[0].v[1] = 0; + cuberightback[0].v[1] = 0.0; - cuberightback[0].verts[2][0] = 0; - cuberightback[0].verts[2][1] = -M_SQRT2; - cuberightback[0].verts[2][2] = 1.0; + cuberightback[0].verts[2][0] = 0.0f; + cuberightback[0].verts[2][1] = (float)(-M_SQRT2); + cuberightback[0].verts[2][2] = 1.0f; cuberightback[0].u[2] = uv_ratio; cuberightback[0].v[2] = uv_ratio; //second triangle - cuberightback[1].verts[0][0] = M_SQRT2; - cuberightback[1].verts[0][1] = 0; - cuberightback[1].verts[0][2] = -1.0; - cuberightback[1].u[0] = 0; - cuberightback[1].v[0] = 0; - - cuberightback[1].verts[1][0] = 0; - cuberightback[1].verts[1][1] = -M_SQRT2; - cuberightback[1].verts[1][2] = 1.0; + cuberightback[1].verts[0][0] = (float)M_SQRT2; + cuberightback[1].verts[0][1] = 0.0f; + cuberightback[1].verts[0][2] = -1.0f; + cuberightback[1].u[0] = 0.0; + cuberightback[1].v[0] = 0.0; + + cuberightback[1].verts[1][0] = 0.0f; + cuberightback[1].verts[1][1] = (float)(-M_SQRT2); + cuberightback[1].verts[1][2] = 1.0f; cuberightback[1].u[1] = uv_ratio; cuberightback[1].v[1] = uv_ratio; - cuberightback[1].verts[2][0] = M_SQRT2; - cuberightback[1].verts[2][1] = 0; - cuberightback[1].verts[2][2] = 1.0; - cuberightback[1].u[2] = 0; + cuberightback[1].verts[2][0] = (float)M_SQRT2; + cuberightback[1].verts[2][1] = 0.0f; + cuberightback[1].verts[2][2] = 1.0f; + cuberightback[1].u[2] = 0.0; cuberightback[1].v[2] = uv_ratio; nfacesrightback = 2; @@ -1328,13 +1328,13 @@ void KX_Dome::FlattenDome(MT_Vector3 verts[3]) phi = atan2(verts[i][2], verts[i][0]); verts[i][0] = r * cos(phi); - verts[i][1] = 0; + verts[i][1] = 0.0f; verts[i][2] = r * sin(phi); if (r > 1.0) { //round the border verts[i][0] = cos(phi); - verts[i][1] = -3.0; + verts[i][1] = -3.0f; verts[i][2] = sin(phi); } } @@ -1355,7 +1355,7 @@ void KX_Dome::FlattenPanorama(MT_Vector3 verts[3]) edge=true; verts[i][0] = phi / MT_PI; - verts[i][1] = 0; + verts[i][1] = 0.0f; theta = asin(verts[i][2]); verts[i][2] = theta / MT_PI; @@ -1364,15 +1364,15 @@ void KX_Dome::FlattenPanorama(MT_Vector3 verts[3]) bool right=false; for (i=0;i<3;i++) { - if (fmod(verts[i][0],1.0) > 0.0) { + if (fmodf(verts[i][0],1.0f) > 0.0f) { right=true; break; } } if (right) { for (i=0;i<3;i++) { - if (verts[i][0] < 0.0) - verts[i][0] *= -1.0; + if (verts[i][0] < 0.0f) + verts[i][0] *= -1.0f; } } } @@ -1438,8 +1438,8 @@ void KX_Dome::CalculateFrustum(KX_Camera *cam) // manually creating a 90deg Field of View Frustum // the original formula: - top = tan(fov*3.14159/360.0) * near [for fov in degrees] - fov*0.5 = arctan ((top-bottom)*0.5 / near) [for fov in radians] + top = tan(fov*3.14159f/30.0f)) * near [for fov in degrees] + fov*0.5f = arctan ((top-bottom)*0.5f / near) [for fov in radians] bottom = -top left = aspect * bottom right = aspect * top @@ -1447,7 +1447,7 @@ void KX_Dome::CalculateFrustum(KX_Camera *cam) // the equivalent GLU call is: glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(90.0,1.0,cam->GetCameraNear(),cam->GetCameraFar()); + gluPerspective(90.0f,1.0f,cam->GetCameraNear(),cam->GetCameraFar()); #endif RAS_FrameFrustum m_frustrum; //90 deg. Frustum @@ -1455,7 +1455,7 @@ void KX_Dome::CalculateFrustum(KX_Camera *cam) m_frustrum.camnear = cam->GetCameraNear(); m_frustrum.camfar = cam->GetCameraFar(); -// float top = tan(90.0*MT_PI/360.0) * m_frustrum.camnear; +// float top = tan(90.0f*MT_PI/360.0f) * m_frustrum.camnear; float top = m_frustrum.camnear; // for deg = 90deg, tan = 1 m_frustrum.x1 = -top; @@ -1485,90 +1485,90 @@ void KX_Dome::CalculateCameraOrientation() || m_mode == DOME_TRUNCATED_REAR)) { m_locRot[0] = MT_Matrix3x3( // 90deg - Top - c, -s, 0.0, - 0.0,0.0, -1.0, - s, c, 0.0); + c, -s, 0.0f, + 0.0f,0.0f, -1.0f, + s, c, 0.0f); m_locRot[1] = MT_Matrix3x3( // 90deg - Bottom - -s, c, 0.0, - 0.0,0.0, 1.0, - s, c, 0.0); + -s, c, 0.0f, + 0.0f,0.0f, 1.0f, + s, c, 0.0f); m_locRot[2] = MT_Matrix3x3( // 45deg - Left - c, 0.0, s, - 0, 1.0, 0.0, - -s, 0.0, c); + c, 0.0f, s, + 0, 1.0f, 0.0f, + -s, 0.0f, c); m_locRot[3] = MT_Matrix3x3( // 45deg - Right - c, 0.0, -s, - 0.0, 1.0, 0.0, - s, 0.0, c); + c, 0.0f, -s, + 0.0f, 1.0f, 0.0f, + s, 0.0f, c); } else if (m_mode == DOME_ENVMAP || (m_angle > 180 && (m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR))) { m_locRot[0] = MT_Matrix3x3( // 90deg - Top - 1.0, 0.0, 0.0, - 0.0, 0.0,-1.0, - 0.0, 1.0, 0.0); + 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f,-1.0f, + 0.0f, 1.0f, 0.0f); m_locRot[1] = MT_Matrix3x3( // 90deg - Bottom - 1.0, 0.0, 0.0, - 0.0, 0.0, 1.0, - 0.0,-1.0, 0.0); + 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, + 0.0f,-1.0f, 0.0f); m_locRot[2] = MT_Matrix3x3( // -90deg - Left - 0.0, 0.0, 1.0, - 0.0, 1.0, 0.0, - -1.0, 0.0, 0.0); + 0.0f, 0.0f, 1.0f, + 0.0f, 1.0f, 0.0f, + -1.0f, 0.0f, 0.0f); m_locRot[3] = MT_Matrix3x3( // 90deg - Right - 0.0, 0.0,-1.0, - 0.0, 1.0, 0.0, - 1.0, 0.0, 0.0); + 0.0f, 0.0f,-1.0f, + 0.0f, 1.0f, 0.0f, + 1.0f, 0.0f, 0.0f); m_locRot[4] = MT_Matrix3x3( // 0deg - Front - 1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0, 1.0); + 1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f); m_locRot[5] = MT_Matrix3x3( // 180deg - Back - USED for ENVMAP only - -1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0,-1.0); + -1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f,-1.0f); } else if (m_mode == DOME_PANORAM_SPH) { m_locRot[0] = MT_Matrix3x3( // Top - c, s, 0.0, - 0.0,0.0, -1.0, - -s, c, 0.0); + c, s, 0.0f, + 0.0f,0.0f, -1.0f, + -s, c, 0.0f); m_locRot[1] = MT_Matrix3x3( // Bottom - c, s, 0.0, - 0.0, 0.0, 1.0, - s, -c, 0.0); + c, s, 0.0f, + 0.0f, 0.0f, 1.0f, + s, -c, 0.0f); m_locRot[2] = MT_Matrix3x3( // 45deg - Left - -s, 0.0, c, - 0, 1.0, 0.0, - -c, 0.0, -s); + -s, 0.0f, c, + 0, 1.0f, 0.0f, + -c, 0.0f, -s); m_locRot[3] = MT_Matrix3x3( // 45deg - Right - c, 0.0, s, - 0, 1.0, 0.0, - -s, 0.0, c); + c, 0.0f, s, + 0, 1.0f, 0.0f, + -s, 0.0f, c); m_locRot[4] = MT_Matrix3x3( // 135deg - LeftBack - -s, 0.0, -c, - 0.0, 1.0, 0.0, - c, 0.0, -s); + -s, 0.0f, -c, + 0.0f, 1.0f, 0.0f, + c, 0.0f, -s); m_locRot[5] = MT_Matrix3x3( // 135deg - RightBack - c, 0.0, -s, - 0.0, 1.0, 0.0, - s, 0.0, c); + c, 0.0f, -s, + 0.0f, 1.0f, 0.0f, + s, 0.0f, c); } // rotating the camera in horizontal axis @@ -1579,9 +1579,9 @@ void KX_Dome::CalculateCameraOrientation() s = sin(tiltdeg); MT_Matrix3x3 tilt_mat = MT_Matrix3x3( - 1.0, 0.0, 0.0, - 0.0, c, -s, - 0.0, s, c + 1.0f, 0.0f, 0.0f, + 0.0f, c, -s, + 0.0f, s, c ); for (i =0;i<6;i++) @@ -1667,11 +1667,11 @@ void KX_Dome::DrawEnvMap(void) float ortho_width, ortho_height; if (warp.usemesh) - glOrtho((-1.0), 1.0, (-0.66), 0.66, -20.0, 10.0); //stretch the image to reduce resolution lost + glOrtho((-1.0), 1.0, (-0.66), 0.66, 0.0, 0.0); //stretch the image to reduce resolution lost else { if (can_width/3 <= can_height/2) { - ortho_width = 1.0; + ortho_width = 1.0f; ortho_height = (float)can_height/can_width; } else { @@ -1679,14 +1679,14 @@ void KX_Dome::DrawEnvMap(void) ortho_width = (float)can_width/can_height * ortho_height; } - glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0); + glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0f, 10.0f); } glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0,0.0,1.0, 0.0,0.0,0.0, 0.0,1.0,0.0); + gluLookAt(0.0f,0.0f,1.0f, 0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f); glPolygonMode(GL_FRONT, GL_FILL); glShadeModel(GL_SMOOTH); @@ -1694,7 +1694,7 @@ void KX_Dome::DrawEnvMap(void) glDisable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); - glColor3f(1.0,1.0,1.0); + glColor3f(1.0f,1.0f,1.0f); float uv_ratio = (float)(m_buffersize-1) / m_imagesize; double onebythree = 1.0f / 3; @@ -1704,11 +1704,11 @@ void KX_Dome::DrawEnvMap(void) glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); glVertex3f( onebythree, 0.0f, 3.0f); - glTexCoord2f(0.0,uv_ratio); + glTexCoord2f(0.0f,uv_ratio); glVertex3f(-onebythree, 0.0f, 3.0f); - glTexCoord2f(0.0,0.0); + glTexCoord2f(0.0f,0.0f); glVertex3f(-onebythree,-2 * onebythree, 3.0f); - glTexCoord2f(uv_ratio,0.0); + glTexCoord2f(uv_ratio,0.0f); glVertex3f(onebythree,-2 * onebythree, 3.0f); glEnd(); @@ -1717,11 +1717,11 @@ void KX_Dome::DrawEnvMap(void) glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); glVertex3f(-onebythree, 0.0f, 3.0f); - glTexCoord2f(0.0,uv_ratio); + glTexCoord2f(0.0f,uv_ratio); glVertex3f(-1.0f, 0.0f, 3.0f); - glTexCoord2f(0.0,0.0); + glTexCoord2f(0.0f,0.0f); glVertex3f(-1.0f,-2 * onebythree, 3.0f); - glTexCoord2f(uv_ratio,0.0); + glTexCoord2f(uv_ratio,0.0f); glVertex3f(-onebythree,-2 * onebythree, 3.0f); glEnd(); @@ -1730,11 +1730,11 @@ void KX_Dome::DrawEnvMap(void) glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); glVertex3f(-onebythree, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,uv_ratio); + glTexCoord2f(0.0f,uv_ratio); glVertex3f(-1.0f, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,0.0); + glTexCoord2f(0.0f,0.0f); glVertex3f(-1.0f, 0.0f, 3.0f); - glTexCoord2f(uv_ratio,0.0); + glTexCoord2f(uv_ratio,0.0f); glVertex3f(-onebythree, 0.0f, 3.0f); glEnd(); @@ -1743,11 +1743,11 @@ void KX_Dome::DrawEnvMap(void) glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); glVertex3f( 1.0f, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,uv_ratio); + glTexCoord2f(0.0f,uv_ratio); glVertex3f( onebythree, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,0.0); + glTexCoord2f(0.0f,0.0f); glVertex3f( onebythree, 0.0f, 3.0f); - glTexCoord2f(uv_ratio,0.0); + glTexCoord2f(uv_ratio,0.0f); glVertex3f(1.0f, 0.0f, 3.0f); glEnd(); @@ -1756,11 +1756,11 @@ void KX_Dome::DrawEnvMap(void) glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); glVertex3f( 1.0f, 0.0f, 3.0f); - glTexCoord2f(0.0,uv_ratio); + glTexCoord2f(0.0f,uv_ratio); glVertex3f( onebythree, 0.0f, 3.0f); - glTexCoord2f(0.0,0.0); + glTexCoord2f(0.0f,0.0f); glVertex3f( onebythree,-2 * onebythree, 3.0f); - glTexCoord2f(uv_ratio,0.0); + glTexCoord2f(uv_ratio,0.0f); glVertex3f(1.0f, -2 * onebythree, 3.0f); glEnd(); @@ -1769,11 +1769,11 @@ void KX_Dome::DrawEnvMap(void) glBegin(GL_QUADS); glTexCoord2f(uv_ratio,uv_ratio); glVertex3f( onebythree, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,uv_ratio); + glTexCoord2f(0.0f,uv_ratio); glVertex3f(-onebythree, 2 * onebythree, 3.0f); - glTexCoord2f(0.0,0.0); + glTexCoord2f(0.0f,0.0f); glVertex3f(-onebythree, 0.0f, 3.0f); - glTexCoord2f(uv_ratio,0.0); + glTexCoord2f(uv_ratio,0.0f); glVertex3f(onebythree, 0.0f, 3.0f); glEnd(); @@ -1798,40 +1798,40 @@ void KX_Dome::DrawDomeFisheye(void) if (m_mode == DOME_FISHEYE) { if (warp.usemesh) - glOrtho((-1.0), 1.0, (-1.0), 1.0, -20.0, 10.0); //stretch the image to reduce resolution lost + glOrtho((-1.0f), 1.0f, (-1.0f), 1.0f, -20.0f, 10.0f); //stretch the image to reduce resolution lost else { if (can_width < can_height) { - ortho_width = 1.0; + ortho_width = 1.0f; ortho_height = (float)can_height/can_width; } else { ortho_width = (float)can_width/can_height; - ortho_height = 1.0; + ortho_height = 1.0f; } - glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0); + glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0f, 10.0f); } } else if (m_mode == DOME_TRUNCATED_FRONT) { - ortho_width = 1.0; + ortho_width = 1.0f; ortho_height = 2.0f * ((float)can_height / can_width) - 1.0f; - glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_width, -20.0, 10.0); + glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_width, -20.0f, 10.0f); } else { //m_mode == DOME_TRUNCATED_REAR - ortho_width = 1.0; + ortho_width = 1.0f; ortho_height = 2.0f * ((float)can_height / can_width) - 1.0f; - glOrtho((-ortho_width), ortho_width, (-ortho_width), ortho_height, -20.0, 10.0); + glOrtho((-ortho_width), ortho_width, (-ortho_width), ortho_height, -20.0f, 10.0f); } glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - gluLookAt(0.0,-1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0); + gluLookAt(0.0f,-1.0f,0.0f, 0.0f,0.0f,0.0f, 0.0f,0.0f,1.0f); if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME) glPolygonMode(GL_FRONT, GL_LINE); @@ -1843,7 +1843,7 @@ void KX_Dome::DrawDomeFisheye(void) glDisable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); - glColor3f(1.0,1.0,1.0); + glColor3f(1.0f,1.0f,1.0f); if (dlistSupported) { for (i=0;iGetWorldToCamera()); MT_Matrix4x4 viewmat(camtrans); - m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), 1.0); + m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), 1.0f); cam->SetModelviewMatrix(viewmat); // restore the original orientation diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 32ac8c594d2..364f8d4bfc6 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -200,7 +200,7 @@ void KX_FontObject::DrawFontText() mat[12] += offset[0]; mat[13] += offset[1]; mat[14] += offset[2]; /* Orient the spacing vector */ - MT_Vector3 spacing = MT_Vector3(0, m_fsize*m_line_spacing, 0); + MT_Vector3 spacing = MT_Vector3(0.0f, m_fsize*m_line_spacing, 0.0f); spacing = this->NodeGetWorldOrientation() * spacing * this->NodeGetWorldScaling()[1]; /* Draw each line, taking spacing into consideration */ diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 38d8a303fe8..ad6447778e5 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -83,11 +83,11 @@ #include "BLI_math.h" -static MT_Point3 dummy_point= MT_Point3(0.0, 0.0, 0.0); -static MT_Vector3 dummy_scaling = MT_Vector3(1.0, 1.0, 1.0); -static MT_Matrix3x3 dummy_orientation = MT_Matrix3x3(1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0, 1.0); +static MT_Point3 dummy_point= MT_Point3(0.0f, 0.0f, 0.0f); +static MT_Vector3 dummy_scaling = MT_Vector3(1.0f, 1.0f, 1.0f); +static MT_Matrix3x3 dummy_orientation = MT_Matrix3x3(1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f); KX_GameObject::KX_GameObject( void* sgReplicationInfo, @@ -101,7 +101,7 @@ KX_GameObject::KX_GameObject( m_pBlenderGroupObject(NULL), m_bUseObjectColor(false), m_bIsNegativeScaling(false), - m_objectColor(1.0, 1.0, 1.0, 1.0), + m_objectColor(1.0f, 1.0f, 1.0f, 1.0f), m_bVisible(true), m_bCulled(true), m_bOccluder(false), @@ -354,9 +354,9 @@ void KX_GameObject::SetParent(KX_Scene *scene, KX_GameObject* obj, bool addToCom m_pPhysicsController->SuspendDynamics(ghost); } // Set us to our new scale, position, and orientation - scale2[0] = 1.0/scale2[0]; - scale2[1] = 1.0/scale2[1]; - scale2[2] = 1.0/scale2[2]; + scale2[0] = 1.0f/scale2[0]; + scale2[1] = 1.0f/scale2[1]; + scale2[2] = 1.0f/scale2[2]; scale1 = scale1 * scale2; MT_Matrix3x3 invori = obj->NodeGetWorldOrientation().inverse(); MT_Vector3 newpos = invori*(NodeGetWorldPosition()-obj->NodeGetWorldPosition())*scale2; @@ -711,7 +711,7 @@ float *KX_GameObject::GetOpenGLMatrix() trans.setBasis(GetSGNode()->GetWorldOrientation()); MT_Vector3 scaling = GetSGNode()->GetWorldScaling(); - m_bIsNegativeScaling = ((scaling[0] < 0.0) ^ (scaling[1] < 0.0) ^ (scaling[2] < 0.0)) ? true : false; + m_bIsNegativeScaling = ((scaling[0] < 0.0f) ^ (scaling[1] < 0.0f) ^ (scaling[2] < 0.0f)) ? true : false; trans.scale(scaling[0], scaling[1], scaling[2]); trans.getValue(fl); GetSGNode()->ClearDirty(); @@ -1214,12 +1214,12 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) { case 0: //x axis 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? + if (MT_abs(vect.dot(ori)) > 1.0f-3.0f*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.0f) { x = vect; } else { - x = (vect * fac) + ((orimat * MT_Vector3(1.0, 0.0, 0.0)) * (1.0f - fac)); + x = (vect * fac) + ((orimat * MT_Vector3(1.0f, 0.0f, 0.0f)) * (1.0f - fac)); len = x.length(); if (MT_fuzzyZero(len)) x = vect; else x /= len; @@ -1229,12 +1229,12 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) break; case 1: //y axis ori.setValue(orimat[0][0], orimat[1][0], orimat[2][0]); - if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) + if (MT_abs(vect.dot(ori)) > 1.0f-3.0f*MT_EPSILON) ori.setValue(orimat[0][2], orimat[1][2], orimat[2][2]); if (fac == 1.0f) { y = vect; } else { - y = (vect * fac) + ((orimat * MT_Vector3(0.0, 1.0, 0.0)) * (1.0f - fac)); + y = (vect * fac) + ((orimat * MT_Vector3(0.0f, 1.0f, 0.0f)) * (1.0f - fac)); len = y.length(); if (MT_fuzzyZero(len)) y = vect; else y /= len; @@ -1244,12 +1244,12 @@ void KX_GameObject::AlignAxisToVect(const MT_Vector3& dir, int axis, float fac) break; case 2: //z axis ori.setValue(orimat[0][1], orimat[1][1], orimat[2][1]); - if (MT_abs(vect.dot(ori)) > 1.0-3.0*MT_EPSILON) + if (MT_abs(vect.dot(ori)) > 1.0f-3.0f*MT_EPSILON) ori.setValue(orimat[0][0], orimat[1][0], orimat[2][0]); if (fac == 1.0f) { z = vect; } else { - z = (vect * fac) + ((orimat * MT_Vector3(0.0, 0.0, 1.0)) * (1.0f - fac)); + z = (vect * fac) + ((orimat * MT_Vector3(0.0f, 0.0f, 1.0f)) * (1.0f - fac)); len = z.length(); if (MT_fuzzyZero(len)) z = vect; else z /= len; @@ -1284,12 +1284,12 @@ MT_Scalar KX_GameObject::GetMass() { return m_pPhysicsController->GetMass(); } - return 0.0; + return 0.0f; } MT_Vector3 KX_GameObject::GetLocalInertia() { - MT_Vector3 local_inertia(0.0,0.0,0.0); + MT_Vector3 local_inertia(0.0f,0.0f,0.0f); if (m_pPhysicsController) { local_inertia = m_pPhysicsController->GetLocalInertia(); @@ -1299,7 +1299,7 @@ MT_Vector3 KX_GameObject::GetLocalInertia() MT_Vector3 KX_GameObject::GetLinearVelocity(bool local) { - MT_Vector3 velocity(0.0,0.0,0.0), locvel; + MT_Vector3 velocity(0.0f,0.0f,0.0f), locvel; MT_Matrix3x3 ori; if (m_pPhysicsController) { @@ -1318,7 +1318,7 @@ MT_Vector3 KX_GameObject::GetLinearVelocity(bool local) MT_Vector3 KX_GameObject::GetAngularVelocity(bool local) { - MT_Vector3 velocity(0.0,0.0,0.0), locvel; + MT_Vector3 velocity(0.0f,0.0f,0.0f), locvel; MT_Matrix3x3 ori; if (m_pPhysicsController) { @@ -1341,7 +1341,7 @@ MT_Vector3 KX_GameObject::GetVelocity(const MT_Point3& point) { return m_pPhysicsController->GetVelocity(point); } - return MT_Vector3(0.0,0.0,0.0); + return MT_Vector3(0.0f,0.0f,0.0f); } // scenegraph node stuff @@ -1468,9 +1468,9 @@ void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans) { return; } - scale[0] = 1.0/scale[0]; - scale[1] = 1.0/scale[1]; - scale[2] = 1.0/scale[2]; + scale[0] = 1.0f/scale[0]; + scale[1] = 1.0f/scale[1]; + scale[2] = 1.0f/scale[2]; MT_Matrix3x3 invori = parent->GetWorldOrientation().inverse(); MT_Vector3 newpos = invori*(trans-parent->GetWorldPosition())*scale; NodeSetLocalPosition(MT_Point3(newpos[0],newpos[1],newpos[2])); @@ -2421,7 +2421,7 @@ PyObject *KX_GameObject::pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF CValue *life = self->GetProperty("::timebomb"); if (life) - // this convert the timebomb seconds to frames, hard coded 50.0 (assuming 50fps) + // this convert the timebomb seconds to frames, hard coded 50.0f (assuming 50fps) // value hardcoded in KX_Scene::AddReplicaObject() return PyFloat_FromDouble(life->GetNumber() * 50.0); else @@ -2432,7 +2432,7 @@ PyObject *KX_GameObject::pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF { KX_GameObject* self = static_cast(self_v); PHY_IPhysicsController *spc = self->GetPhysicsController(); - return PyFloat_FromDouble(spc ? spc->GetMass() : 0.0); + return PyFloat_FromDouble(spc ? spc->GetMass() : 0.0f); } int KX_GameObject::pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) @@ -2440,7 +2440,7 @@ int KX_GameObject::pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrd KX_GameObject* self = static_cast(self_v); PHY_IPhysicsController *spc = self->GetPhysicsController(); MT_Scalar val = PyFloat_AsDouble(value); - if (val < 0.0) { /* also accounts for non float */ + if (val < 0.0f) { /* 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; } @@ -2476,7 +2476,7 @@ int KX_GameObject::pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF KX_GameObject* self = static_cast(self_v); PHY_IPhysicsController *spc = self->GetPhysicsController(); MT_Scalar val = PyFloat_AsDouble(value); - if (val < 0.0) { /* also accounts for non float */ + if (val < 0.0f) { /* 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; } @@ -2499,7 +2499,7 @@ int KX_GameObject::pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF KX_GameObject* self = static_cast(self_v); PHY_IPhysicsController *spc = self->GetPhysicsController(); MT_Scalar val = PyFloat_AsDouble(value); - if (val < 0.0) { /* also accounts for non float */ + if (val < 0.0f) { /* 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; } @@ -2976,7 +2976,7 @@ PyObject *KX_GameObject::pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUT if (self->GetSGNode() && (sg_parent = self->GetSGNode()->GetSGParent()) != NULL && sg_parent->IsSlowParent()) { return PyFloat_FromDouble(static_cast(sg_parent->GetParentRelation())->GetTimeOffset()); } else { - return PyFloat_FromDouble(0.0); + return PyFloat_FromDouble(0.0f); } } @@ -2986,7 +2986,7 @@ int KX_GameObject::pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF if (self->GetSGNode()) { MT_Scalar val = PyFloat_AsDouble(value); SG_Node *sg_parent= self->GetSGNode()->GetSGParent(); - if (val < 0.0) { /* also accounts for non float */ + if (val < 0.0f) { /* 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; } @@ -3366,7 +3366,7 @@ PyObject *KX_GameObject::PySetOcclusion(PyObject *args) PyObject *KX_GameObject::PyGetVelocity(PyObject *args) { // only can get the velocity if we have a physics object connected to us... - MT_Point3 point(0.0,0.0,0.0); + MT_Point3 point(0.0f,0.0f,0.0f); PyObject *pypos = NULL; if (!PyArg_ParseTuple(args, "|O:getVelocity", &pypos) || (pypos && !PyVecTo(pypos, point))) @@ -3386,7 +3386,7 @@ PyObject *KX_GameObject::PyGetReactionForce() return PyObjectFrom(dummy_point); #endif - return Py_BuildValue("fff", 0.0, 0.0, 0.0); + return Py_BuildValue("fff", 0.0f, 0.0f, 0.0f); } @@ -3619,8 +3619,8 @@ KX_PYMETHODDEF_DOC_O(KX_GameObject, getVectTo, if (MT_fuzzyZero(distance)) { //cout << "getVectTo() Error: Null vector!\n"; - locToDir = toDir = MT_Vector3(0.0,0.0,0.0); - distance = 0.0; + locToDir = toDir = MT_Vector3(0.0f,0.0f,0.0f); + distance = 0.0f; } else { toDir.normalize(); locToDir = toDir * NodeGetWorldOrientation(); diff --git a/source/gameengine/Ketsji/KX_IPOTransform.h b/source/gameengine/Ketsji/KX_IPOTransform.h index a68292bf9df..a81c432b01e 100644 --- a/source/gameengine/Ketsji/KX_IPOTransform.h +++ b/source/gameengine/Ketsji/KX_IPOTransform.h @@ -38,12 +38,12 @@ class KX_IPOTransform { public: KX_IPOTransform() : - m_position(0.0, 0.0, 0.0), - m_eulerAngles(0.0, 0.0, 0.0), - m_scaling(1.0, 1.0, 1.0), - m_deltaPosition(0.0, 0.0, 0.0), - m_deltaEulerAngles(0.0, 0.0, 0.0), - m_deltaScaling(0.0, 0.0, 0.0) + m_position(0.0f, 0.0f, 0.0f), + m_eulerAngles(0.0f, 0.0f, 0.0f), + m_scaling(1.0f, 1.0f, 1.0f), + m_deltaPosition(0.0f, 0.0f, 0.0f), + m_deltaEulerAngles(0.0f, 0.0f, 0.0f), + m_deltaScaling(0.0f, 0.0f, 0.0f) {} MT_Transform GetTransform() const { @@ -69,9 +69,9 @@ public: void SetScaling(const MT_Vector3& scaling) { m_scaling = scaling; } void ClearDeltaStuff() { - m_deltaPosition.setValue(0.0, 0.0, 0.0); - m_deltaEulerAngles.setValue(0.0, 0.0, 0.0); - m_deltaScaling.setValue(0.0, 0.0, 0.0); + m_deltaPosition.setValue(0.0f, 0.0f, 0.0f); + m_deltaEulerAngles.setValue(0.0f, 0.0f, 0.0f); + m_deltaScaling.setValue(0.0f, 0.0f, 0.0f); } protected: diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index fa924f74290..cb44758c46d 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -143,12 +143,12 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_exitcode(KX_EXIT_REQUEST_NO_REQUEST), m_exitstring(""), - m_cameraZoom(1.0), + m_cameraZoom(1.0f), m_overrideCam(false), m_overrideCamUseOrtho(false), - m_overrideCamNear(0.0), - m_overrideCamFar(0.0), + m_overrideCamNear(0.0f), + m_overrideCamFar(0.0f), m_overrideCamZoom(1.0f), m_stereo(false), @@ -170,9 +170,9 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_hideCursor(false), m_overrideFrameColor(false), - m_overrideFrameColorR(0.0), - m_overrideFrameColorG(0.0), - m_overrideFrameColorB(0.0), + m_overrideFrameColorR(0.0f), + m_overrideFrameColorG(0.0f), + m_overrideFrameColorB(0.0f), m_usedome(false) { @@ -529,8 +529,8 @@ void KX_KetsjiEngine::EndFrame() for (int i = tc_first; i < tc_numCategories; ++i) { double time = m_logger->GetAverage((KX_TimeCategory)i); PyObject *val = PyTuple_New(2); - PyTuple_SetItem(val, 0, PyFloat_FromDouble(time*1000.f)); - PyTuple_SetItem(val, 1, PyFloat_FromDouble(time/tottime * 100.f)); + PyTuple_SetItem(val, 0, PyFloat_FromDouble(time*1000.0)); + PyTuple_SetItem(val, 1, PyFloat_FromDouble(time/tottime * 100.0)); PyDict_SetItemString(m_pyprofiledict, m_profileLabels[i], val); Py_DECREF(val); @@ -607,7 +607,7 @@ bool KX_KetsjiEngine::NextFrame() } double deltatime = m_clockTime - m_frameTime; - if (deltatime<0.f) + if (deltatime<0.0) { // We got here too quickly, which means there is nothing todo, just return and don't render. // Not sure if this is the best fix, but it seems to stop the jumping framerate issue (#33088) @@ -1379,8 +1379,8 @@ void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene) activecam->NodeSetLocalOrientation(camtrans.getBasis()); activecam->NodeUpdateGS(0); } else { - activecam->NodeSetLocalPosition(MT_Point3(0.0, 0.0, 0.0)); - activecam->NodeSetLocalOrientation(MT_Vector3(0.0, 0.0, 0.0)); + activecam->NodeSetLocalPosition(MT_Point3(0.0f, 0.0f, 0.0f)); + activecam->NodeSetLocalOrientation(MT_Vector3(0.0f, 0.0f, 0.0f)); activecam->NodeUpdateGS(0); } @@ -1445,7 +1445,7 @@ void KX_KetsjiEngine::RenderDebugProperties() m_canvas->GetWidth() /* RdV, TODO ?? */, m_canvas->GetHeight() /* RdV, TODO ?? */); - debugtxt.Format("%5.1fms (%.1ffps)", tottime * 1000.f, 1.0/tottime); + debugtxt.Format("%5.1fms (%.1ffps)", tottime * 1000.0f, 1.0f/tottime); m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED, debugtxt.ReadPtr(), xcoord + const_xindent + profile_indent, @@ -1468,14 +1468,14 @@ void KX_KetsjiEngine::RenderDebugProperties() double time = m_logger->GetAverage((KX_TimeCategory)j); - debugtxt.Format("%5.2fms | %d%%", time*1000.f, (int)(time/tottime * 100.f)); + debugtxt.Format("%5.2fms | %d%%", (float)time*1000.f, (int)((float)time/tottime * 100.f)); m_rasterizer->RenderText2D(RAS_IRasterizer::RAS_TEXT_PADDED, debugtxt.ReadPtr(), xcoord + const_xindent + profile_indent, ycoord, m_canvas->GetWidth(), m_canvas->GetHeight()); - m_rasterizer->RenderBox2D(xcoord + (int)(2.2 * profile_indent), ycoord, m_canvas->GetWidth(), m_canvas->GetHeight(), time/tottime); + m_rasterizer->RenderBox2D(xcoord + (int)(2.2f * profile_indent), ycoord, m_canvas->GetWidth(), m_canvas->GetHeight(), (float)time/tottime); ycoord += const_ysize; } } diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index 0dec5715588..b681f10804a 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -231,8 +231,8 @@ int KX_LightObject::pyattr_set_distance(void *self_v, const KX_PYATTRIBUTE_DEF * if (PyFloat_Check(value)) { float val = PyFloat_AsDouble(value); - if (val < 0.01) - val = 0.01; + if (val < 0.01f) + val = 0.01f; else if (val > 5000.f) val = 5000.f; @@ -326,13 +326,13 @@ int KX_LightObject::pyattr_set_spotsize(void *self_v, const KX_PYATTRIBUTE_DEF * KX_LightObject* self = static_cast(self_v); if (PyFloat_Check(value)) { - float val = PyFloat_AsDouble(value); - if (val < 0.f) - val = 0.f; - else if (val > 180.f) - val = 180.f; + double val = PyFloat_AsDouble(value); + if (val < 0.0) + val = 0.0; + else if (val > 180.0) + val = 180.0; - self->m_lightobj->m_spotsize = DEG2RAD(val); + self->m_lightobj->m_spotsize = (float)DEG2RAD(val); return PY_SET_ATTR_SUCCESS; } @@ -350,7 +350,7 @@ int KX_LightObject::pyattr_set_spotblend(void *self_v, const KX_PYATTRIBUTE_DEF KX_LightObject* self = static_cast(self_v); if (PyFloat_Check(value)) { - float val = PyFloat_AsDouble(value); + float val = (float)PyFloat_AsDouble(value); if (val < 0.f) val = 0.f; else if (val > 1.f) diff --git a/source/gameengine/Ketsji/KX_MouseActuator.cpp b/source/gameengine/Ketsji/KX_MouseActuator.cpp index 154ad1da3a1..6aa0d588b50 100644 --- a/source/gameengine/Ketsji/KX_MouseActuator.cpp +++ b/source/gameengine/Ketsji/KX_MouseActuator.cpp @@ -125,8 +125,8 @@ bool KX_MouseActuator::Update() float position[2]; float movement[2]; MT_Vector3 rotation; - float setposition[2] = {0.0}; - float center_x = 0.5, center_y = 0.5; + float setposition[2] = {0.0f}; + float center_x = 0.5f, center_y = 0.5f; getMousePosition(position); @@ -135,14 +135,14 @@ bool KX_MouseActuator::Update() //preventing undesired drifting when resolution is odd if ((m_canvas->GetWidth() % 2) != 0) { - center_x = ((m_canvas->GetWidth() - 1.0) / 2.0) / (m_canvas->GetWidth()); + center_x = ((m_canvas->GetWidth() - 1.0f) / 2.0f) / (m_canvas->GetWidth()); } if ((m_canvas->GetHeight() % 2) != 0) { - center_y = ((m_canvas->GetHeight() - 1.0) / 2.0) / (m_canvas->GetHeight()); + center_y = ((m_canvas->GetHeight() - 1.0f) / 2.0f) / (m_canvas->GetHeight()); } //preventing initial skipping. - if ((m_oldposition[0] <= -0.9) && (m_oldposition[1] <= -0.9)) { + if ((m_oldposition[0] <= -0.9f) && (m_oldposition[1] <= -0.9f)) { if (m_reset_x) { m_oldposition[0] = center_x; @@ -173,21 +173,21 @@ bool KX_MouseActuator::Update() movement[0] -= m_oldposition[0]; } - movement[0] *= -1.0; + movement[0] *= -1.0f; /* Don't apply the rotation when we are under a certain threshold for mouse movement */ - if (((movement[0] > (m_threshold[0] / 10.0)) || - ((movement[0] * (-1.0)) > (m_threshold[0] / 10.0)))) { + if (((movement[0] > (m_threshold[0] / 10.0f)) || + ((movement[0] * (-1.0f)) > (m_threshold[0] / 10.0f)))) { movement[0] *= m_sensitivity[0]; - if ((m_limit_x[0] != 0.0) && ((m_angle[0] + movement[0]) <= m_limit_x[0])) { + if ((m_limit_x[0] != 0.0f) && ((m_angle[0] + movement[0]) <= m_limit_x[0])) { movement[0] = m_limit_x[0] - m_angle[0]; } - if ((m_limit_x[1] != 0.0) && ((m_angle[0] + movement[0]) >= m_limit_x[1])) { + if ((m_limit_x[1] != 0.0f) && ((m_angle[0] + movement[0]) >= m_limit_x[1])) { movement[0] = m_limit_x[1] - m_angle[0]; } @@ -196,17 +196,17 @@ bool KX_MouseActuator::Update() switch (m_object_axis[0]) { case KX_ACT_MOUSE_OBJECT_AXIS_X: { - rotation = MT_Vector3(movement[0], 0.0, 0.0); + rotation = MT_Vector3(movement[0], 0.0f, 0.0f); break; } case KX_ACT_MOUSE_OBJECT_AXIS_Y: { - rotation = MT_Vector3(0.0, movement[0], 0.0); + rotation = MT_Vector3(0.0f, movement[0], 0.0f); break; } case KX_ACT_MOUSE_OBJECT_AXIS_Z: { - rotation = MT_Vector3(0.0, 0.0, movement[0]); + rotation = MT_Vector3(0.0f, 0.0f, movement[0]); break; } default: @@ -231,21 +231,21 @@ bool KX_MouseActuator::Update() movement[1] -= m_oldposition[1]; } - movement[1] *= -1.0; + movement[1] *= -1.0f; /* Don't apply the rotation when we are under a certain threshold for mouse movement */ - if (((movement[1] > (m_threshold[1] / 10.0)) || - ((movement[1] * (-1.0)) > (m_threshold[1] / 10.0)))) { + if (((movement[1] > (m_threshold[1] / 10.0f)) || + ((movement[1] * (-1.0f)) > (m_threshold[1] / 10.0f)))) { movement[1] *= m_sensitivity[1]; - if ((m_limit_y[0] != 0.0) && ((m_angle[1] + movement[1]) <= m_limit_y[0])) { + if ((m_limit_y[0] != 0.0f) && ((m_angle[1] + movement[1]) <= m_limit_y[0])) { movement[1] = m_limit_y[0] - m_angle[1]; } - if ((m_limit_y[1] != 0.0) && ((m_angle[1] + movement[1]) >= m_limit_y[1])) { + if ((m_limit_y[1] != 0.0f) && ((m_angle[1] + movement[1]) >= m_limit_y[1])) { movement[1] = m_limit_y[1] - m_angle[1]; } @@ -255,17 +255,17 @@ bool KX_MouseActuator::Update() { case KX_ACT_MOUSE_OBJECT_AXIS_X: { - rotation = MT_Vector3(movement[1], 0.0, 0.0); + rotation = MT_Vector3(movement[1], 0.0f, 0.0f); break; } case KX_ACT_MOUSE_OBJECT_AXIS_Y: { - rotation = MT_Vector3(0.0, movement[1], 0.0); + rotation = MT_Vector3(0.0f, movement[1], 0.0f); break; } case KX_ACT_MOUSE_OBJECT_AXIS_Z: { - rotation = MT_Vector3(0.0, 0.0, movement[1]); + rotation = MT_Vector3(0.0f, 0.0f, movement[1]); break; } default: @@ -377,7 +377,7 @@ PyAttributeDef KX_MouseActuator::Attributes[] = { KX_PYATTRIBUTE_BOOL_RW("visible", KX_MouseActuator, m_visible), KX_PYATTRIBUTE_BOOL_RW("use_axis_x", KX_MouseActuator, m_use_axis_x), KX_PYATTRIBUTE_BOOL_RW("use_axis_y", KX_MouseActuator, m_use_axis_y), - KX_PYATTRIBUTE_FLOAT_ARRAY_RW("threshold", 0.0, 0.5, KX_MouseActuator, m_threshold, 2), + KX_PYATTRIBUTE_FLOAT_ARRAY_RW("threshold", 0.0f, 0.5f, KX_MouseActuator, m_threshold, 2), KX_PYATTRIBUTE_BOOL_RW("reset_x", KX_MouseActuator, m_reset_x), KX_PYATTRIBUTE_BOOL_RW("reset_y", KX_MouseActuator, m_reset_y), KX_PYATTRIBUTE_INT_ARRAY_RW("object_axis", 0, 2, 1, KX_MouseActuator, m_object_axis, 2), @@ -393,7 +393,7 @@ PyAttributeDef KX_MouseActuator::Attributes[] = { PyObject* KX_MouseActuator::pyattr_get_limit_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_MouseActuator* self= static_cast(self_v); - return Py_BuildValue("[f,f]", (self->m_limit_x[0] / M_PI * 180.0), (self->m_limit_x[1] / M_PI * 180.0)); + return Py_BuildValue("[f,f]", (self->m_limit_x[0] / (float)M_PI * 180.0f), (self->m_limit_x[1] / (float)M_PI * 180.0f)); } int KX_MouseActuator::pyattr_set_limit_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) @@ -414,8 +414,8 @@ int KX_MouseActuator::pyattr_set_limit_x(void *self_v, const KX_PYATTRIBUTE_DEF return PY_SET_ATTR_FAIL; } else { - self->m_limit_x[0] = (PyFloat_AsDouble(item1) * M_PI / 180.0); - self->m_limit_x[1] = (PyFloat_AsDouble(item2) * M_PI / 180.0); + self->m_limit_x[0] = (float)((PyFloat_AsDouble(item1) * M_PI) / 180.0f); + self->m_limit_x[1] = (float)((PyFloat_AsDouble(item2) * M_PI) / 180.0f); } return PY_SET_ATTR_SUCCESS; @@ -424,7 +424,7 @@ int KX_MouseActuator::pyattr_set_limit_x(void *self_v, const KX_PYATTRIBUTE_DEF PyObject* KX_MouseActuator::pyattr_get_limit_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_MouseActuator* self= static_cast(self_v); - return Py_BuildValue("[f,f]", (self->m_limit_y[0] / M_PI * 180.0), (self->m_limit_y[1] / M_PI * 180.0)); + return Py_BuildValue("[f,f]", (self->m_limit_y[0] / (float)M_PI * 180.0f), (self->m_limit_y[1] / (float)M_PI * 180.0f)); } int KX_MouseActuator::pyattr_set_limit_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) @@ -445,8 +445,8 @@ int KX_MouseActuator::pyattr_set_limit_y(void *self_v, const KX_PYATTRIBUTE_DEF return PY_SET_ATTR_FAIL; } else { - self->m_limit_y[0] = (PyFloat_AsDouble(item1) * M_PI / 180.0); - self->m_limit_y[1] = (PyFloat_AsDouble(item2) * M_PI / 180.0); + self->m_limit_y[0] = (float)((PyFloat_AsDouble(item1) * M_PI) / 180.0f); + self->m_limit_y[1] = (float)((PyFloat_AsDouble(item2) * M_PI) / 180.0f); } return PY_SET_ATTR_SUCCESS; @@ -455,7 +455,7 @@ int KX_MouseActuator::pyattr_set_limit_y(void *self_v, const KX_PYATTRIBUTE_DEF PyObject* KX_MouseActuator::pyattr_get_angle(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_MouseActuator* self= static_cast(self_v); - return Py_BuildValue("[f,f]", (self->m_angle[0] / M_PI * 180.0), (self->m_angle[1] / M_PI * 180.0)); + return Py_BuildValue("[f,f]", (self->m_angle[0] / (float)M_PI * 180.0f), (self->m_angle[1] / (float)M_PI * 180.0f)); } int KX_MouseActuator::pyattr_set_angle(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) @@ -476,8 +476,8 @@ int KX_MouseActuator::pyattr_set_angle(void *self_v, const KX_PYATTRIBUTE_DEF *a return PY_SET_ATTR_FAIL; } else { - self->m_angle[0] = (PyFloat_AsDouble(item1) * M_PI / 180.0); - self->m_angle[1] = (PyFloat_AsDouble(item2) * M_PI / 180.0); + self->m_angle[0] = ((float)(PyFloat_AsDouble(item1) * M_PI) / 180.0f); + self->m_angle[1] = ((float)(PyFloat_AsDouble(item2) * M_PI) / 180.0f); } return PY_SET_ATTR_SUCCESS; @@ -491,17 +491,17 @@ PyObject* KX_MouseActuator::PyReset() switch (m_object_axis[0]) { case KX_ACT_MOUSE_OBJECT_AXIS_X: { - rotation = MT_Vector3(-1.0 * m_angle[0], 0.0, 0.0); + rotation = MT_Vector3(-1.0f * m_angle[0], 0.0f, 0.0f); break; } case KX_ACT_MOUSE_OBJECT_AXIS_Y: { - rotation = MT_Vector3(0.0, -1.0 * m_angle[0], 0.0); + rotation = MT_Vector3(0.0f, -1.0f * m_angle[0], 0.0f); break; } case KX_ACT_MOUSE_OBJECT_AXIS_Z: { - rotation = MT_Vector3(0.0, 0.0, -1.0 * m_angle[0]); + rotation = MT_Vector3(0.0f, 0.0f, -1.0f * m_angle[0]); break; } default: @@ -512,17 +512,17 @@ PyObject* KX_MouseActuator::PyReset() switch (m_object_axis[1]) { case KX_ACT_MOUSE_OBJECT_AXIS_X: { - rotation = MT_Vector3(-1.0 * m_angle[1], 0.0, 0.0); + rotation = MT_Vector3(-1.0f * m_angle[1], 0.0f, 0.0f); break; } case KX_ACT_MOUSE_OBJECT_AXIS_Y: { - rotation = MT_Vector3(0.0, -1.0 * m_angle[1], 0.0); + rotation = MT_Vector3(0.0f, -1.0f * m_angle[1], 0.0f); break; } case KX_ACT_MOUSE_OBJECT_AXIS_Z: { - rotation = MT_Vector3(0.0, 0.0, -1.0 * m_angle[1]); + rotation = MT_Vector3(0.0f, 0.0f, -1.0f * m_angle[1]); break; } default: @@ -530,8 +530,8 @@ PyObject* KX_MouseActuator::PyReset() } parent->ApplyRotation(rotation, m_local_y); - m_angle[0] = 0.0; - m_angle[1] = 0.0; + m_angle[0] = 0.0f; + m_angle[1] = 0.0f; Py_RETURN_NONE; } diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index db2cb1fdcfd..451078d4a36 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -314,15 +314,15 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) * The actual z coordinates used don't have to be exact just infront and * behind of the near and far clip planes. */ - frompoint.setValue( (2 * (m_x-x_lb) / width) - 1.0, - 1.0 - (2 * (m_y_inv - y_lb) / height), - -1.0, - 1.0 ); + frompoint.setValue( (2 * (m_x-x_lb) / width) - 1.0f, + 1.0f - (2 * (m_y_inv - y_lb) / height), + -1.0f, + 1.0f ); - topoint.setValue( (2 * (m_x-x_lb) / width) - 1.0, - 1.0 - (2 * (m_y_inv-y_lb) / height), - 1.0, - 1.0 ); + topoint.setValue( (2 * (m_x-x_lb) / width) - 1.0f, + 1.0f - (2 * (m_y_inv-y_lb) / height), + 1.0f, + 1.0f ); /* camera to world */ MT_Matrix4x4 camcs_wcs_matrix = MT_Matrix4x4(cam->GetCameraToWorld()); diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp index 762148d8f76..87c2592ecfd 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp +++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp @@ -65,12 +65,12 @@ KX_ObjectActuator( m_drot(drot), m_linear_velocity(linV), m_angular_velocity(angV), - m_linear_length2(0.0), - m_current_linear_factor(0.0), - m_current_angular_factor(0.0), + m_linear_length2(0.0f), + m_current_linear_factor(0.0f), + m_current_angular_factor(0.0f), m_damping(damping), - m_previous_error(0.0,0.0,0.0), - m_error_accumulator(0.0,0.0,0.0), + m_previous_error(0.0f,0.0f,0.0f), + m_error_accumulator(0.0f,0.0f,0.0f), m_bitLocalFlag (flag), m_reference(refobj), m_active_combined_velocity (false), @@ -134,13 +134,13 @@ bool KX_ObjectActuator::Update() // Explicitly stop the movement if we're using character motion if (m_bitLocalFlag.CharacterMotion) { - character->SetWalkDirection(MT_Vector3 (0.0, 0.0, 0.0)); + character->SetWalkDirection(MT_Vector3 (0.0f, 0.0f, 0.0f)); } m_linear_damping_active = false; m_angular_damping_active = false; - m_error_accumulator.setValue(0.0,0.0,0.0); - m_previous_error.setValue(0.0,0.0,0.0); + m_error_accumulator.setValue(0.0f,0.0f,0.0f); + m_previous_error.setValue(0.0f,0.0f,0.0f); m_jumping = false; return false; @@ -299,10 +299,10 @@ bool KX_ObjectActuator::Update() m_current_linear_factor = linV.dot(m_linear_velocity)/m_linear_length2; m_linear_damping_active = true; } - if (m_current_linear_factor < 1.0) - m_current_linear_factor += 1.0/m_damping; - if (m_current_linear_factor > 1.0) - m_current_linear_factor = 1.0; + if (m_current_linear_factor < 1.0f) + m_current_linear_factor += 1.0f/m_damping; + if (m_current_linear_factor > 1.0f) + m_current_linear_factor = 1.0f; linV = m_current_linear_factor * m_linear_velocity; parent->setLinearVelocity(linV,(m_bitLocalFlag.LinearVelocity) != 0); } else { @@ -327,10 +327,10 @@ bool KX_ObjectActuator::Update() m_current_angular_factor = angV.dot(m_angular_velocity)/m_angular_length2; m_angular_damping_active = true; } - if (m_current_angular_factor < 1.0) - m_current_angular_factor += 1.0/m_damping; - if (m_current_angular_factor > 1.0) - m_current_angular_factor = 1.0; + if (m_current_angular_factor < 1.0f) + m_current_angular_factor += 1.0f/m_damping; + if (m_current_angular_factor > 1.0f) + m_current_angular_factor = 1.0f; angV = m_current_angular_factor * m_angular_velocity; parent->setAngularVelocity(angV,(m_bitLocalFlag.AngularVelocity) != 0); } else { diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h index b5622d97611..919c6acf03b 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.h +++ b/source/gameengine/Ketsji/KX_ObjectActuator.h @@ -161,9 +161,9 @@ public: m_bitLocalFlag.ZeroDLoc = MT_fuzzyZero(m_dloc); m_bitLocalFlag.ZeroDRot = MT_fuzzyZero(m_drot); m_bitLocalFlag.ZeroLinearVelocity = MT_fuzzyZero(m_linear_velocity); - m_linear_length2 = (m_bitLocalFlag.ZeroLinearVelocity) ? 0.0 : m_linear_velocity.length2(); + m_linear_length2 = (m_bitLocalFlag.ZeroLinearVelocity) ? 0.0f : m_linear_velocity.length2(); m_bitLocalFlag.ZeroAngularVelocity = MT_fuzzyZero(m_angular_velocity); - m_angular_length2 = (m_bitLocalFlag.ZeroAngularVelocity) ? 0.0 : m_angular_velocity.length2(); + m_angular_length2 = (m_bitLocalFlag.ZeroAngularVelocity) ? 0.0f : m_angular_velocity.length2(); } virtual bool Update(); diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp index 456f5f8af3b..239bfde4c98 100644 --- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp +++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp @@ -302,7 +302,7 @@ void KX_ObstacleSimulation::DrawObstacles() if (!m_enableVisualization) return; static const MT_Vector3 bluecolor(0,0,1); - static const MT_Vector3 normal(0.0, 0.0, 1.0); + static const MT_Vector3 normal(0.0f, 0.0f, 1.0f); static const int SECTORS_NUM = 32; for (size_t i=0; im_pos, otherObst); - if ( fabs(activeObst->m_pos.z() - p.z()) > levelHeight) + if ( fabsf(activeObst->m_pos.z() - p.z()) > levelHeight) return false; return true; @@ -459,14 +459,14 @@ void KX_ObstacleSimulationTOI_rays::sampleRVO(KX_Obstacle* activeObst, KX_NavMes { // Calculate sample velocity const float ndir = ((float)iter/(float)m_maxSamples) - aoff; - const float dir = odir+ndir*M_PI*2; + const float dir = odir+ndir*(float)M_PI*2.0f; MT_Vector2 svel; svel.x() = cosf(dir) * vmax; svel.y() = sinf(dir) * vmax; // Find min time of impact and exit amongst all obstacles. float tmin = m_maxToi; - float tmine = 0; + float tmine = 0.0f; for (int i = 0; i < nobs; ++i) { KX_Obstacle* ob = m_obstacles[i]; diff --git a/source/gameengine/Ketsji/KX_RadarSensor.cpp b/source/gameengine/Ketsji/KX_RadarSensor.cpp index 732bcdc3773..861e3f70296 100644 --- a/source/gameengine/Ketsji/KX_RadarSensor.cpp +++ b/source/gameengine/Ketsji/KX_RadarSensor.cpp @@ -104,42 +104,42 @@ void KX_RadarSensor::SynchronizeTransform() { MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(90)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0f, 0)); break; }; case SENS_RADAR_Y_AXIS: // +Y Axis { MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0f, 0)); break; }; case SENS_RADAR_Z_AXIS: // +Z Axis { MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-90)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0f, 0)); break; }; case SENS_RADAR_NEG_X_AXIS: // -X Axis { MT_Quaternion rotquatje(MT_Vector3(0,0,1),MT_radians(-90)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0f, 0)); break; }; case SENS_RADAR_NEG_Y_AXIS: // -Y Axis { //MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(-180)); //trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0f, 0)); break; }; case SENS_RADAR_NEG_Z_AXIS: // -Z Axis { MT_Quaternion rotquatje(MT_Vector3(1,0,0),MT_radians(90)); trans.rotate(rotquatje); - trans.translate(MT_Vector3 (0, -m_coneheight/2.0, 0)); + trans.translate(MT_Vector3 (0, -m_coneheight/2.0f, 0)); break; }; default: @@ -154,7 +154,7 @@ void KX_RadarSensor::SynchronizeTransform() m_cone_origin[1] = temp[1]; m_cone_origin[2] = temp[2]; - temp = trans(MT_Point3(0, -m_coneheight/2.0, 0)); + temp = trans(MT_Point3(0, -m_coneheight/2.0f, 0)); m_cone_target[0] = temp[0]; m_cone_target[1] = temp[1]; m_cone_target[2] = temp[2]; diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp index 333e7b57d67..478019c6304 100644 --- a/source/gameengine/Ketsji/KX_RayCast.cpp +++ b/source/gameengine/Ketsji/KX_RayCast.cpp @@ -103,11 +103,11 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_ // but it would require some change in Bullet. prevpoint = callback.m_hitPoint; /* We add 0.001 of fudge, so that if the margin && radius == 0.0, we don't endless loop. */ - MT_Scalar marg = 0.001 + hit_controller->GetMargin(); + MT_Scalar marg = 0.001f + hit_controller->GetMargin(); marg *= 2.f; /* Calculate the other side of this object */ MT_Scalar h = MT_abs(todir.dot(callback.m_hitNormal)); - if (h <= 0.01) + if (h <= 0.01f) // the normal is almost orthogonal to the ray direction, cannot compute the other side break; marg /= h; diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp index 96e1cc29de3..a4220424c6f 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp @@ -73,7 +73,7 @@ PyMethodDef KX_SCA_DynamicActuator::Methods[] = { PyAttributeDef KX_SCA_DynamicActuator::Attributes[] = { KX_PYATTRIBUTE_SHORT_RW("mode",0,4,false,KX_SCA_DynamicActuator,m_dyn_operation), - KX_PYATTRIBUTE_FLOAT_RW("mass",0.0,FLT_MAX,KX_SCA_DynamicActuator,m_setmass), + KX_PYATTRIBUTE_FLOAT_RW("mass",0.0f,FLT_MAX,KX_SCA_DynamicActuator,m_setmass), { NULL } //Sentinel }; diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp index 19b9d13087d..5a13cf5440d 100644 --- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp +++ b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp @@ -89,7 +89,7 @@ UpdateChildCoordinates( { // Get the child's transform, and the bone matrix. MT_Matrix4x4 child_transform ( - MT_Transform(child_pos + MT_Vector3(0.0, armature->GetBoneLength(m_bone), 0.0), + MT_Transform(child_pos + MT_Vector3(0.0f, armature->GetBoneLength(m_bone), 0.0f), child_rotation.scaled( child_scale[0], child_scale[1], @@ -107,7 +107,7 @@ UpdateChildCoordinates( child_w_rotation.setValue(child_transform[0][0], child_transform[0][1], child_transform[0][2], child_transform[1][0], child_transform[1][1], child_transform[1][2], child_transform[2][0], child_transform[2][1], child_transform[2][2]); - child_w_rotation.scale(1.0/child_w_scale[0], 1.0/child_w_scale[1], 1.0/child_w_scale[2]); + child_w_rotation.scale(1.0f/child_w_scale[0], 1.0f/child_w_scale[1], 1.0f/child_w_scale[2]); child_w_pos = MT_Point3(child_transform[0][3], child_transform[1][3], child_transform[2][3]); diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 350bad0a336..9eb9066d56f 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -898,7 +898,7 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, m_tempObjectList->Add(replica->AddRef()); // this convert the life from frames to sort-of seconds, hard coded 0.02 that assumes we have 50 frames per second // if you change this value, make sure you change it in KX_GameObject::pyattr_get_life property too - CValue *fval = new CFloatValue(lifespan*0.02); + CValue *fval = new CFloatValue(lifespan*0.02f); replica->SetProperty("::timebomb",fval); fval->Release(); } @@ -1588,7 +1588,7 @@ void KX_Scene::LogicBeginFrame(double curtime) if (propval) { - float timeleft = propval->GetNumber() - 1.0/KX_KetsjiEngine::GetTicRate(); + float timeleft = (float)(propval->GetNumber() - 1.0/KX_KetsjiEngine::GetTicRate()); if (timeleft > 0) { @@ -1827,9 +1827,9 @@ void KX_Scene::UpdateObjectActivity(void) * Manhattan distance. */ MT_Point3 obpos = ob->NodeGetWorldPosition(); - if ((fabs(camloc[0] - obpos[0]) > m_activity_box_radius) || - (fabs(camloc[1] - obpos[1]) > m_activity_box_radius) || - (fabs(camloc[2] - obpos[2]) > m_activity_box_radius) ) + if ((fabsf(camloc[0] - obpos[0]) > m_activity_box_radius) || + (fabsf(camloc[1] - obpos[1]) > m_activity_box_radius) || + (fabsf(camloc[2] - obpos[2]) > m_activity_box_radius) ) { ob->Suspend(); } @@ -1843,8 +1843,8 @@ void KX_Scene::UpdateObjectActivity(void) void KX_Scene::SetActivityCullingRadius(float f) { - if (f < 0.5) - f = 0.5; + if (f < 0.5f) + f = 0.5f; m_activity_box_radius = f; } diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index f6f09dd3bda..1c42d65ae75 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -379,7 +379,7 @@ PyObject *KX_SoundActuator::pyattr_get_3d_property(void *self, const struct KX_P { KX_SoundActuator * actuator = static_cast (self); const char* prop = attrdef->m_name; - float result_value = 0.0; + float result_value = 0.0f; if (!strcmp(prop, "volume_maximum")) { result_value = actuator->m_3d.max_gain; @@ -416,7 +416,7 @@ PyObject *KX_SoundActuator::pyattr_get_3d_property(void *self, const struct KX_P PyObject *KX_SoundActuator::pyattr_get_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef) { KX_SoundActuator * actuator = static_cast (self); - float position = 0.0; + float position = 0.0f; if (actuator->m_handle) position = AUD_Handle_getPosition(actuator->m_handle); @@ -459,7 +459,7 @@ int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRI { KX_SoundActuator * actuator = static_cast (self); const char* prop = attrdef->m_name; - float prop_value = 0.0; + float prop_value = 0.0f; if (!PyArg_Parse(value, "f", &prop_value)) return PY_SET_ATTR_FAIL; @@ -519,7 +519,7 @@ int KX_SoundActuator::pyattr_set_audposition(void *self, const struct KX_PYATTRI { KX_SoundActuator * actuator = static_cast (self); - float position = 1.0; + float position = 1.0f; if (!PyArg_Parse(value, "f", &position)) return PY_SET_ATTR_FAIL; @@ -530,7 +530,7 @@ int KX_SoundActuator::pyattr_set_audposition(void *self, const struct KX_PYATTRI int KX_SoundActuator::pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { - float gain = 1.0; + float gain = 1.0f; KX_SoundActuator * actuator = static_cast (self); if (!PyArg_Parse(value, "f", &gain)) return PY_SET_ATTR_FAIL; @@ -544,7 +544,7 @@ int KX_SoundActuator::pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DE int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { - float pitch = 1.0; + float pitch = 1.0f; KX_SoundActuator * actuator = static_cast (self); if (!PyArg_Parse(value, "f", &pitch)) return PY_SET_ATTR_FAIL; diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.cpp b/source/gameengine/Ketsji/KX_SteeringActuator.cpp index cd2cd2bae0b..af2a2b30b84 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.cpp +++ b/source/gameengine/Ketsji/KX_SteeringActuator.cpp @@ -169,8 +169,8 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) if (m_posevent && !m_isActive) { - delta = 0; - m_pathUpdateTime = -1; + delta = 0.0; + m_pathUpdateTime = -1.0; m_updateTime = curtime; m_isActive = true; } @@ -191,8 +191,8 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) const MT_Point3& targpos = m_target->NodeGetWorldPosition(); MT_Vector3 vectotarg = targpos - mypos; MT_Vector3 vectotarg2d = vectotarg; - vectotarg2d.z() = 0; - m_steerVec = MT_Vector3(0, 0, 0); + vectotarg2d.z() = 0.0f; + m_steerVec = MT_Vector3(0.0f, 0.0f, 0.0f); bool apply_steerforce = false; bool terminate = true; @@ -220,10 +220,10 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) { terminate = false; - static const MT_Scalar WAYPOINT_RADIUS(0.25); + static const MT_Scalar WAYPOINT_RADIUS(0.25f); if (m_pathUpdateTime<0 || (m_pathUpdatePeriod>=0 && - curtime - m_pathUpdateTime>((double)m_pathUpdatePeriod/1000))) + curtime - m_pathUpdateTime>((double)m_pathUpdatePeriod/1000.0))) { m_pathUpdateTime = curtime; m_pathLen = m_navmesh->FindPath(mypos, targpos, m_path, MAX_PATH_LENGTH); @@ -252,7 +252,7 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) if (m_enableVisualization) { //debug draw - static const MT_Vector3 PATH_COLOR(1,0,0); + static const MT_Vector3 PATH_COLOR(1.0f,0.0f,0.0f); m_navmesh->DrawPath(m_path, m_pathLen, PATH_COLOR); } } @@ -274,11 +274,11 @@ bool KX_SteeringActuator::Update(double curtime, bool frame) if (m_simulation && m_obstacle /*&& !newvel.fuzzyZero()*/) { if (m_enableVisualization) - KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(1.0, 0.0, 0.0)); + KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(1.0f, 0.0f, 0.0f)); m_simulation->AdjustObstacleVelocity(m_obstacle, m_mode!=KX_STEERING_PATHFOLLOWING ? m_navmesh : NULL, - newvel, m_acceleration*delta, m_turnspeed/180.0f*M_PI*delta); + newvel, m_acceleration*(float)delta, m_turnspeed/(180.0f*(float)(M_PI*delta))); if (m_enableVisualization) - KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(0.0, 1.0, 0.0)); + KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(0.0f, 1.0f, 0.0f)); } HandleActorFace(newvel); diff --git a/source/gameengine/Ketsji/KX_TimeLogger.cpp b/source/gameengine/Ketsji/KX_TimeLogger.cpp index 1a0d3d28d4c..12106245c4d 100644 --- a/source/gameengine/Ketsji/KX_TimeLogger.cpp +++ b/source/gameengine/Ketsji/KX_TimeLogger.cpp @@ -109,7 +109,7 @@ double KX_TimeLogger::GetAverage(void) const for (unsigned int i = 1; i < numMeasurements; i++) { avg += m_measurements[i]; } - avg /= (float)numMeasurements - 1; + avg /= (double)numMeasurements - 1.0; } return avg; diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp index 3ed8eba759f..651cc473640 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp +++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp @@ -131,7 +131,7 @@ static void Mat3ToEulOld(MT_Matrix3x3 mat, float eul[3]) else { eul[0] = atan2f(-mat[2][1], mat[1][1]); eul[1] = atan2f(-mat[0][2], cy); - eul[2] = 0.0; + eul[2] = 0.0f; } } @@ -196,8 +196,8 @@ static float basis_cross(int n, int m) static MT_Matrix3x3 vectomat(MT_Vector3 vec, short axis, short upflag, short threedimup) { MT_Matrix3x3 mat; - MT_Vector3 y(MT_Scalar(0.0), MT_Scalar(1.0), MT_Scalar(0.0)); - MT_Vector3 z(MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(1.0)); /* world Z axis is the global up axis */ + MT_Vector3 y(MT_Scalar(0.0f), MT_Scalar(1.0f), MT_Scalar(0.0f)); + MT_Vector3 z(MT_Scalar(0.0f), MT_Scalar(0.0f), MT_Scalar(1.0f)); /* world Z axis is the global up axis */ MT_Vector3 proj; MT_Vector3 right; MT_Scalar mul; @@ -208,7 +208,7 @@ static MT_Matrix3x3 vectomat(MT_Vector3 vec, short axis, short upflag, short thr /* if 2D doesn't move the up vector */ if (!threedimup){ - vec.setValue(MT_Scalar(vec[0]), MT_Scalar(vec[1]), MT_Scalar(0.0)); + vec.setValue(MT_Scalar(vec[0]), MT_Scalar(vec[1]), MT_Scalar(0.0f)); vec = (vec - z.dot(vec)*z).safe_normalized_vec(z); } diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp index cd1c9eed91b..40f4c462801 100644 --- a/source/gameengine/Ketsji/KX_VertexProxy.cpp +++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp @@ -198,7 +198,7 @@ PyObject *KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DE KX_VertexProxy* self = static_cast(self_v); const unsigned char *colp = self->m_vertex->getRGBA(); MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]); - color /= 255.0; + color /= 255.0f; return PyObjectFrom(color); } @@ -321,7 +321,7 @@ int KX_VertexProxy::pyattr_set_r(void *self_v, const struct KX_PYATTRIBUTE_DEF * float val = PyFloat_AsDouble(value); unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA()); unsigned char *cp = (unsigned char*) &icol; - val *= 255.0; + val *= 255.0f; cp[0] = (unsigned char) val; self->m_vertex->SetRGBA(icol); self->m_mesh->SetMeshModified(true); @@ -338,7 +338,7 @@ int KX_VertexProxy::pyattr_set_g(void *self_v, const struct KX_PYATTRIBUTE_DEF * float val = PyFloat_AsDouble(value); unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA()); unsigned char *cp = (unsigned char*) &icol; - val *= 255.0; + val *= 255.0f; cp[1] = (unsigned char) val; self->m_vertex->SetRGBA(icol); self->m_mesh->SetMeshModified(true); @@ -355,7 +355,7 @@ int KX_VertexProxy::pyattr_set_b(void *self_v, const struct KX_PYATTRIBUTE_DEF * float val = PyFloat_AsDouble(value); unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA()); unsigned char *cp = (unsigned char*) &icol; - val *= 255.0; + val *= 255.0f; cp[2] = (unsigned char) val; self->m_vertex->SetRGBA(icol); self->m_mesh->SetMeshModified(true); @@ -372,7 +372,7 @@ int KX_VertexProxy::pyattr_set_a(void *self_v, const struct KX_PYATTRIBUTE_DEF * float val = PyFloat_AsDouble(value); unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA()); unsigned char *cp = (unsigned char*) &icol; - val *= 255.0; + val *= 255.0f; cp[3] = (unsigned char) val; self->m_vertex->SetRGBA(icol); self->m_mesh->SetMeshModified(true); -- cgit v1.2.3