summaryrefslogtreecommitdiffstats
path: root/src/render/lights/qabstractlight.cpp
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/qabstractlight.cpp
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/qabstractlight.cpp')
-rw-r--r--src/render/lights/qabstractlight.cpp161
1 files changed, 0 insertions, 161 deletions
diff --git a/src/render/lights/qabstractlight.cpp b/src/render/lights/qabstractlight.cpp
deleted file mode 100644
index b0132e43a..000000000
--- a/src/render/lights/qabstractlight.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 "qabstractlight.h"
-#include "qabstractlight_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender
-{
-
-/*!
- * \qmltype AbstractLight
- * \inqmlmodule Qt3D.Render
- * \instantiates Qt3DRender::QAbstractLight
- * \brief Encapsulate a QAbstractLight object in a Qt 3D scene.
- * \since 5.3
- */
-
-
-/*!
- \class Qt3DRender::QAbstractLightPrivate
- \internal
-*/
-QAbstractLightPrivate::QAbstractLightPrivate()
- : QShaderDataPrivate()
- , m_color(QColor(255, 255, 255))
- , m_intensity(1.0f)
-{}
-
-void QAbstractLight::copy(const QNode *ref)
-{
- const QAbstractLight *light = static_cast<const QAbstractLight*>(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
- \inmodule Qt3DRender
-*/
-
-/*!
- * Constructs a new QAbstractLight with the given \a parent.
- */
-QAbstractLight::QAbstractLight(Qt3DCore::QNode *parent) :
- QShaderData(*new QAbstractLightPrivate, parent)
-{
-}
-
-/*! \internal */
-QAbstractLight::QAbstractLight(QAbstractLightPrivate &dd, QNode *parent)
- : QShaderData(dd, parent)
-{
-}
-
-
-/*!
- * \property Qt3DRender::QAbstractLight::color
- *
- * Holds the current QAbstractLight color.
- */
-QColor QAbstractLight::color() const
-{
- Q_D(const QAbstractLight);
- return d->m_color;
-}
-
-void QAbstractLight::setColor(const QColor &color)
-{
- Q_D(QAbstractLight);
- if (d->m_color != color) {
- d->m_color = color;
- emit colorChanged();
- }
-}
-
-/*!
- \property Qt3DRender::QAbstractLight::intensity
-
- Holds the current QAbstractLight intensity.
-*/
-float QAbstractLight::intensity() const
-{
- Q_D(const QAbstractLight);
- return d->m_intensity;
-}
-
-void QAbstractLight::setIntensity(float intensity)
-{
- Q_D(QAbstractLight);
- 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