[Bf-blender-cvs] [0c19a04] master: BGE Ketsji clean-up: double-promotion warnings
Jorge Bernal
noreply at git.blender.org
Wed Dec 16 02:02:48 CET 2015
Commit: 0c19a043e8198018ae794145fc4f1e78d5f00923
Author: Jorge Bernal
Date: Wed Dec 16 01:31:38 2015 +0100
Branches: master
https://developer.blender.org/rB0c19a043e8198018ae794145fc4f1e78d5f00923
BGE Ketsji clean-up: double-promotion warnings
===================================================================
M source/gameengine/Ketsji/BL_Action.cpp
M source/gameengine/Ketsji/BL_Texture.cpp
M source/gameengine/Ketsji/KX_BlenderMaterial.cpp
M source/gameengine/Ketsji/KX_Camera.cpp
M source/gameengine/Ketsji/KX_ConstraintActuator.cpp
M source/gameengine/Ketsji/KX_Dome.cpp
M source/gameengine/Ketsji/KX_FontObject.cpp
M source/gameengine/Ketsji/KX_GameObject.cpp
M source/gameengine/Ketsji/KX_IPOTransform.h
M source/gameengine/Ketsji/KX_KetsjiEngine.cpp
M source/gameengine/Ketsji/KX_Light.cpp
M source/gameengine/Ketsji/KX_MouseActuator.cpp
M source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
M source/gameengine/Ketsji/KX_ObjectActuator.cpp
M source/gameengine/Ketsji/KX_ObjectActuator.h
M source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
M source/gameengine/Ketsji/KX_RadarSensor.cpp
M source/gameengine/Ketsji/KX_RayCast.cpp
M source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
M source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp
M source/gameengine/Ketsji/KX_Scene.cpp
M source/gameengine/Ketsji/KX_SoundActuator.cpp
M source/gameengine/Ketsji/KX_SteeringActuator.cpp
M source/gameengine/Ketsji/KX_TimeLogger.cpp
M source/gameengine/Ketsji/KX_TrackToActuator.cpp
M source/gameengine/Ketsji/KX_VertexProxy.cpp
===================================================================
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp
index 89d8ec0..45946f3 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 d14b9cc..0b0a0f5 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 a10bdf4..1d185d5 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 644c71a..76c7b4a 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<KX_Camera*>(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 fecd60e..8f15955 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_Constraint
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list