From 8dc95e0edc71cefc6c3e5c4cc67bfe385a8a0f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Thu, 25 Jun 2015 13:00:54 +0300 Subject: Fix for shadow pass Change-Id: Ie7452c66a196ecdf348ed9cf9ca5b7cce7984d7c Task-number: QTBUG-44988 Reviewed-by: Paul Lemire --- src/core/core-components/qcamera.cpp | 11 +++++++++++ src/core/core-components/qcamera.h | 4 ++++ 2 files changed, 15 insertions(+) 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) -- cgit v1.2.3