Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-19 03:03:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-19 03:03:27 +0400
commitd0e892a7286791a4b2d1c5d7321fe8fe040819dd (patch)
tree43a9024562d8272d3211e75bea0b614d286196c8 /source/gameengine/Ketsji/KX_TrackToActuator.cpp
parentdb14b97be6917d961c893ba6e0188c927ffa67b0 (diff)
quiet double promotion warnings for the game engine.
Diffstat (limited to 'source/gameengine/Ketsji/KX_TrackToActuator.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_TrackToActuator.cpp116
1 files changed, 57 insertions, 59 deletions
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index af93121b50e..99732130f83 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -1,39 +1,40 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
/** \file gameengine/Ketsji/KX_TrackToActuator.cpp
* \ingroup ketsji
+ *
+ * Replace the mesh for this actuator's parent
*/
-//
-// Replace the mesh for this actuator's parent
-//
-//
-// ***** BEGIN GPL LICENSE BLOCK *****
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software Foundation,
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-// All rights reserved.
-//
-// The Original Code is: all of this file.
-//
-// Contributor(s): none yet.
-//
-// ***** END GPL LICENSE BLOCK *****
-
-// todo: not all trackflags / upflags are implemented/tested !
-// m_trackflag is used to determine the forward tracking direction
-// m_upflag for the up direction
-// normal situation is +y for forward, +z for up
+
+/* todo: not all trackflags / upflags are implemented/tested !
+ * m_trackflag is used to determine the forward tracking direction
+ * m_upflag for the up direction
+ * normal situation is +y for forward, +z for up */
#include "MT_Scalar.h"
#include "SCA_IActuator.h"
@@ -50,8 +51,6 @@
/* Native functions */
/* ------------------------------------------------------------------------- */
-
-
KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj,
SCA_IObject *ob,
int time,
@@ -123,19 +122,18 @@ MT_Matrix3x3 EulToMat3(float *eul)
/* old function from Blender */
-void Mat3ToEulOld(MT_Matrix3x3 mat, float *eul)
+void Mat3ToEulOld(MT_Matrix3x3 mat, float eul[3])
{
- MT_Scalar cy;
-
- cy = sqrt(mat[0][0]*mat[0][0] + mat[0][1]*mat[0][1]);
-
- if (cy > 16.0*FLT_EPSILON) {
- eul[0] = atan2(mat[1][2], mat[2][2]);
- eul[1] = atan2(-mat[0][2], cy);
- eul[2] = atan2(mat[0][1], mat[0][0]);
- } else {
- eul[0] = atan2(-mat[2][1], mat[1][1]);
- eul[1] = atan2(-mat[0][2], cy);
+ const float cy = sqrtf(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1]);
+
+ if (cy > (float)(16.0f * FLT_EPSILON)) {
+ eul[0] = atan2f( mat[1][2], mat[2][2]);
+ eul[1] = atan2f(-mat[0][2], cy);
+ eul[2] = atan2f( mat[0][1], mat[0][0]);
+ }
+ else {
+ eul[0] = atan2f(-mat[2][1], mat[1][1]);
+ eul[1] = atan2f(-mat[0][2], cy);
eul[2] = 0.0;
}
}
@@ -149,18 +147,18 @@ void compatible_eulFast(float *eul, float *oldrot)
/* angular difference of 360 degrees */
- dx= eul[0] - oldrot[0];
- dy= eul[1] - oldrot[1];
- dz= eul[2] - oldrot[2];
+ dx = eul[0] - oldrot[0];
+ dy = eul[1] - oldrot[1];
+ dz = eul[2] - oldrot[2];
- if ( fabs(dx) > MT_PI) {
- if (dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI;
+ if (fabsf(dx) > (float)MT_PI) {
+ if (dx > 0.0f) eul[0] -= (float)MT_2_PI; else eul[0] += (float)MT_2_PI;
}
- if ( fabs(dy) > MT_PI) {
- if (dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI;
+ if (fabsf(dy) > (float)MT_PI) {
+ if (dy > 0.0f) eul[1] -= (float)MT_2_PI; else eul[1] += (float)MT_2_PI;
}
- if ( fabs(dz) > MT_PI ) {
- if (dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI;
+ if (fabsf(dz) > (float)MT_PI) {
+ if (dz > 0.0f) eul[2] -= (float)MT_2_PI; else eul[2] += (float)MT_2_PI;
}
}
@@ -174,9 +172,9 @@ MT_Matrix3x3 matrix3x3_interpol(MT_Matrix3x3 oldmat, MT_Matrix3x3 mat, int m_tim
Mat3ToEulOld(mat, eul);
compatible_eulFast(eul, oldeul);
- eul[0]= (m_time*oldeul[0] + eul[0])/(1.0+m_time);
- eul[1]= (m_time*oldeul[1] + eul[1])/(1.0+m_time);
- eul[2]= (m_time*oldeul[2] + eul[2])/(1.0+m_time);
+ eul[0] = (m_time * oldeul[0] + eul[0]) / (1.0f + m_time);
+ eul[1] = (m_time * oldeul[1] + eul[1]) / (1.0f + m_time);
+ eul[2] = (m_time * oldeul[2] + eul[2]) / (1.0f + m_time);
return EulToMat3(eul);
}