BGE Ketsji clean-up: double-promotion warnings
This commit is contained in:
parent
5b33115070
commit
0c19a043e8
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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 */
|
||||
|
|
|
@ -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<KX_GameObject*>(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<KX_GameObject*>(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<KX_GameObject*>(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<KX_GameObject*>(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<KX_SlowParentRelation *>(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();
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<KX_LightObject*>(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<KX_LightObject*>(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)
|
||||
|
|
|
@ -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<KX_MouseActuator*>(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<KX_MouseActuator*>(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<KX_MouseActuator*>(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;
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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; i<m_obstacles.size(); i++)
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ static bool filterObstacle(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM
|
|||
|
||||
//filter obstacles by position
|
||||
MT_Point3 p = nearestPointToObstacle(activeObst->m_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];
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -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]);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ PyObject *KX_SoundActuator::pyattr_get_3d_property(void *self, const struct KX_P
|
|||
{
|
||||
KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (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<KX_SoundActuator *> (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<KX_SoundActuator *> (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<KX_SoundActuator *> (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<KX_SoundActuator *> (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<KX_SoundActuator *> (self);
|
||||
if (!PyArg_Parse(value, "f", &pitch))
|
||||
return PY_SET_ATTR_FAIL;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ PyObject *KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DE
|
|||
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(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);
|
||||
|
|
Loading…
Reference in New Issue