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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user