diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-12-07 14:20:01 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-12-09 13:53:23 +0000 |
commit | 94f3df1aacab5853d09e79596eb3bdae3aecae0a (patch) | |
tree | 4db06240d22462becc9ad5b499926aa11316b88d /src/render/lights | |
parent | 3655c334b0f4a28a1487c918384da50498ef9418 (diff) |
Add support for spotlights
Change-Id: I61a4e072c1a2e00cdbcee917aa557e56fb8cb7c0
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/lights')
-rw-r--r-- | src/render/lights/qpointlight.cpp | 4 | ||||
-rw-r--r-- | src/render/lights/qpointlight_p.h | 2 | ||||
-rw-r--r-- | src/render/lights/qspotlight.cpp | 7 | ||||
-rw-r--r-- | src/render/lights/qspotlight.h | 4 | ||||
-rw-r--r-- | src/render/lights/qspotlight_p.h | 4 |
5 files changed, 11 insertions, 10 deletions
diff --git a/src/render/lights/qpointlight.cpp b/src/render/lights/qpointlight.cpp index 05fb85676..808378c2d 100644 --- a/src/render/lights/qpointlight.cpp +++ b/src/render/lights/qpointlight.cpp @@ -62,8 +62,8 @@ namespace Qt3DRender { \class Qt3DRender::QPointLightPrivate \internal */ -QPointLightPrivate::QPointLightPrivate() - : QLightPrivate(QLight::PointLight) +QPointLightPrivate::QPointLightPrivate(QLight::Type type) + : QLightPrivate(type) , m_attenuation(0.0f, 0.0f, 0.002f) { } diff --git a/src/render/lights/qpointlight_p.h b/src/render/lights/qpointlight_p.h index 2929ffd97..b7fb561ce 100644 --- a/src/render/lights/qpointlight_p.h +++ b/src/render/lights/qpointlight_p.h @@ -59,7 +59,7 @@ class QPointLight; class QPointLightPrivate : public QLightPrivate { public: - QPointLightPrivate(); + QPointLightPrivate(QLight::Type type = QLight::PointLight); QVector3D m_attenuation; diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp index 13c81b494..1912852ce 100644 --- a/src/render/lights/qspotlight.cpp +++ b/src/render/lights/qspotlight.cpp @@ -67,8 +67,9 @@ namespace Qt3DRender { \internal */ QSpotLightPrivate::QSpotLightPrivate() - : QLightPrivate(QLight::SpotLight) + : QPointLightPrivate(QLight::SpotLight) , m_cutOffAngle(45.0f) + , m_direction(0.0f, -1.0f, 0.0f) { } @@ -106,13 +107,13 @@ void QSpotLight::copy(const QNode *ref) Constructs a new QSpotLight with the specified \a parent. */ QSpotLight::QSpotLight(QNode *parent) - : QLight(*new QSpotLightPrivate, parent) + : QPointLight(*new QSpotLightPrivate, parent) { } /*! \internal */ QSpotLight::QSpotLight(QSpotLightPrivate &dd, QNode *parent) - : QLight(dd, parent) + : QPointLight(dd, parent) { } diff --git a/src/render/lights/qspotlight.h b/src/render/lights/qspotlight.h index edba764cc..4c3c5dd53 100644 --- a/src/render/lights/qspotlight.h +++ b/src/render/lights/qspotlight.h @@ -37,7 +37,7 @@ #ifndef QT3DRENDER_QSPOTLIGHT_H #define QT3DRENDER_QSPOTLIGHT_H -#include <Qt3DRender/qlight.h> +#include <Qt3DRender/qpointlight.h> QT_BEGIN_NAMESPACE @@ -45,7 +45,7 @@ namespace Qt3DRender { class QSpotLightPrivate; -class QT3DRENDERSHARED_EXPORT QSpotLight : public QLight +class QT3DRENDERSHARED_EXPORT QSpotLight : public QPointLight { Q_OBJECT Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged) diff --git a/src/render/lights/qspotlight_p.h b/src/render/lights/qspotlight_p.h index 66d5dfa6d..38adcdc51 100644 --- a/src/render/lights/qspotlight_p.h +++ b/src/render/lights/qspotlight_p.h @@ -48,13 +48,13 @@ // We mean it. // -#include <private/qlight_p.h> +#include <private/qpointlight_p.h> QT_BEGIN_NAMESPACE namespace Qt3DRender { -class QSpotLightPrivate : public QLightPrivate +class QSpotLightPrivate : public QPointLightPrivate { public: QSpotLightPrivate(); |