From 62055ddbc99f663f4ed6ed343794831ee10e4454 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 25 Nov 2015 11:36:58 +0100 Subject: Add a framegraph node for lighting Empty for now. Change-Id: I4edcdae58230e53c266c214052522d3ab54b1c6c Reviewed-by: Sean Harmer --- src/render/framegraph/framegraph.pri | 9 +++- src/render/framegraph/framegraphnode_p.h | 3 +- src/render/framegraph/lighting.cpp | 77 ++++++++++++++++++++++++++++++++ src/render/framegraph/lighting_p.h | 76 +++++++++++++++++++++++++++++++ src/render/framegraph/qlighting.cpp | 70 +++++++++++++++++++++++++++++ src/render/framegraph/qlighting.h | 69 ++++++++++++++++++++++++++++ src/render/framegraph/qlighting_p.h | 69 ++++++++++++++++++++++++++++ 7 files changed, 370 insertions(+), 3 deletions(-) create mode 100644 src/render/framegraph/lighting.cpp create mode 100644 src/render/framegraph/lighting_p.h create mode 100644 src/render/framegraph/qlighting.cpp create mode 100644 src/render/framegraph/qlighting.h create mode 100644 src/render/framegraph/qlighting_p.h (limited to 'src/render/framegraph') diff --git a/src/render/framegraph/framegraph.pri b/src/render/framegraph/framegraph.pri index 55ac95f77..b40b68932 100644 --- a/src/render/framegraph/framegraph.pri +++ b/src/render/framegraph/framegraph.pri @@ -43,7 +43,10 @@ HEADERS += \ $$PWD/techniquefilternode_p.h \ $$PWD/viewportnode_p.h \ $$PWD/qfrustumculling.h \ - $$PWD/frustumculling_p.h + $$PWD/frustumculling_p.h \ + $$PWD/qlighting.h \ + $$PWD/qlighting_p.h \ + $$PWD/lighting_p.h SOURCES += \ $$PWD/cameraselectornode.cpp \ @@ -75,4 +78,6 @@ SOURCES += \ $$PWD/techniquefilternode.cpp \ $$PWD/viewportnode.cpp \ $$PWD/qfrustumculling.cpp \ - $$PWD/frustumculling.cpp + $$PWD/frustumculling.cpp \ + $$PWD/qlighting.cpp \ + $$PWD/lighting.cpp diff --git a/src/render/framegraph/framegraphnode_p.h b/src/render/framegraph/framegraphnode_p.h index c9566e5d3..b068b103a 100644 --- a/src/render/framegraph/framegraphnode_p.h +++ b/src/render/framegraph/framegraphnode_p.h @@ -81,7 +81,8 @@ public: SubtreeSelector, StateSet, NoDraw, - FrustumCulling + FrustumCulling, + Lighting }; FrameGraphNodeType nodeType() const { return m_nodeType; } diff --git a/src/render/framegraph/lighting.cpp b/src/render/framegraph/lighting.cpp new file mode 100644 index 000000000..a5f65d2e1 --- /dev/null +++ b/src/render/framegraph/lighting.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** 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 "lighting_p.h" +#include +#include + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +namespace Render { + +Lighting::Lighting() + : FrameGraphNode(FrameGraphNode::Lighting) +{ +} + +void Lighting::updateFromPeer(Qt3DCore::QNode *peer) +{ + QLighting *lighting = static_cast(peer); + setEnabled(lighting->isEnabled()); +} + +void Lighting::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) +{ + Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast(e); + + switch (e->type()) { + case Qt3DCore::NodeUpdated: + if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) + setEnabled(propertyChange->value().toBool()); + break; + + default: + break; + } +} + +} // namespace Render + +} // namespace Qt3DRender + +QT_END_NAMESPACE diff --git a/src/render/framegraph/lighting_p.h b/src/render/framegraph/lighting_p.h new file mode 100644 index 000000000..fe00cea6b --- /dev/null +++ b/src/render/framegraph/lighting_p.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** 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_LIGHTING_H +#define QT3DRENDER_RENDER_LIGHTING_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 + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +namespace Render { + +class Lighting : public FrameGraphNode +{ +public: + Lighting(); + + void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE; + +protected: + void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; +}; + +} // namespace Render + +} // namespace Qt3DRender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_RENDER_LIGHTING_H diff --git a/src/render/framegraph/qlighting.cpp b/src/render/framegraph/qlighting.cpp new file mode 100644 index 000000000..07fe6022f --- /dev/null +++ b/src/render/framegraph/qlighting.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** 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 "qlighting.h" +#include "qlighting_p.h" +#include + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +QLighting::QLighting(QNode *parent) + : QFrameGraphNode(*new QLightingPrivate, parent) +{ +} + +QLighting::QLighting(QLightingPrivate &dd, QNode *parent) + : QFrameGraphNode(dd, parent) +{ +} + +QLighting::~QLighting() +{ + QNode::cleanup(); +} + +void QLighting::copy(const QNode *ref) +{ + QFrameGraphNode::copy(ref); + const QLighting *lighting = static_cast(ref); + Q_UNUSED(lighting); +} + + +} // namespace Qt3DRender + +QT_END_NAMESPACE diff --git a/src/render/framegraph/qlighting.h b/src/render/framegraph/qlighting.h new file mode 100644 index 000000000..dab2f056e --- /dev/null +++ b/src/render/framegraph/qlighting.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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_QLIGHTING_H +#define QT3DRENDER_QLIGHTING_H + +#include + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +class QLightingPrivate; + +class QT3DRENDERSHARED_EXPORT QLighting : public QFrameGraphNode +{ + Q_OBJECT + +public: + explicit QLighting(Qt3DCore::QNode *parent = 0); + ~QLighting(); + +protected: + QLighting(QLightingPrivate &dd, Qt3DCore::QNode *parent = 0); + void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE; + +private: + Q_DECLARE_PRIVATE(QLighting) + QT3D_CLONEABLE(QLighting) +}; + +} // namespace Qt3DRender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_QLIGHTING_H diff --git a/src/render/framegraph/qlighting_p.h b/src/render/framegraph/qlighting_p.h new file mode 100644 index 000000000..83b605890 --- /dev/null +++ b/src/render/framegraph/qlighting_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** 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_QLIGHTING_P_H +#define QT3DRENDER_QLIGHTING_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 + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +class QLighting; + +class QLightingPrivate : public QFrameGraphNodePrivate +{ +public : + Q_DECLARE_PUBLIC(QLighting) +}; + +} // namespace Qt3DRender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_QLIGHTING_P_H -- cgit v1.2.3