| 605 | } |
| 606 | |
| 607 | void Matrix::RotationQuaternion(const Quaternion& rotation, Matrix& result) |
| 608 | { |
| 609 | const float xx = rotation.X * rotation.X; |
| 610 | const float yy = rotation.Y * rotation.Y; |
| 611 | const float zz = rotation.Z * rotation.Z; |
| 612 | const float xy = rotation.X * rotation.Y; |
| 613 | const float zw = rotation.Z * rotation.W; |
| 614 | const float zx = rotation.Z * rotation.X; |
| 615 | const float yw = rotation.Y * rotation.W; |
| 616 | const float yz = rotation.Y * rotation.Z; |
| 617 | const float xw = rotation.X * rotation.W; |
| 618 | |
| 619 | result.M11 = 1.0f - 2.0f * (yy + zz); |
| 620 | result.M12 = 2.0f * (xy + zw); |
| 621 | result.M13 = 2.0f * (zx - yw); |
| 622 | result.M14 = 0; |
| 623 | |
| 624 | result.M21 = 2.0f * (xy - zw); |
| 625 | result.M22 = 1.0f - 2.0f * (zz + xx); |
| 626 | result.M23 = 2.0f * (yz + xw); |
| 627 | result.M24 = 0; |
| 628 | |
| 629 | result.M31 = 2.0f * (zx + yw); |
| 630 | result.M32 = 2.0f * (yz - xw); |
| 631 | result.M33 = 1.0f - 2.0f * (yy + xx); |
| 632 | result.M34 = 0; |
| 633 | |
| 634 | result.M41 = 0; |
| 635 | result.M42 = 0; |
| 636 | result.M43 = 0; |
| 637 | result.M44 = 1; |
| 638 | } |
| 639 | |
| 640 | void Matrix::RotationYawPitchRoll(float yaw, float pitch, float roll, Matrix& result) |
| 641 | { |
no outgoing calls