summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/cylinder-cpp
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2015-12-28 08:12:34 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-01-13 14:20:09 +0000
commit71b4e8612e558115edd12e8ac19f8d6abe583475 (patch)
tree76826eb7111bda149c279a480eebaa02dc6959dd /examples/qt3d/cylinder-cpp
parenta57538409a79be1035b70ff79313f2cf8d731e85 (diff)
Port all the pure C++ examples to Qt3DRender::QWindow
Change-Id: I43b4a5fcfb4ec00ccaec013cb31d00ca92d3c224 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/cylinder-cpp')
-rw-r--r--examples/qt3d/cylinder-cpp/main.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/examples/qt3d/cylinder-cpp/main.cpp b/examples/qt3d/cylinder-cpp/main.cpp
index a7230ffd8..f45492926 100644
--- a/examples/qt3d/cylinder-cpp/main.cpp
+++ b/examples/qt3d/cylinder-cpp/main.cpp
@@ -36,7 +36,6 @@
#include <QGuiApplication>
-#include <window.h>
#include <Qt3DCore/qcamera.h>
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/qcameralens.h>
@@ -57,26 +56,21 @@
#include <Qt3DRender/qrenderaspect.h>
#include <Qt3DRender/qframegraph.h>
#include <Qt3DRender/qforwardrenderer.h>
+#include <Qt3DRender/qwindow.h>
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- Window view;
- Qt3DCore::QAspectEngine engine;
- engine.registerAspect(new Qt3DRender::QRenderAspect());
+ Qt3DRender::QWindow view;
Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
- engine.registerAspect(input);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.setData(data);
+ view.registerAspect(input);
// Root entity
Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
// Camera
- Qt3DCore::QCamera *cameraEntity = new Qt3DCore::QCamera(rootEntity);
+ Qt3DCore::QCamera *cameraEntity = view.defaultCamera();
cameraEntity->setObjectName(QStringLiteral("cameraEntity"));
cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
@@ -114,10 +108,10 @@ int main(int argc, char **argv)
cylinderEntity->addComponent(cylinderTransform);
// Setting the FrameGraph
- rootEntity->addComponent(frameGraph);
+ view.setFrameGraph(frameGraph);
// Set root object of the scene
- engine.setRootEntity(rootEntity);
+ view.setRootEntity(rootEntity);
// Show window
view.show();