summaryrefslogtreecommitdiffstats
path: root/src/render/lights
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-11-23 15:27:48 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-11-26 17:36:04 +0000
commit653fdeb073a525a676bf0c12511c3f74bad2095e (patch)
tree9c4e2f2f29e63a12a0a0f7799235cad9b71c738e /src/render/lights
parent1324668b1b77c865c90a1352a61b0b3da3da39b1 (diff)
Lights phase 1: infrastructure
QAbstractLight becomes QLight and gets its own backend node. This way we can easily gather all lights for the scene and filter them when building render commands. Both the frontend and backend remain a subclass of (Q)ShaderData but will not be part of the ordinary ShaderData component list. This prevents mixing up ShaderDatas and Lights but allows reusing the same underlying infrastructure so that properties can automatically be transformed for example. It is worth noting that the position property for lights is now removed: the position is determined by the entity's (to which the light component belongs) position. A number of changes are made to ShaderData itself as backend subclassing with different managers is not straightforward. For now the distance between the rendered entity and the entity with the light component is calculated and lights will be chosen based on this distance. A framegraph node for controlling this will be added in future patches. No uniform setting or shader changes are included here. Task-number: QTBUG-48834 Change-Id: I43a6c5f9420d4254d798c558bd58680b2b09eceb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/lights')
-rw-r--r--src/render/lights/light.cpp79
-rw-r--r--src/render/lights/light_p.h88
-rw-r--r--src/render/lights/lights.pri13
-rw-r--r--src/render/lights/qdirectionallight.cpp7
-rw-r--r--src/render/lights/qdirectionallight.h4
-rw-r--r--src/render/lights/qdirectionallight_p.h4
-rw-r--r--src/render/lights/qlight.cpp (renamed from src/render/lights/qabstractlight.cpp)91
-rw-r--r--src/render/lights/qlight.h (renamed from src/render/lights/qabstractlight.h)28
-rw-r--r--src/render/lights/qlight_p.h (renamed from src/render/lights/qabstractlight_p.h)15
-rw-r--r--src/render/lights/qpointlight.cpp5
-rw-r--r--src/render/lights/qpointlight.h4
-rw-r--r--src/render/lights/qpointlight_p.h4
-rw-r--r--src/render/lights/qspotlight.cpp11
-rw-r--r--src/render/lights/qspotlight.h4
-rw-r--r--src/render/lights/qspotlight_p.h4
15 files changed, 247 insertions, 114 deletions
diff --git a/src/render/lights/light.cpp b/src/render/lights/light.cpp
new file mode 100644
index 000000000..de28349e6
--- /dev/null
+++ b/src/render/lights/light.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "light_p.h"
+#include "qlight.h"
+#include <Qt3DCore/qscenepropertychange.h>
+#include <private/abstractrenderer_p.h>
+#include <private/nodemanagers_p.h>
+#include <private/qbackendnode_p.h>
+#include <private/managers_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderLightFunctor::RenderLightFunctor(NodeManagers *managers)
+ : m_managers(managers)
+{
+}
+
+Qt3DCore::QBackendNode *RenderLightFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+{
+ Light *backend = m_managers->lightManager()->getOrCreateResource(frontend->id());
+ backend->setFactory(factory);
+ backend->setManagers(m_managers);
+ backend->setPeer(frontend);
+ return backend;
+}
+
+Qt3DCore::QBackendNode *RenderLightFunctor::get(const Qt3DCore::QNodeId &id) const
+{
+ return m_managers->lightManager()->lookupResource(id);
+}
+
+void RenderLightFunctor::destroy(const Qt3DCore::QNodeId &id) const
+{
+ m_managers->lightManager()->releaseResource(id);
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/lights/light_p.h b/src/render/lights/light_p.h
new file mode 100644
index 000000000..3059a6917
--- /dev/null
+++ b/src/render/lights/light_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_LIGHT_P_H
+#define QT3DRENDER_RENDER_LIGHT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/shaderdata_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class NodeManagers;
+
+class Q_AUTOTEST_EXPORT Light : public ShaderData
+{
+public:
+
+};
+
+class RenderLightFunctor : public Qt3DCore::QBackendNodeFunctor
+{
+public:
+ explicit RenderLightFunctor(NodeManagers *managers);
+
+ Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
+ void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
+
+private:
+ NodeManagers *m_managers;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DRender::Render::Light*)
+
+#endif // QT3DRENDER_RENDER_LIGHT_P_H
diff --git a/src/render/lights/lights.pri b/src/render/lights/lights.pri
index e12428e9d..ade6d29d7 100644
--- a/src/render/lights/lights.pri
+++ b/src/render/lights/lights.pri
@@ -1,18 +1,19 @@
INCLUDEPATH += $$PWD
HEADERS += \
- $$PWD/qabstractlight.h \
- $$PWD/qabstractlight_p.h \
+ $$PWD/qlight.h \
+ $$PWD/qlight_p.h \
$$PWD/qdirectionallight.h \
$$PWD/qdirectionallight_p.h \
$$PWD/qpointlight.h \
$$PWD/qpointlight_p.h \
$$PWD/qspotlight.h \
- $$PWD/qspotlight_p.h
-
+ $$PWD/qspotlight_p.h \
+ $$PWD/light_p.h
SOURCES += \
- $$PWD/qabstractlight.cpp \
+ $$PWD/qlight.cpp \
$$PWD/qdirectionallight.cpp \
$$PWD/qpointlight.cpp \
- $$PWD/qspotlight.cpp
+ $$PWD/qspotlight.cpp \
+ $$PWD/light.cpp
diff --git a/src/render/lights/qdirectionallight.cpp b/src/render/lights/qdirectionallight.cpp
index 2e3f91714..80e0bc5f1 100644
--- a/src/render/lights/qdirectionallight.cpp
+++ b/src/render/lights/qdirectionallight.cpp
@@ -66,7 +66,6 @@ namespace Qt3DRender {
\internal
*/
QDirectionalLightPrivate::QDirectionalLightPrivate()
- : QAbstractLightPrivate()
{
}
@@ -76,17 +75,17 @@ void QDirectionalLight::copy(const QNode *ref)
d_func()->m_direction = light->d_func()->m_direction;
// This needs to be last otherwise, properties value won't be copied
// as we use shader introspection in QShaderData::copy
- QAbstractLight::copy(ref);
+ QLight::copy(ref);
}
QDirectionalLight::QDirectionalLight(QNode *parent)
- : QAbstractLight(*new QDirectionalLightPrivate, parent)
+ : QLight(*new QDirectionalLightPrivate, parent)
{
}
/*! \internal */
QDirectionalLight::QDirectionalLight(QDirectionalLightPrivate &dd, QNode *parent)
- : QAbstractLight(dd, parent)
+ : QLight(dd, parent)
{
}
diff --git a/src/render/lights/qdirectionallight.h b/src/render/lights/qdirectionallight.h
index 6acc28721..c2af37ea5 100644
--- a/src/render/lights/qdirectionallight.h
+++ b/src/render/lights/qdirectionallight.h
@@ -37,7 +37,7 @@
#ifndef QT3DRENDER_QDIRECTIONALLIGHT_H
#define QT3DRENDER_QDIRECTIONALLIGHT_H
-#include <Qt3DRender/qabstractlight.h>
+#include <Qt3DRender/qlight.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +45,7 @@ namespace Qt3DRender {
class QDirectionalLightPrivate;
-class QT3DRENDERSHARED_EXPORT QDirectionalLight : public QAbstractLight
+class QT3DRENDERSHARED_EXPORT QDirectionalLight : public QLight
{
Q_OBJECT
Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged)
diff --git a/src/render/lights/qdirectionallight_p.h b/src/render/lights/qdirectionallight_p.h
index 0798cf9fd..c197c527d 100644
--- a/src/render/lights/qdirectionallight_p.h
+++ b/src/render/lights/qdirectionallight_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <private/qabstractlight_p.h>
+#include <private/qlight_p.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +56,7 @@ namespace Qt3DRender {
class QDirectionalLight;
-class QDirectionalLightPrivate : QAbstractLightPrivate
+class QDirectionalLightPrivate : QLightPrivate
{
public:
QDirectionalLightPrivate();
diff --git a/src/render/lights/qabstractlight.cpp b/src/render/lights/qlight.cpp
index b0132e43a..eeb6e7463 100644
--- a/src/render/lights/qabstractlight.cpp
+++ b/src/render/lights/qlight.cpp
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#include "qabstractlight.h"
-#include "qabstractlight_p.h"
+#include "qlight.h"
+#include "qlight_p.h"
QT_BEGIN_NAMESPACE
@@ -43,68 +43,70 @@ namespace Qt3DRender
{
/*!
- * \qmltype AbstractLight
+ * \qmltype Light
* \inqmlmodule Qt3D.Render
- * \instantiates Qt3DRender::QAbstractLight
- * \brief Encapsulate a QAbstractLight object in a Qt 3D scene.
- * \since 5.3
+ * \instantiates QLight
+ * \brief Encapsulate a QLight object in a Qt 3D scene.
+ * \since 5.6
*/
/*!
- \class Qt3DRender::QAbstractLightPrivate
+ \class Qt3DRender::QLightPrivate
\internal
*/
-QAbstractLightPrivate::QAbstractLightPrivate()
- : QShaderDataPrivate()
- , m_color(QColor(255, 255, 255))
+QLightPrivate::QLightPrivate()
+ : m_color(QColor(255, 255, 255))
, m_intensity(1.0f)
-{}
+{
+}
-void QAbstractLight::copy(const QNode *ref)
+void QLight::copy(const QNode *ref)
{
- const QAbstractLight *light = static_cast<const QAbstractLight*>(ref);
+ const QLight *light = static_cast<const QLight*>(ref);
d_func()->m_color = light->d_func()->m_color;
d_func()->m_intensity = light->d_func()->m_intensity;
- // This needs to be last otherwise, properties value won't be copied
- // as we use shader introspection in QShaderData::copy
QShaderData::copy(ref);
}
/*!
- \class Qt3DRender::QAbstractLight
+ \class Qt3DRender::QLight
\inmodule Qt3DRender
*/
/*!
- * Constructs a new QAbstractLight with the given \a parent.
+ * Constructs a new QLight with the given \a parent.
*/
-QAbstractLight::QAbstractLight(Qt3DCore::QNode *parent) :
- QShaderData(*new QAbstractLightPrivate, parent)
+QLight::QLight(Qt3DCore::QNode *parent) :
+ QShaderData(*new QLightPrivate, parent)
{
}
/*! \internal */
-QAbstractLight::QAbstractLight(QAbstractLightPrivate &dd, QNode *parent)
+QLight::QLight(QLightPrivate &dd, QNode *parent)
: QShaderData(dd, parent)
{
}
+QLight::~QLight()
+{
+ cleanup();
+}
/*!
- * \property Qt3DRender::QAbstractLight::color
+ * \property Qt3DRender::QLight::color
*
- * Holds the current QAbstractLight color.
+ * Holds the current QLight color.
*/
-QColor QAbstractLight::color() const
+QColor QLight::color() const
{
- Q_D(const QAbstractLight);
+ Q_D(const QLight);
return d->m_color;
}
-void QAbstractLight::setColor(const QColor &color)
+void QLight::setColor(const QColor &color)
{
- Q_D(QAbstractLight);
+ Q_D(QLight);
if (d->m_color != color) {
d->m_color = color;
emit colorChanged();
@@ -112,50 +114,25 @@ void QAbstractLight::setColor(const QColor &color)
}
/*!
- \property Qt3DRender::QAbstractLight::intensity
+ \property Qt3DRender::QLight::intensity
- Holds the current QAbstractLight intensity.
+ Holds the current QLight intensity.
*/
-float QAbstractLight::intensity() const
+float QLight::intensity() const
{
- Q_D(const QAbstractLight);
+ Q_D(const QLight);
return d->m_intensity;
}
-void QAbstractLight::setIntensity(float intensity)
+void QLight::setIntensity(float intensity)
{
- Q_D(QAbstractLight);
+ Q_D(QLight);
if (d->m_intensity != intensity) {
d->m_intensity = intensity;
emit intensityChanged();
}
}
-/*!
- \property Qt3DRender::QAbstractLight::position
-
- Holds the current QAbstractLight position.
-*/
-void QAbstractLight::setPosition(const QVector3D &position)
-{
- Q_D(QAbstractLight);
- if (d->m_position != position) {
- d->m_position = position;
- emit positionChanged();
- }
-}
-
-QVector3D QAbstractLight::position() const
-{
- Q_D(const QAbstractLight);
- return d->m_position;
-}
-
-QShaderData::TransformType QAbstractLight::positionTransformed() const
-{
- return QShaderData::ModelToEye;
-}
-
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/lights/qabstractlight.h b/src/render/lights/qlight.h
index 4379f6aa6..4ed279e34 100644
--- a/src/render/lights/qabstractlight.h
+++ b/src/render/lights/qlight.h
@@ -34,11 +34,11 @@
**
****************************************************************************/
-#ifndef QT3DRENDER_QABSTRACTLIGHT_H
-#define QT3DRENDER_QABSTRACTLIGHT_H
+#ifndef QT3DRENDER_QLIGHT_H
+#define QT3DRENDER_QLIGHT_H
-#include <Qt3DRender/qshaderdata.h>
#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DRender/qshaderdata.h>
#include <QVector3D>
#include <QColor>
@@ -47,18 +47,17 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAbstractLightPrivate;
+class QLightPrivate;
-class QT3DRENDERSHARED_EXPORT QAbstractLight : public QShaderData
+class QT3DRENDERSHARED_EXPORT QLight : public QShaderData
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(float intensity READ intensity WRITE setIntensity NOTIFY intensityChanged)
- Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
- Q_PROPERTY(TransformType positionTransformed READ positionTransformed CONSTANT)
public :
- explicit QAbstractLight(Qt3DCore::QNode *parent = 0);
+ explicit QLight(Qt3DCore::QNode *parent = 0);
+ ~QLight();
QColor color() const;
void setColor(const QColor &color);
@@ -66,26 +65,21 @@ public :
float intensity() const;
void setIntensity(float intensity);
- void setPosition(const QVector3D &position);
- QVector3D position() const;
-
- TransformType positionTransformed() const;
-
protected :
- QAbstractLight(QAbstractLightPrivate &dd, Qt3DCore::QNode *parent = 0);
+ QLight(QLightPrivate &dd, Qt3DCore::QNode *parent = 0);
void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
Q_SIGNALS:
void colorChanged();
void intensityChanged();
- void positionChanged();
private:
- Q_DECLARE_PRIVATE(QAbstractLight)
+ Q_DECLARE_PRIVATE(QLight)
+ QT3D_CLONEABLE(QLight)
};
} // namespace Qt3DRender
QT_END_NAMESPACE
-#endif // QT3DRENDER_LIGHT_H
+#endif // QT3DRENDER_QLIGHT_H
diff --git a/src/render/lights/qabstractlight_p.h b/src/render/lights/qlight_p.h
index cb81a712c..6f8229505 100644
--- a/src/render/lights/qabstractlight_p.h
+++ b/src/render/lights/qlight_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QT3DRENDER_QABSTRACTLIGHT_P_H
-#define QT3DRENDER_QABSTRACTLIGHT_P_H
+#ifndef QT3DRENDER_QLIGHT_P_H
+#define QT3DRENDER_QLIGHT_P_H
//
// W A R N I N G
@@ -54,21 +54,20 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAbstractLight;
+class QLight;
-class QAbstractLightPrivate : public QShaderDataPrivate
+class QLightPrivate : public QShaderDataPrivate
{
public:
- QAbstractLightPrivate();
+ QLightPrivate();
- Q_DECLARE_PUBLIC(QAbstractLight)
+ Q_DECLARE_PUBLIC(QLight)
QColor m_color;
float m_intensity;
- QVector3D m_position;
};
}
QT_END_NAMESPACE
-#endif // QT3DRENDER_QABSTRACTLIGHT_P_H
+#endif // QT3DRENDER_QLIGHT_P_H
diff --git a/src/render/lights/qpointlight.cpp b/src/render/lights/qpointlight.cpp
index 21ff60aa0..539e99b00 100644
--- a/src/render/lights/qpointlight.cpp
+++ b/src/render/lights/qpointlight.cpp
@@ -63,7 +63,6 @@ namespace Qt3DRender {
\internal
*/
QPointLightPrivate::QPointLightPrivate()
- : QAbstractLightPrivate()
{
}
@@ -88,13 +87,13 @@ QPointLightPrivate::QPointLightPrivate()
Constructs a new QPointLight with the specified \a parent.
*/
QPointLight::QPointLight(QNode *parent)
- : QAbstractLight(*new QPointLightPrivate, parent)
+ : QLight(*new QPointLightPrivate, parent)
{
}
/*! \internal */
QPointLight::QPointLight(QPointLightPrivate &dd, QNode *parent)
- : QAbstractLight(dd, parent)
+ : QLight(dd, parent)
{
}
diff --git a/src/render/lights/qpointlight.h b/src/render/lights/qpointlight.h
index 2f3711459..eb8b447d7 100644
--- a/src/render/lights/qpointlight.h
+++ b/src/render/lights/qpointlight.h
@@ -37,7 +37,7 @@
#ifndef QT3DRENDER_QPOINTLIGHT_H
#define QT3DRENDER_QPOINTLIGHT_H
-#include <Qt3DRender/qabstractlight.h>
+#include <Qt3DRender/qlight.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +45,7 @@ namespace Qt3DRender {
class QPointLightPrivate;
-class QT3DRENDERSHARED_EXPORT QPointLight : public QAbstractLight
+class QT3DRENDERSHARED_EXPORT QPointLight : public QLight
{
Q_OBJECT
diff --git a/src/render/lights/qpointlight_p.h b/src/render/lights/qpointlight_p.h
index 67396b943..2e2cd652e 100644
--- a/src/render/lights/qpointlight_p.h
+++ b/src/render/lights/qpointlight_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <private/qabstractlight_p.h>
+#include <private/qlight_p.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +56,7 @@ namespace Qt3DRender {
class QPointLight;
-class QPointLightPrivate : public QAbstractLightPrivate
+class QPointLightPrivate : public QLightPrivate
{
public:
QPointLightPrivate();
diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp
index ab0d822e7..b666ef1e1 100644
--- a/src/render/lights/qspotlight.cpp
+++ b/src/render/lights/qspotlight.cpp
@@ -67,8 +67,7 @@ namespace Qt3DRender {
\internal
*/
QSpotLightPrivate::QSpotLightPrivate()
- : QAbstractLightPrivate()
- , m_cutOffAngle(45.0f)
+ : m_cutOffAngle(45.0f)
{
}
@@ -97,9 +96,7 @@ void QSpotLight::copy(const QNode *ref)
const QSpotLight *light = static_cast<const QSpotLight*>(ref);
d_func()->m_direction = light->d_func()->m_direction;
d_func()->m_cutOffAngle = light->d_func()->m_cutOffAngle;
- // This needs to be last otherwise, properties value won't be copied
- // as we use shader introspection in QShaderData::copy
- QAbstractLight::copy(ref);
+ QLight::copy(ref);
}
@@ -108,13 +105,13 @@ void QSpotLight::copy(const QNode *ref)
Constructs a new QSpotLight with the specified \a parent.
*/
QSpotLight::QSpotLight(QNode *parent)
- : QAbstractLight(*new QSpotLightPrivate, parent)
+ : QLight(*new QSpotLightPrivate, parent)
{
}
/*! \internal */
QSpotLight::QSpotLight(QSpotLightPrivate &dd, QNode *parent)
- : QAbstractLight(dd, parent)
+ : QLight(dd, parent)
{
}
diff --git a/src/render/lights/qspotlight.h b/src/render/lights/qspotlight.h
index 6f8d2bbd6..9a04b7925 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/qabstractlight.h>
+#include <Qt3DRender/qlight.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +45,7 @@ namespace Qt3DRender {
class QSpotLightPrivate;
-class QT3DRENDERSHARED_EXPORT QSpotLight : public QAbstractLight
+class QT3DRENDERSHARED_EXPORT QSpotLight : public QLight
{
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 05f916083..66d5dfa6d 100644
--- a/src/render/lights/qspotlight_p.h
+++ b/src/render/lights/qspotlight_p.h
@@ -48,13 +48,13 @@
// We mean it.
//
-#include <private/qabstractlight_p.h>
+#include <private/qlight_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QSpotLightPrivate : public QAbstractLightPrivate
+class QSpotLightPrivate : public QLightPrivate
{
public:
QSpotLightPrivate();