summaryrefslogtreecommitdiffstats
path: root/tests/manual/dynamicscene-cpp
diff options
context:
space:
mode:
authorRobert Brock <robert.brock@kdab.com>2016-05-09 11:12:16 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-05-15 13:44:46 +0000
commitdb5900bb675e766179da332ed574f8b4f6e4b935 (patch)
treee62e9388183ffb04c150cfac7e34cc76ad16e757 /tests/manual/dynamicscene-cpp
parent2ed452167ef143147137f134639be53bf065112a (diff)
Moved dynamicscene-cpp example to manual test
Part of an examples cleanup Change-Id: Ib2154b36f91093bb248b37a1e41a4cfc51c52880 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/manual/dynamicscene-cpp')
-rw-r--r--tests/manual/dynamicscene-cpp/boxentity.cpp120
-rw-r--r--tests/manual/dynamicscene-cpp/boxentity.h94
-rw-r--r--tests/manual/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc32
-rw-r--r--tests/manual/dynamicscene-cpp/dynamicscene-cpp.pro14
-rw-r--r--tests/manual/dynamicscene-cpp/examplescene.cpp96
-rw-r--r--tests/manual/dynamicscene-cpp/examplescene.h80
-rw-r--r--tests/manual/dynamicscene-cpp/main.cpp88
7 files changed, 524 insertions, 0 deletions
diff --git a/tests/manual/dynamicscene-cpp/boxentity.cpp b/tests/manual/dynamicscene-cpp/boxentity.cpp
new file mode 100644
index 000000000..a39c9a9dc
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/boxentity.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "boxentity.h"
+
+#include <qmath.h>
+
+BoxEntity::BoxEntity(QNode *parent)
+ : Qt3DCore::QEntity(parent)
+ , m_transform(new Qt3DCore::QTransform())
+ , m_mesh(new Qt3DExtras::QCuboidMesh())
+ , m_material(new Qt3DExtras::QPhongMaterial())
+ , m_angle(0.0f)
+ , m_radius(1.0f)
+{
+ connect(m_material, SIGNAL(diffuseChanged(const QColor &)),
+ this, SIGNAL(diffuseColorChanged(const QColor &)));
+ m_material->setAmbient(Qt::gray);
+ m_material->setSpecular(Qt::white);
+ m_material->setShininess(150.0f);
+
+ addComponent(m_transform);
+ addComponent(m_mesh);
+ addComponent(m_material);
+}
+
+void BoxEntity::setDiffuseColor(const QColor &diffuseColor)
+{
+ m_material->setDiffuse(diffuseColor);
+}
+
+void BoxEntity::setAngle(float arg)
+{
+ if (m_angle == arg)
+ return;
+
+ m_angle = arg;
+ emit angleChanged();
+ updateTransformation();
+}
+
+void BoxEntity::setRadius(float arg)
+{
+ if (m_radius == arg)
+ return;
+
+ m_radius = arg;
+ emit radiusChanged();
+ updateTransformation();
+}
+
+QColor BoxEntity::diffuseColor()
+{
+ return m_material->diffuse();
+}
+
+float BoxEntity::angle() const
+{
+ return m_angle;
+}
+
+float BoxEntity::radius() const
+{
+ return m_radius;
+}
+
+void BoxEntity::updateTransformation()
+{
+ m_transform->setTranslation(QVector3D(qCos(m_angle) * m_radius,
+ 1.0f,
+ qSin(m_angle) * m_radius));
+}
+
diff --git a/tests/manual/dynamicscene-cpp/boxentity.h b/tests/manual/dynamicscene-cpp/boxentity.h
new file mode 100644
index 000000000..f9fdb9580
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/boxentity.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BOXENTITY_H
+#define BOXENTITY_H
+
+#include <Qt3DCore/QEntity>
+#include <Qt3DCore/QTransform>
+#include <Qt3DExtras/QCuboidMesh>
+#include <Qt3DExtras/QPhongMaterial>
+
+class BoxEntity : public Qt3DCore::QEntity
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QColor diffuseColor READ diffuseColor WRITE setDiffuseColor NOTIFY diffuseColorChanged)
+ Q_PROPERTY(float angle READ angle WRITE setAngle NOTIFY angleChanged)
+ Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
+
+public:
+ BoxEntity(QNode *parent = 0);
+
+ QColor diffuseColor();
+ float angle() const;
+ float radius() const;
+
+public Q_SLOTS:
+ void setDiffuseColor(const QColor &diffuseColor);
+ void setAngle(float arg);
+ void setRadius(float arg);
+
+Q_SIGNALS:
+ void diffuseColorChanged(const QColor &);
+ void angleChanged();
+ void radiusChanged();
+
+private:
+ void updateTransformation();
+
+ Qt3DCore::QTransform *m_transform;
+ Qt3DExtras::QCuboidMesh *m_mesh;
+ Qt3DExtras::QPhongMaterial *m_material;
+ float m_angle;
+ float m_radius;
+};
+
+#endif // BOXENTITY_H
diff --git a/tests/manual/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc b/tests/manual/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc
new file mode 100644
index 000000000..4c5709837
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example dynamicscene-cpp
+ \title Qt 3D: Dynamic Scene C++ Example
+ \ingroup qt3d-examples-cpp
+*/
diff --git a/tests/manual/dynamicscene-cpp/dynamicscene-cpp.pro b/tests/manual/dynamicscene-cpp/dynamicscene-cpp.pro
new file mode 100644
index 000000000..21ae58fed
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/dynamicscene-cpp.pro
@@ -0,0 +1,14 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dextras
+
+SOURCES += \
+ main.cpp \
+ examplescene.cpp \
+ boxentity.cpp
+
+HEADERS += \
+ examplescene.h \
+ boxentity.h
diff --git a/tests/manual/dynamicscene-cpp/examplescene.cpp b/tests/manual/dynamicscene-cpp/examplescene.cpp
new file mode 100644
index 000000000..b11e2f54a
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/examplescene.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "examplescene.h"
+#include "boxentity.h"
+
+#include <QTimer>
+#include <qmath.h>
+
+ExampleScene::ExampleScene(Qt3DCore::QNode *parent)
+ : Qt3DCore::QEntity(parent)
+ , m_timer(new QTimer(this))
+ , m_even(true)
+{
+ buildScene();
+ QObject::connect(m_timer, SIGNAL(timeout()), SLOT(updateScene()));
+ m_timer->setInterval(1200);
+ m_timer->start();
+}
+
+ExampleScene::~ExampleScene()
+{
+ qDeleteAll(m_entities);
+}
+
+void ExampleScene::updateScene()
+{
+ for (int i = 0; i < m_entities.size(); ++i) {
+ const bool visible = (i % 2) ^ m_even;
+ m_entities[i]->setParent(visible ? this : nullptr);
+ }
+ m_even = !m_even;
+}
+
+void ExampleScene::buildScene()
+{
+ int count = 20;
+ const float radius = 5.0f;
+
+ for (int i = 0; i < count; ++i) {
+ BoxEntity *entity = new BoxEntity;
+ const float angle = M_PI * 2.0f * float(i) / count;
+ entity->setAngle(angle);
+ entity->setRadius(radius);
+ entity->setDiffuseColor(QColor(qFabs(qCos(angle)) * 255, 204, 75));
+ m_entities.append(entity);
+ }
+}
+
diff --git a/tests/manual/dynamicscene-cpp/examplescene.h b/tests/manual/dynamicscene-cpp/examplescene.h
new file mode 100644
index 000000000..cac6330f3
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/examplescene.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef EXAMPLESCENE_H
+#define EXAMPLESCENE_H
+
+#include <Qt3DCore/QEntity>
+
+class BoxEntity;
+
+QT_BEGIN_NAMESPACE
+class QTimer;
+QT_END_NAMESPACE
+
+class ExampleScene : public Qt3DCore::QEntity
+{
+ Q_OBJECT
+
+public:
+ explicit ExampleScene(Qt3DCore::QNode *parent = 0);
+ ~ExampleScene();
+
+private Q_SLOTS:
+ void updateScene();
+ void buildScene();
+
+private:
+ QVector<BoxEntity *> m_entities;
+ QTimer *m_timer;
+ bool m_even;
+};
+
+#endif // EXAMPLESCENE_H
diff --git a/tests/manual/dynamicscene-cpp/main.cpp b/tests/manual/dynamicscene-cpp/main.cpp
new file mode 100644
index 000000000..ebc36ab5f
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/main.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+
+#include <Qt3DCore/QAspectEngine>
+#include <Qt3DRender/QCamera>
+
+#include <Qt3DInput/QInputAspect>
+
+#include <Qt3DRender/QRenderAspect>
+#include <Qt3DExtras/QForwardRenderer>
+
+#include "examplescene.h"
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qfirstpersoncameracontroller.h>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Qt3DWindow view;
+
+ ExampleScene *sceneRoot = new ExampleScene();
+
+ // Scene Camera
+ Qt3DRender::QCamera *basicCamera = view.camera();
+ basicCamera->setProjectionType(Qt3DRender::QCameraLens::PerspectiveProjection);
+ basicCamera->setAspectRatio(view.width() / view.height());
+ basicCamera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
+ basicCamera->setViewCenter(QVector3D(0.0f, 3.5f, 0.0f));
+ basicCamera->setPosition(QVector3D(0.0f, 3.5f, 25.0f));
+
+ // For camera controls
+ Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(sceneRoot);
+ camController->setCamera(basicCamera);
+
+ view.setRootEntity(sceneRoot);
+ view.show();
+
+ return app.exec();
+}