diff options
Diffstat (limited to 'examples/qt3d/tessellation-modes')
-rw-r--r-- | examples/qt3d/tessellation-modes/main.cpp | 25 | ||||
-rw-r--r-- | examples/qt3d/tessellation-modes/main.qml | 4 |
2 files changed, 8 insertions, 21 deletions
diff --git a/examples/qt3d/tessellation-modes/main.cpp b/examples/qt3d/tessellation-modes/main.cpp index 427058be3..d835da374 100644 --- a/examples/qt3d/tessellation-modes/main.cpp +++ b/examples/qt3d/tessellation-modes/main.cpp @@ -35,40 +35,29 @@ ****************************************************************************/ #include "tessellatedquadmesh.h" - -#include <window.h> -#include <Qt3DRender/qrenderaspect.h> -#include <Qt3DInput/QInputAspect> +#include "qt3dquickwindow.h" #include <Qt3DQuick/QQmlAspectEngine> - #include <QGuiApplication> -#include <QtQml> +#include <qqml.h> +#include <QQmlContext> +#include <QQmlEngine> int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Window view; - Qt3DCore::Quick::QQmlAspectEngine engine; - - engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect()); - engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect()); - - QVariantMap data; - data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view))); - data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view)); - engine.aspectEngine()->setData(data); + Qt3DQuickWindow view; // Register our custom types qmlRegisterType<TessellatedQuadMesh>("Qt3D.Examples", 1, 0, "TessellatedQuadMesh"); // Expose the window as a context property so we can set the aspect ratio - engine.qmlEngine()->rootContext()->setContextProperty("_window", &view); + view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view); // There should be some synchronising mechanism to make sure // the source is set after all aspects have been completely initialized // Otherwise we might encounter cases where an Aspect's QML elements have // not yet been registered - engine.setSource(QUrl("qrc:/main.qml")); + view.setSource(QUrl("qrc:/main.qml")); view.show(); return app.exec(); diff --git a/examples/qt3d/tessellation-modes/main.qml b/examples/qt3d/tessellation-modes/main.qml index e75664364..e2b06f21f 100644 --- a/examples/qt3d/tessellation-modes/main.qml +++ b/examples/qt3d/tessellation-modes/main.qml @@ -59,9 +59,7 @@ Entity { position: Qt.vector3d( 0.0, 0.0, 10.0 ) } - Configuration { - controlledCamera: mainCamera - } + FirstPersonCameraController { camera: mainCamera } TessellatedWireframeMaterial { id: quadMaterial |