summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Brock <robert.brock@kdab.com>2016-12-22 12:13:16 +0000
committerSean Harmer <sean.harmer@kdab.com>2017-01-02 13:50:37 +0000
commit03f17a311c4d09d8b734f2bf7c893527e622eac9 (patch)
tree636848bf3cae7a9c027c68c9d858e11b10c77f07
parente90e10efbaaac87cb4f7a642b0b835c6a5f1434d (diff)
BugFix - Added warning when upVector is null or (anti-)collinear
Odd behavior was noticed when the camera was set to be collinear with the up vector. A warning has been added in the updateViewMatrix() to check for when this happens. Task-number: QTBUG-57726 Change-Id: I396f74cd9d6566beaf13e07f2d878228bf102aea Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/render/frontend/qcamera_p.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/render/frontend/qcamera_p.h b/src/render/frontend/qcamera_p.h
index ae2ef7a3b..107b1d268 100644
--- a/src/render/frontend/qcamera_p.h
+++ b/src/render/frontend/qcamera_p.h
@@ -68,6 +68,8 @@ public:
void updateViewMatrix()
{
+ if (m_upVector.isNull() || QVector3D::crossProduct(m_cameraToCenter, m_upVector).normalized().isNull())
+ qWarning() << "Camera up vector must not be colinear with the view vector";
QMatrix4x4 m;
m.lookAt(m_position, m_viewCenter, m_upVector);
m_transform->setMatrix(m);