summaryrefslogtreecommitdiffstats
path: root/src/render/frontend/qcameralens.cpp
diff options
context:
space:
mode:
authorVolker Krause <volker.krause@kdab.com>2016-03-20 13:01:14 +0100
committerVolker Krause <volker.krause@kdab.com>2016-03-20 12:10:07 +0000
commitc710ac721b51082e85681e798dd3fac5985de78f (patch)
treeac6ca12c6db5791a96d8615fc42400adaf33b476 /src/render/frontend/qcameralens.cpp
parent524a8e7f3b568c2ca2cc6ab03c3d0f94fd1976dc (diff)
Allow to specify a custom projection matrix.
Task-number: QTBUG-48573 Change-Id: I349b6efe9571158d4d4a8ec48f20e1e38599b932 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/frontend/qcameralens.cpp')
-rw-r--r--src/render/frontend/qcameralens.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/render/frontend/qcameralens.cpp b/src/render/frontend/qcameralens.cpp
index ceddcd3d1..28ea4dbe5 100644
--- a/src/render/frontend/qcameralens.cpp
+++ b/src/render/frontend/qcameralens.cpp
@@ -106,6 +106,17 @@ QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent)
}
/*!
+ * \enum Qt3DRender::QCameraLens::ProjectionType
+ *
+ * Specifies which parameters of Qt3DRender::QCameraLens are used to compute the projection matrix.
+ *
+ * \value OrthographicProjection
+ * \value PerspectiveProjection
+ * \value FrustumProjection
+ * \value CustomProjection
+ */
+
+/*!
* Sets the lens' projection type \a projectionType.
*
* \note Qt3DRender::QCameraLens::Frustum and
@@ -412,6 +423,22 @@ float QCameraLens::top() const
}
/*!
+ * Sets the project matrix.
+ *
+ * \note This will set the projection type to Qt3DRender::QCameraLens::CustomProjection and thus
+ * ignore all other camera parameters that might have been specified.
+ */
+void QCameraLens::setProjectionMatrix(const QMatrix4x4 &projectionMatrix)
+{
+ Q_D(QCameraLens);
+ setProjectionType(CustomProjection);
+ if (qFuzzyCompare(d->m_projectionMatrix, projectionMatrix))
+ return;
+ d->m_projectionMatrix = projectionMatrix;
+ emit projectionMatrixChanged(projectionMatrix);
+}
+
+/*!
* Returns the projection matrix.
*/
QMatrix4x4 QCameraLens::projectionMatrix() const