summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/cylinder-cpp/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qt3d/cylinder-cpp/main.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();