diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-11 12:15:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-11 12:15:13 +0400 |
commit | b4a0152e76683dfb170c3e2796e15e1b5b67e2ab (patch) | |
tree | 15466a4e658f8fd42d55b9748bbeb6f02c12ba30 /source/gameengine | |
parent | 9ae0523921fa4baeb37bcdd36f208da952f4337f (diff) |
code cleanup: float formatting was confusing in some cases - eg: (0.,0.,0.)
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_DeformableGameObject.h | 2 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_System.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Camera.cpp | 12 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_ObstacleSimulation.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_RayCast.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SteeringActuator.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_TimeLogger.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdGraphicController.cpp | 12 | ||||
-rw-r--r-- | source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/SceneGraph/SG_BBox.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/SceneGraph/SG_BBox.h | 2 |
12 files changed, 26 insertions, 26 deletions
diff --git a/source/gameengine/Converter/BL_DeformableGameObject.h b/source/gameengine/Converter/BL_DeformableGameObject.h index b86069bca1b..d0fe741672d 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.h +++ b/source/gameengine/Converter/BL_DeformableGameObject.h @@ -70,7 +70,7 @@ public: KX_GameObject(sgReplicationInfo,callbacks), m_pDeformer(NULL), m_activeAct(NULL), - m_lastframe(0.), + m_lastframe(0.0), m_blendobj(blendobj), m_activePriority(9999) { diff --git a/source/gameengine/GamePlayer/ghost/GPG_System.cpp b/source/gameengine/GamePlayer/ghost/GPG_System.cpp index d5e45029679..6710572d843 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_System.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_System.cpp @@ -46,7 +46,7 @@ double GPG_System::GetTimeInSeconds() { GHOST_TInt64 millis = (GHOST_TInt64)m_system->getMilliSeconds(); double time = (double)millis; - time /= 1000.; + time /= 1000.0f; return time; } diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp index 0aaedd4d83b..a9602d16430 100644 --- a/source/gameengine/Ketsji/KX_Camera.cpp +++ b/source/gameengine/Ketsji/KX_Camera.cpp @@ -306,14 +306,14 @@ void KX_Camera::ExtractFrustumSphere() 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.);// center of far cliping plane 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_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., 1., 1., 1.); + MT_Vector4 npoint(1.0, 1.0, 1.0, 1.0); MT_Vector4 hpoint; MT_Point3 point; MT_Scalar len; @@ -337,7 +337,7 @@ void KX_Camera::ExtractFrustumSphere() // the far center is the average of the far clipping points farcenter *= 0.25; // the extreme near point is the opposite point on the near clipping plane - nfar.setValue(-nfar[0], -nfar[1], -1., 1.); + nfar.setValue(-nfar[0], -nfar[1], -1.0, 1.0); nfar = clip_camcs_matrix*nfar; nearpoint.setValue(nfar[0]/nfar[3], nfar[1]/nfar[3], nfar[2]/nfar[3]); // this is a frustrum projection @@ -362,7 +362,7 @@ void KX_Camera::ExtractFrustumSphere() { // orthographic projection // The most extreme points on the near and far plane. (normalized device coords) - MT_Vector4 hnear(1., 1., 1., 1.), hfar(-1., -1., -1., 1.); + MT_Vector4 hnear(1.0, 1.0, 1.0, 1.0), hfar(-1.0, -1.0, -1.0, 1.0); // Transform to hom camera local space hnear = clip_camcs_matrix*hnear; @@ -389,7 +389,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.) + 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) return false; } return true; @@ -407,7 +407,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.) + 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) behindCount++; } diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp index f9d60c57adc..b8169899c78 100644 --- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp +++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp @@ -343,7 +343,7 @@ void KX_ObstacleSimulation::DrawObstacles() if (!m_enableVisualization) return; static const MT_Vector3 bluecolor(0,0,1); - static const MT_Vector3 normal(0.,0.,1.); + static const MT_Vector3 normal(0.0, 0.0, 1.0); static const int SECTORS_NUM = 32; for (size_t i=0; i<m_obstacles.size(); i++) { diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp index 29e9fb5bca0..459600f2e34 100644 --- a/source/gameengine/Ketsji/KX_RayCast.cpp +++ b/source/gameengine/Ketsji/KX_RayCast.cpp @@ -103,7 +103,7 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_ // Note that retrieving in a single shot multiple hit points would be possible // 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., we don't endless loop. */ + /* 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(); marg *= 2.f; /* Calculate the other side of this object */ diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.cpp b/source/gameengine/Ketsji/KX_SteeringActuator.cpp index f3aecd9e0ba..dd2ff2e305a 100644 --- a/source/gameengine/Ketsji/KX_SteeringActuator.cpp +++ b/source/gameengine/Ketsji/KX_SteeringActuator.cpp @@ -266,11 +266,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.)); + KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(1.0, 0.0, 0.0)); m_simulation->AdjustObstacleVelocity(m_obstacle, m_mode!=KX_STEERING_PATHFOLLOWING ? m_navmesh : NULL, newvel, m_acceleration*delta, m_turnspeed/180.0f*M_PI*delta); if (m_enableVisualization) - KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(0.,1.,0.)); + KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(0.0, 1.0, 0.0)); } HandleActorFace(newvel); diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp b/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp index 2b09fe09fc1..13717993c4c 100644 --- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp +++ b/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp @@ -120,7 +120,7 @@ double KX_TimeCategoryLogger::GetAverage(TimeCategory tc) double KX_TimeCategoryLogger::GetAverage(void) { - double time = 0.; + double time = 0.0; KX_TimeLoggerMap::iterator it; for (it = m_loggers.begin(); it != m_loggers.end(); it++) { diff --git a/source/gameengine/Ketsji/KX_TimeLogger.cpp b/source/gameengine/Ketsji/KX_TimeLogger.cpp index e0aea45291c..1a0d3d28d4c 100644 --- a/source/gameengine/Ketsji/KX_TimeLogger.cpp +++ b/source/gameengine/Ketsji/KX_TimeLogger.cpp @@ -87,7 +87,7 @@ void KX_TimeLogger::NextMeasurement(double now) EndLog(now); // Add a new measurement at the front - double m = 0.; + double m = 0.0; m_measurements.push_front(m); // Remove measurement if we grow beyond the maximum size @@ -102,7 +102,7 @@ void KX_TimeLogger::NextMeasurement(double now) double KX_TimeLogger::GetAverage(void) const { - double avg = 0.; + double avg = 0.0; unsigned int numMeasurements = m_measurements.size(); if (numMeasurements > 1) { diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp index 92cba6e9afc..36e7b0d482f 100644 --- a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp +++ b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp @@ -86,12 +86,12 @@ void CcdGraphicController::getAabb(btVector3& aabbMin, btVector3& aabbMax) btVector3 tmpAabbMin = m_localAabbMin * scale; btVector3 tmpAabbMax = m_localAabbMax * scale; - localAabbMin[0] = (scale.getX() >= 0.) ? tmpAabbMin[0] : tmpAabbMax[0]; - localAabbMin[1] = (scale.getY() >= 0.) ? tmpAabbMin[1] : tmpAabbMax[1]; - localAabbMin[2] = (scale.getZ() >= 0.) ? tmpAabbMin[2] : tmpAabbMax[2]; - localAabbMax[0] = (scale.getX() <= 0.) ? tmpAabbMin[0] : tmpAabbMax[0]; - localAabbMax[1] = (scale.getY() <= 0.) ? tmpAabbMin[1] : tmpAabbMax[1]; - localAabbMax[2] = (scale.getZ() <= 0.) ? tmpAabbMin[2] : tmpAabbMax[2]; + localAabbMin[0] = (scale.getX() >= 0.0) ? tmpAabbMin[0] : tmpAabbMax[0]; + localAabbMin[1] = (scale.getY() >= 0.0) ? tmpAabbMin[1] : tmpAabbMax[1]; + localAabbMin[2] = (scale.getZ() >= 0.0) ? tmpAabbMin[2] : tmpAabbMax[2]; + localAabbMax[0] = (scale.getX() <= 0.0) ? tmpAabbMin[0] : tmpAabbMax[0]; + localAabbMax[1] = (scale.getY() <= 0.0) ? tmpAabbMin[1] : tmpAabbMax[1]; + localAabbMax[2] = (scale.getZ() <= 0.0) ? tmpAabbMin[2] : tmpAabbMax[2]; btVector3 localHalfExtents = btScalar(0.5)*(localAabbMax-localAabbMin); btVector3 localCenter = btScalar(0.5)*(localAabbMax+localAabbMin); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index d1713462224..7db433b5b4f 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -393,7 +393,7 @@ void RAS_OpenGLRasterizer::FlushDebugShapes() glBegin(GL_LINE_LOOP); glColor4f(m_debugShapes[i].m_color[0],m_debugShapes[i].m_color[1],m_debugShapes[i].m_color[2],1.f); - static const MT_Vector3 worldUp(0.,0.,1.); + static const MT_Vector3 worldUp(0.0, 0.0, 1.0); MT_Vector3 norm = m_debugShapes[i].m_param; MT_Matrix3x3 tr; if (norm.fuzzyZero() || norm == worldUp) @@ -414,7 +414,7 @@ void RAS_OpenGLRasterizer::FlushDebugShapes() for (int j = 0; j<n; j++) { MT_Scalar theta = j*M_PI*2/n; - MT_Vector3 pos(cos(theta)*rad, sin(theta)*rad, 0.); + MT_Vector3 pos(cos(theta) * rad, sin(theta) * rad, 0.0); pos = pos*tr; pos += m_debugShapes[i].m_pos; const MT_Scalar* posPtr = &pos.x(); diff --git a/source/gameengine/SceneGraph/SG_BBox.cpp b/source/gameengine/SceneGraph/SG_BBox.cpp index b1e3a3216ed..4b2fc5410fa 100644 --- a/source/gameengine/SceneGraph/SG_BBox.cpp +++ b/source/gameengine/SceneGraph/SG_BBox.cpp @@ -37,8 +37,8 @@ #include "SG_Node.h" SG_BBox::SG_BBox() : - m_min(0., 0., 0.), - m_max(0., 0., 0.) + m_min(0.0, 0.0, 0.0), + m_max(0.0, 0.0, 0.0) { } diff --git a/source/gameengine/SceneGraph/SG_BBox.h b/source/gameengine/SceneGraph/SG_BBox.h index 5096d65558e..33e29b85a5f 100644 --- a/source/gameengine/SceneGraph/SG_BBox.h +++ b/source/gameengine/SceneGraph/SG_BBox.h @@ -81,7 +81,7 @@ public: /** * Scales the bounding box about the optional point. */ - void scale(const MT_Vector3 &size, const MT_Point3 &point = MT_Point3(0., 0., 0.)); + void scale(const MT_Vector3 &size, const MT_Point3 &point = MT_Point3(0.0, 0.0, 0.0)); #endif SG_BBox transform(const MT_Transform &world) const; /** |