diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2009-08-18 05:53:48 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-08-18 05:53:48 (GMT) |
commit | 572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173 (patch) | |
tree | 8e0d5e2393d22d4f2a2452db17ba7ea57a0549da /src/gui | |
parent | 6d9563070a87bc6c0b014b2a40af2e4b6eb1a6f6 (diff) | |
parent | 1ddf4ae979e3b573f45a99ac92838e098dfc8e45 (diff) | |
download | Qt-572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173.zip Qt-572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173.tar.gz Qt-572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/math3d/qmatrix4x4.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index dc17eda..8fc439b 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -1010,11 +1010,24 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, const QVector3D& vector) */ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) { + if (angle == 0.0f) + return *this; QMatrix4x4 m(1); // The "1" says to not load the identity. - qreal a = angle * M_PI / 180.0f; - qreal c = qCos(a); - qreal s = qSin(a); - qreal ic; + qreal c, s, ic; + if (angle == 90.0f || angle == -270.0f) { + s = 1.0f; + c = 0.0f; + } else if (angle == -90.0f || angle == 270.0f) { + s = -1.0f; + c = 0.0f; + } else if (angle == 180.0f || angle == -180.0f) { + s = 0.0f; + c = -1.0f; + } else { + qreal a = angle * M_PI / 180.0f; + c = qCos(a); + s = qSin(a); + } bool quick = false; if (x == 0.0f) { if (y == 0.0f) { |