summaryrefslogtreecommitdiffstats
path: root/src/render/framegraph/framegraphnode.cpp
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/framegraphnode.cpp
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/framegraphnode.cpp')
-rw-r--r--src/render/framegraph/framegraphnode.cpp166
1 files changed, 166 insertions, 0 deletions
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