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-07 02:48:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-07 02:48:28 +0400
commit3a0593cc3d5de33248b3a7b913a45729c37dc1b4 (patch)
tree88fcddc5e3c060c87a6313d853315f0efa484a52 /source/gameengine
parent2336aadb80f8602f001b2c5b0bcaacf3ad858f83 (diff)
code cleanup: dont use function calls like dot_v3v3, pow and sqrt within macros which results in calling the function multiple times needlessly.
also added some comments.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_ObstacleSimulation.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index 46ebd0ecc4f..ea4ac1e150b 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -311,7 +311,7 @@ int SCA_Joystick::pAxisTest(int axisnum)
short i2= m_axis_array[(axisnum*2)+1];
/* long winded way to do
- * return MAX2(abs(i1), abs(i2))
+ * return maxf(absf(i1), absf(i2))
* avoid abs from math.h */
if (i1 < 0) i1 = -i1;
if (i2 < 0) i2 = -i2;
diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
index fd47587e2c8..a942f87856c 100644
--- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
+++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
@@ -378,13 +378,14 @@ static MT_Point3 nearestPointToObstacle(MT_Point3& pos ,KX_Obstacle* obstacle)
MT_Vector3 ab = obstacle->m_pos2 - obstacle->m_pos;
if (!ab.fuzzyZero())
{
+ const MT_Scalar dist = ab.length();
MT_Vector3 abdir = ab.normalized();
MT_Vector3 v = pos - obstacle->m_pos;
MT_Scalar proj = abdir.dot(v);
- CLAMP(proj, 0, ab.length());
+ CLAMP(proj, 0, dist);
MT_Point3 res = obstacle->m_pos + abdir*proj;
return res;
- }
+ }
}
case KX_OBSTACLE_CIRCLE :
default: