summaryrefslogtreecommitdiffstats
path: root/src/datavis3d/utils/camerahelper.cpp
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-06-17 09:12:28 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-06-17 09:28:37 +0300
commitc428d88f5f2fa1026b6cf6d847a5162b12092b9f (patch)
tree50c8f46d1d24a62114684ed0c103b2b1b76b581e /src/datavis3d/utils/camerahelper.cpp
parent930cec10b892dfb2bd0124fb8d807ae8d471b8c5 (diff)
Include fix
Module sources now include our own global headers from local dirs, not from installed dir. + Replaced radian conversions with a qmath function. Change-Id: Ie9f6d561c98022d3225a0dd4964f5118d00f9815 Change-Id: Ie9f6d561c98022d3225a0dd4964f5118d00f9815 Reviewed-by: Pasi Keränen <pasi.keranen@digia.com> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavis3d/utils/camerahelper.cpp')
-rw-r--r--src/datavis3d/utils/camerahelper.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/datavis3d/utils/camerahelper.cpp b/src/datavis3d/utils/camerahelper.cpp
index 60050e5a..5b0183b0 100644
--- a/src/datavis3d/utils/camerahelper.cpp
+++ b/src/datavis3d/utils/camerahelper.cpp
@@ -116,8 +116,8 @@ QMatrix4x4 CameraHelper::calculateViewMatrix(const QPoint &mousePos, int zoom,
viewMatrix.translate(m_target.x(), m_target.y(), m_target.z());
// Apply rotations
// Handle x and z rotation when y -angle is other than 0
- viewMatrix.rotate(m_xRotation, 0, cos(m_yRotation * m_pi / 180.0f),
- sin(m_yRotation * m_pi / 180.0f));
+ viewMatrix.rotate(m_xRotation, 0, cos(qDegreesToRadians(m_yRotation)),
+ sin(qDegreesToRadians(m_yRotation)));
// y rotation is always "clean"
viewMatrix.rotate(m_yRotation, 1.0f, 0.0f, 0.0f);
// handle zoom by scaling
@@ -126,10 +126,10 @@ QMatrix4x4 CameraHelper::calculateViewMatrix(const QPoint &mousePos, int zoom,
viewMatrix.translate(-m_target.x(), -m_target.y(), -m_target.z());
//qDebug() << m_xRotation << m_yRotation;
- //qDebug() << "sin(m_yRotation)" << sin(m_yRotation*m_pi/180);
- //qDebug() << "asin(m_yRotation)" << asin(m_yRotation*m_pi/180);
- //qDebug() << "cos(m_yRotation)" << cos(m_yRotation*m_pi/180);
- //qDebug() << "tan(m_yRotation)" << tan(m_yRotation*m_pi/180);
+ //qDebug() << "sin(m_yRotation)" << sin(qDegreesToRadians(m_yRotation));
+ //qDebug() << "asin(m_yRotation)" << asin(qDegreesToRadians(m_yRotation));
+ //qDebug() << "cos(m_yRotation)" << cos(qDegreesToRadians(m_yRotation));
+ //qDebug() << "tan(m_yRotation)" << tan(qDegreesToRadians(m_yRotation));
m_previousMousePos = mousePos;
return viewMatrix;
@@ -144,10 +144,10 @@ QVector3D CameraHelper::calculateLightPosition(const QVector3D &lightPosition,
GLfloat xAngle;
GLfloat yAngle;
if (!fixedRotation) {
- xAngle = m_xRotation * m_pi / 180.0f;
- yAngle = m_yRotation * m_pi / 180.0f;
+ xAngle = qDegreesToRadians(m_xRotation);
+ yAngle = qDegreesToRadians(m_yRotation);
} else {
- xAngle = fixedRotation * m_pi / 180.0f;
+ xAngle = qDegreesToRadians(fixedRotation);
yAngle = 0;
}
GLfloat radius = (radiusFactor + lightPosition.y()); // set radius to match the highest height of the light