summaryrefslogtreecommitdiffstats
path: root/examples/dynamicscene-cpp/forwardrenderer.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-01-05 12:22:57 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-01-10 20:58:19 +0100
commit69123a4ca74cbc37a5c3eab1ee3c0ba14faa9062 (patch)
treec0cae61ba091f7d7e43efa697ef05a34a8a2ae28 /examples/dynamicscene-cpp/forwardrenderer.cpp
parent15b78caa27a198567d06e4e42ae5f01203b29a1b (diff)
dynamicscene-cpp example
Demonstrate and ensure that dynamic element adding/removing from the scene is working. Change-Id: I83819fe813c3910c9a8e4460ef7147fc56421c74 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/dynamicscene-cpp/forwardrenderer.cpp')
-rw-r--r--examples/dynamicscene-cpp/forwardrenderer.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/examples/dynamicscene-cpp/forwardrenderer.cpp b/examples/dynamicscene-cpp/forwardrenderer.cpp
new file mode 100644
index 000000000..ebd8f7cdc
--- /dev/null
+++ b/examples/dynamicscene-cpp/forwardrenderer.cpp
@@ -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: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 "forwardrenderer.h"
+
+ForwardRenderer::ForwardRenderer(Qt3D::QNode *parent)
+ : Qt3D::QFrameGraph(parent)
+ , m_viewport(new Qt3D::QViewport())
+ , m_cameraSelector(new Qt3D::QCameraSelector())
+ , m_clearBuffer(new Qt3D::QClearBuffer())
+{
+ m_viewport->setRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f));
+ m_viewport->setClearColor(Qt::white);
+ m_clearBuffer->setBuffers(Qt3D::QClearBuffer::ColorDepthBuffer);
+ m_cameraSelector->setParent(m_viewport);
+ m_clearBuffer->setParent(m_cameraSelector);
+ setActiveFrameGraph(m_viewport);
+}
+
+void ForwardRenderer::setCamera(Qt3D::QEntity *camera)
+{
+ m_cameraSelector->setCamera(camera);
+}