diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-09-04 04:12:08 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-09-04 07:00:23 (GMT) |
commit | 974aec137dfdbb1dd68c41113b22eb25131965b8 (patch) | |
tree | adbf042502fd35d1bce5a2aea811d41633ecd495 /tests/benchmarks | |
parent | 4c501d7fce503a610edabfba5d6efc3ef2778bef (diff) | |
download | Qt-974aec137dfdbb1dd68c41113b22eb25131965b8.zip Qt-974aec137dfdbb1dd68c41113b22eb25131965b8.tar.gz Qt-974aec137dfdbb1dd68c41113b22eb25131965b8.tar.bz2 |
Modify QMatrix4x4 and QQuaternion to use qreal internally
Some concerns were expressed about the float precision of QMatrix4x4,
which this change addresses by using qreal instead.
The QVector2D/3D/4D classes still use float internally, so that they
can be used directly in large arrays of vertex values to be uploaded
to an OpenGL server.
QQuaternion is a client-side class, and it should produce rotations
that are consistent with QMatrix4x4. So its precision was changed too.
A consequence of this change is that the following no longer works
in a portable fashion:
QMatrix4x4 mat;
...
glLoadMatrixf(mat.constData());
The caller must now repack the argument to convert from qreal to GLfloat.
Reviewed-by: Michael Goddard
Reviewed-by: Andreas
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp b/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp index b4c8202..c72bc27 100644 --- a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp +++ b/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp @@ -171,9 +171,9 @@ void tst_QMatrix4x4::multiplyDirect() QMatrix4x4 m3; - const float *m1data = m1.constData(); - const float *m2data = m2.constData(); - float *m3data = m3.data(); + const qreal *m1data = m1.constData(); + const qreal *m2data = m2.constData(); + qreal *m3data = m3.data(); QBENCHMARK { for (int row = 0; row < 4; ++row) { @@ -266,9 +266,9 @@ void tst_QMatrix4x4::mapVectorDirect() { QFETCH(QMatrix4x4, m1); - const float *m1data = m1.constData(); - float v[4] = {10.5f, -2.0f, 3.0f, 1.0f}; - float result[4]; + const qreal *m1data = m1.constData(); + qreal v[4] = {10.5f, -2.0f, 3.0f, 1.0f}; + qreal result[4]; QBENCHMARK { for (int row = 0; row < 4; ++row) { |