summaryrefslogtreecommitdiffstats
path: root/src/render/framegraph
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2015-09-18 18:04:22 +0100
committerPaul Lemire <paul.lemire@kdab.com>2015-10-13 12:13:09 +0000
commitb6756277908e1d8e15dd3e35da72c42569494152 (patch)
tree237ea333015f4479f9fbafd4184b89789983a304 /src/render/framegraph
parent9c1281f56317bfb8c050d0c464a5a1da1ca885bd (diff)
Final batch of file moves for now
Change-Id: I0c9e83e3142e6b083feb2cbcabcc4279de64b95b Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render/framegraph')
-rw-r--r--src/render/framegraph/cameraselectornode.cpp87
-rw-r--r--src/render/framegraph/cameraselectornode_p.h73
-rw-r--r--src/render/framegraph/clearbuffer.cpp79
-rw-r--r--src/render/framegraph/clearbuffer_p.h70
-rw-r--r--src/render/framegraph/framegraph.pri74
-rw-r--r--src/render/framegraph/framegraphnode.cpp166
-rw-r--r--src/render/framegraph/framegraphnode_p.h179
-rw-r--r--src/render/framegraph/framegraphsubtreeselector.cpp70
-rw-r--r--src/render/framegraph/framegraphsubtreeselector_p.h65
-rw-r--r--src/render/framegraph/framegraphvisitor.cpp99
-rw-r--r--src/render/framegraph/framegraphvisitor_p.h76
-rw-r--r--src/render/framegraph/layerfilternode.cpp84
-rw-r--r--src/render/framegraph/layerfilternode_p.h73
-rw-r--r--src/render/framegraph/nodraw.cpp83
-rw-r--r--src/render/framegraph/nodraw_p.h66
-rw-r--r--src/render/framegraph/qcameraselector.cpp108
-rw-r--r--src/render/framegraph/qcameraselector.h78
-rw-r--r--src/render/framegraph/qcameraselector_p.h63
-rw-r--r--src/render/framegraph/qclearbuffer.cpp96
-rw-r--r--src/render/framegraph/qclearbuffer.h87
-rw-r--r--src/render/framegraph/qclearbuffer_p.h60
-rw-r--r--src/render/framegraph/qframegraph.cpp144
-rw-r--r--src/render/framegraph/qframegraph.h81
-rw-r--r--src/render/framegraph/qframegraph_p.h64
-rw-r--r--src/render/framegraph/qframegraphnode.cpp140
-rw-r--r--src/render/framegraph/qframegraphnode.h77
-rw-r--r--src/render/framegraph/qframegraphnode_p.h64
-rw-r--r--src/render/framegraph/qframegraphselector.cpp104
-rw-r--r--src/render/framegraph/qframegraphselector.h82
-rw-r--r--src/render/framegraph/qframegraphselector_p.h65
-rw-r--r--src/render/framegraph/qlayerfilter.cpp128
-rw-r--r--src/render/framegraph/qlayerfilter.h76
-rw-r--r--src/render/framegraph/qlayerfilter_p.h62
-rw-r--r--src/render/framegraph/qnodraw.cpp70
-rw-r--r--src/render/framegraph/qnodraw.h61
-rw-r--r--src/render/framegraph/qrenderpassfilter.cpp161
-rw-r--r--src/render/framegraph/qrenderpassfilter.h82
-rw-r--r--src/render/framegraph/qrenderpassfilter_p.h65
-rw-r--r--src/render/framegraph/qrendertargetselector.cpp140
-rw-r--r--src/render/framegraph/qrendertargetselector.h84
-rw-r--r--src/render/framegraph/qrendertargetselector_p.h63
-rw-r--r--src/render/framegraph/qsortcriterion.cpp96
-rw-r--r--src/render/framegraph/qsortcriterion.h83
-rw-r--r--src/render/framegraph/qsortcriterion_p.h60
-rw-r--r--src/render/framegraph/qsortmethod.cpp120
-rw-r--r--src/render/framegraph/qsortmethod.h74
-rw-r--r--src/render/framegraph/qsortmethod_p.h61
-rw-r--r--src/render/framegraph/qstateset.cpp148
-rw-r--r--src/render/framegraph/qstateset.h74
-rw-r--r--src/render/framegraph/qstateset_p.h63
-rw-r--r--src/render/framegraph/qtechniquefilter.cpp165
-rw-r--r--src/render/framegraph/qtechniquefilter.h79
-rw-r--r--src/render/framegraph/qtechniquefilter_p.h62
-rw-r--r--src/render/framegraph/qviewport.cpp111
-rw-r--r--src/render/framegraph/qviewport.h83
-rw-r--r--src/render/framegraph/qviewport_p.h62
-rw-r--r--src/render/framegraph/renderpassfilternode.cpp121
-rw-r--r--src/render/framegraph/renderpassfilternode_p.h79
-rw-r--r--src/render/framegraph/rendertargetselectornode.cpp96
-rw-r--r--src/render/framegraph/rendertargetselectornode_p.h70
-rw-r--r--src/render/framegraph/sortcriterion.cpp80
-rw-r--r--src/render/framegraph/sortcriterion_p.h73
-rw-r--r--src/render/framegraph/sortmethod.cpp86
-rw-r--r--src/render/framegraph/sortmethod_p.h69
-rw-r--r--src/render/framegraph/statesetnode.cpp113
-rw-r--r--src/render/framegraph/statesetnode_p.h73
-rw-r--r--src/render/framegraph/techniquefilternode.cpp122
-rw-r--r--src/render/framegraph/techniquefilternode_p.h85
-rw-r--r--src/render/framegraph/viewportnode.cpp149
-rw-r--r--src/render/framegraph/viewportnode_p.h91
70 files changed, 6297 insertions, 0 deletions
diff --git a/src/render/framegraph/cameraselectornode.cpp b/src/render/framegraph/cameraselectornode.cpp
new file mode 100644
index 000000000..527147842
--- /dev/null
+++ b/src/render/framegraph/cameraselectornode.cpp
@@ -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: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 "cameraselectornode_p.h"
+#include <Qt3DRenderer/private/qcameraselector_p.h>
+#include <Qt3DRenderer/private/renderer_p.h>
+#include <Qt3DCore/private/qaspectmanager_p.h>
+#include <Qt3DCore/private/qchangearbiter_p.h>
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRenderer/private/renderlogging_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+CameraSelector::CameraSelector()
+ : FrameGraphNode(FrameGraphNode::CameraSelector)
+{
+}
+
+void CameraSelector::updateFromPeer(Qt3D::QNode *peer)
+{
+ QCameraSelector *selector = static_cast<QCameraSelector *>(peer);
+ m_cameraUuid = QNodeId();
+ if (selector->camera() != Q_NULLPTR)
+ m_cameraUuid = selector->camera()->id();
+ setEnabled(selector->isEnabled());
+}
+
+void CameraSelector::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ qCDebug(Render::Framegraph) << Q_FUNC_INFO;
+ if (e->type() == NodeUpdated) {
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("camera"))
+ m_cameraUuid = propertyChange->value().value<QNodeId>();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
+ setEnabled(propertyChange->value().toBool());
+ }
+}
+
+QNodeId CameraSelector::cameraUuid() const
+{
+ return m_cameraUuid;
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/cameraselectornode_p.h b/src/render/framegraph/cameraselectornode_p.h
new file mode 100644
index 000000000..cfe29f36d
--- /dev/null
+++ b/src/render/framegraph/cameraselectornode_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_CAMERASELECTOR_H
+#define QT3DRENDER_RENDER_CAMERASELECTOR_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QEntity;
+class QCameraSelector;
+
+namespace Render {
+
+class Renderer;
+
+class CameraSelector : public FrameGraphNode
+{
+public:
+ CameraSelector();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ Qt3D::QNodeId cameraUuid() const;
+
+private:
+ Qt3D::QNodeId m_cameraUuid;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_CAMERASELECTOR_H
diff --git a/src/render/framegraph/clearbuffer.cpp b/src/render/framegraph/clearbuffer.cpp
new file mode 100644
index 000000000..47982d5f0
--- /dev/null
+++ b/src/render/framegraph/clearbuffer.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** 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 "clearbuffer_p.h"
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+ClearBuffer::ClearBuffer()
+ : FrameGraphNode(FrameGraphNode::ClearBuffer)
+ , m_type(QClearBuffer::None)
+{
+}
+
+void ClearBuffer::updateFromPeer(Qt3D::QNode *peer)
+{
+ QClearBuffer *clearBuffer = static_cast<QClearBuffer *>(peer);
+ m_type = clearBuffer->buffers();
+ setEnabled(clearBuffer->isEnabled());
+}
+
+void ClearBuffer::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ if (e->type() == NodeUpdated) {
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("buffers"))
+ m_type = static_cast<QClearBuffer::BufferType>(propertyChange->value().toInt());
+ else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
+ setEnabled(propertyChange->value().toBool());
+ }
+}
+
+QClearBuffer::BufferType ClearBuffer::type() const
+{
+ return m_type;
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/clearbuffer_p.h b/src/render/framegraph/clearbuffer_p.h
new file mode 100644
index 000000000..1883e8134
--- /dev/null
+++ b/src/render/framegraph/clearbuffer_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_CLEARBUFFER_P_H
+#define QT3DRENDER_RENDER_CLEARBUFFER_P_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+#include <Qt3DRenderer/qclearbuffer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class FrameGraphManager;
+
+class ClearBuffer : public FrameGraphNode
+{
+public:
+ ClearBuffer();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ QClearBuffer::BufferType type() const;
+
+private:
+ QClearBuffer::BufferType m_type;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_CLEARBUFFER_P_H
diff --git a/src/render/framegraph/framegraph.pri b/src/render/framegraph/framegraph.pri
new file mode 100644
index 000000000..52cad4319
--- /dev/null
+++ b/src/render/framegraph/framegraph.pri
@@ -0,0 +1,74 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/cameraselectornode_p.h \
+ $$PWD/clearbuffer_p.h \
+ $$PWD/framegraphnode_p.h \
+ $$PWD/framegraphsubtreeselector_p.h \
+ $$PWD/framegraphvisitor_p.h \
+ $$PWD/layerfilternode_p.h \
+ $$PWD/nodraw_p.h \
+ $$PWD/qcameraselector.h \
+ $$PWD/qcameraselector_p.h \
+ $$PWD/qclearbuffer.h \
+ $$PWD/qclearbuffer_p.h \
+ $$PWD/qframegraph.h \
+ $$PWD/qframegraph_p.h \
+ $$PWD/qframegraphnode.h \
+ $$PWD/qframegraphnode_p.h \
+ $$PWD/qframegraphselector.h \
+ $$PWD/qframegraphselector_p.h \
+ $$PWD/qlayerfilter.h \
+ $$PWD/qlayerfilter_p.h \
+ $$PWD/qnodraw.h \
+ $$PWD/qrenderpassfilter.h \
+ $$PWD/qrenderpassfilter_p.h \
+ $$PWD/qrendertargetselector.h \
+ $$PWD/qrendertargetselector_p.h \
+ $$PWD/qsortcriterion.h \
+ $$PWD/qsortcriterion_p.h \
+ $$PWD/qsortmethod.h \
+ $$PWD/qsortmethod_p.h \
+ $$PWD/qstateset.h \
+ $$PWD/qstateset_p.h \
+ $$PWD/qtechniquefilter.h \
+ $$PWD/qtechniquefilter_p.h \
+ $$PWD/qviewport.h \
+ $$PWD/qviewport_p.h \
+ $$PWD/renderpassfilternode_p.h \
+ $$PWD/rendertargetselectornode_p.h \
+ $$PWD/sortcriterion_p.h \
+ $$PWD/sortmethod_p.h \
+ $$PWD/statesetnode_p.h \
+ $$PWD/techniquefilternode_p.h \
+ $$PWD/viewportnode_p.h
+
+SOURCES += \
+ $$PWD/cameraselectornode.cpp \
+ $$PWD/clearbuffer.cpp \
+ $$PWD/framegraphnode.cpp \
+ $$PWD/framegraphsubtreeselector.cpp \
+ $$PWD/framegraphvisitor.cpp \
+ $$PWD/layerfilternode.cpp \
+ $$PWD/nodraw.cpp \
+ $$PWD/qcameraselector.cpp \
+ $$PWD/qclearbuffer.cpp \
+ $$PWD/qframegraph.cpp \
+ $$PWD/qframegraphnode.cpp \
+ $$PWD/qframegraphselector.cpp \
+ $$PWD/qlayerfilter.cpp \
+ $$PWD/qnodraw.cpp \
+ $$PWD/qrenderpassfilter.cpp \
+ $$PWD/qrendertargetselector.cpp \
+ $$PWD/qsortcriterion.cpp \
+ $$PWD/qsortmethod.cpp \
+ $$PWD/qstateset.cpp \
+ $$PWD/qtechniquefilter.cpp \
+ $$PWD/qviewport.cpp \
+ $$PWD/renderpassfilternode.cpp \
+ $$PWD/rendertargetselectornode.cpp \
+ $$PWD/sortcriterion.cpp \
+ $$PWD/sortmethod.cpp \
+ $$PWD/statesetnode.cpp \
+ $$PWD/techniquefilternode.cpp \
+ $$PWD/viewportnode.cpp
diff --git a/src/render/framegraph/framegraphnode.cpp b/src/render/framegraph/framegraphnode.cpp
new file mode 100644
index 000000000..b001fd675
--- /dev/null
+++ b/src/render/framegraph/framegraphnode.cpp
@@ -0,0 +1,166 @@
+/****************************************************************************
+**
+** 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 "framegraphnode_p.h"
+#include <Qt3DRenderer/private/renderer_p.h>
+#include <Qt3DRenderer/qframegraph.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+FrameGraphNode::FrameGraphNode()
+ : QBackendNode()
+ , m_nodeType(InvalidNodeType)
+ , m_enabled(true)
+ , m_manager(Q_NULLPTR)
+{
+}
+
+FrameGraphNode::FrameGraphNode(FrameGraphNodeType nodeType)
+ : m_nodeType(nodeType)
+ , m_enabled(true)
+ , m_manager(Q_NULLPTR)
+{
+}
+
+FrameGraphNode::~FrameGraphNode()
+{
+}
+
+void FrameGraphNode::setFrameGraphManager(FrameGraphManager *manager)
+{
+ if (m_manager != manager)
+ m_manager = manager;
+}
+
+void FrameGraphNode::setHandle(HFrameGraphNode handle)
+{
+ m_handle = handle;
+}
+
+void FrameGraphNode::setParentHandle(HFrameGraphNode parentHandle)
+{
+ m_parentHandle = parentHandle;
+ FrameGraphNode **parent = m_manager->data(m_parentHandle);
+ if (parent != Q_NULLPTR && *parent != Q_NULLPTR && !(*parent)->m_childrenHandles.contains(m_handle))
+ (*parent)->m_childrenHandles.append(m_handle);
+}
+
+void FrameGraphNode::appendChildHandle(HFrameGraphNode childHandle)
+{
+ if (!m_childrenHandles.contains(childHandle)) {
+ FrameGraphNode **child = m_manager->data(childHandle);
+ if (child != Q_NULLPTR) {
+ m_childrenHandles.append(childHandle);
+ (*child)->m_parentHandle = m_handle;
+ }
+ }
+}
+
+void FrameGraphNode::removeChildHandle(HFrameGraphNode childHandle)
+{
+ if (m_childrenHandles.contains(childHandle))
+ m_childrenHandles.removeAll(childHandle);
+}
+
+HFrameGraphNode FrameGraphNode::handle() const
+{
+ return m_handle;
+}
+
+HFrameGraphNode FrameGraphNode::parentHandle() const
+{
+ return m_parentHandle;
+}
+
+QList<HFrameGraphNode> FrameGraphNode::childrenHandles() const
+{
+ return m_childrenHandles;
+}
+
+FrameGraphNode *FrameGraphNode::parent() const
+{
+ FrameGraphNode **parent = m_manager->data(m_parentHandle);
+ if (parent != Q_NULLPTR)
+ return *parent;
+ return Q_NULLPTR;
+}
+
+QList<FrameGraphNode *> FrameGraphNode::children() const
+{
+ QList<FrameGraphNode *> children;
+
+ Q_FOREACH (HFrameGraphNode handle, m_childrenHandles) {
+ FrameGraphNode **child = m_manager->data(handle);
+ if (child != Q_NULLPTR)
+ children << *child;
+ }
+ return children;
+}
+
+// TO DO: We need to rework that and probably add a RenderFrameGraph element
+FrameGraphComponentFunctor::FrameGraphComponentFunctor(Renderer *renderer)
+ : m_renderer(renderer)
+{
+}
+
+Qt3D::QBackendNode *FrameGraphComponentFunctor::create(Qt3D::QNode *frontend, const Qt3D::QBackendNodeFactory *) const
+{
+ // TO DO: Ideally we should have a RenderFrameGraph component and use its setPeer method
+ // to do that
+ QFrameGraph *framegraph = static_cast<QFrameGraph *>(frontend);
+ if (framegraph->activeFrameGraph() != Q_NULLPTR)
+ m_renderer->setFrameGraphRoot(framegraph->activeFrameGraph()->id());
+ return Q_NULLPTR;
+}
+
+Qt3D::QBackendNode *FrameGraphComponentFunctor::get(const Qt3D::QNodeId &id) const
+{
+ Q_UNUSED(id);
+ return Q_NULLPTR;
+}
+
+void FrameGraphComponentFunctor::destroy(const Qt3D::QNodeId &id) const
+{
+ Q_UNUSED(id);
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/framegraphnode_p.h b/src/render/framegraph/framegraphnode_p.h
new file mode 100644
index 000000000..f5683a58e
--- /dev/null
+++ b/src/render/framegraph/framegraphnode_p.h
@@ -0,0 +1,179 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_FRAMEGRAPHNODE_H
+#define QT3DRENDER_RENDER_FRAMEGRAPHNODE_H
+
+#include <Qt3DCore/qhandle.h>
+#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DRenderer/qframegraphnode.h>
+#include <Qt3DRenderer/private/managers_p.h>
+#include <qglobal.h>
+#include <QVector>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class FrameGraphNode : public Qt3D::QBackendNode
+{
+public:
+ FrameGraphNode();
+ virtual ~FrameGraphNode();
+
+ enum FrameGraphNodeType {
+ InvalidNodeType = 0,
+ CameraSelector,
+ LayerFilter,
+ RenderPassFilter,
+ RenderTarget,
+ TechniqueFilter,
+ Viewport,
+ ClearBuffer,
+ SortMethod,
+ SubtreeSelector,
+ StateSet,
+ NoDraw
+ };
+ FrameGraphNodeType nodeType() const { return m_nodeType; }
+
+ void setEnabled(bool enabled) { m_enabled = enabled; }
+ inline bool isEnabled() const { return m_enabled; }
+
+ void setFrameGraphManager(FrameGraphManager *manager);
+
+ void setHandle(HFrameGraphNode handle);
+ void setParentHandle(HFrameGraphNode parentHandle);
+ void appendChildHandle(HFrameGraphNode childHandle);
+ void removeChildHandle(HFrameGraphNode childHandle);
+
+ HFrameGraphNode handle() const;
+ HFrameGraphNode parentHandle() const;
+ QList<HFrameGraphNode> childrenHandles() const;
+
+ FrameGraphNode *parent() const;
+ QList<FrameGraphNode *> children() const;
+
+protected:
+ FrameGraphNode(FrameGraphNodeType nodeType);
+
+private:
+ FrameGraphNodeType m_nodeType;
+ bool m_enabled;
+ HFrameGraphNode m_handle;
+ HFrameGraphNode m_parentHandle;
+ QList<HFrameGraphNode> m_childrenHandles;
+ FrameGraphManager *m_manager;
+
+ friend class FrameGraphVisitor;
+};
+
+template<typename Backend, typename Frontend>
+class FrameGraphNodeFunctor : public Qt3D::QBackendNodeFunctor
+{
+public:
+ explicit FrameGraphNodeFunctor(FrameGraphManager *manager)
+ : m_manager(manager)
+ {
+ }
+
+ Qt3D::QBackendNode *create(Qt3D::QNode *frontend, const Qt3D::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE
+ {
+ return createBackendFrameGraphNode(frontend, factory);
+ }
+
+ Qt3D::QBackendNode *get(const Qt3D::QNodeId &id) const Q_DECL_OVERRIDE
+ {
+ FrameGraphNode **node = m_manager->lookupResource(id);
+ if (node != Q_NULLPTR)
+ return *node;
+ return Q_NULLPTR;
+ }
+
+ void destroy(const Qt3D::QNodeId &id) const Q_DECL_OVERRIDE
+ {
+ m_manager->releaseResource(id);
+ }
+
+protected:
+ Backend *createBackendFrameGraphNode(Qt3D::QNode *n, const Qt3D::QBackendNodeFactory *factory) const
+ {
+ Frontend *f = qobject_cast<Frontend *>(n);
+ if (f != Q_NULLPTR) {
+ HFrameGraphNode handle = m_manager->lookupHandle(n->id());
+ if (handle.isNull()) {
+ handle = m_manager->getOrAcquireHandle(n->id());
+ Backend *backend = new Backend();
+ *m_manager->data(handle) = backend;
+ backend->setFactory(factory);
+ backend->setFrameGraphManager(m_manager);
+ backend->setHandle(handle);
+ backend->setPeer(f);
+ QFrameGraphNode *parentFGNode = static_cast<QFrameGraphNode *>(n)->parentFrameGraphNode();
+ if (parentFGNode)
+ backend->setParentHandle(m_manager->lookupHandle(parentFGNode->id()));
+ return backend;
+ }
+ return static_cast<Backend *>(*m_manager->data(handle));
+ }
+ return Q_NULLPTR;
+ }
+
+private:
+ FrameGraphManager *m_manager;
+};
+
+class FrameGraphComponentFunctor : public Qt3D::QBackendNodeFunctor
+{
+public:
+ explicit FrameGraphComponentFunctor(Renderer *renderer);
+ Qt3D::QBackendNode *create(Qt3D::QNode *frontend, const Qt3D::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
+ Qt3D::QBackendNode *get(const Qt3D::QNodeId &id) const Q_DECL_OVERRIDE;
+ void destroy(const Qt3D::QNodeId &id) const Q_DECL_OVERRIDE;
+
+private:
+ Renderer *m_renderer;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_FRAMEGRAPHNODE_H
diff --git a/src/render/framegraph/framegraphsubtreeselector.cpp b/src/render/framegraph/framegraphsubtreeselector.cpp
new file mode 100644
index 000000000..5fa060d37
--- /dev/null
+++ b/src/render/framegraph/framegraphsubtreeselector.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 "framegraphsubtreeselector_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+// TO DO: this will be completed once the QServiceLocator is in place
+
+FrameGraphSubtreeSelector::FrameGraphSubtreeSelector()
+ : FrameGraphNode(FrameGraphNode::SubtreeSelector)
+{
+}
+
+FrameGraphSubtreeSelector::~FrameGraphSubtreeSelector()
+{
+}
+
+void FrameGraphSubtreeSelector::updateFromPeer(Qt3D::QNode *peer)
+{
+ QFrameGraphSelector *selector = static_cast<QFrameGraphSelector *>(peer);
+ setEnabled(selector->isEnabled());
+}
+
+void FrameGraphSubtreeSelector::sceneChangeEvent(const Qt3D::QSceneChangePtr &)
+{
+}
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/framegraphsubtreeselector_p.h b/src/render/framegraph/framegraphsubtreeselector_p.h
new file mode 100644
index 000000000..8f3cd9ea2
--- /dev/null
+++ b/src/render/framegraph/framegraphsubtreeselector_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_FRAMEGRAPHSUBTREESELECTOR_H
+#define QT3DRENDER_RENDER_FRAMEGRAPHSUBTREESELECTOR_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+#include <Qt3DRenderer/qframegraphselector.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class FrameGraphSubtreeSelector : public FrameGraphNode
+{
+public:
+ FrameGraphSubtreeSelector();
+ ~FrameGraphSubtreeSelector();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_FINAL;
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_FINAL;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_FRAMEGRAPHSUBTREESELECTOR_H
diff --git a/src/render/framegraph/framegraphvisitor.cpp b/src/render/framegraph/framegraphvisitor.cpp
new file mode 100644
index 000000000..e9b825815
--- /dev/null
+++ b/src/render/framegraph/framegraphvisitor.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: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 "framegraphvisitor_p.h"
+
+#include "framegraphnode_p.h"
+#include <Qt3DRenderer/private/renderer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+FrameGraphVisitor::FrameGraphVisitor()
+ : m_renderer(Q_NULLPTR)
+ , m_jobs(Q_NULLPTR)
+ , m_renderviewIndex(0)
+
+{
+}
+
+void FrameGraphVisitor::traverse(FrameGraphNode *root,
+ Renderer *renderer,
+ QVector<Qt3D::QAspectJobPtr> *jobs)
+{
+ m_renderer = renderer;
+ m_jobs = jobs;
+ m_renderviewIndex = 0;
+
+ Q_ASSERT(m_renderer);
+ Q_ASSERT(m_jobs);
+ Q_ASSERT_X(root, Q_FUNC_INFO, "The FrameGraphRoot is null");
+
+ // Kick off the traversal
+ Render::FrameGraphNode *node = root;
+ if (node == Q_NULLPTR)
+ qCritical() << Q_FUNC_INFO << "FrameGraph is null";
+ visit(node);
+}
+
+void FrameGraphVisitor::visit(Render::FrameGraphNode *node)
+{
+ // TO DO: check if node is a subtree selector
+ // in which case, we only visit the subtrees returned
+ // by the selector functor and not all the children
+ // as we would otherwise do
+
+ // Recurse to children (if we have any), otherwise if this is a leaf node,
+ // initiate a rendering from the current camera
+ Q_FOREACH (Render::FrameGraphNode *n, node->children())
+ visit(n);
+ // Leaf node - create a RenderView ready to be populated
+ // TODO: Pass in only framegraph config that has changed from previous
+ // index RenderViewJob.
+ if (node->childrenHandles().empty()) {
+ QAspectJobPtr job = m_renderer->createRenderViewJob(node, m_renderviewIndex++);
+ m_jobs->append(job);
+ }
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/framegraphvisitor_p.h b/src/render/framegraph/framegraphvisitor_p.h
new file mode 100644
index 000000000..560aa9787
--- /dev/null
+++ b/src/render/framegraph/framegraphvisitor_p.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: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_FRAMEGRAPHVISITOR_H
+#define QT3DRENDER_RENDER_FRAMEGRAPHVISITOR_H
+
+#include <qglobal.h>
+
+#include <Qt3DCore/qaspectjob.h>
+
+#include <QVector>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+class FrameGraphNode;
+class Renderer;
+
+class FrameGraphVisitor
+{
+public:
+ FrameGraphVisitor();
+
+ void traverse(FrameGraphNode *root,
+ Renderer *renderer,
+ QVector<Qt3D::QAspectJobPtr> *jobs);
+
+private:
+ void visit(Render::FrameGraphNode *node);
+
+ Renderer *m_renderer;
+ QVector<Qt3D::QAspectJobPtr> *m_jobs;
+ int m_renderviewIndex;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_FRAMEGRAPHVISITOR_H
diff --git a/src/render/framegraph/layerfilternode.cpp b/src/render/framegraph/layerfilternode.cpp
new file mode 100644
index 000000000..4c9ee50ad
--- /dev/null
+++ b/src/render/framegraph/layerfilternode.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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 "layerfilternode_p.h"
+#include "qlayerfilter.h"
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+LayerFilterNode::LayerFilterNode()
+ : FrameGraphNode(FrameGraphNode::LayerFilter)
+{
+}
+
+void LayerFilterNode::updateFromPeer(Qt3D::QNode *peer)
+{
+ QLayerFilter *layerFilter = static_cast<QLayerFilter *>(peer);
+ m_layers = layerFilter->layers();
+ setEnabled(layerFilter->isEnabled());
+}
+
+void LayerFilterNode::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ if (e->type() == NodeUpdated) {
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("layers"))
+ setLayers(propertyChange->value().value<QStringList>());
+ else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
+ setEnabled(propertyChange->value().toBool());
+ }
+}
+
+QStringList LayerFilterNode::layers() const
+{
+ return m_layers;
+}
+
+void LayerFilterNode::setLayers(const QStringList &list)
+{
+ m_layers = list;
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/layerfilternode_p.h b/src/render/framegraph/layerfilternode_p.h
new file mode 100644
index 000000000..fcbf54c77
--- /dev/null
+++ b/src/render/framegraph/layerfilternode_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_LAYERFILTERNODE_H
+#define QT3DRENDER_RENDER_LAYERFILTERNODE_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+#include <QStringList>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QLayerFilter;
+
+namespace Render {
+
+class Renderer;
+
+class LayerFilterNode : public FrameGraphNode
+{
+public:
+ LayerFilterNode();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ QStringList layers() const;
+ void setLayers(const QStringList &list);
+
+private:
+ QStringList m_layers;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_LAYERFILTERNODE_H
diff --git a/src/render/framegraph/nodraw.cpp b/src/render/framegraph/nodraw.cpp
new file mode 100644
index 000000000..0822779f8
--- /dev/null
+++ b/src/render/framegraph/nodraw.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 "nodraw_p.h"
+#include <Qt3DRenderer/qnodraw.h>
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+NoDraw::NoDraw()
+ : FrameGraphNode(FrameGraphNode::NoDraw)
+{
+}
+
+NoDraw::~NoDraw()
+{
+}
+
+void NoDraw::updateFromPeer(Qt3D::QNode *peer)
+{
+ QNoDraw *noDraw = static_cast<QNoDraw *>(peer);
+ setEnabled(noDraw->isEnabled());
+}
+
+void NoDraw::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+
+ switch (e->type()) {
+ case 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/nodraw_p.h b/src/render/framegraph/nodraw_p.h
new file mode 100644
index 000000000..068143252
--- /dev/null
+++ b/src/render/framegraph/nodraw_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 <Qt3DRenderer/private/framegraphnode_p.h>
+
+#ifndef QT3DRENDER_RENDER_NODRAW_H
+#define QT3DRENDER_RENDER_NODRAW_H
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class NoDraw : public FrameGraphNode
+{
+public:
+ NoDraw();
+ ~NoDraw();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+
+protected:
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_NODRAW_H
diff --git a/src/render/framegraph/qcameraselector.cpp b/src/render/framegraph/qcameraselector.cpp
new file mode 100644
index 000000000..d77c493e9
--- /dev/null
+++ b/src/render/framegraph/qcameraselector.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** 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 "qcameraselector.h"
+#include "qcameraselector_p.h"
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qentity_p.h>
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3D::CameraSelector
+*/
+
+/*! \internal */
+QCameraSelector::QCameraSelector(QCameraSelectorPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+/*!
+ \class Qt3DRender::QCameraSelectorPrivate
+ \internal
+*/
+QCameraSelectorPrivate::QCameraSelectorPrivate()
+ : QFrameGraphNodePrivate()
+ , m_camera(Q_NULLPTR)
+{}
+
+void QCameraSelector::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+ const QCameraSelector *other = static_cast<const QCameraSelector*>(ref);
+
+ if (other->d_func()->m_camera)
+ setCamera(qobject_cast<Qt3D::QEntity *>(QNode::clone(other->d_func()->m_camera)));
+}
+
+QCameraSelector::QCameraSelector(Qt3D::QNode *parent)
+ : QFrameGraphNode(*new QCameraSelectorPrivate, parent)
+{}
+
+QCameraSelector::~QCameraSelector()
+{
+ QNode::cleanup();
+}
+
+void QCameraSelector::setCamera(Qt3D::QEntity *camera)
+{
+ Q_D(QCameraSelector);
+ if (d->m_camera != camera) {
+ d->m_camera = camera;
+
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, it gets destroyed as well
+ if (!camera->parent())
+ camera->setParent(this);
+ emit cameraChanged();
+ }
+}
+
+Qt3D::QEntity *QCameraSelector::camera() const
+{
+ Q_D(const QCameraSelector);
+ return d->m_camera;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qcameraselector.h b/src/render/framegraph/qcameraselector.h
new file mode 100644
index 000000000..546d77a61
--- /dev/null
+++ b/src/render/framegraph/qcameraselector.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCAMERASELECTOR_H
+#define QT3DRENDER_QCAMERASELECTOR_H
+
+#include <Qt3DRenderer/qt3drenderer_global.h>
+#include <Qt3DRenderer/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QCameraSelectorPrivate;
+
+class QT3DRENDERERSHARED_EXPORT QCameraSelector : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3D::QEntity *camera READ camera WRITE setCamera NOTIFY cameraChanged)
+
+public:
+ explicit QCameraSelector(Qt3D::QNode *parent = 0);
+ ~QCameraSelector();
+
+ void setCamera(Qt3D::QEntity *camera);
+ Qt3D::QEntity *camera() const;
+
+Q_SIGNALS:
+ void cameraChanged();
+
+protected:
+ QCameraSelector(QCameraSelectorPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ QT3D_CLONEABLE(QCameraSelector)
+ Q_DECLARE_PRIVATE(QCameraSelector)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+
+#endif // QT3DRENDER_QCAMERASELECTOR_H
diff --git a/src/render/framegraph/qcameraselector_p.h b/src/render/framegraph/qcameraselector_p.h
new file mode 100644
index 000000000..bcf00d6b6
--- /dev/null
+++ b/src/render/framegraph/qcameraselector_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCAMERASELECTOR_P_H
+#define QT3DRENDER_QCAMERASELECTOR_P_H
+
+#include <private/qframegraphnode_p.h>
+#include <Qt3DRenderer/qcameraselector.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QCameraSelector;
+
+class QCameraSelectorPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QCameraSelectorPrivate();
+
+ Q_DECLARE_PUBLIC(QCameraSelector)
+ Qt3D::QEntity *m_camera;
+};
+
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCAMERASELECTOR_P_H
diff --git a/src/render/framegraph/qclearbuffer.cpp b/src/render/framegraph/qclearbuffer.cpp
new file mode 100644
index 000000000..5706f6aa7
--- /dev/null
+++ b/src/render/framegraph/qclearbuffer.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** 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 "qclearbuffer.h"
+#include <private/qclearbuffer_p.h>
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QClearBufferPrivate
+ \internal
+*/
+QClearBufferPrivate::QClearBufferPrivate()
+ : QFrameGraphNodePrivate()
+ , m_buffersType(QClearBuffer::None)
+{
+}
+
+void QClearBuffer::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+ const QClearBuffer *b = static_cast<const QClearBuffer*>(ref);
+ d_func()->m_buffersType = b->d_func()->m_buffersType;
+}
+
+QClearBuffer::QClearBuffer(QNode *parent)
+ : QFrameGraphNode(*new QClearBufferPrivate, parent)
+{
+}
+
+QClearBuffer::~QClearBuffer()
+{
+ QNode::cleanup();
+}
+
+/*! \internal */
+QClearBuffer::QClearBuffer(QClearBufferPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+
+QClearBuffer::BufferType QClearBuffer::buffers() const
+{
+ Q_D(const QClearBuffer);
+ return d->m_buffersType;
+}
+
+void QClearBuffer::setBuffers(QClearBuffer::BufferType buffers)
+{
+ Q_D(QClearBuffer);
+ if (d->m_buffersType != buffers) {
+ d->m_buffersType = buffers;
+ emit buffersChanged();
+ }
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qclearbuffer.h b/src/render/framegraph/qclearbuffer.h
new file mode 100644
index 000000000..9b42cb46c
--- /dev/null
+++ b/src/render/framegraph/qclearbuffer.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: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_QCLEARBUFFER_H
+#define QT3DRENDER_QCLEARBUFFER_H
+
+#include <Qt3DRenderer/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QClearBufferPrivate;
+
+class QT3DRENDERERSHARED_EXPORT QClearBuffer : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(BufferType buffers READ buffers WRITE setBuffers NOTIFY buffersChanged)
+public:
+ explicit QClearBuffer(Qt3D::QNode *parent = 0);
+ ~QClearBuffer();
+
+ enum BufferType {
+ None = 0,
+ ColorBuffer = (1 << 0),
+ DepthBuffer = (1 << 1),
+ StencilBuffer = (1 << 2),
+ DepthStencilBuffer = (1 << 1) | (1 << 2),
+ ColorDepthBuffer = ColorBuffer | DepthBuffer,
+ ColorDepthStencilBuffer = ColorBuffer | DepthStencilBuffer,
+ AllBuffers = 0xFFFFFFFF
+ };
+ Q_ENUM(BufferType)
+
+ void setBuffers(BufferType buffers);
+ BufferType buffers() const;
+
+Q_SIGNALS:
+ void buffersChanged();
+
+protected:
+ QClearBuffer(QClearBufferPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QClearBuffer)
+ QT3D_CLONEABLE(QClearBuffer)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCLEARBUFFER_H
diff --git a/src/render/framegraph/qclearbuffer_p.h b/src/render/framegraph/qclearbuffer_p.h
new file mode 100644
index 000000000..402f956a2
--- /dev/null
+++ b/src/render/framegraph/qclearbuffer_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCLEARBUFFER_P_H
+#define QT3DRENDER_QCLEARBUFFER_P_H
+
+#include <private/qframegraphnode_p.h>
+#include <Qt3DRenderer/qclearbuffer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QClearBufferPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QClearBufferPrivate();
+
+ Q_DECLARE_PUBLIC(QClearBuffer)
+ QClearBuffer::BufferType m_buffersType;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCLEARBUFFER_P_H
diff --git a/src/render/framegraph/qframegraph.cpp b/src/render/framegraph/qframegraph.cpp
new file mode 100644
index 000000000..b8357f396
--- /dev/null
+++ b/src/render/framegraph/qframegraph.cpp
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** 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 "qframegraph.h"
+#include "qframegraph_p.h"
+#include <Qt3DCore/qentity.h>
+#include <Qt3DRenderer/qframegraphnode.h>
+#include <Qt3DRenderer/private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QFrameGraphPrivate
+ \internal
+*/
+QFrameGraphPrivate::QFrameGraphPrivate()
+ : QComponentPrivate()
+ , m_activeFrameGraph(Q_NULLPTR)
+{
+
+}
+
+/*!
+ \class FrameGraph
+ \inmodule Qt3DRenderer
+ \since 5.3
+
+ \brief Defines the rendering method to be used by the renderer
+
+ FrameGraph is the Component that has an activeFrameGraph property
+ that should reference the root FrameGraphItem of a frame graph
+ tree. The Entity that contains a FrameGraph property defines the
+ rendering method to be used by the renderer.
+
+ \note Only one FrameGraph can be active at any moment.
+ */
+
+/*!
+ \qmltype FrameGraph
+ \instantiates Qt3DRender::QFrameGraph
+ \inherits Component3D
+ \inqmlmodule Qt3D.Renderer
+ \since 5.5
+ \brief For OpenGL ...
+*/
+
+/*! \fn void Qt3DRender::QFrameGraph::copy(const QNode *ref)
+ Copies the \a ref instance into this one.
+ */
+void QFrameGraph::copy(const QNode *ref)
+{
+ QComponent::copy(ref);
+ const QFrameGraph *other = static_cast<const QFrameGraph*>(ref);
+ setActiveFrameGraph(qobject_cast<QFrameGraphNode *>(QNode::clone(other->d_func()->m_activeFrameGraph)));
+}
+
+/*!
+ \fn Qt3DRender::QFrameGraph::QFrameGraph(QNode *parent)
+ Constructs a new QFrameGraph with the specified \a parent.
+*/
+QFrameGraph::QFrameGraph(QNode *parent)
+ : QComponent(*new QFrameGraphPrivate, parent)
+{
+}
+
+QFrameGraph::~QFrameGraph()
+{
+ QNode::cleanup();
+}
+
+/*! \internal */
+QFrameGraph::QFrameGraph(QFrameGraphPrivate &dd, QNode *parent)
+ : QComponent(dd, parent)
+{
+}
+
+/*!
+ \qmlproperty Qt3D.Renderer::FrameGraphNode Qt3D.Renderer::FrameGraph::activeFrameGraph
+
+ Holds the current activeFrameGraph root node.
+*/
+
+/*!
+ \property Qt3DRender::QFrameGraph::activeFrameGraph
+
+ Holds the current activeFrameGraph root node.
+ */
+QFrameGraphNode *QFrameGraph::activeFrameGraph() const
+{
+ Q_D(const QFrameGraph);
+ return d->m_activeFrameGraph;
+}
+
+void QFrameGraph::setActiveFrameGraph(QFrameGraphNode *activeFrameGraph)
+{
+ Q_D(QFrameGraph);
+ if (activeFrameGraph != d->m_activeFrameGraph) {
+
+ if (!activeFrameGraph->parent())
+ activeFrameGraph->setParent(this);
+
+ d->m_activeFrameGraph = activeFrameGraph;
+ emit activeFrameGraphChanged();
+ }
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qframegraph.h b/src/render/framegraph/qframegraph.h
new file mode 100644
index 000000000..2a32a95f6
--- /dev/null
+++ b/src/render/framegraph/qframegraph.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: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_QFRAMEGRAPH_H
+#define QT3DRENDER_QFRAMEGRAPH_H
+
+#include <Qt3DRenderer/qt3drenderer_global.h>
+#include <Qt3DCore/qcomponent.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFrameGraphPrivate;
+class QFrameGraphNode;
+
+class QT3DRENDERERSHARED_EXPORT QFrameGraph : public Qt3D::QComponent
+{
+ Q_OBJECT
+ // Note : The full namespace has to be used to define the property
+ // otherwise this results in an error "cannot assign object to property"
+ Q_PROPERTY(Qt3DRender::QFrameGraphNode *activeFrameGraph READ activeFrameGraph WRITE setActiveFrameGraph NOTIFY activeFrameGraphChanged)
+ Q_CLASSINFO("DefaultProperty", "activeFrameGraph")
+
+public:
+ explicit QFrameGraph(Qt3D::QNode *parent = 0);
+ ~QFrameGraph();
+
+ QFrameGraphNode *activeFrameGraph() const;
+ void setActiveFrameGraph(QFrameGraphNode *activeFrameGraph);
+
+Q_SIGNALS:
+ void activeFrameGraphChanged();
+
+protected:
+ QFrameGraph(QFrameGraphPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QFrameGraph)
+ QT3D_CLONEABLE(QFrameGraph)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QFRAMEGRAPH_H
diff --git a/src/render/framegraph/qframegraph_p.h b/src/render/framegraph/qframegraph_p.h
new file mode 100644
index 000000000..0eb8ca7e5
--- /dev/null
+++ b/src/render/framegraph/qframegraph_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QFRAMEGRAPH_P_H
+#define QT3DRENDER_QFRAMEGRAPH_P_H
+
+#include <Qt3DCore/qt3dcore_global.h>
+#include <private/qcomponent_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFrameGraph;
+class QFrameGraphNode;
+
+class QFrameGraphPrivate : public Qt3D::QComponentPrivate
+{
+public:
+ QFrameGraphPrivate();
+
+ Q_DECLARE_PUBLIC(QFrameGraph)
+
+ QFrameGraphNode *m_activeFrameGraph;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QFRAMEGRAPH_P_H
diff --git a/src/render/framegraph/qframegraphnode.cpp b/src/render/framegraph/qframegraphnode.cpp
new file mode 100644
index 000000000..1c28d72a0
--- /dev/null
+++ b/src/render/framegraph/qframegraphnode.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** 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 "qframegraphnode.h"
+#include "qframegraphnode_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QFrameGraphNodePrivate
+ \internal
+*/
+QFrameGraphNodePrivate::QFrameGraphNodePrivate()
+ : QNodePrivate()
+ , m_enabled(true)
+{
+}
+
+/*!
+ \class QFrameGraphNode
+ \inmodule Qt3DRenderer
+ \since 5.5
+
+ \brief Base class of all FrameGraph configuration nodes.
+
+ This is an abstract class so it cannot be instanced directly
+ but rather through one of its subclasses.
+
+ */
+
+/*!
+ \qmltype FrameGraphNode
+ \inqmlmodule Qt3D.Renderer
+ \instantiates QFrameGraphNode
+ \inherits Node
+ \since 5.5
+ \qmlabstract
+*/
+
+/*!
+ The constructor creates an instance with the specified \a parent.
+ */
+QFrameGraphNode::QFrameGraphNode(QNode *parent)
+ : QNode(*new QFrameGraphNodePrivate, parent)
+{
+}
+
+QFrameGraphNode::~QFrameGraphNode()
+{
+ Q_ASSERT_X(Qt3D::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QFrameGraphNode subclass didn't call QNode::cleanup in its destructor");
+}
+
+/*!
+ Returns a pointer to the parent.
+ */
+QFrameGraphNode *QFrameGraphNode::parentFrameGraphNode() const
+{
+ QFrameGraphNode *parentFGNode = Q_NULLPTR;
+ QNode *parentN = parentNode();
+
+ while (parentN) {
+ if ((parentFGNode = qobject_cast<QFrameGraphNode *>(parentN)) != Q_NULLPTR)
+ break;
+ parentN = parentN->parentNode();
+ }
+ return parentFGNode;
+}
+
+/*! \internal */
+QFrameGraphNode::QFrameGraphNode(QFrameGraphNodePrivate &dd, QNode *parent)
+ : QNode(dd, parent)
+{
+}
+
+/*!
+ \qmlproperty bool Qt3D.Renderer::FrameGraphNode::enabled
+
+ Holds whether the frame graph node is enabled or disabled.
+*/
+
+/*!
+ \property Qt3DRender::QFrameGraphNode::enabled
+
+ Holds whether the frame graph node is enabled or disabled.
+*/
+
+bool QFrameGraphNode::isEnabled() const
+{
+ Q_D(const QFrameGraphNode);
+ return d->m_enabled;
+}
+
+void QFrameGraphNode::setEnabled(bool enabled)
+{
+ Q_D(QFrameGraphNode);
+ if (d->m_enabled != enabled) {
+ d->m_enabled = enabled;
+ emit enabledChanged();
+ }
+}
+
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qframegraphnode.h b/src/render/framegraph/qframegraphnode.h
new file mode 100644
index 000000000..ce14b9bed
--- /dev/null
+++ b/src/render/framegraph/qframegraphnode.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QFRAMEGRAPHNODE_H
+#define QT3DRENDER_QFRAMEGRAPHNODE_H
+
+#include <Qt3DCore/qnode.h>
+#include <Qt3DRenderer/qt3drenderer_global.h>
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFrameGraphNodePrivate;
+
+class QT3DRENDERERSHARED_EXPORT QFrameGraphNode : public Qt3D::QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
+public:
+ explicit QFrameGraphNode(Qt3D::QNode *parent = 0);
+ ~QFrameGraphNode();
+
+ QFrameGraphNode *parentFrameGraphNode() const;
+
+ bool isEnabled() const;
+ void setEnabled(bool enabled);
+
+protected:
+ QFrameGraphNode(QFrameGraphNodePrivate &dd, Qt3D::QNode *parent = 0);
+
+Q_SIGNALS:
+ void enabledChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QFrameGraphNode)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QFRAMEGRAPHNODE_H
diff --git a/src/render/framegraph/qframegraphnode_p.h b/src/render/framegraph/qframegraphnode_p.h
new file mode 100644
index 000000000..d1dc98196
--- /dev/null
+++ b/src/render/framegraph/qframegraphnode_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QFRAMEGRAPHNODE_P_H
+#define QT3DRENDER_QFRAMEGRAPHNODE_P_H
+
+#include <QtCore/QtGlobal>
+#include <private/qnode_p.h>
+#include <Qt3DRenderer/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFrameGraphNode;
+
+class QFrameGraphNodePrivate : public Qt3D::QNodePrivate
+{
+public:
+ QFrameGraphNodePrivate();
+
+ Q_DECLARE_PUBLIC(QFrameGraphNode)
+ bool m_enabled;
+ QList<QFrameGraphNode *> m_fgChildren;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QFRAMEGRAPHNODE_P_H
diff --git a/src/render/framegraph/qframegraphselector.cpp b/src/render/framegraph/qframegraphselector.cpp
new file mode 100644
index 000000000..6d2dc7e6e
--- /dev/null
+++ b/src/render/framegraph/qframegraphselector.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 "qframegraphselector.h"
+#include "qframegraphselector_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QFrameGraphSelectorPrivate
+ \internal
+*/
+QFrameGraphSelectorPrivate::QFrameGraphSelectorPrivate()
+ : QFrameGraphNodePrivate()
+{
+}
+
+/*!
+ \class Qt3DRender::QFrameGraphSelector
+ \inmodule Qt3DRenderer
+
+ \brief Qt3DRender::QFrameGraphSelector provide a way to select a one or more subtree of
+ the FrameGraph at runtime
+
+ The selection is made by executing Qt3DRender::QFrameGraphSelectorFunctor that will
+ return a vector containing the indices of the \l {QFrameGraph}{FrameGraph} subtree to be used
+ for the current frame.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QFrameGraphSelector instance using \a parent as parent.
+ */
+QFrameGraphSelector::QFrameGraphSelector(QNode *parent)
+ : QFrameGraphNode(*new QFrameGraphSelectorPrivate, parent)
+{
+}
+
+QFrameGraphSelector::~QFrameGraphSelector()
+{
+ QNode::cleanup();
+}
+
+/*!
+ \return the functor to be used for selecting FrameGraph subtrees.
+ */
+QFrameGraphSelectorFunctorPtr QFrameGraphSelector::selectionFunctor() const
+{
+ Q_D(const QFrameGraphSelector);
+ return d->m_selectionFunctor;
+}
+
+/*!
+ Sets the functor \a functor to be used for selecting \l {QFrameGraph}{FrameGraph} subtrees at
+ runtime.
+ */
+void QFrameGraphSelector::setSelectionFunctor(QFrameGraphSelectorFunctorPtr functor)
+{
+ Q_D(QFrameGraphSelector);
+ d->m_selectionFunctor = functor;
+}
+
+void QFrameGraphSelector::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qframegraphselector.h b/src/render/framegraph/qframegraphselector.h
new file mode 100644
index 000000000..8300be080
--- /dev/null
+++ b/src/render/framegraph/qframegraphselector.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QFRAMEGRAPHSELECTOR_H
+#define QT3DRENDER_QFRAMEGRAPHSELECTOR_H
+
+#include <Qt3DRenderer/qframegraphnode.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFrameGraphSelectorPrivate;
+
+class QT3DRENDERERSHARED_EXPORT QFrameGraphSelectorFunctor
+{
+public:
+ virtual QVector<int> operator()() = 0;
+ virtual ~QFrameGraphSelectorFunctor() {}
+};
+
+typedef QSharedPointer<QFrameGraphSelectorFunctor> QFrameGraphSelectorFunctorPtr;
+
+class QT3DRENDERERSHARED_EXPORT QFrameGraphSelector : public QFrameGraphNode
+{
+ Q_OBJECT
+public:
+ explicit QFrameGraphSelector(Qt3D::QNode *parent = 0);
+ ~QFrameGraphSelector();
+
+ QFrameGraphSelectorFunctorPtr selectionFunctor() const;
+ void setSelectionFunctor(QFrameGraphSelectorFunctorPtr functor);
+
+protected:
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ QT3D_CLONEABLE(QFrameGraphSelector)
+ Q_DECLARE_PRIVATE(QFrameGraphSelector)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DRender::QFrameGraphSelectorFunctorPtr)
+
+#endif // QT3DRENDER_QGFRAMEGRAPHSELECTOR_H
diff --git a/src/render/framegraph/qframegraphselector_p.h b/src/render/framegraph/qframegraphselector_p.h
new file mode 100644
index 000000000..b1d63a7fe
--- /dev/null
+++ b/src/render/framegraph/qframegraphselector_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QFRAMEGRAPHSELECTOR_P_H
+#define QT3DRENDER_QFRAMEGRAPHSELECTOR_P_H
+
+#include <Qt3DRenderer/private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFrameGraphSelector;
+class QFrameGraphSelectorFunctor;
+typedef QSharedPointer<QFrameGraphSelectorFunctor> QFrameGraphSelectorFunctorPtr;
+
+class QFrameGraphSelectorPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QFrameGraphSelectorPrivate();
+
+ QFrameGraphSelectorFunctorPtr m_selectionFunctor;
+
+ Q_DECLARE_PUBLIC(QFrameGraphSelector)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QFRAMEGRAPHSELECTOR_P_H
+
diff --git a/src/render/framegraph/qlayerfilter.cpp b/src/render/framegraph/qlayerfilter.cpp
new file mode 100644
index 000000000..1dad3c1db
--- /dev/null
+++ b/src/render/framegraph/qlayerfilter.cpp
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** 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 "qlayerfilter.h"
+#include "qlayerfilter_p.h"
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QLayerFilterPrivate
+ \internal
+*/
+QLayerFilterPrivate::QLayerFilterPrivate()
+ : QFrameGraphNodePrivate()
+{
+}
+
+/*!
+ \class QLayerFilter
+ \inmodule Qt3DRenderer
+ \since 5.5
+ \brief The QLayerFilter class provides ...
+*/
+
+/*!
+ \qmltype LayerFilter
+ \instantiates Qt3DRender::QLayerFilter
+ \inherits FrameGraphNode
+ \inqmlmodule Qt3D.Renderer
+ \since 5.5
+ \brief For ...
+*/
+
+/*! \fn void Qt3DRender::QLayerFilter::copy(const QNode *ref)
+ Copies the \a ref instance into this one.
+ */
+void QLayerFilter::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+ const QLayerFilter *layer = static_cast<const QLayerFilter*>(ref);
+ d_func()->m_layers = layer->d_func()->m_layers;
+}
+
+
+/*! \fn Qt3DRender::QLayerFilter::QLayerFilter(QNode *parent)
+ Constructs a new QLayerFilter with the specified \a parent.
+ */
+QLayerFilter::QLayerFilter(QNode *parent)
+ : QFrameGraphNode(*new QLayerFilterPrivate, parent)
+{
+}
+
+QLayerFilter::~QLayerFilter()
+{
+ QNode::cleanup();
+}
+
+/*! \internal */
+QLayerFilter::QLayerFilter(QLayerFilterPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+/*!
+ \property Qt3DRender::QLayerFilter::layers
+
+ */
+
+/*!
+ \qmlproperty stringlist Qt3D.Renderer::LayerFilter::layers
+
+*/
+
+void QLayerFilter::setLayers(const QStringList &layers)
+{
+ Q_D(QLayerFilter);
+ if (d->m_layers != layers) {
+ d->m_layers = layers;
+ emit layersChanged();
+ }
+}
+
+QStringList QLayerFilter::layers() const
+{
+ Q_D(const QLayerFilter);
+ return d->m_layers;
+}
+
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qlayerfilter.h b/src/render/framegraph/qlayerfilter.h
new file mode 100644
index 000000000..7e177e322
--- /dev/null
+++ b/src/render/framegraph/qlayerfilter.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: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_QLAYERFILTER_H
+#define QT3DRENDER_QLAYERFILTER_H
+
+#include <Qt3DRenderer/qframegraphnode.h>
+#include <QStringList>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QLayerFilterPrivate;
+
+class QT3DRENDERERSHARED_EXPORT QLayerFilter : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList layers READ layers WRITE setLayers NOTIFY layersChanged)
+public:
+ explicit QLayerFilter(Qt3D::QNode *parent = 0);
+ ~QLayerFilter();
+
+ void setLayers(const QStringList &layers);
+ QStringList layers() const;
+
+Q_SIGNALS:
+ void layersChanged();
+
+protected:
+ QLayerFilter(QLayerFilterPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QLayerFilter)
+ QT3D_CLONEABLE(QLayerFilter)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QLAYERFILTER_H
diff --git a/src/render/framegraph/qlayerfilter_p.h b/src/render/framegraph/qlayerfilter_p.h
new file mode 100644
index 000000000..e1abb7cf8
--- /dev/null
+++ b/src/render/framegraph/qlayerfilter_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QLAYERFILTER_P_H
+#define QT3DRENDER_QLAYERFILTER_P_H
+
+#include <Qt3DRenderer/qt3drenderer_global.h>
+#include <private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QLayerFilter;
+
+class QT3DRENDERERSHARED_EXPORT QLayerFilterPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QLayerFilterPrivate();
+
+ Q_DECLARE_PUBLIC(QLayerFilter)
+ QStringList m_layers;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QLAYERFILTER_P_H
diff --git a/src/render/framegraph/qnodraw.cpp b/src/render/framegraph/qnodraw.cpp
new file mode 100644
index 000000000..294bdba5f
--- /dev/null
+++ b/src/render/framegraph/qnodraw.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 "qnodraw.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ * \class Qt3D::QNoDraw::QNoDraw
+ *
+ * \brief When a Qt3D::QNoDraw node is present in a FrameGraph branch, this
+ * prevents the renderer from rendering any primitive.
+ *
+ * Qt3D::QNoDraw should be used when the FrameGraph needs to set up some render
+ * states or clear some buffers without requiring any mesh to be drawn. It has
+ * the same effect as having a Qt3DRender::QRenderPassFilter that matches none of
+ * available Qt3DRender::QRenderPass instances of the scene without the overhead cost
+ * of actually performing the filtering.
+ *
+ * \since 5.5
+ */
+
+QNoDraw::QNoDraw(QNode *parent)
+ : QFrameGraphNode(parent)
+{
+}
+
+QNoDraw::~QNoDraw()
+{
+ QNode::cleanup();
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qnodraw.h b/src/render/framegraph/qnodraw.h
new file mode 100644
index 000000000..361bbfdc4
--- /dev/null
+++ b/src/render/framegraph/qnodraw.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QNODRAW_H
+#define QT3DRENDER_QNODRAW_H
+
+#include <Qt3DRenderer/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QT3DRENDERERSHARED_EXPORT QNoDraw : public QFrameGraphNode
+{
+ Q_OBJECT
+public:
+ explicit QNoDraw(Qt3D::QNode *parent = 0);
+ ~QNoDraw();
+
+private:
+ QT3D_CLONEABLE(QNoDraw)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QNODRAW_H
diff --git a/src/render/framegraph/qrenderpassfilter.cpp b/src/render/framegraph/qrenderpassfilter.cpp
new file mode 100644
index 000000000..bc72ed652
--- /dev/null
+++ b/src/render/framegraph/qrenderpassfilter.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** 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 "qrenderpassfilter.h"
+#include "qrenderpassfilter_p.h"
+
+#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRenderer/qannotation.h>
+#include <Qt3DRenderer/qparameter.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QRenderPassFilterPrivate
+ \internal
+*/
+
+QRenderPassFilter::QRenderPassFilter(QNode *parent)
+ : QFrameGraphNode(*new QRenderPassFilterPrivate, parent)
+{}
+
+QRenderPassFilter::~QRenderPassFilter()
+{
+ QNode::cleanup();
+}
+
+/*! \internal */
+QRenderPassFilter::QRenderPassFilter(QRenderPassFilterPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+QList<QAnnotation *> QRenderPassFilter::includes() const
+{
+ Q_D(const QRenderPassFilter);
+ return d->m_includeList;
+}
+
+void QRenderPassFilter::addInclude(QAnnotation *annotation)
+{
+ Q_D(QRenderPassFilter);
+ if (!d->m_includeList.contains(annotation)) {
+ d->m_includeList.append(annotation);
+
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, it gets destroyed as well
+ if (!annotation->parent())
+ annotation->setParent(this);
+
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ propertyChange->setPropertyName("include");
+ propertyChange->setValue(QVariant::fromValue(annotation));
+ d->notifyObservers(propertyChange);
+ }
+ }
+}
+
+void QRenderPassFilter::removeInclude(QAnnotation *annotation)
+{
+ Q_D(QRenderPassFilter);
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ propertyChange->setPropertyName("include");
+ propertyChange->setValue(QVariant::fromValue(annotation));
+ d->notifyObservers(propertyChange);
+ }
+ d->m_includeList.removeOne(annotation);
+}
+
+void QRenderPassFilter::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+ const QRenderPassFilter *other = static_cast<const QRenderPassFilter*>(ref);
+ Q_FOREACH (QAnnotation *c, other->d_func()->m_includeList)
+ addInclude(qobject_cast<QAnnotation *>(QNode::clone(c)));
+}
+
+void QRenderPassFilter::addParameter(QParameter *parameter)
+{
+ Q_D(QRenderPassFilter);
+ if (!d->m_parameters.contains(parameter)) {
+ d->m_parameters.append(parameter);
+
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, the child parameters get destroyed as well
+ if (!parameter->parent())
+ parameter->setParent(this);
+
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ change->setPropertyName("parameter");
+ change->setValue(QVariant::fromValue(parameter->id()));
+ d->notifyObservers(change);
+ }
+ }
+}
+
+void QRenderPassFilter::removeParameter(QParameter *parameter)
+{
+ Q_D(QRenderPassFilter);
+
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ change->setPropertyName("parameter");
+ change->setValue(QVariant::fromValue(parameter->id()));
+ d->notifyObservers(change);
+ }
+ d->m_parameters.removeOne(parameter);
+}
+
+QList<QParameter *> QRenderPassFilter::parameters() const
+{
+ Q_D(const QRenderPassFilter);
+ return d->m_parameters;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qrenderpassfilter.h b/src/render/framegraph/qrenderpassfilter.h
new file mode 100644
index 000000000..edab54406
--- /dev/null
+++ b/src/render/framegraph/qrenderpassfilter.h
@@ -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: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_QRENDERPASSFILTER_H
+#define QT3DRENDER_QRENDERPASSFILTER_H
+
+#include <Qt3DRenderer/qt3drenderer_global.h>
+#include <Qt3DRenderer/qframegraphnode.h>
+#include <QString>
+
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderPassFilterPrivate;
+class QAnnotation;
+class QParameter;
+
+class QT3DRENDERERSHARED_EXPORT QRenderPassFilter : public QFrameGraphNode
+{
+ Q_OBJECT
+
+public:
+ explicit QRenderPassFilter(Qt3D::QNode *parent = 0);
+ ~QRenderPassFilter();
+
+ QList<QAnnotation *> includes() const;
+ void addInclude(QAnnotation *criterion);
+ void removeInclude(QAnnotation *criterion);
+
+ void addParameter(QParameter *p);
+ void removeParameter(QParameter *p);
+ QList<QParameter *> parameters() const;
+
+protected:
+ QRenderPassFilter(QRenderPassFilterPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QRenderPassFilter)
+ QT3D_CLONEABLE(QRenderPassFilter)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERPASSFILTER_H
diff --git a/src/render/framegraph/qrenderpassfilter_p.h b/src/render/framegraph/qrenderpassfilter_p.h
new file mode 100644
index 000000000..a1f3a4afa
--- /dev/null
+++ b/src/render/framegraph/qrenderpassfilter_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: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_QRENDERPASSFILTER_P_H
+#define QT3DRENDER_QRENDERPASSFILTER_P_H
+
+#include <private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderPassFilter;
+
+class QRenderPassFilterPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QRenderPassFilterPrivate()
+ : QFrameGraphNodePrivate()
+ {}
+
+ Q_DECLARE_PUBLIC(QRenderPassFilter)
+ QString m_renderPassName;
+ QList<QAnnotation *> m_includeList;
+ QList<QParameter *> m_parameters;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERPASSFILTER_P_H
diff --git a/src/render/framegraph/qrendertargetselector.cpp b/src/render/framegraph/qrendertargetselector.cpp
new file mode 100644
index 000000000..fc87cadc9
--- /dev/null
+++ b/src/render/framegraph/qrendertargetselector.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** 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 "qrendertargetselector.h"
+#include "qrendertargetselector_p.h"
+#include <Qt3DRenderer/qrendertarget.h>
+#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRenderer/private/qrenderpass_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QRenderTargetSelectorPrivate
+ \internal
+*/
+QRenderTargetSelectorPrivate::QRenderTargetSelectorPrivate()
+ : QFrameGraphNodePrivate()
+ , m_target(Q_NULLPTR)
+{
+}
+
+void QRenderTargetSelector::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+
+ const QRenderTargetSelector *other = static_cast<const QRenderTargetSelector*>(ref);
+
+ if (other->d_func()->m_target)
+ setTarget(qobject_cast<QRenderTarget *>(QNode::clone(other->d_func()->m_target)));
+}
+
+QRenderTargetSelector::QRenderTargetSelector(QNode *parent)
+ : QFrameGraphNode(*new QRenderTargetSelectorPrivate, parent)
+{
+}
+
+QRenderTargetSelector::~QRenderTargetSelector()
+{
+ QNode::cleanup();
+}
+
+void QRenderTargetSelector::setTarget(QRenderTarget *target)
+{
+ Q_D(QRenderTargetSelector);
+ if (d->m_target != target) {
+ d->m_target = target;
+
+ // For inline declaration cases
+ if (!target->parent())
+ target->setParent(this);
+ emit targetChanged();
+ }
+}
+
+QRenderTarget *QRenderTargetSelector::target() const
+{
+ Q_D(const QRenderTargetSelector);
+ return d->m_target;
+}
+
+/*!
+ * \internal
+ * Sets the draw buffers \a buffers to be used. The draw buffers should be
+ * matching the Qt3DRender::QRenderAttachment::RenderAttachmentType
+ * defined in the attachments of the Qt3DRender::QRenderTarget associated to the
+ * Qt3DRender::QRenderTargetSelector instance.
+ *
+ * \note At render time, if no draw buffer has been specified, the renderer will
+ * default to using all the attachments' draw buffers.
+ *
+ */
+void QRenderTargetSelector::setDrawBuffers(const QList<QRenderAttachment::RenderAttachmentType> &buffers)
+{
+ Q_D(QRenderTargetSelector);
+ if (buffers != d->m_drawBuffers) {
+ d->m_drawBuffers = buffers;
+
+ if (d->m_changeArbiter) {
+ QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
+ change->setPropertyName("drawBuffers");
+ change->setValue(QVariant::fromValue(d->m_drawBuffers));
+ d->notifyObservers(change);
+ }
+ }
+}
+
+/*!
+ * Returns the list of draw buffers for the current Qt3DRender::QRenderTargetSelector instance.
+ */
+QList<QRenderAttachment::RenderAttachmentType> QRenderTargetSelector::drawBuffers() const
+{
+ Q_D(const QRenderTargetSelector);
+ return d->m_drawBuffers;
+}
+
+QRenderTargetSelector::QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qrendertargetselector.h b/src/render/framegraph/qrendertargetselector.h
new file mode 100644
index 000000000..c05f4584f
--- /dev/null
+++ b/src/render/framegraph/qrendertargetselector.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERTARGETSELECTOR_H
+#define QT3DRENDER_QRENDERTARGETSELECTOR_H
+
+#include <Qt3DRenderer/qt3drenderer_global.h>
+#include <Qt3DCore/qnode.h>
+#include <Qt3DRenderer/qframegraphnode.h>
+#include <Qt3DRenderer/qrenderattachment.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderTargetSelectorPrivate;
+class QRenderTarget;
+
+class QT3DRENDERERSHARED_EXPORT QRenderTargetSelector : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DRender::QRenderTarget *target READ target WRITE setTarget NOTIFY targetChanged)
+public:
+ explicit QRenderTargetSelector(Qt3D::QNode *parent = 0);
+ ~QRenderTargetSelector();
+
+ void setTarget(QRenderTarget *target);
+ QRenderTarget *target() const;
+
+ void setDrawBuffers(const QList<QRenderAttachment::RenderAttachmentType> &buffers);
+ QList<QRenderAttachment::RenderAttachmentType> drawBuffers() const;
+
+Q_SIGNALS:
+ void targetChanged();
+
+protected:
+ QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QRenderTargetSelector)
+ QT3D_CLONEABLE(QRenderTargetSelector)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QList<Qt3DRender::QRenderAttachment::RenderAttachmentType>)
+
+#endif // QT3DRENDER_QRENDERTARGETSELECTOR_H
diff --git a/src/render/framegraph/qrendertargetselector_p.h b/src/render/framegraph/qrendertargetselector_p.h
new file mode 100644
index 000000000..fa4d4aff2
--- /dev/null
+++ b/src/render/framegraph/qrendertargetselector_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERTARGETSELECTOR_P_H
+#define QT3DRENDER_QRENDERTARGETSELECTOR_P_H
+
+#include <private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderTargetSelector;
+class QRenderTarget;
+
+class QRenderTargetSelectorPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QRenderTargetSelectorPrivate();
+
+ Q_DECLARE_PUBLIC(QRenderTargetSelector)
+ QRenderTarget *m_target;
+ QList<QRenderAttachment::RenderAttachmentType> m_drawBuffers;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERTARGETSELECTOR_P_H
diff --git a/src/render/framegraph/qsortcriterion.cpp b/src/render/framegraph/qsortcriterion.cpp
new file mode 100644
index 000000000..2c09a552c
--- /dev/null
+++ b/src/render/framegraph/qsortcriterion.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** 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 "qsortcriterion.h"
+#include "qsortcriterion_p.h"
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3D::QSortCriterionPrivate
+ \internal
+*/
+QSortCriterionPrivate::QSortCriterionPrivate()
+ : QNodePrivate()
+ , m_sort(QSortCriterion::StateChangeCost)
+{
+}
+
+void QSortCriterion::copy(const QNode *ref)
+{
+ QNode::copy(ref);
+ const QSortCriterion *s = static_cast<const QSortCriterion*>(ref);
+ d_func()->m_sort = s->d_func()->m_sort;
+}
+
+QSortCriterion::QSortCriterion(QNode *parent)
+ : QNode(*new QSortCriterionPrivate, parent)
+{
+}
+
+QSortCriterion::~QSortCriterion()
+{
+ QNode::cleanup();
+}
+
+QSortCriterion::SortType QSortCriterion::sort() const
+{
+ Q_D(const QSortCriterion);
+ return d->m_sort;
+}
+
+void QSortCriterion::setSort(QSortCriterion::SortType &sort)
+{
+ Q_D(QSortCriterion);
+ if (d->m_sort != sort) {
+
+ d->m_sort = sort;
+ emit sortChanged();
+ }
+}
+
+/*! \internal */
+QSortCriterion::QSortCriterion(QSortCriterionPrivate &dd, QNode *parent)
+ : QNode(dd, parent)
+{
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qsortcriterion.h b/src/render/framegraph/qsortcriterion.h
new file mode 100644
index 000000000..d4e12a7a8
--- /dev/null
+++ b/src/render/framegraph/qsortcriterion.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSORTCRITERION_H
+#define QT3DRENDER_QSORTCRITERION_H
+
+#include <Qt3DCore/qnode.h>
+#include <Qt3DRenderer/qt3drenderer_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSortCriterionPrivate;
+
+class QT3DRENDERERSHARED_EXPORT QSortCriterion : public Qt3D::QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DRender::QSortCriterion::SortType sort READ sort WRITE setSort NOTIFY sortChanged)
+public:
+ explicit QSortCriterion(Qt3D::QNode *parent = 0);
+ ~QSortCriterion();
+
+ enum SortType {
+ StateChangeCost = (1 << 0),
+ BackToFront = (1 << 1),
+ Material = (1 << 2)
+ };
+ Q_ENUM(SortType)
+
+ SortType sort() const;
+ void setSort(SortType &sort);
+
+Q_SIGNALS:
+ void sortChanged();
+
+protected:
+ QSortCriterion(QSortCriterionPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ QT3D_CLONEABLE(QSortCriterion)
+ Q_DECLARE_PRIVATE(QSortCriterion)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QSORTCRITERION_H
diff --git a/src/render/framegraph/qsortcriterion_p.h b/src/render/framegraph/qsortcriterion_p.h
new file mode 100644
index 000000000..d4701aa24
--- /dev/null
+++ b/src/render/framegraph/qsortcriterion_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSORTCRITERION_P_H
+#define QT3DRENDER_QSORTCRITERION_P_H
+
+#include <private/qnode_p.h>
+#include <Qt3DRenderer/qsortcriterion.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSortCriterionPrivate : public Qt3D::QNodePrivate
+{
+public:
+ QSortCriterionPrivate();
+
+ Q_DECLARE_PUBLIC(QSortCriterion)
+ QSortCriterion::SortType m_sort;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSORTCRITERION_P_H
diff --git a/src/render/framegraph/qsortmethod.cpp b/src/render/framegraph/qsortmethod.cpp
new file mode 100644
index 000000000..c103fbe47
--- /dev/null
+++ b/src/render/framegraph/qsortmethod.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** 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 "qsortmethod.h"
+#include "qsortmethod_p.h"
+#include "qsortcriterion_p.h"
+#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRenderer/qsortcriterion.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3D::QSortMethodPrivate
+ \internal
+*/
+QSortMethodPrivate::QSortMethodPrivate()
+ : QFrameGraphNodePrivate()
+{
+}
+
+void QSortMethod::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+ const QSortMethod *other = static_cast<const QSortMethod*>(ref);
+ Q_FOREACH (QSortCriterion *c, other->d_func()->m_criteria)
+ addCriterion(qobject_cast<QSortCriterion *>(QNode::clone(c)));
+}
+
+QSortMethod::QSortMethod(QNode *parent)
+ : QFrameGraphNode(*new QSortMethodPrivate, parent)
+{
+}
+
+QSortMethod::~QSortMethod()
+{
+ QNode::cleanup();
+}
+
+/*! \internal */
+QSortMethod::QSortMethod(QSortMethodPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+void QSortMethod::addCriterion(QSortCriterion *criterion)
+{
+ Q_D(QSortMethod);
+ if (!d->m_criteria.contains(criterion)) {
+ d->m_criteria.append(criterion);
+
+ if (!criterion->parent())
+ criterion->setParent(this);
+
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ propertyChange->setPropertyName("sortCriterion");
+ propertyChange->setValue(QVariant::fromValue(criterion));
+ d->notifyObservers(propertyChange);
+ }
+ }
+}
+
+void QSortMethod::removeCriterion(QSortCriterion *criterion)
+{
+ Q_D(QSortMethod);
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ propertyChange->setPropertyName("sortCriterion");
+ propertyChange->setValue(QVariant::fromValue(criterion));
+ d->notifyObservers(propertyChange);
+ }
+ d->m_criteria.removeOne(criterion);
+}
+
+QList<QSortCriterion *> QSortMethod::criteria() const
+{
+ Q_D(const QSortMethod);
+ return d->m_criteria;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qsortmethod.h b/src/render/framegraph/qsortmethod.h
new file mode 100644
index 000000000..5eb5ee85e
--- /dev/null
+++ b/src/render/framegraph/qsortmethod.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSORTMETHOD_H
+#define QT3DRENDER_QSORTMETHOD_H
+
+#include <Qt3DRenderer/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSortCriterion;
+class QSortMethodPrivate;
+
+class QT3DRENDERERSHARED_EXPORT QSortMethod : public QFrameGraphNode
+{
+ Q_OBJECT
+
+public:
+ explicit QSortMethod(Qt3D::QNode *parent = 0);
+ ~QSortMethod();
+
+ void addCriterion(QSortCriterion *criterion);
+ void removeCriterion(QSortCriterion *criterion);
+ QList<QSortCriterion *> criteria() const;
+
+protected:
+ QSortMethod(QSortMethodPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QSortMethod)
+ QT3D_CLONEABLE(QSortMethod)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSORTMETHOD_H
diff --git a/src/render/framegraph/qsortmethod_p.h b/src/render/framegraph/qsortmethod_p.h
new file mode 100644
index 000000000..5cc7944ea
--- /dev/null
+++ b/src/render/framegraph/qsortmethod_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSORTMETHOD_P_H
+#define QT3DRENDER_QSORTMETHOD_P_H
+
+#include <private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSortMethod;
+class QSortCriterion;
+
+class QSortMethodPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QSortMethodPrivate();
+ Q_DECLARE_PUBLIC(QSortMethod)
+ QList<QSortCriterion *> m_criteria;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSORTMETHOD_P_H
diff --git a/src/render/framegraph/qstateset.cpp b/src/render/framegraph/qstateset.cpp
new file mode 100644
index 000000000..cd7646d7b
--- /dev/null
+++ b/src/render/framegraph/qstateset.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 "qstateset.h"
+#include "qstateset_p.h"
+
+#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRenderer/qrenderstate.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+
+QStateSetPrivate::QStateSetPrivate()
+ : QFrameGraphNodePrivate()
+{
+}
+
+/*!
+ * \class Qt3D::QStateSet
+ * \inmodule Qt3DRender
+ *
+ * \brief The Qt3D::QStateSet FrameGraph node offers a way of specifying a set
+ * of Qt3D::QRenderState to be applied during the execution of a FrameGraph
+ * branch.
+ *
+ * States set on a Qt3D::QStateSet are set globally, contrary to the per
+ * Material states that can be set on a Qt3DRender::QRenderPass. By default an empty
+ * Qt3D::QStateSet will result in all render states being disabled when
+ * executed. Adding a Qt3D::QRenderState state explicitly enables that render
+ * state at runtime.
+ *
+ * \since 5.5
+ *
+ * \sa Qt3D::QRenderState, Qt3DRender::QRenderPass
+ */
+
+QStateSet::QStateSet(QNode *parent)
+ : QFrameGraphNode(*new QStateSetPrivate, parent)
+{
+}
+
+QStateSet::QStateSet(QStateSetPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+QStateSet::~QStateSet()
+{
+ QNode::cleanup();
+}
+
+void QStateSet::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+ const QStateSet *other = static_cast<const QStateSet*>(ref);
+
+ Q_FOREACH (QRenderState *renderState, other->d_func()->m_renderStates)
+ addRenderState(qobject_cast<QRenderState *>(QNode::clone(renderState)));
+}
+
+/*!
+ * Adds a new Qt3D::QRenderState \a state to the Qt3D::QStateSet instance.
+ *
+ * \note Not setting any Qt3D::QRenderState state on a Qt3D::QStateSet instance
+ * implies all the render states will be disabled at render time.
+ */
+void QStateSet::addRenderState(QRenderState *state)
+{
+ Q_D(QStateSet);
+
+ if (!d->m_renderStates.contains(state)) {
+ d->m_renderStates.append(state);
+
+ if (!state->parent())
+ state->setParent(this);
+
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ change->setPropertyName("renderState");
+ change->setValue(QVariant::fromValue(QNodePtr(QNode::clone(state))));
+ d->notifyObservers(change);
+ }
+ }
+}
+
+/*!
+ * Removes the Qt3D::QRenderState \a state from the Qt3D::QStateSet instance.
+ */
+void QStateSet::removeRenderState(QRenderState *state)
+{
+ Q_D(QStateSet);
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ change->setPropertyName("renderState");
+ change->setValue(QVariant::fromValue(state->id()));
+ d->notifyObservers(change);
+ }
+ d->m_renderStates.removeOne(state);
+}
+
+/*!
+ * Returns the list of Qt3D::QRenderState that compose the Qt3D::QStateSet instance.
+ */
+QList<QRenderState *> QStateSet::renderStates() const
+{
+ Q_D(const QStateSet);
+ return d->m_renderStates;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qstateset.h b/src/render/framegraph/qstateset.h
new file mode 100644
index 000000000..c9d6eb68d
--- /dev/null
+++ b/src/render/framegraph/qstateset.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTATESET_H
+#define QT3DRENDER_QSTATESET_H
+
+#include <Qt3DRenderer/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStateSetPrivate;
+class QRenderState;
+
+class QT3DRENDERERSHARED_EXPORT QStateSet : public QFrameGraphNode
+{
+ Q_OBJECT
+
+public:
+ explicit QStateSet(Qt3D::QNode *parent = 0);
+ ~QStateSet();
+
+ void addRenderState(QRenderState *state);
+ void removeRenderState(QRenderState *state);
+ QList<QRenderState *> renderStates() const;
+
+protected:
+ QStateSet(QStateSetPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QStateSet)
+ QT3D_CLONEABLE(QStateSet)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTATESET_H
diff --git a/src/render/framegraph/qstateset_p.h b/src/render/framegraph/qstateset_p.h
new file mode 100644
index 000000000..69e743fd0
--- /dev/null
+++ b/src/render/framegraph/qstateset_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTATESET_P_H
+#define QT3DRENDER_QSTATESET_P_H
+
+#include <private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStateSet;
+class QRenderState;
+
+class QStateSetPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QStateSetPrivate();
+
+ Q_DECLARE_PUBLIC(QStateSet)
+ QList<QRenderState *> m_renderStates;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTATESET_P_H
+
diff --git a/src/render/framegraph/qtechniquefilter.cpp b/src/render/framegraph/qtechniquefilter.cpp
new file mode 100644
index 000000000..6092fb870
--- /dev/null
+++ b/src/render/framegraph/qtechniquefilter.cpp
@@ -0,0 +1,165 @@
+
+/****************************************************************************
+**
+** 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 "qtechniquefilter.h"
+#include "qtechniquefilter_p.h"
+#include <Qt3DRenderer/qannotation.h>
+#include <Qt3DRenderer/qparameter.h>
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QTechniqueFilterPrivate
+ \internal
+*/
+QTechniqueFilterPrivate::QTechniqueFilterPrivate()
+ : QFrameGraphNodePrivate()
+{
+}
+
+void QTechniqueFilter::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+ const QTechniqueFilter *other = static_cast<const QTechniqueFilter*>(ref);
+
+ Q_FOREACH (QAnnotation *crit, other->d_func()->m_requireList)
+ addRequirement(qobject_cast<QAnnotation *>(QNode::clone(crit)));
+}
+
+QTechniqueFilter::QTechniqueFilter(QNode *parent)
+ : QFrameGraphNode(*new QTechniqueFilterPrivate, parent)
+{
+}
+
+QTechniqueFilter::~QTechniqueFilter()
+{
+ QNode::cleanup();
+}
+
+/*! \internal */
+QTechniqueFilter::QTechniqueFilter(QTechniqueFilterPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+QList<QAnnotation *> QTechniqueFilter::criteria() const
+{
+ Q_D(const QTechniqueFilter);
+ return d->m_requireList;
+}
+
+void QTechniqueFilter::addRequirement(QAnnotation *criterion)
+{
+ Q_D(QTechniqueFilter);
+ d->m_requireList.append(criterion);
+
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, it gets destroyed as well
+ if (!criterion->parent())
+ criterion->setParent(this);
+
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ propertyChange->setPropertyName("require");
+ propertyChange->setValue(QVariant::fromValue(criterion));
+ d->notifyObservers(propertyChange);
+ }
+}
+
+void QTechniqueFilter::removeRequirement(QAnnotation *criterion)
+{
+ Q_D(QTechniqueFilter);
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ propertyChange->setPropertyName("require");
+ propertyChange->setValue(QVariant::fromValue(criterion->id()));
+ d->notifyObservers(propertyChange);
+ }
+ d->m_requireList.removeOne(criterion);
+}
+
+void QTechniqueFilter::addParameter(QParameter *parameter)
+{
+ Q_D(QTechniqueFilter);
+ if (!d->m_parameters.contains(parameter)) {
+ d->m_parameters.append(parameter);
+
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, the child parameters get destroyed as well
+ if (!parameter->parent())
+ parameter->setParent(this);
+
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ change->setPropertyName("parameter");
+ change->setValue(QVariant::fromValue(parameter->id()));
+ d->notifyObservers(change);
+ }
+ }
+}
+
+void QTechniqueFilter::removeParameter(QParameter *parameter)
+{
+ Q_D(QTechniqueFilter);
+
+ if (d->m_changeArbiter != Q_NULLPTR) {
+ QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ change->setPropertyName("parameter");
+ change->setValue(QVariant::fromValue(parameter->id()));
+ d->notifyObservers(change);
+ }
+ d->m_parameters.removeOne(parameter);
+}
+
+QList<QParameter *> QTechniqueFilter::parameters() const
+{
+ Q_D(const QTechniqueFilter);
+ return d->m_parameters;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qtechniquefilter.h b/src/render/framegraph/qtechniquefilter.h
new file mode 100644
index 000000000..8b8a115f8
--- /dev/null
+++ b/src/render/framegraph/qtechniquefilter.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QTECHNIQUEFILTER_H
+#define QT3DRENDER_QTECHNIQUEFILTER_H
+
+#include <Qt3DRenderer/qt3drenderer_global.h>
+#include <Qt3DRenderer/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QTechniqueFilterPrivate;
+class QAnnotation;
+class QParameter;
+
+class QT3DRENDERERSHARED_EXPORT QTechniqueFilter : public QFrameGraphNode
+{
+ Q_OBJECT
+public:
+ explicit QTechniqueFilter(Qt3D::QNode *parent = 0);
+ ~QTechniqueFilter();
+
+ QList<QAnnotation *> criteria() const;
+ void addRequirement(QAnnotation *criterion);
+ void removeRequirement(QAnnotation *criterion);
+
+ void addParameter(QParameter *p);
+ void removeParameter(QParameter *p);
+ QList<QParameter *> parameters() const;
+
+protected:
+ QTechniqueFilter(QTechniqueFilterPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QTechniqueFilter)
+ QT3D_CLONEABLE(QTechniqueFilter)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QTECHNIQUEFILTER_H
diff --git a/src/render/framegraph/qtechniquefilter_p.h b/src/render/framegraph/qtechniquefilter_p.h
new file mode 100644
index 000000000..219e50b9a
--- /dev/null
+++ b/src/render/framegraph/qtechniquefilter_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QTECHNIQUEFILTER_P_H
+#define QT3DRENDER_QTECHNIQUEFILTER_P_H
+
+#include <private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QTechniqueFilter;
+
+class QTechniqueFilterPrivate : public QFrameGraphNodePrivate
+{
+public :
+ QTechniqueFilterPrivate();
+
+ Q_DECLARE_PUBLIC(QTechniqueFilter)
+ QList<QAnnotation *> m_requireList;
+ QList<QParameter *> m_parameters;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QTECHNIQUEFILTER_P_H
diff --git a/src/render/framegraph/qviewport.cpp b/src/render/framegraph/qviewport.cpp
new file mode 100644
index 000000000..4f821b58f
--- /dev/null
+++ b/src/render/framegraph/qviewport.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** 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 "qviewport.h"
+#include "qviewport_p.h"
+
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QViewportPrivate
+ \internal
+*/
+QViewportPrivate::QViewportPrivate()
+ : QFrameGraphNodePrivate()
+ , m_rect(QRectF(0.0f, 0.0f, 1.0f, 1.0f))
+{
+}
+
+void QViewport::copy(const QNode *ref)
+{
+ QFrameGraphNode::copy(ref);
+ const QViewport *viewport = static_cast<const QViewport*>(ref);
+ d_func()->m_rect = viewport->d_func()->m_rect;
+}
+
+QViewport::QViewport(QNode *parent)
+ : QFrameGraphNode(*new QViewportPrivate, parent)
+{
+}
+
+QViewport::~QViewport()
+{
+ QNode::cleanup();
+}
+
+/*! \internal */
+QViewport::QViewport(QViewportPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+QRectF QViewport::rect() const
+{
+ Q_D(const QViewport);
+ return d->m_rect;
+}
+
+void QViewport::setRect(const QRectF &rect)
+{
+ Q_D(QViewport);
+ if (rect != d->m_rect) {
+ d->m_rect = rect;
+ emit rectChanged();
+ }
+}
+
+QColor QViewport::clearColor() const
+{
+ Q_D(const QViewport);
+ return d->m_clearColor;
+}
+
+void QViewport::setClearColor(const QColor &color)
+{
+ Q_D(QViewport);
+ if (color != d->m_clearColor) {
+ d->m_clearColor = color;
+ emit clearColorChanged();
+ }
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qviewport.h b/src/render/framegraph/qviewport.h
new file mode 100644
index 000000000..3f427d044
--- /dev/null
+++ b/src/render/framegraph/qviewport.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QVIEWPORT_H
+#define QT3DRENDER_QVIEWPORT_H
+
+#include <Qt3DRenderer/qframegraphnode.h>
+#include <QRectF>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QViewportPrivate;
+
+class QT3DRENDERERSHARED_EXPORT QViewport : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(QRectF rect READ rect WRITE setRect NOTIFY rectChanged)
+ Q_PROPERTY(QColor clearColor READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
+
+public:
+ explicit QViewport(Qt3D::QNode *parent = 0);
+ ~QViewport();
+
+ QRectF rect() const;
+ void setRect(const QRectF& rect);
+
+ QColor clearColor() const;
+ void setClearColor(const QColor &color);
+
+Q_SIGNALS:
+ void rectChanged();
+ void clearColorChanged();
+
+protected:
+ QViewport(QViewportPrivate &dd, Qt3D::QNode *parent = 0);
+ void copy(const Qt3D::QNode *ref) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QViewport)
+ QT3D_CLONEABLE(QViewport)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QVIEWPORT_H
diff --git a/src/render/framegraph/qviewport_p.h b/src/render/framegraph/qviewport_p.h
new file mode 100644
index 000000000..bb1cd1a26
--- /dev/null
+++ b/src/render/framegraph/qviewport_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QVIEWPORT_P_H
+#define QT3DRENDER_QVIEWPORT_P_H
+
+#include <private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QViewport;
+
+class QViewportPrivate : public QFrameGraphNodePrivate
+{
+public :
+ QViewportPrivate();
+
+ Q_DECLARE_PUBLIC(QViewport)
+ QRectF m_rect;
+ QColor m_clearColor;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QVIEWPORT_P_H
diff --git a/src/render/framegraph/renderpassfilternode.cpp b/src/render/framegraph/renderpassfilternode.cpp
new file mode 100644
index 000000000..10c0352d8
--- /dev/null
+++ b/src/render/framegraph/renderpassfilternode.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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 "renderpassfilternode_p.h"
+#include "qannotation.h"
+#include "qrenderpassfilter.h"
+#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRenderer/qparameter.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderPassFilter::RenderPassFilter()
+ : FrameGraphNode(FrameGraphNode::RenderPassFilter)
+{
+}
+
+void RenderPassFilter::updateFromPeer(Qt3D::QNode *peer)
+{
+ QRenderPassFilter *filter = static_cast<QRenderPassFilter *>(peer);
+ m_filters.clear();
+ m_parameterPack.clear();
+ setEnabled(filter->isEnabled());
+ Q_FOREACH (QAnnotation *criterion, filter->includes())
+ appendFilter(criterion);
+ Q_FOREACH (QParameter *p, filter->parameters())
+ m_parameterPack.appendParameter(p->id());
+}
+
+QList<Qt3D::QNodeId> RenderPassFilter::filters() const
+{
+ return m_filters;
+}
+
+void RenderPassFilter::appendFilter(QAnnotation *criterion)
+{
+ if (!m_filters.contains(criterion->id()))
+ m_filters.append(criterion->id());
+}
+
+void RenderPassFilter::removeFilter(const Qt3D::QNodeId &criterionId)
+{
+ m_filters.removeOne(criterionId);
+}
+
+QList<Qt3D::QNodeId> RenderPassFilter::parameters() const
+{
+ return m_parameterPack.parameters();
+}
+
+void RenderPassFilter::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+
+ switch (e->type()) {
+ case NodeUpdated: {
+ if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
+ setEnabled(propertyChange->value().toBool());
+ }
+ break;
+
+ case NodeAdded: {
+ if (propertyChange->propertyName() == QByteArrayLiteral("include"))
+ appendFilter(propertyChange->value().value<QAnnotation *>());
+ else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>());
+ }
+ break;
+ case NodeRemoved: {
+ if (propertyChange->propertyName() == QByteArrayLiteral("include"))
+ removeFilter(propertyChange->value().value<QNodeId>());
+ else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.removeParameter(propertyChange->value().value<QNodeId>());
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/renderpassfilternode_p.h b/src/render/framegraph/renderpassfilternode_p.h
new file mode 100644
index 000000000..009794488
--- /dev/null
+++ b/src/render/framegraph/renderpassfilternode_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_RENDERPASSFILTER_H
+#define QT3DRENDER_RENDER_RENDERPASSFILTER_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+#include <Qt3DRenderer/private/parameterpack_p.h>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAnnotation;
+class QRenderPassFilter;
+
+template <typename T, uint INDEXBITS>
+class QHandle;
+
+namespace Render {
+
+class RenderPassFilter
+ : public Render::FrameGraphNode
+{
+public:
+ RenderPassFilter();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+ QList<Qt3D::QNodeId> filters() const;
+ QList<Qt3D::QNodeId> parameters() const;
+ void appendFilter(QAnnotation *criterion);
+ void removeFilter(const Qt3D::QNodeId &criterionId);
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+private:
+ QList<Qt3D::QNodeId> m_filters;
+ ParameterPack m_parameterPack;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_RENDERPASSFILTER_H
diff --git a/src/render/framegraph/rendertargetselectornode.cpp b/src/render/framegraph/rendertargetselectornode.cpp
new file mode 100644
index 000000000..ddd565d57
--- /dev/null
+++ b/src/render/framegraph/rendertargetselectornode.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** 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 "rendertargetselectornode_p.h"
+#include <Qt3DRenderer/private/renderer_p.h>
+#include <Qt3DCore/private/qaspectmanager_p.h>
+#include <Qt3DCore/private/qchangearbiter_p.h>
+#include <Qt3DRenderer/qrendertargetselector.h>
+#include <Qt3DRenderer/qrendertarget.h>
+#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRenderer/private/renderlogging_p.h>
+#include <Qt3DRenderer/qrenderattachment.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderTargetSelector::RenderTargetSelector() :
+ FrameGraphNode(FrameGraphNode::RenderTarget)
+{
+}
+
+void RenderTargetSelector::updateFromPeer(Qt3D::QNode *peer)
+{
+ QRenderTargetSelector *selector = static_cast<QRenderTargetSelector *>(peer);
+ m_renderTargetUuid = QNodeId();
+ if (selector->target() != Q_NULLPTR)
+ m_renderTargetUuid = selector->target()->id();
+ setEnabled(selector->isEnabled());
+ m_drawBuffers = selector->drawBuffers();
+}
+
+void RenderTargetSelector::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ qCDebug(Render::Framegraph) << Q_FUNC_INFO;
+ if (e->type() == NodeUpdated) {
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("target"))
+ m_renderTargetUuid = propertyChange->value().value<QNodeId>();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
+ setEnabled(propertyChange->value().toBool());
+ else if (propertyChange->propertyName() == QByteArrayLiteral("drawBuffers"))
+ m_drawBuffers = propertyChange->value().value<QList<Qt3DRender::QRenderAttachment::RenderAttachmentType> >();
+ }
+}
+
+Qt3D::QNodeId RenderTargetSelector::renderTargetUuid() const
+{
+ return m_renderTargetUuid;
+}
+
+QList<QRenderAttachment::RenderAttachmentType> RenderTargetSelector::drawBuffers() const
+{
+ return m_drawBuffers;
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/rendertargetselectornode_p.h b/src/render/framegraph/rendertargetselectornode_p.h
new file mode 100644
index 000000000..9b3e4199b
--- /dev/null
+++ b/src/render/framegraph/rendertargetselectornode_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_RENDERTARGETSELECTOR_H
+#define QT3DRENDER_RENDER_RENDERTARGETSELECTOR_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderTargetSelector;
+
+namespace Render {
+
+class RenderTargetSelector : public FrameGraphNode
+{
+public:
+ RenderTargetSelector();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ Qt3D::QNodeId renderTargetUuid() const;
+ QList<QRenderAttachment::RenderAttachmentType> drawBuffers() const;
+
+private:
+ Qt3D::QNodeId m_renderTargetUuid;
+ QList<QRenderAttachment::RenderAttachmentType> m_drawBuffers;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_RENDERTARGETSELECTOR_H
diff --git a/src/render/framegraph/sortcriterion.cpp b/src/render/framegraph/sortcriterion.cpp
new file mode 100644
index 000000000..97db75c9f
--- /dev/null
+++ b/src/render/framegraph/sortcriterion.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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 "sortcriterion_p.h"
+#include <Qt3DCore/qscenepropertychange.h>
+#include <QVariant>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+SortCriterion::SortCriterion()
+ : QBackendNode()
+ , m_type(QSortCriterion::StateChangeCost)
+{
+}
+
+void SortCriterion::cleanup()
+{
+}
+
+void SortCriterion::updateFromPeer(Qt3D::QNode *peer)
+{
+ QSortCriterion *criterion = static_cast<QSortCriterion *>(peer);
+ m_type = criterion->sort();
+}
+
+QSortCriterion::SortType SortCriterion::sortType() const
+{
+ return m_type;
+}
+
+void SortCriterion::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (e->type() == NodeUpdated && propertyChange->propertyName() == QByteArrayLiteral("sort")) {
+ m_type = static_cast<QSortCriterion::SortType>(propertyChange->value().toInt());
+ }
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/sortcriterion_p.h b/src/render/framegraph/sortcriterion_p.h
new file mode 100644
index 000000000..982c3a50c
--- /dev/null
+++ b/src/render/framegraph/sortcriterion_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_SORTCRITERION_P_H
+#define QT3DRENDER_RENDER_SORTCRITERION_P_H
+
+#include <Qt3DRenderer/qsortcriterion.h>
+#include <Qt3DCore/qbackendnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class SortCriterionManager;
+
+class SortCriterion : public Qt3D::QBackendNode
+{
+public:
+ SortCriterion();
+
+ void cleanup();
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+
+ QSortCriterion::SortType sortType() const;
+
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+private:
+ QSortCriterion::SortType m_type;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_SORTCRITERION_P_H
diff --git a/src/render/framegraph/sortmethod.cpp b/src/render/framegraph/sortmethod.cpp
new file mode 100644
index 000000000..4f67eb08f
--- /dev/null
+++ b/src/render/framegraph/sortmethod.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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 "sortmethod_p.h"
+#include <Qt3DRenderer/qsortcriterion.h>
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+SortMethod::SortMethod()
+ : FrameGraphNode(FrameGraphNode::SortMethod)
+{
+}
+
+void SortMethod::updateFromPeer(Qt3D::QNode *peer)
+{
+ QSortMethod *sortMethod = static_cast<QSortMethod *>(peer);
+ m_criteria.clear();
+ Q_FOREACH (QSortCriterion *c, sortMethod->criteria())
+ m_criteria.append(c->id());
+ setEnabled(sortMethod->isEnabled());
+}
+
+void SortMethod::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("sortCriterion")) {
+ QSortCriterion *c = propertyChange->value().value<QSortCriterion *>();
+ if (c != Q_NULLPTR) {
+ if (e->type() == NodeAdded)
+ m_criteria.append(c->id());
+ else if (e->type() == NodeRemoved)
+ m_criteria.removeAll(c->id());
+ }
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled") && e->type() == NodeUpdated) {
+ setEnabled(propertyChange->value().toBool());
+ }
+}
+
+QList<QNodeId> SortMethod::criteria() const
+{
+ return m_criteria;
+}
+
+} // namepace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/sortmethod_p.h b/src/render/framegraph/sortmethod_p.h
new file mode 100644
index 000000000..b9d26d2a3
--- /dev/null
+++ b/src/render/framegraph/sortmethod_p.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: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_SORTMETHOD_P_H
+#define QT3DRENDER_RENDER_SORTMETHOD_P_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+#include <Qt3DRenderer/qsortmethod.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class SortMethod : public FrameGraphNode
+{
+public:
+ SortMethod();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ QList<Qt3D::QNodeId> criteria() const;
+
+private:
+ QList<Qt3D::QNodeId> m_criteria;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_SORTMETHOD_P_H
diff --git a/src/render/framegraph/statesetnode.cpp b/src/render/framegraph/statesetnode.cpp
new file mode 100644
index 000000000..cd0d82371
--- /dev/null
+++ b/src/render/framegraph/statesetnode.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 "statesetnode_p.h"
+
+#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRenderer/qstateset.h>
+#include <Qt3DRenderer/private/genericstate_p.h>
+#include <Qt3DRenderer/private/renderstateset_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+StateSetNode::StateSetNode()
+ : FrameGraphNode(FrameGraphNode::StateSet)
+{
+}
+
+StateSetNode::~StateSetNode()
+{
+}
+
+void StateSetNode::updateFromPeer(Qt3D::QNode *peer)
+{
+ QStateSet *stateSet = static_cast<QStateSet*>(peer);
+
+ setEnabled(stateSet->isEnabled());
+ Q_FOREACH (QRenderState *renderState, stateSet->renderStates())
+ appendRenderState(renderState->id(), RenderState::getOrCreateBackendState(renderState));
+}
+
+QList<RenderState *> StateSetNode::renderStates() const
+{
+ return m_renderStates.values();
+}
+
+void StateSetNode::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ switch (e->type()) {
+ case NodeAdded: {
+ if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) {
+ QNodePtr nodePtr = propertyChange->value().value<QNodePtr>();
+ QRenderState *renderState = static_cast<QRenderState *>(nodePtr.data());
+ appendRenderState(renderState->id(), RenderState::getOrCreateBackendState(renderState));
+ }
+ }
+ break;
+
+ case NodeRemoved: {
+ if (propertyChange->propertyName() == QByteArrayLiteral("renderState"))
+ removeRenderState(propertyChange->value().value<QNodeId>());
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void StateSetNode::appendRenderState(const Qt3D::QNodeId &id, RenderState *renderState)
+{
+ if (!m_renderStates.contains(id))
+ m_renderStates[id] = renderState;
+}
+
+void StateSetNode::removeRenderState(const Qt3D::QNodeId &renderStateId)
+{
+ m_renderStates.remove(renderStateId);
+}
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/statesetnode_p.h b/src/render/framegraph/statesetnode_p.h
new file mode 100644
index 000000000..d5d2921f2
--- /dev/null
+++ b/src/render/framegraph/statesetnode_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_STATESETNODE_H
+#define QT3DRENDER_RENDER_STATESETNODE_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class StateSetNode : public FrameGraphNode
+{
+public:
+ StateSetNode();
+ ~StateSetNode();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+
+ QList<RenderState *> renderStates() const;
+
+protected:
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ void appendRenderState(const Qt3D::QNodeId &id, RenderState *renderState);
+ void removeRenderState(const Qt3D::QNodeId &renderStateId);
+
+ QHash<Qt3D::QNodeId, RenderState *> m_renderStates;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_STATESETNODE_H
diff --git a/src/render/framegraph/techniquefilternode.cpp b/src/render/framegraph/techniquefilternode.cpp
new file mode 100644
index 000000000..547ed077b
--- /dev/null
+++ b/src/render/framegraph/techniquefilternode.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** 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 "techniquefilternode_p.h"
+#include "qannotation.h"
+#include "qtechniquefilter.h"
+#include <Qt3DRenderer/private/managers_p.h>
+#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRenderer/qparameter.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+TechniqueFilter::TechniqueFilter()
+ : FrameGraphNode(FrameGraphNode::TechniqueFilter)
+{
+}
+
+void TechniqueFilter::updateFromPeer(Qt3D::QNode *peer)
+{
+ QTechniqueFilter *filter = static_cast<QTechniqueFilter *>(peer);
+ m_filters.clear();
+ m_parameterPack.clear();
+ Q_FOREACH (QAnnotation *criterion, filter->criteria())
+ appendFilter(criterion);
+ Q_FOREACH (QParameter *p, filter->parameters())
+ m_parameterPack.appendParameter(p->id());
+ setEnabled(filter->isEnabled());
+}
+
+QList<Qt3D::QNodeId> TechniqueFilter::parameters() const
+{
+ return m_parameterPack.parameters();
+}
+
+QList<Qt3D::QNodeId> TechniqueFilter::filters() const
+{
+ return m_filters;
+}
+
+void TechniqueFilter::appendFilter(QAnnotation *criterion)
+{
+ if (!m_filters.contains(criterion->id()))
+ m_filters.append(criterion->id());
+}
+
+void TechniqueFilter::removeFilter(const Qt3D::QNodeId &criterionId)
+{
+ m_filters.removeOne(criterionId);
+}
+
+void TechniqueFilter::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+
+ switch (e->type()) {
+ case NodeUpdated: {
+ if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
+ setEnabled(propertyChange->value().toBool());
+ }
+ break;
+
+ case NodeAdded: {
+ if (propertyChange->propertyName() == QByteArrayLiteral("require"))
+ appendFilter(propertyChange->value().value<QAnnotation *>());
+ else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>());
+ }
+ break;
+ case NodeRemoved: {
+ if (propertyChange->propertyName() == QByteArrayLiteral("require"))
+ removeFilter(propertyChange->value().value<QNodeId>());
+ else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.removeParameter(propertyChange->value().value<QNodeId>());
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/techniquefilternode_p.h b/src/render/framegraph/techniquefilternode_p.h
new file mode 100644
index 000000000..afcf7c1d8
--- /dev/null
+++ b/src/render/framegraph/techniquefilternode_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_TECHNIQUEFILTER_H
+#define QT3DRENDER_RENDER_TECHNIQUEFILTER_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+#include <Qt3DRenderer/private/parameterpack_p.h>
+
+#include <QList>
+#include <QString>
+#include <QVariant>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAnnotation;
+class QTechniqueFilter;
+
+template <typename T, uint INDEXBITS>
+class QHandle;
+
+namespace Render {
+
+class TechniqueFilter
+ : public FrameGraphNode
+{
+public:
+ TechniqueFilter();
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+
+ QList<Qt3D::QNodeId> parameters() const;
+
+ QList<Qt3D::QNodeId> filters() const;
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+private:
+ void appendFilter(QAnnotation *criterion);
+ void removeFilter(const Qt3D::QNodeId &criterionId);
+
+ QList<Qt3D::QNodeId> m_filters;
+ ParameterPack m_parameterPack;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_TECHNIQUEFILTER_H
diff --git a/src/render/framegraph/viewportnode.cpp b/src/render/framegraph/viewportnode.cpp
new file mode 100644
index 000000000..29751068c
--- /dev/null
+++ b/src/render/framegraph/viewportnode.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** 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 "viewportnode_p.h"
+#include <Qt3DRenderer/qviewport.h>
+#include <Qt3DCore/qscenepropertychange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3D;
+
+namespace Qt3DRender {
+namespace Render {
+
+ViewportNode::ViewportNode()
+ : FrameGraphNode(FrameGraphNode::Viewport)
+ , m_xMin(0.0f)
+ , m_yMin(0.0f)
+ , m_xMax(1.0f)
+ , m_yMax(1.0f)
+{
+}
+
+void ViewportNode::updateFromPeer(Qt3D::QNode *peer)
+{
+ QViewport *viewport = static_cast<QViewport *>(peer);
+ setXMin(viewport->rect().x());
+ setXMax(viewport->rect().width());
+ setYMin(viewport->rect().y());
+ setYMax(viewport->rect().height());
+ m_clearColor = viewport->clearColor();
+ setEnabled(viewport->isEnabled());
+}
+
+float ViewportNode::xMin() const
+{
+ return m_xMin;
+}
+
+void ViewportNode::setXMin(float xMin)
+{
+ m_xMin = xMin;
+}
+float ViewportNode::yMin() const
+{
+ return m_yMin;
+}
+
+void ViewportNode::setYMin(float yMin)
+{
+ m_yMin = yMin;
+}
+float ViewportNode::xMax() const
+{
+ return m_xMax;
+}
+
+void ViewportNode::setXMax(float xMax)
+{
+ m_xMax = xMax;
+}
+float ViewportNode::yMax() const
+{
+ return m_yMax;
+}
+
+void ViewportNode::setYMax(float yMax)
+{
+ m_yMax = yMax;
+}
+
+QColor ViewportNode::clearColor() const
+{
+ return m_clearColor;
+}
+
+void ViewportNode::sceneChangeEvent(const Qt3D::QSceneChangePtr &e)
+{
+ if (e->type() == NodeUpdated) {
+ QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("rect")) {
+ QRectF rect = propertyChange->value().value<QRectF>();
+ setXMin(rect.x());
+ setYMin(rect.y());
+ setXMax(rect.width());
+ setYMax(rect.height());
+ }
+ else if (propertyChange->propertyName() == QByteArrayLiteral("clearColor")) {
+ m_clearColor = propertyChange->value().value<QColor>();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
+ setEnabled(propertyChange->value().toBool());
+ }
+ }
+}
+
+QRectF computeViewport(const QRectF &childViewport, const ViewportNode *parentViewport)
+{
+ QRectF vp(parentViewport->xMin(),
+ parentViewport->yMin(),
+ parentViewport->xMax(),
+ parentViewport->yMax());
+
+ if (childViewport.isEmpty()) {
+ return vp;
+ } else {
+ return QRectF(vp.x() + vp.width() * childViewport.x(),
+ vp.y() + vp.height() * childViewport.y(),
+ vp.width() * childViewport.width(),
+ vp.height() * childViewport.height());
+ }
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/viewportnode_p.h b/src/render/framegraph/viewportnode_p.h
new file mode 100644
index 000000000..35a1110c2
--- /dev/null
+++ b/src/render/framegraph/viewportnode_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_VIEWPORTNODE_H
+#define QT3DRENDER_RENDER_VIEWPORTNODE_H
+
+#include <Qt3DRenderer/private/framegraphnode_p.h>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QViewport;
+
+namespace Render {
+
+class Renderer;
+
+class ViewportNode : public FrameGraphNode
+{
+public:
+ ViewportNode();
+
+ void updateFromPeer(Qt3D::QNode *peer) Q_DECL_OVERRIDE;
+
+ float xMin() const;
+ void setXMin(float xMin);
+
+ float yMin() const;
+ void setYMin(float yMin);
+
+ float xMax() const;
+ void setXMax(float xMax);
+
+ float yMax() const;
+ void setYMax(float yMax);
+
+ QColor clearColor() const;
+
+ void sceneChangeEvent(const Qt3D::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+private:
+ float m_xMin;
+ float m_yMin;
+ float m_xMax;
+ float m_yMax;
+ QColor m_clearColor;
+};
+
+QRectF computeViewport(const QRectF &childViewport, const ViewportNode *parentViewport);
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_VIEWPORTNODE_H