diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2014-03-24 11:02:10 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-30 14:42:40 +0200 |
commit | 1aa17e9bdffae08e9c5c2a6bbf1c5affce73c802 (patch) | |
tree | 108693a3514c55a3b75c116c466f5731696c9d00 | |
parent | 3aab83685122e2391c3080f250d334a923a8b3f4 (diff) |
FrameGraph and frontend FrameGraphNode
All framegraph building blocks are now subclasses of FrameGraphNode.
An Entity can reference the framegraph configuration to use by
by declaring inline a FrameGraphBuildingBlock or referencing it.
RenderSceneBuilder retrieves the first FrameGraph in the scene and builds
a tree of Render::FrameGraphNodes from the activeFrameGraph it references.
The Render::FrameGraphNodes are empty at the moment and will be filled in follow-up commmits
Change-Id: Id5f90421be16c3c979a6da2dccf19068bf7921ec
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
38 files changed, 673 insertions, 166 deletions
diff --git a/examples/simple-qml/ForwardRenderer.qml b/examples/simple-qml/ForwardRenderer.qml index 0928931a4..2b2f52008 100644 --- a/examples/simple-qml/ForwardRenderer.qml +++ b/examples/simple-qml/ForwardRenderer.qml @@ -40,11 +40,13 @@ ****************************************************************************/ import Qt3D 2.0 -import "elements/" +import Qt3D.Render 2.0 -Entity { +TechniqueFilter { id: root + objectName : "techniqueFilter" + // Expose the viewport rect and camera. This allows users of this // forward rendering framegraph to decide which camera in the // scene renders to a given viewport region. @@ -52,23 +54,24 @@ Entity { // Using this as a building block for a larger framegraph would // allow a scene to be rendered multiple times to different // viewports using different cameras for e.g. - property alias viewportRect: viewport.viewportRect + property alias viewportRect: viewport.rect property alias camera: cameraSelector.camera - TechniqueFilterEntity { - filterTags: [ - Tag { name: "style"; value: "forward"} - ] + tags: [ + Tag { name: "style"; value: "forward"} + ] + + Viewport { + id: viewport + objectName : "viewport" - ViewportEntity { - id: viewport - CameraSelectorEntity { - id: cameraSelector + CameraSelector { + id: cameraSelector + objectName : "cameraSelector" - RenderPassFilterEntity { renderPassNames: "zFill" } - RenderPassFilterEntity { renderPassNames: "lighting" } - } + RenderPassFilter { renderPassNames: "zFill" } + RenderPassFilter { renderPassNames: "lighting" } } } } diff --git a/examples/simple-qml/main.cpp b/examples/simple-qml/main.cpp index a1f963a85..b54c802de 100644 --- a/examples/simple-qml/main.cpp +++ b/examples/simple-qml/main.cpp @@ -42,6 +42,7 @@ #include <window.h> #include <rendereraspect.h> + #include <QGuiApplication> #include <QtQml> diff --git a/examples/simple-qml/main.qml b/examples/simple-qml/main.qml index 919aafcec..3e09acb57 100644 --- a/examples/simple-qml/main.qml +++ b/examples/simple-qml/main.qml @@ -42,6 +42,7 @@ import Qt3D 2.0 import Qt3D.Render 2.0 + // For Qt.vector3d() and friends. For some reason this is provided by // QQuickValueTypeProvider in QtQuick rather than the default value // type provider in QtQml. So we will need to replicate this in Qt3D @@ -54,21 +55,47 @@ Node { objectName: "root" // Scene graph - Node { + Entity { id: sceneRoot - objectName: "sceneRoot" + objectName: "sceneRootTest" + + property FrameGraph frameGraph : FrameGraph { + objectName : "frameGraph" + // activeFrameGraph can be defined inline or by reference + // activeFrameGraph : ForwardRenderer {objectName :"innerExternalRenderer"} + activeFrameGraph : external_forward_renderer + } + + ForwardRenderer { + id : external_forward_renderer + objectName : "externalRenderer" + camera: mainCamera + viewportRect: Qt.rect(0, 0, 1, 1) + } + + property Entity testEntity : Entity { + objectName : "testInlineEntity" + } + + property Transform transform: Transform { + transforms: Rotate {objectName : "scaleTransform"} + } + + property Mesh toto : Mesh { + Material { + + } + } + + Entity { + id : test_entity + objectName : "test_entity" + } Entity { id: mainCamera objectName: "mainCamera" - property Transform transform: Transform { - transforms: LookAt { - position: Qt.vector3d(0.0, 2.0, 0.0) - viewCenter: Qt.vector3d(0.0, 0.0, 0.5) - upVector: Qt.vector3d(0.0, 1.0, 0.0) - } - } property Camera camera: Camera { objectName: "cameraComponent" @@ -83,10 +110,10 @@ Node { } } - AdsEffect { - id: adsEffect - objectName: "adsEffect" - } + // AdsEffect { + // id: adsEffect + // objectName: "adsEffect" + // } Mesh { id: ballMesh @@ -120,36 +147,37 @@ Node { property Material material: ballMaterial } + Translate { + id: ball2Translation + objectName : "ball2Translation" + dx: 0; dy: 0 + QQ2.SequentialAnimation { + running: true + loops: QQ2.Animation.Infinite + + QQ2.NumberAnimation { + target: ball2Translation + property: "dx" + duration: 1000 + easing.type: QQ2.Easing.InOutQuad + from: 0; to: 100 + } + QQ2.NumberAnimation { + target: ball2Translation + property: "dx" + duration: 1000 + easing.type: QQ2.Easing.InOutQuad + from: 100; to: 0 + } + } + } + Entity { id: ball2 objectName: "ball2" property Transform transform: Transform { - Translate { - id: ball2Translation - dx: 0; dy: 0 - - QQ2.SequentialAnimation { - running: true - loops: QQ2.Animation.Infinite - - QQ2.NumberAnimation { - target: ball2Translation - property: "dx" - duration: 1000 - easing.type: Easing.InOutQuad - from: 0; to: 100 - } - QQ2.NumberAnimation { - target: ball2Translation - property: "dx" - duration: 1000 - easing.type: Easing.InOutQuad - from: 100; to: 0 - } - } - } - } + transforms: ball2Translation} property Mesh mesh: ballMesh property Material material: ballMaterial } diff --git a/examples/simple-qml/simple-qml.qrc b/examples/simple-qml/simple-qml.qrc index 568337235..b20d8aee6 100644 --- a/examples/simple-qml/simple-qml.qrc +++ b/examples/simple-qml/simple-qml.qrc @@ -5,5 +5,6 @@ <file>Renderable.qml</file> <file>AdsEffect.qml</file> <file>assets/ball.obj</file> + <file>ForwardRenderer.qml</file> </qresource> </RCC> diff --git a/src/core/nodes/nodevisitor.cpp b/src/core/nodes/nodevisitor.cpp index f77a6896a..075eae488 100644 --- a/src/core/nodes/nodevisitor.cpp +++ b/src/core/nodes/nodevisitor.cpp @@ -120,7 +120,7 @@ void NodeVisitor::outerVisitNode(Node *n) visitEntity(e); m_path.pop_back(); - m_matrixStack.pop_back(); +// m_matrixStack.pop_back(); } else { visitNode(n); } diff --git a/src/core/render/frontend/framegraph.cpp b/src/core/render/frontend/framegraph.cpp new file mode 100644 index 000000000..a27f64dc2 --- /dev/null +++ b/src/core/render/frontend/framegraph.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:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "framegraph.h" +#include "entity.h" + +namespace Qt3D { + +/*! + * \class FrameGraph + * + * \brief Component that has an activeFrameGraph property that should + * reference a FrameGraphNode. Then Entity that contains a FrameGraph property + * defines the rendering method to be used by the renderer. + * + * Note that only a single FrameGraph can be active at any moment. + * + * \since 5.3 + * \namespace Qt3D + */ + +FrameGraph::FrameGraph(Node *parent) : + Qt3D::Component(parent), + m_activeFrameGraph(Q_NULLPTR) +{ +} + +/*! + * Returns the current activeFrameGraph root node. + */ +FrameGraphNode* FrameGraph::activeFrameGraph() const +{ + return m_activeFrameGraph; +} + +/*! + * Sets the root node \a activeFrameGraph of the FrameGraph. + */ +void FrameGraph::setActiveFrameGraph(FrameGraphNode *activeFrameGraph) +{ + if (activeFrameGraph != m_activeFrameGraph) { + m_activeFrameGraph = activeFrameGraph; + qDebug() << Q_FUNC_INFO << m_activeFrameGraph; + emit activeFrameGraphChanged(); + } +} + +} // Qt3D diff --git a/src/core/render/frontend/framegraph.h b/src/core/render/frontend/framegraph.h new file mode 100644 index 000000000..26568a579 --- /dev/null +++ b/src/core/render/frontend/framegraph.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_FRAMEGRAPH_H +#define QT3D_FRAMEGRAPH_H + +#include <qt3dcore_global.h> +#include <component.h> + +namespace Qt3D { + +class FrameGraphNode; + +class QT3DCORESHARED_EXPORT FrameGraph : public Qt3D::Component +{ + 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(Qt3D::FrameGraphNode *activeFrameGraph READ activeFrameGraph WRITE setActiveFrameGraph NOTIFY activeFrameGraphChanged) + Q_CLASSINFO("DefaultProperty", "activeFrameGraph") + +public: + explicit FrameGraph(Node *parent = 0); + + FrameGraphNode *activeFrameGraph() const; + void setActiveFrameGraph(FrameGraphNode *activeFrameGraph); + +private: + FrameGraphNode *m_activeFrameGraph; + +signals: + void activeFrameGraphChanged(); +}; + +} //Qt3D + +#endif // QT3D_FRAMEGRAPH_H diff --git a/examples/simple-qml/elements/RenderPassFilterEntity.qml b/src/core/render/frontend/framegraphnode.cpp index 5bd902c1a..3f86e78b4 100644 --- a/examples/simple-qml/elements/RenderPassFilterEntity.qml +++ b/src/core/render/frontend/framegraphnode.cpp @@ -39,14 +39,26 @@ ** ****************************************************************************/ -import Qt3D 2.0 +#include "frontend/framegraphnode.h" -Entity { - property alias renderPassNames: filter.renderPassNames +/*! + * \class FrameGraphNode + * + * \brief Base class of all FrameGraph configuration nodes. + * + * \since 5.3 + * \namespace Qt3D + */ - property RenderPassFilter _renderPassFilter: filter +namespace Qt3D { - RenderPassFilter { - id: filter - } +FrameGraphNode::FrameGraphNode(Node *parent) : + Node(parent) +{ } + +FrameGraphNode::~FrameGraphNode() +{ +} + +} // Qt3D diff --git a/examples/simple-qml/elements/TechniqueFilterEntity.qml b/src/core/render/frontend/framegraphnode.h index 2b9c2cfda..85d416885 100644 --- a/examples/simple-qml/elements/TechniqueFilterEntity.qml +++ b/src/core/render/frontend/framegraphnode.h @@ -39,14 +39,22 @@ ** ****************************************************************************/ -import Qt3D 2.0 +#ifndef QT3D_FRAMEGRAPHNODE_H +#define QT3D_FRAMEGRAPHNODE_H -Entity { - property alias filterTags: filter.tags +#include <qt3drenderer_global.h> +#include <node.h> - property TechniqueFilter _techniqueFilter: filter +namespace Qt3D { - TechniqueFilter { - id: filter - } -} +class QT3DRENDERERSHARED_EXPORT FrameGraphNode : public Node +{ + Q_OBJECT +public: + explicit FrameGraphNode(Node *parent = 0); + virtual ~FrameGraphNode(); +}; + +} // Qt3D + +#endif // QT3D_FRAMEGRAPHNODE_H diff --git a/src/render/backend/framegraph/cameraselectornode.cpp b/src/render/backend/framegraph/cameraselectornode.cpp index d1d1bfac0..82c1e45cf 100644 --- a/src/render/backend/framegraph/cameraselectornode.cpp +++ b/src/render/backend/framegraph/cameraselectornode.cpp @@ -46,8 +46,8 @@ namespace Qt3D { namespace Render { -CameraSelector::CameraSelector(FrameGraphNode *parent) - : FrameGraphNode(parent) +CameraSelector::CameraSelector(Render::FrameGraphNode *parent) + : Render::FrameGraphNode(parent) { } diff --git a/src/render/backend/framegraph/cameraselectornode.h b/src/render/backend/framegraph/cameraselectornode.h index 326ba600b..4f5c2f6e6 100644 --- a/src/render/backend/framegraph/cameraselectornode.h +++ b/src/render/backend/framegraph/cameraselectornode.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef CAMERASELECTOR_H -#define CAMERASELECTOR_H +#ifndef QT3D_RENDER_CAMERASELECTOR_H +#define QT3D_RENDER_CAMERASELECTOR_H #include "framegraphnode.h" @@ -50,10 +50,10 @@ class Camera; namespace Render { -class CameraSelector : public FrameGraphNode +class CameraSelector : public Render::FrameGraphNode { public: - CameraSelector(FrameGraphNode *parent = 0); + CameraSelector(Render::FrameGraphNode *parent = 0); void apply() Q_DECL_OVERRIDE; void revert() Q_DECL_OVERRIDE; @@ -65,4 +65,4 @@ public: } } -#endif // CAMERASELECTOR_H +#endif // QT3D_RENDER_CAMERASELECTOR_H diff --git a/src/render/backend/framegraph/framegraphnode.h b/src/render/backend/framegraph/framegraphnode.h index 0fd0a2e3f..f54a946f3 100644 --- a/src/render/backend/framegraph/framegraphnode.h +++ b/src/render/backend/framegraph/framegraphnode.h @@ -54,9 +54,11 @@ public: virtual ~FrameGraphNode(); FrameGraphNode *parent() const { return m_parent; } + void setParent(FrameGraphNode *parent) { m_parent = parent; } int childCount() const { return m_children.count(); } FrameGraphNode * child(int index) const { return m_children.at(index); } + void appendChild(FrameGraphNode *child) { child->setParent(m_parent); m_children.append(child); } void setEnabled(bool enabled) { m_enabled = enabled; } bool isEnabled() const { return m_enabled; } diff --git a/src/render/backend/framegraph/framegraphvisitor.cpp b/src/render/backend/framegraph/framegraphvisitor.cpp index b74a77873..518d11b9c 100644 --- a/src/render/backend/framegraph/framegraphvisitor.cpp +++ b/src/render/backend/framegraph/framegraphvisitor.cpp @@ -51,16 +51,16 @@ FrameGraphVisitor::FrameGraphVisitor() { } -void FrameGraphVisitor::traverse(FrameGraphNode *root, Renderer *renderer) +void FrameGraphVisitor::traverse(Render::FrameGraphNode *root, Renderer *renderer) { m_renderer = renderer; // Kick off the traversal - FrameGraphNode *node = root; + Render::FrameGraphNode *node = root; visit(node); } -void FrameGraphVisitor::visit(FrameGraphNode *node) +void FrameGraphVisitor::visit(Render::FrameGraphNode *node) { // Apply the state from this node node->apply(); @@ -69,7 +69,7 @@ void FrameGraphVisitor::visit(FrameGraphNode *node) // initiate a rendering from the current camera if (node->childCount()) { for (int i = 0; i < node->childCount(); ++i) { - FrameGraphNode *n = node->child(i); + Render::FrameGraphNode *n = node->child(i); visit(n); } } else { diff --git a/src/render/backend/framegraph/framegraphvisitor.h b/src/render/backend/framegraph/framegraphvisitor.h index 174a90bdf..f637538eb 100644 --- a/src/render/backend/framegraph/framegraphvisitor.h +++ b/src/render/backend/framegraph/framegraphvisitor.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QT3D_RENDERER_FRAMEGRAPHVISITOR_H -#define QT3D_RENDERER_FRAMEGRAPHVISITOR_H +#ifndef QT3D_RENDER_FRAMEGRAPHVISITOR_H +#define QT3D_RENDER_FRAMEGRAPHVISITOR_H namespace Qt3D { namespace Render { @@ -53,10 +53,10 @@ class FrameGraphVisitor public: FrameGraphVisitor(); - void traverse(FrameGraphNode *root, Renderer *renderer); + void traverse(Render::FrameGraphNode *root, Renderer *renderer); private: - void visit(FrameGraphNode *node); + void visit(Render::FrameGraphNode *node); Renderer *m_renderer; }; @@ -64,4 +64,4 @@ private: } // namespace Render } // namespace Qt3D -#endif // QT3D_RENDERER_FRAMEGRAPHVISITOR_H +#endif // QT3D_RENDER_FRAMEGRAPHVISITOR_H diff --git a/src/render/backend/framegraph/renderpassfilternode.cpp b/src/render/backend/framegraph/renderpassfilternode.cpp index 89b3d4e0c..35d09dae0 100644 --- a/src/render/backend/framegraph/renderpassfilternode.cpp +++ b/src/render/backend/framegraph/renderpassfilternode.cpp @@ -46,8 +46,8 @@ namespace Qt3D { namespace Render { -RenderPassFilter::RenderPassFilter(FrameGraphNode *parent) - : FrameGraphNode(parent) +RenderPassFilter::RenderPassFilter(Render::FrameGraphNode *parent) + : Render::FrameGraphNode(parent) { } diff --git a/src/render/backend/framegraph/renderpassfilternode.h b/src/render/backend/framegraph/renderpassfilternode.h index ed05e6b5c..1c3591a3b 100644 --- a/src/render/backend/framegraph/renderpassfilternode.h +++ b/src/render/backend/framegraph/renderpassfilternode.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef RENDERPASSFILTER_H -#define RENDERPASSFILTER_H +#ifndef QT3D_RENDER_RENDERPASSFILTER_H +#define QT3D_RENDER_RENDERPASSFILTER_H #include "framegraphnode.h" @@ -49,10 +49,10 @@ namespace Qt3D { namespace Render { -class RenderPassFilter : public FrameGraphNode +class RenderPassFilter : public Render::FrameGraphNode { public: - RenderPassFilter(FrameGraphNode *parent = 0); + RenderPassFilter(Render::FrameGraphNode *parent = 0); void apply() Q_DECL_OVERRIDE; void revert() Q_DECL_OVERRIDE; @@ -65,4 +65,4 @@ public: } -#endif // RENDERPASSFILTER_H +#endif // QT3D_RENDER_RENDERPASSFILTER_H diff --git a/src/render/backend/framegraph/techniquefilternode.cpp b/src/render/backend/framegraph/techniquefilternode.cpp index 3c021c77c..023406106 100644 --- a/src/render/backend/framegraph/techniquefilternode.cpp +++ b/src/render/backend/framegraph/techniquefilternode.cpp @@ -46,8 +46,8 @@ namespace Qt3D { namespace Render { -TechniqueFilter::TechniqueFilter(FrameGraphNode *parent) - : FrameGraphNode(parent) +TechniqueFilter::TechniqueFilter(Qt3D::Render::FrameGraphNode *parent) + : Qt3D::Render::FrameGraphNode(parent) { } diff --git a/src/render/backend/framegraph/techniquefilternode.h b/src/render/backend/framegraph/techniquefilternode.h index f6c801019..0873da9fa 100644 --- a/src/render/backend/framegraph/techniquefilternode.h +++ b/src/render/backend/framegraph/techniquefilternode.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef TECHNIQUEFILTER_H -#define TECHNIQUEFILTER_H +#ifndef QT3D_RENDER_TECHNIQUEFILTER_H +#define QT3D_RENDER_TECHNIQUEFILTER_H #include "framegraphnode.h" @@ -51,10 +51,10 @@ namespace Qt3D { namespace Render { -class TechniqueFilter : public FrameGraphNode +class TechniqueFilter : public Render::FrameGraphNode { public: - TechniqueFilter(FrameGraphNode *parent = 0); + TechniqueFilter(Render::FrameGraphNode *parent = 0); void apply() Q_DECL_OVERRIDE; void revert() Q_DECL_OVERRIDE; @@ -66,4 +66,4 @@ public: } } -#endif // TECHNIQUEFILTER_H +#endif // QT3D_RENDER_TECHNIQUEFILTER_H diff --git a/src/render/backend/framegraph/viewportnode.cpp b/src/render/backend/framegraph/viewportnode.cpp index bac967975..0cee07214 100644 --- a/src/render/backend/framegraph/viewportnode.cpp +++ b/src/render/backend/framegraph/viewportnode.cpp @@ -46,8 +46,8 @@ namespace Qt3D { namespace Render { -ViewportNode::ViewportNode(FrameGraphNode *parent) - : FrameGraphNode(parent) +ViewportNode::ViewportNode(Render::FrameGraphNode *parent) + : Render::FrameGraphNode(parent) , m_xMin(0.0f) , m_yMin(0.0f) , m_xMax(1.0f) @@ -65,5 +65,5 @@ void ViewportNode::revert() qDebug() << Q_FUNC_INFO; } -} -} +} // Render +} // Qt3D diff --git a/src/render/backend/framegraph/viewportnode.h b/src/render/backend/framegraph/viewportnode.h index 6d1b643a5..371522ba3 100644 --- a/src/render/backend/framegraph/viewportnode.h +++ b/src/render/backend/framegraph/viewportnode.h @@ -39,18 +39,18 @@ ** ****************************************************************************/ -#ifndef VIEWPORT_H -#define VIEWPORT_H +#ifndef QT3D_RENDER_VIEWPORTNODE_H +#define QT3D_RENDER_VIEWPORTNODE_H #include "framegraphnode.h" namespace Qt3D { namespace Render { -class ViewportNode : public FrameGraphNode +class ViewportNode : public Render::FrameGraphNode { public: - ViewportNode(FrameGraphNode *parent = 0); + ViewportNode(Render::FrameGraphNode *parent = 0); void apply() Q_DECL_OVERRIDE; void revert() Q_DECL_OVERRIDE; @@ -65,4 +65,4 @@ public: } } -#endif // VIEWPORT_H +#endif // QT3D_RENDER_VIEWPORTNODE_H diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index bce5c0657..55b99deb4 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -45,12 +45,11 @@ #include <entity.h> #include <scene.h> -#include "framegraph/framegraphnode.h" -#include "framegraph/framegraphvisitor.h" -#include "framegraph/cameraselectornode.h" -#include "framegraph/renderpassfilternode.h" -#include "framegraph/techniquefilternode.h" -#include "framegraph/viewportnode.h" +#include "framegraphvisitor.h" +#include "cameraselectornode.h" +#include "renderpassfilternode.h" +#include "techniquefilternode.h" +#include "viewportnode.h" #include <material.h> #include <mesh.h> @@ -156,6 +155,7 @@ Renderer::Renderer() buildDefaultTechnique(); buildDefaultMaterial(); + } void Renderer::buildDefaultTechnique() @@ -247,13 +247,13 @@ void Renderer::initialize() } -void Renderer::setFrameGraphRoot(FrameGraphNode *fgRoot) +void Renderer::setFrameGraphRoot(Render::FrameGraphNode *fgRoot) { qDebug() << Q_FUNC_INFO; m_frameGraphRoot = fgRoot; } -FrameGraphNode *Renderer::frameGraphRoot() const +Render::FrameGraphNode *Renderer::frameGraphRoot() const { return m_frameGraphRoot; } @@ -306,7 +306,7 @@ void Renderer::setSceneGraphRoot(Node *sgRoot) // |- Viewport // |- CameraSelector[mainCamera] // |- RenderPass[lighting] - FrameGraphNode *fgRoot = new FrameGraphNode; + Render::FrameGraphNode *fgRoot = new Render::FrameGraphNode; TechniqueFilter *forwardTechnique = new TechniqueFilter(fgRoot); forwardTechnique->m_filters.insert(QStringLiteral("style"), QStringLiteral("forward")); diff --git a/src/render/backend/renderer.h b/src/render/backend/renderer.h index 225c338f8..e3ca5618c 100644 --- a/src/render/backend/renderer.h +++ b/src/render/backend/renderer.h @@ -90,8 +90,8 @@ public: void setRendererAspect(RendererAspect *rendererAspect) { m_rendererAspect = rendererAspect; } RendererAspect *rendererAspect() const { return m_rendererAspect; } - void setFrameGraphRoot(FrameGraphNode *fgRoot); - FrameGraphNode *frameGraphRoot() const; + void setFrameGraphRoot(Render::FrameGraphNode *fgRoot); + Render::FrameGraphNode *frameGraphRoot() const; void setSceneObject(Qt3D::Node *obj); void setSceneGraphRoot(Qt3D::Node *sgRoot); @@ -130,7 +130,7 @@ private: RendererAspect *m_rendererAspect; // Frame graph root - FrameGraphNode *m_frameGraphRoot; + Render::FrameGraphNode *m_frameGraphRoot; Qt3D::Node *m_sceneGraphRoot; RenderNode *m_renderSceneRoot; diff --git a/src/render/backend/rendereraspect.cpp b/src/render/backend/rendereraspect.cpp index 88114fc98..e293cd4d8 100644 --- a/src/render/backend/rendereraspect.cpp +++ b/src/render/backend/rendereraspect.cpp @@ -72,6 +72,8 @@ #include "techniquefilter.h" #include "shape.h" #include "texture.h" +#include "framegraph.h" + namespace Qt3D { @@ -168,6 +170,9 @@ void RendererAspect::registerQmlComponents() qmlRegisterType<Qt3D::CameraSelector>("Qt3D.Render", 2, 0, "CameraSelector"); qmlRegisterType<Qt3D::RenderPassFilter>("Qt3D.Render", 2, 0, "RenderPassFilter"); qmlRegisterType<Qt3D::TechniqueFilter>("Qt3D.Render", 2, 0, "TechniqueFilter"); + qmlRegisterType<Qt3D::Viewport>("Qt3D.Render", 2, 0, "Viewport"); + qmlRegisterType<Qt3D::FrameGraphItem>("Qt3D.Render", 2, 0, "FrameGraphNode"); + qmlRegisterType<Qt3D::FrameGraph>("Qt3D.Render", 2, 0, "FrameGraph"); } } diff --git a/src/render/backend/renderscenebuilder.cpp b/src/render/backend/renderscenebuilder.cpp index 6dc8afbad..b6dd0ddc7 100644 --- a/src/render/backend/renderscenebuilder.cpp +++ b/src/render/backend/renderscenebuilder.cpp @@ -49,9 +49,20 @@ #include <material.h> #include <mesh.h> #include <transform.h> - #include <entity.h> +#include <framegraph.h> +#include <viewport.h> +#include <techniquefilter.h> +#include <renderpassfilter.h> +#include <cameraselector.h> + +#include <techniquefilternode.h> +#include <cameraselectornode.h> +#include <renderpassfilternode.h> +#include <viewportnode.h> + + namespace Qt3D { namespace Render { @@ -62,6 +73,78 @@ RenderSceneBuilder::RenderSceneBuilder(Renderer *renderer) { } +/*! + * Returns a FrameGraphNode and all its children from \a node which points to the activeFrameGraph. + * Returns Q_NULLPTR if \a is also Q_NULLPTR or if there is no FrameGraphComponent + * in node's children tree. + */ +Render::FrameGraphNode *RenderSceneBuilder::buildFrameGraph(Node *node) +{ + if (node == Q_NULLPTR) + return Q_NULLPTR; + + qDebug() << Q_FUNC_INFO << node->objectName(); + + Render::FrameGraphNode *fgNode = Q_NULLPTR; + Qt3D::FrameGraphItem *fgItem = Q_NULLPTR; + + if ((fgItem = qobject_cast<Qt3D::FrameGraphItem *>(node)) != Q_NULLPTR) { + // Instantiate proper backend node corresponding to the frontend node + fgNode = backendFrameGraphNode(fgItem); + } + + // we need to travel the node's children tree to find either the FG root Node or + // its children + QList<FrameGraphNode *> fgChildNodes; + foreach (Node *child, node->children()) { + FrameGraphNode* fgChildNode = buildFrameGraph(child); + if (fgChildNode != Q_NULLPTR) + fgChildNodes << fgChildNode; + } + if (!fgChildNodes.isEmpty()) { + if (fgNode == Q_NULLPTR && fgChildNodes.size() == 1) { + fgNode = fgChildNodes.first(); + } + else { + if (fgNode == Q_NULLPTR) + fgNode = new FrameGraphNode(); + foreach (FrameGraphNode *fgChildNodes, fgChildNodes) + fgNode->appendChild(fgChildNodes); + } + } + return fgNode; +} + +/*! + * Returns a proper FrameGraphNode subclass instance from \a block. + * If no subclass corresponds, Q_NULLPTR is returned. + */ +Render::FrameGraphNode *RenderSceneBuilder::backendFrameGraphNode(Qt3D::FrameGraphItem *block) +{ + if (qobject_cast<Qt3D::TechniqueFilter*>(block) != Q_NULLPTR) { + qDebug() << Q_FUNC_INFO << "TechniqueFilter"; + Render::TechniqueFilter *techniqueFilterNode = new Render::TechniqueFilter(); + return techniqueFilterNode; + } + else if (qobject_cast<Qt3D::Viewport*>(block) != Q_NULLPTR) { + qDebug() << Q_FUNC_INFO << "Viewport"; + Render::ViewportNode *viewportNode = new Render::ViewportNode(); + return viewportNode; + } + else if (qobject_cast<Qt3D::RenderPassFilter*>(block) != Q_NULLPTR) { + qDebug() << Q_FUNC_INFO << "RenderPassFilter"; + Render::RenderPassFilter *renderPassFilterNode = new Render::RenderPassFilter(); + return renderPassFilterNode; + } + else if (qobject_cast<Qt3D::CameraSelector*>(block) != Q_NULLPTR) + { + qDebug() << Q_FUNC_INFO << "CameraSelector"; + Render::CameraSelector *cameraSelectorNode = new Render::CameraSelector(); + return cameraSelectorNode; + } + return Q_NULLPTR; +} + void RenderSceneBuilder::visitNode(Qt3D::Node *node) { if (!m_rootNode) { @@ -69,7 +152,7 @@ void RenderSceneBuilder::visitNode(Qt3D::Node *node) m_rootNode->m_frontEndPeer = node; m_nodeStack.push(m_rootNode); } - + qDebug() << Q_FUNC_INFO << "Node " << node->objectName(); Qt3D::NodeVisitor::visitNode(node); } @@ -77,7 +160,9 @@ void RenderSceneBuilder::visitEntity(Qt3D::Entity *entity) { // Create a RenderNode corresponding to the Entity. Most data will // be calculated later by jobs + qDebug() << Q_FUNC_INFO << "Entity " << entity->objectName(); RenderNode *renderNode = new RenderNode(m_renderer->rendererAspect(), m_nodeStack.top()); +// entity->dumpObjectTree(); renderNode->m_frontEndPeer = entity; // REPLACE WITH ENTITY MATRIX FROM TRANSFORMS // *(renderNode->m_localTransform) = entity->matrix(); @@ -88,10 +173,21 @@ void RenderSceneBuilder::visitEntity(Qt3D::Entity *entity) if (!transforms.isEmpty()) renderNode->setPeer(transforms.first()); -// QList<Material *> materials = entity->componentsOfType<Material>(); -// Material *material = 0; -// if (!materials.isEmpty()) -// material = materials.first(); + + QList<FrameGraph *> framegraphRefs = entity->componentsOfType<FrameGraph>(); + if (!framegraphRefs.isEmpty()) { + FrameGraph *fg = framegraphRefs.first(); + // Entity has a reference to a framegraph configuration + // Build a tree of FrameGraphNodes by reading the tree of FrameGraphBuildingBlocks + Render::FrameGraphNode* frameGraphRootNode = buildFrameGraph(fg->activeFrameGraph()); + qDebug() << Q_FUNC_INFO << "SceneGraphRoot" << frameGraphRootNode; + m_renderer->setFrameGraphRoot(frameGraphRootNode); + } + + // QList<Material *> materials = entity->componentsOfType<Material>(); + // Material *material = 0; + // if (!materials.isEmpty()) + // material = materials.first(); // We'll update matrices in a job later. In fact should the matrix be decoupled from the mesh? foreach (Mesh *mesh, entity->componentsOfType<Mesh>()) { diff --git a/src/render/backend/renderscenebuilder.h b/src/render/backend/renderscenebuilder.h index 2f3812f26..e19d2ea63 100644 --- a/src/render/backend/renderscenebuilder.h +++ b/src/render/backend/renderscenebuilder.h @@ -47,10 +47,14 @@ #include <QStack> namespace Qt3D { + +class FrameGraphItem; + namespace Render { class Renderer; class RenderNode; +class FrameGraphNode; class RenderSceneBuilder : public Qt3D::NodeVisitor { @@ -67,6 +71,10 @@ private: Renderer *m_renderer; RenderNode *m_rootNode; QStack<RenderNode *> m_nodeStack; + + Render::FrameGraphNode* buildFrameGraph(Node *node); + Render::FrameGraphNode* backendFrameGraphNode(Qt3D::FrameGraphItem *); + }; } // namespace Render diff --git a/src/render/frontend/cameraselector.cpp b/src/render/frontend/cameraselector.cpp index 091327646..0be712b52 100644 --- a/src/render/frontend/cameraselector.cpp +++ b/src/render/frontend/cameraselector.cpp @@ -44,7 +44,7 @@ namespace Qt3D { CameraSelector::CameraSelector(Node *parent) - : Qt3D::Component(parent) + : FrameGraphItem(parent) , m_camera(0) { } diff --git a/src/render/frontend/cameraselector.h b/src/render/frontend/cameraselector.h index e5efa37a5..7da5ffbe8 100644 --- a/src/render/frontend/cameraselector.h +++ b/src/render/frontend/cameraselector.h @@ -42,14 +42,14 @@ #ifndef QT3D_CAMERASELECTOR_H #define QT3D_CAMERASELECTOR_H -#include <component.h> #include <qt3drenderer_global.h> +#include "framegraphitem.h" namespace Qt3D { class Camera; -class QT3DRENDERERSHARED_EXPORT CameraSelector : public Qt3D::Component +class QT3DRENDERERSHARED_EXPORT CameraSelector : public FrameGraphItem { Q_OBJECT diff --git a/src/render/frontend/framegraph.cpp b/src/render/frontend/framegraph.cpp new file mode 100644 index 000000000..b4fb41081 --- /dev/null +++ b/src/render/frontend/framegraph.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:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "framegraph.h" +#include "entity.h" + +namespace Qt3D { + +/*! + * \class FrameGraph + * + * \brief 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 that only a single FrameGraph can be active at any moment. + * + * \since 5.3 + * \namespace Qt3D + */ + +FrameGraph::FrameGraph(Node *parent) : + Qt3D::Component(parent), + m_activeFrameGraph(Q_NULLPTR) +{ +} + +/*! + * Returns the current activeFrameGraph root node. + */ +FrameGraphItem *FrameGraph::activeFrameGraph() const +{ + return m_activeFrameGraph; +} + +/*! + * Sets the root node \a activeFrameGraph of the FrameGraph. + */ +void FrameGraph::setActiveFrameGraph(FrameGraphItem *activeFrameGraph) +{ + if (activeFrameGraph != m_activeFrameGraph) { + m_activeFrameGraph = activeFrameGraph; + emit activeFrameGraphChanged(); + } +} + +} // Qt3D diff --git a/src/render/frontend/framegraph.h b/src/render/frontend/framegraph.h new file mode 100644 index 000000000..945bd1e6c --- /dev/null +++ b/src/render/frontend/framegraph.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_FRAMEGRAPH_H +#define QT3D_FRAMEGRAPH_H + +#include <qt3dcore_global.h> +#include <component.h> + +namespace Qt3D { + +class FrameGraphItem; + +class QT3DCORESHARED_EXPORT FrameGraph : public Qt3D::Component +{ + 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(Qt3D::FrameGraphItem *activeFrameGraph READ activeFrameGraph WRITE setActiveFrameGraph NOTIFY activeFrameGraphChanged) + Q_CLASSINFO("DefaultProperty", "activeFrameGraph") + +public: + explicit FrameGraph(Node *parent = 0); + + FrameGraphItem *activeFrameGraph() const; + void setActiveFrameGraph(FrameGraphItem *activeFrameGraph); + +signals: + void activeFrameGraphChanged(); + +private: + FrameGraphItem *m_activeFrameGraph; +}; + +} //Qt3D + +#endif // QT3D_FRAMEGRAPH_H diff --git a/examples/simple-qml/elements/CameraSelectorEntity.qml b/src/render/frontend/framegraphitem.cpp index 0bd8d64db..01707877a 100644 --- a/examples/simple-qml/elements/CameraSelectorEntity.qml +++ b/src/render/frontend/framegraphitem.cpp @@ -39,14 +39,26 @@ ** ****************************************************************************/ -import Qt3D 2.0 +#include "framegraphitem.h" -Entity { - property alias camera: selector.camera +/*! + * \class FrameGraphNode + * + * \brief Base class of all FrameGraph configuration nodes. + * + * \since 5.3 + * \namespace Qt3D + */ - property CameraSelector _cameraSelector: selector +namespace Qt3D { - CameraSelector { - id: selector - } +FrameGraphItem::FrameGraphItem(Node *parent) + : Node(parent) +{ } + +FrameGraphItem::~FrameGraphItem() +{ +} + +} // Qt3D diff --git a/examples/simple-qml/elements/ViewportEntity.qml b/src/render/frontend/framegraphitem.h index 5d1fd4e18..2260dd785 100644 --- a/examples/simple-qml/elements/ViewportEntity.qml +++ b/src/render/frontend/framegraphitem.h @@ -39,14 +39,22 @@ ** ****************************************************************************/ -import Qt3D 2.0 +#ifndef QT3D_FRAMEGRAPHNODE_H +#define QT3D_FRAMEGRAPHNODE_H -Entity { - property alias viewportRect: defaultViewport.rect +#include <qt3drenderer_global.h> +#include <node.h> - property Viewport _viewport: defaultViewport +namespace Qt3D { - Viewport { - id: defaultViewport - } -} +class QT3DRENDERERSHARED_EXPORT FrameGraphItem : public Node +{ + Q_OBJECT +public: + explicit FrameGraphItem(Node *parent = 0); + virtual ~FrameGraphItem(); +}; + +} // Qt3D + +#endif // QT3D_FRAMEGRAPHNODE_H diff --git a/src/render/frontend/render-frontend.pri b/src/render/frontend/render-frontend.pri index b2e37ee75..2c5800b76 100644 --- a/src/render/frontend/render-frontend.pri +++ b/src/render/frontend/render-frontend.pri @@ -13,11 +13,12 @@ HEADERS += \ $$PWD/techniquefilter.h \ $$PWD/tag.h \ $$PWD/shape.h \ - $$PWD/transform.h \ $$PWD/qitemmodelbuffer.h \ $$PWD/texture.h \ $$PWD/sphere.h \ - $$PWD/scene.h + $$PWD/scene.h \ + $$PWD/framegraph.h \ + $$PWD/framegraphitem.h SOURCES += \ $$PWD/effect.cpp \ @@ -34,4 +35,6 @@ SOURCES += \ $$PWD/qitemmodelbuffer.cpp \ $$PWD/texture.cpp \ $$PWD/sphere.cpp \ - $$PWD/scene.cpp + $$PWD/scene.cpp \ + $$PWD/framegraph.cpp \ + $$PWD/framegraphitem.cpp diff --git a/src/render/frontend/renderpassfilter.cpp b/src/render/frontend/renderpassfilter.cpp index 8b25fe239..67db289e3 100644 --- a/src/render/frontend/renderpassfilter.cpp +++ b/src/render/frontend/renderpassfilter.cpp @@ -44,7 +44,7 @@ namespace Qt3D { RenderPassFilter::RenderPassFilter(Node *parent) - : Component(parent) + : FrameGraphItem(parent) { } @@ -61,4 +61,4 @@ QString RenderPassFilter::renderPassNames() const return m_renderPassNames; } -} +} // Qt3D diff --git a/src/render/frontend/renderpassfilter.h b/src/render/frontend/renderpassfilter.h index 01de80b3f..f7f0ca18f 100644 --- a/src/render/frontend/renderpassfilter.h +++ b/src/render/frontend/renderpassfilter.h @@ -39,17 +39,17 @@ ** ****************************************************************************/ -#ifndef RENDERPASSFILTER_H -#define RENDERPASSFILTER_H +#ifndef QT3D_RENDERPASSFILTER_H +#define QT3D_RENDERPASSFILTER_H #include <qt3drenderer_global.h> -#include <component.h> +#include "framegraphitem.h" #include <QString> namespace Qt3D { -class QT3DRENDERERSHARED_EXPORT RenderPassFilter : public Component +class QT3DRENDERERSHARED_EXPORT RenderPassFilter : public FrameGraphItem { Q_OBJECT @@ -66,8 +66,9 @@ signals: private: QString m_renderPassNames; + }; } // namespace Qt3D -#endif // RENDERPASSFILTER_H +#endif // QT3D_RENDERPASSFILTER_H diff --git a/src/render/frontend/techniquefilter.cpp b/src/render/frontend/techniquefilter.cpp index 038fa51f1..fe4b5ced8 100644 --- a/src/render/frontend/techniquefilter.cpp +++ b/src/render/frontend/techniquefilter.cpp @@ -44,7 +44,7 @@ namespace Qt3D { TechniqueFilter::TechniqueFilter(Node *parent) - : Qt3D::Component(parent) + : FrameGraphItem(parent) { } diff --git a/src/render/frontend/techniquefilter.h b/src/render/frontend/techniquefilter.h index cbdfe1661..69f594824 100644 --- a/src/render/frontend/techniquefilter.h +++ b/src/render/frontend/techniquefilter.h @@ -42,8 +42,8 @@ #ifndef QT3D_TECHNIQUEFILTER_H #define QT3D_TECHNIQUEFILTER_H -#include <component.h> #include <qt3drenderer_global.h> +#include "framegraphitem.h" #include "tag.h" @@ -51,12 +51,10 @@ namespace Qt3D { -class QT3DRENDERERSHARED_EXPORT TechniqueFilter : public Qt3D::Component +class QT3DRENDERERSHARED_EXPORT TechniqueFilter : public FrameGraphItem { Q_OBJECT - Q_PROPERTY(QQmlListProperty<Qt3D::Tag> tags READ tags NOTIFY tagsChanged) - Q_CLASSINFO("DefaultProperty", "tags") public: explicit TechniqueFilter(Node *parent = 0); diff --git a/src/render/frontend/viewport.cpp b/src/render/frontend/viewport.cpp index 8c13190a1..42d44900b 100644 --- a/src/render/frontend/viewport.cpp +++ b/src/render/frontend/viewport.cpp @@ -44,7 +44,7 @@ namespace Qt3D { Viewport::Viewport(Node *parent) - : Component(parent) + : FrameGraphItem(parent) { } @@ -61,4 +61,4 @@ void Viewport::setRect(const QRectF &rect) } } -} +} // Qt3D diff --git a/src/render/frontend/viewport.h b/src/render/frontend/viewport.h index 6b7f5ab07..23376f95d 100644 --- a/src/render/frontend/viewport.h +++ b/src/render/frontend/viewport.h @@ -39,20 +39,19 @@ ** ****************************************************************************/ -#ifndef VIEWPORT_H -#define VIEWPORT_H +#ifndef QT3D_VIEWPORT_H +#define QT3D_VIEWPORT_H -#include <component.h> #include <qt3drenderer_global.h> +#include "framegraphitem.h" #include <QRectF> namespace Qt3D { -class QT3DRENDERERSHARED_EXPORT Viewport : public Component +class QT3DRENDERERSHARED_EXPORT Viewport : public FrameGraphItem { Q_OBJECT - Q_PROPERTY(QRectF rect READ rect WRITE setRect NOTIFY rectChanged) public: @@ -72,4 +71,4 @@ private: } -#endif // VIEWPORT_H +#endif // QT3D_VIEWPORT_H |