2
0
Эх сурвалжийг харах

- 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

kimmi 15 жил өмнө
parent
commit
bd92f15128

+ 3 - 0
CREDITS

@@ -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.

+ 4 - 0
code/CMakeLists.txt

@@ -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

+ 6 - 5
include/aiQuaternion.h

@@ -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;
 }