summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2012-09-15 20:33:30 +0100
committerQt by Nokia <qt-info@nokia.com>2012-09-16 11:03:03 +0200
commit36d48811ca41c02978b78216c52d454123be36df (patch)
treeaa24da7584606ba57007ba813ed1b0690255f1ff /tools
parent3b6c224d0a266e5eb8e1894b9ca4ae9c1d9a27ce (diff)
Use float throughout the Qt3D module for consistency and performance
This commit changes the API of all classes in this module to use float rather than qreal. This makes the API consistent across platforms and improves floating point performance. Change-Id: I95ae65cb31428748e066d5efca059ce24087fafa Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Sarah Jane Smith <sez@storybridge.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/qt3d/qglinfo/fpswidget.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/qt3d/qglinfo/fpswidget.cpp b/tools/qt3d/qglinfo/fpswidget.cpp
index 8d8bff4c0..ac4dd232c 100644
--- a/tools/qt3d/qglinfo/fpswidget.cpp
+++ b/tools/qt3d/qglinfo/fpswidget.cpp
@@ -198,8 +198,8 @@ void FPSWidget::resizeGL(int w, int h)
glLoadIdentity();
#endif
int side = qMin(w, h);
- qreal ws = (qreal)w / (qreal)side;
- qreal hs = (qreal)h / (qreal)side;
+ float ws = float(w) / float(side);
+ float hs = float(h) / float(side);
#if defined(QT_OPENGL_ES_2)
projection.setToIdentity();
projection.ortho(-ws, ws, -hs, hs, -10.0f, 10.0f);
@@ -253,7 +253,7 @@ void FPSWidget::paintGL()
program.disableAttributeArray(vertexAttr);
program.disableAttributeArray(normalAttr);
#endif
- QString framesPerSecond = QString::fromLatin1("%1 fps").arg(1000.0f / ((qreal)totalFrameTime / (qreal)frameCount));
+ QString framesPerSecond = QString::fromLatin1("%1 fps").arg(1000.0f / (float(totalFrameTime) / float(frameCount)));
}
void FPSWidget::animate()
@@ -268,7 +268,7 @@ void FPSWidget::animate()
{
frameCount += 1;
totalFrameTime += frameElapsed;
- emit fps(1000.0f / ((qreal)frameTime->elapsed() / (qreal)frameCount));
+ emit fps(1000.0f / (float(frameTime->elapsed()) / float(frameCount)));
xrot = (xrot + adv) % 360;
yrot = (xrot + adv) % 360;
zrot = (xrot + adv) % 360;