- BUGFIX : Fix aiQuaternion::nomalize method.

- UPDATE : Improve performance by avoiding multiple divisions.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@873 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
kimmi 2010-11-27 13:53:34 +00:00
parent 76a733e2f4
commit bd92f15128
3 changed files with 13 additions and 5 deletions

View File

@ -97,3 +97,6 @@ Contributed updated and improved xcode workspaces
- drparallax
Contributed the /samples/SimpleAssimpViewX sample
- Carsten Fuchs
Contributed a fix for the Normalize method in aiQuaternion.

View File

@ -112,6 +112,8 @@ SOURCE_GROUP( Common FILES
ScenePreprocessor.h
SkeletonMeshBuilder.cpp
SkeletonMeshBuilder.h
SplitByBoneCountProcess.cpp
SplitByBoneCountProcess.h
SmoothingGroups.h
StandardShapes.cpp
StandardShapes.h
@ -615,6 +617,8 @@ ADD_LIBRARY( assimp SHARED
SceneCombiner.h
ScenePreprocessor.cpp
ScenePreprocessor.h
SplitByBoneCountProcess.cpp
SplitByBoneCountProcess.h
SkeletonMeshBuilder.cpp
SkeletonMeshBuilder.h
SmoothingGroups.h

View File

@ -264,13 +264,14 @@ inline void aiQuaternion::Interpolate( aiQuaternion& pOut, const aiQuaternion& p
inline aiQuaternion& aiQuaternion::Normalize()
{
// compute the magnitude and divide through it
const float mag = x*x+y*y+z*z+w*w;
const float mag = sqrt(x*x + y*y + z*z + w*w);
if (mag)
{
x /= mag;
y /= mag;
z /= mag;
w /= mag;
const float invMag = 1.0f/mag;
x *= invMag;
y *= invMag;
z *= invMag;
w *= invMag;
}
return *this;
}