|
|
@ -1271,6 +1271,11 @@ RMDEF Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount) |
|
|
|
|
|
|
|
float cosHalfTheta = q1.x*q2.x + q1.y*q2.y + q1.z*q2.z + q1.w*q2.w; |
|
|
|
|
|
|
|
if (cosHalfTheta < 0) { |
|
|
|
q2.x = -q2.x; q2.y = -q2.y; q2.z = -q2.z; q2.w = -q2.w; |
|
|
|
cosHalfTheta = -cosHalfTheta; |
|
|
|
} |
|
|
|
|
|
|
|
if (fabs(cosHalfTheta) >= 1.0f) result = q1; |
|
|
|
else if (cosHalfTheta > 0.95f) result = QuaternionNlerp(q1, q2, amount); |
|
|
|
else |
|
|
|