summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/core-components/qcamera.cpp11
-rw-r--r--src/core/core-components/qcamera.h4
2 files changed, 15 insertions, 0 deletions
diff --git a/src/core/core-components/qcamera.cpp b/src/core/core-components/qcamera.cpp
index e90479d06..9450ccf5b 100644
--- a/src/core/core-components/qcamera.cpp
+++ b/src/core/core-components/qcamera.cpp
@@ -77,6 +77,7 @@ QCamera::QCamera(QNode *parent) :
QObject::connect(d_func()->m_lookAt, SIGNAL(positionChanged()), this, SIGNAL(positionChanged()));
QObject::connect(d_func()->m_lookAt, SIGNAL(upVectorChanged()), this, SIGNAL(upVectorChanged()));
QObject::connect(d_func()->m_lookAt, SIGNAL(viewCenterChanged()), this, SIGNAL(viewCenterChanged()));
+ QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged()), this, SIGNAL(matrixChanged()));
d_func()->m_transform->addTransform(d_func()->m_lookAt);
addComponent(d_func()->m_lens);
addComponent(d_func()->m_transform);
@@ -104,6 +105,7 @@ QCamera::QCamera(QCameraPrivate &dd, QNode *parent)
QObject::connect(d_func()->m_lookAt, SIGNAL(positionChanged()), this, SIGNAL(positionChanged()));
QObject::connect(d_func()->m_lookAt, SIGNAL(upVectorChanged()), this, SIGNAL(upVectorChanged()));
QObject::connect(d_func()->m_lookAt, SIGNAL(viewCenterChanged()), this, SIGNAL(viewCenterChanged()));
+ QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged()), this, SIGNAL(matrixChanged()));
d_func()->m_transform->addTransform(d_func()->m_lookAt);
addComponent(d_func()->m_lens);
addComponent(d_func()->m_transform);
@@ -456,6 +458,15 @@ QVector3D QCamera::viewCenter() const
return d->m_lookAt->viewCenter();
}
+/*!
+ \qmlproperty matrix4x4 Qt3D::Camera::matrix
+*/
+QMatrix4x4 QCamera::matrix() const
+{
+ Q_D(const QCamera);
+ return d->m_transform->matrix();
+}
+
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/core/core-components/qcamera.h b/src/core/core-components/qcamera.h
index b6b9de4a6..4bf25534a 100644
--- a/src/core/core-components/qcamera.h
+++ b/src/core/core-components/qcamera.h
@@ -69,6 +69,7 @@ class QT3DCORESHARED_EXPORT QCamera : public QEntity
Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(QVector3D upVector READ upVector WRITE setUpVector NOTIFY upVectorChanged)
Q_PROPERTY(QVector3D viewCenter READ viewCenter WRITE setViewCenter NOTIFY viewCenterChanged)
+ Q_PROPERTY(QMatrix4x4 matrix READ matrix NOTIFY matrixChanged)
public:
explicit QCamera(QNode *parent = 0);
@@ -142,6 +143,8 @@ public:
void setViewCenter(const QVector3D &viewCenter);
QVector3D viewCenter() const;
+ QMatrix4x4 matrix() const;
+
Q_SIGNALS:
void projectionTypeChanged();
void nearPlaneChanged();
@@ -156,6 +159,7 @@ Q_SIGNALS:
void positionChanged();
void upVectorChanged();
void viewCenterChanged();
+ void matrixChanged();
protected:
Q_DECLARE_PRIVATE(QCamera)