diff options
author | Paul Lemire <paul.lemire@epitech.eu> | 2014-02-13 22:37:21 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-07-05 12:57:24 +0200 |
commit | dc88965aa15b9cb725047843fb9874ddc72b3d84 (patch) | |
tree | 87eb0be8b69380b3779289f3f2ff8530d898b740 /src/render | |
parent | c5dbc0db9c76732817977ea9071079adc3b2230f (diff) |
Added basic light elements in rendering frontend.
QAbstractLight, QPointLight, QSpotLight, QDirectionalLight
Change-Id: I5307153f74a030b65d5b1dbf6eebbee85851edda
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/frontend/qabstractlight.cpp | 119 | ||||
-rw-r--r-- | src/render/frontend/qabstractlight.h | 87 | ||||
-rw-r--r-- | src/render/frontend/qabstractlight_p.h | 68 | ||||
-rw-r--r-- | src/render/frontend/qdirectionallight.cpp | 82 | ||||
-rw-r--r-- | src/render/frontend/qdirectionallight.h | 76 | ||||
-rw-r--r-- | src/render/frontend/qdirectionallight_p.h | 66 | ||||
-rw-r--r-- | src/render/frontend/qpointlight.cpp | 66 | ||||
-rw-r--r-- | src/render/frontend/qpointlight.h | 69 | ||||
-rw-r--r-- | src/render/frontend/qpointlight_p.h | 65 | ||||
-rw-r--r-- | src/render/frontend/qspotlight.cpp | 99 | ||||
-rw-r--r-- | src/render/frontend/qspotlight.h | 81 | ||||
-rw-r--r-- | src/render/frontend/qspotlight_p.h | 65 | ||||
-rw-r--r-- | src/render/frontend/render-frontend.pri | 16 |
13 files changed, 957 insertions, 2 deletions
diff --git a/src/render/frontend/qabstractlight.cpp b/src/render/frontend/qabstractlight.cpp new file mode 100644 index 000000000..e086eb606 --- /dev/null +++ b/src/render/frontend/qabstractlight.cpp @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qabstractlight.h" +#include "qabstractlight_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3D +{ + +/*! + * \qmltype QAbstractLight + * \instantiates QAbstractLight + * \brief Encapsulate a QAbstractLight object in a Qt3D scene. + * \since 5.3 + */ + + +QAbstractLightPrivate::QAbstractLightPrivate(QAbstractLight *qq) + : ComponentPrivate(qq) + , m_color(QColor(255, 255, 255)) + , m_intensity(1.0f) + {} + +/*! + * Constructs a new QAbstractLight with the given \a parent. + */ +QAbstractLight::QAbstractLight(Qt3D::Node *parent) : + Component(*new QAbstractLightPrivate(this), parent) +{ +} + +QAbstractLight::QAbstractLight(QAbstractLightPrivate &dd, Node *parent) + : Component(dd, parent) +{ +} + + +/*! + * Returns the current QAbstractLight color. + */ +QColor QAbstractLight::color() const +{ + Q_D(const QAbstractLight); + return d->m_color; +} + +/*! + * Sets the current QAbstractLight \a color; + * + * \sa void QAbstractLight::colorChanged(); + */ +void QAbstractLight::setColor(const QColor &color) +{ + Q_D(QAbstractLight); + if (d->m_color != color) + { + d->m_color = color; + emit colorChanged(); + } +} + +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(); + } +} + +} // Qt3D + +QT_END_NAMESPACE diff --git a/src/render/frontend/qabstractlight.h b/src/render/frontend/qabstractlight.h new file mode 100644 index 000000000..7eb886c57 --- /dev/null +++ b/src/render/frontend/qabstractlight.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QABSTRACTLIGHT_H +#define QT3D_QABSTRACTLIGHT_H + +#include <Qt3DCore/component.h> +#include <Qt3DRenderer/qt3drenderer_global.h> + +#include <QVector3D> +#include <QColor> + +QT_BEGIN_NAMESPACE + +namespace Qt3D +{ + +class QAbstractLightPrivate; + +class QT3DRENDERERSHARED_EXPORT QAbstractLight : public Component +{ + Q_OBJECT + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + Q_PROPERTY(float intensity READ intensity WRITE setIntensity NOTIFY intensityChanged) + +public : + + explicit QAbstractLight(Node *parent = 0); + + QColor color() const; + void setColor(const QColor &color); + + float intensity() const; + void setIntensity(float intensity); + +protected : + Q_DECLARE_PRIVATE(QAbstractLight) + QAbstractLight(QAbstractLightPrivate &dd, Node *parent = 0); + +Q_SIGNALS: + void colorChanged(); + void intensityChanged(); +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_LIGHT_H diff --git a/src/render/frontend/qabstractlight_p.h b/src/render/frontend/qabstractlight_p.h new file mode 100644 index 000000000..0609e1048 --- /dev/null +++ b/src/render/frontend/qabstractlight_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QABSTRACTLIGHT_P_H +#define QT3D_QABSTRACTLIGHT_P_H + +#include <Qt3DRenderer/qt3drenderer_global.h> +#include <private/component_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QAbstractLight; + +class QT3DRENDERERSHARED_EXPORT QAbstractLightPrivate : public ComponentPrivate +{ +public: + QAbstractLightPrivate(QAbstractLight *qq); + + Q_DECLARE_PUBLIC(QAbstractLight) + QColor m_color; + float m_intensity; +}; + +} + +QT_END_NAMESPACE + +#endif // QT3D_QABSTRACTLIGHT_P_H diff --git a/src/render/frontend/qdirectionallight.cpp b/src/render/frontend/qdirectionallight.cpp new file mode 100644 index 000000000..7f74c7144 --- /dev/null +++ b/src/render/frontend/qdirectionallight.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdirectionallight.h" +#include "qdirectionallight_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + + +QDirectionalLightPrivate::QDirectionalLightPrivate(QDirectionalLight *qq) + : QAbstractLightPrivate(qq) +{ +} + +QDirectionalLight::QDirectionalLight(Node *parent) + : QAbstractLight(*new QDirectionalLightPrivate(this), parent) +{ +} + +QDirectionalLight::QDirectionalLight(QDirectionalLightPrivate &dd, Node *parent) + : QAbstractLight(dd, parent) +{ +} + +void QDirectionalLight::setDirection(const QVector3D &direction) +{ + Q_D(QDirectionalLight); + if (direction != d->m_direction) { + d->m_direction = direction; + emit directionChanged(); + } +} + +QVector3D QDirectionalLight::direction() const +{ + Q_D(const QDirectionalLight); + return d->m_direction; +} + +} // Qt3D + +QT_END_NAMESPACE diff --git a/src/render/frontend/qdirectionallight.h b/src/render/frontend/qdirectionallight.h new file mode 100644 index 000000000..1c0dc425f --- /dev/null +++ b/src/render/frontend/qdirectionallight.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QDIRECTIONALLIGHT_H +#define QT3D_QDIRECTIONALLIGHT_H + +#include <Qt3DRenderer/qabstractlight.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QDirectionalLightPrivate; + +class QT3DRENDERERSHARED_EXPORT QDirectionalLight : public QAbstractLight +{ + Q_OBJECT + Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged) + +public: + explicit QDirectionalLight(Node *parent = 0); + + void setDirection(const QVector3D &direction); + QVector3D direction() const; + +Q_SIGNALS: + void directionChanged(); + +protected: + Q_DECLARE_PRIVATE(QDirectionalLight) + QDirectionalLight(QDirectionalLightPrivate &dd, Node *parent = 0); +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_QDIRECTIONALLIGHT_H diff --git a/src/render/frontend/qdirectionallight_p.h b/src/render/frontend/qdirectionallight_p.h new file mode 100644 index 000000000..802d0241c --- /dev/null +++ b/src/render/frontend/qdirectionallight_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QDIRECTIONALLIGHT_P_H +#define QT3D_QDIRECTIONALLIGHT_P_H + +#include <private/qabstractlight_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QDirectionalLight; + +class QT3DRENDERERSHARED_EXPORT QDirectionalLightPrivate : QAbstractLightPrivate +{ +public: + QDirectionalLightPrivate(QDirectionalLight *qq); + + Q_DECLARE_PUBLIC(QDirectionalLight) + QVector3D m_direction; +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_QDIRECTIONALLIGHT_P_H diff --git a/src/render/frontend/qpointlight.cpp b/src/render/frontend/qpointlight.cpp new file mode 100644 index 000000000..a91a3e985 --- /dev/null +++ b/src/render/frontend/qpointlight.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qpointlight.h" +#include "qpointlight_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +QPointLightPrivate::QPointLightPrivate(QPointLight *qq) + : QAbstractLightPrivate(qq) +{ +} + +QPointLight::QPointLight(Node *parent) + : QAbstractLight(*new QPointLightPrivate(this), parent) +{ +} + +QPointLight::QPointLight(QPointLightPrivate &dd, Node *parent) + : QAbstractLight(dd, parent) +{ +} + +} // Qt3D + +QT_END_NAMESPACE diff --git a/src/render/frontend/qpointlight.h b/src/render/frontend/qpointlight.h new file mode 100644 index 000000000..47d1e13ce --- /dev/null +++ b/src/render/frontend/qpointlight.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QPOINTLIGHT_H +#define QT3D_QPOINTLIGHT_H + +#include <Qt3DRenderer/qabstractlight.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QPointLightPrivate; + +class QT3DRENDERERSHARED_EXPORT QPointLight : public QAbstractLight +{ + Q_OBJECT + +public: + explicit QPointLight(Node *parent = 0); + +protected: + Q_DECLARE_PRIVATE(QPointLight) + QPointLight(QPointLightPrivate &dd, Node *parent); +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_QPOINTLIGHT_H diff --git a/src/render/frontend/qpointlight_p.h b/src/render/frontend/qpointlight_p.h new file mode 100644 index 000000000..3b8c421eb --- /dev/null +++ b/src/render/frontend/qpointlight_p.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QPOINTLIGHT_P_H +#define QT3D_QPOINTLIGHT_P_H + +#include <private/qabstractlight_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QPointLight; + +class QT3DRENDERERSHARED_EXPORT QPointLightPrivate : public QAbstractLightPrivate +{ +public: + QPointLightPrivate(QPointLight *qq); + + Q_DECLARE_PUBLIC(QPointLight) +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QPOINTLIGHT_P_H diff --git a/src/render/frontend/qspotlight.cpp b/src/render/frontend/qspotlight.cpp new file mode 100644 index 000000000..67f0ce753 --- /dev/null +++ b/src/render/frontend/qspotlight.cpp @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qspotlight.h" +#include "qspotlight_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + + +QSpotLightPrivate::QSpotLightPrivate(QSpotLight *qq) + :QAbstractLightPrivate(qq) + , m_cutOffAngle(45.0f) +{ +} + + +QSpotLight::QSpotLight(Node *parent) + : QAbstractLight(*new QSpotLightPrivate(this), parent) +{ +} + +QSpotLight::QSpotLight(QSpotLightPrivate &dd, Node *parent) + : QAbstractLight(dd, parent) +{ +} + +QVector3D QSpotLight::direction() const +{ + Q_D(const QSpotLight); + return d->m_direction; +} + +float QSpotLight::cutOffAngle() const +{ + Q_D(const QSpotLight); + return d->m_cutOffAngle; +} + +void QSpotLight::setDirection(const QVector3D &direction) +{ + Q_D(QSpotLight); + if (direction != d->m_direction) { + d->m_direction = direction; + emit directionChanged(); + } +} + +void QSpotLight::setCutOffAngle(float cutOffAngle) +{ + Q_D(QSpotLight); + if (d->m_cutOffAngle != cutOffAngle) { + d->m_cutOffAngle = cutOffAngle; + emit cutOffAngleChanged(); + } +} + +} // Qt3D + +QT_END_NAMESPACE diff --git a/src/render/frontend/qspotlight.h b/src/render/frontend/qspotlight.h new file mode 100644 index 000000000..4a0401c20 --- /dev/null +++ b/src/render/frontend/qspotlight.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QSPOTLIGHT_H +#define QT3D_QSPOTLIGHT_H + +#include <Qt3DRenderer/qabstractlight.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QSpotLightPrivate; + +class QT3DRENDERERSHARED_EXPORT QSpotLight : public QAbstractLight +{ + Q_OBJECT + Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged) + Q_PROPERTY(float cutOffAngle READ cutOffAngle WRITE setCutOffAngle NOTIFY cutOffAngleChanged) + +public: + explicit QSpotLight(Node *parent = 0); + + QVector3D direction() const; + float cutOffAngle() const; + + void setDirection(const QVector3D &direction); + void setCutOffAngle(float cutOffAngle); + +Q_SIGNALS: + void directionChanged(); + void cutOffAngleChanged(); + +protected: + Q_DECLARE_PRIVATE(QSpotLight) + QSpotLight(QSpotLightPrivate &dd, Node *parent = 0); +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_QSPOTLIGHT_H diff --git a/src/render/frontend/qspotlight_p.h b/src/render/frontend/qspotlight_p.h new file mode 100644 index 000000000..24a11300c --- /dev/null +++ b/src/render/frontend/qspotlight_p.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_QSPOTLIGHT_P_H +#define QT3D_QSPOTLIGHT_P_H + +#include <private/qabstractlight_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QT3DRENDERERSHARED_EXPORT QSpotLightPrivate : public QAbstractLightPrivate +{ +public: + QSpotLightPrivate(QSpotLight *qq); + + Q_DECLARE_PUBLIC(QSpotLight) + float m_cutOffAngle; + QVector3D m_direction; +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_QSPOTLIGHT_P_H diff --git a/src/render/frontend/render-frontend.pri b/src/render/frontend/render-frontend.pri index 2f7e1cc2c..83b15cd25 100644 --- a/src/render/frontend/render-frontend.pri +++ b/src/render/frontend/render-frontend.pri @@ -30,7 +30,15 @@ HEADERS += \ $$PWD/qtorusmesh.h \ $$PWD/qspheremesh.h \ $$PWD/qabstractshapemesh_p.h \ - $$PWD/qmesh_p.h + $$PWD/qmesh_p.h \ + $$PWD/qabstractlight.h \ + $$PWD/qpointlight.h \ + $$PWD/qspotlight.h \ + $$PWD/qdirectionallight.h \ + $$PWD/qabstractlight_p.h \ + $$PWD/qspotlight_p.h \ + $$PWD/qdirectionallight_p.h \ + $$PWD/qpointlight_p.h SOURCES += \ $$PWD/material.cpp \ @@ -52,4 +60,8 @@ SOURCES += \ $$PWD/parameter.cpp \ $$PWD/parametermapper.cpp \ $$PWD/qtorusmesh.cpp \ - $$PWD/qspheremesh.cpp + $$PWD/qspheremesh.cpp \ + $$PWD/qabstractlight.cpp \ + $$PWD/qpointlight.cpp \ + $$PWD/qspotlight.cpp \ + $$PWD/qdirectionallight.cpp |