GLTeapot: normalize quaternion

Quaternions representing rotation should have unit length. Multiplying
quaternions cause error accumulation and length change. Normalizing
quaternion after rotation will avoid that.

Fixes #7160.

Change-Id: I82f1f2b89c326a4d2c956c03296600e79ac267c2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2270
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
X512
2020-02-24 15:15:12 +00:00
committed by Jérôme Duval
parent 6f114b94f2
commit e18a08119d
+1
View File
@@ -181,6 +181,7 @@ GLObject::RotateWorldSpace(float rx, float ry)
{
fRotation = Quaternion(Vector3(0.0f, 1.0f, 0.0f), 0.01f * rx) * fRotation;
fRotation = Quaternion(Vector3(1.0f, 0.0f, 0.0f), 0.01f * ry) * fRotation;
fRotation.normalize();
changed = true;
}