Optimizing code, because Quat_FromAxisAngle() will normalize the axis vector. No need to normalize again.

This commit is contained in:
Thompson Lee 2016-08-11 12:19:32 -04:00
parent 0ce2c1398c
commit c2e1416a2a

View File

@ -10,6 +10,6 @@ C3D_FQuat Quat_LookAt(C3D_FVec source, C3D_FVec target, C3D_FVec forwardVector,
if (dot - 1.0f < -FLT_EPSILON) if (dot - 1.0f < -FLT_EPSILON)
return Quat_Identity(); return Quat_Identity();
float rotationAngle = acosf(dot); float rotationAngle = acosf(dot);
C3D_FVec rotationAxis = FVec3_Normalize(FVec3_Cross(forwardVector, forward)); C3D_FVec rotationAxis = FVec3_Cross(forwardVector, forward);
return Quat_FromAxisAngle(rotationAxis, rotationAngle); return Quat_FromAxisAngle(rotationAxis, rotationAngle);
} }