From 86177b98e27a9d376e35039454986ff7de8f3104 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Wed, 20 Jan 2016 16:33:53 +0100 Subject: QAspectEngine/QAbstractAspects: get rid of setData Getting rid of set data and the refactoring on setting the surface implies that: - Given the FrameGraph configuration, there may be several RenderViews each having a different RenderSurfaceSelector/Window - This means that the Renderer/QRenderAspect can't know about the surface before reading the scene - This means that the Renderer may be dealing with more than 1 window - This means that initialization, render and shutdown procedures will have to be updated accordingly Therefore the Renderer was refactored to: - Be initialized without knowing about a surface - For each RenderView, check the surface and if different from the previous one: * Make the context current with it * Create the appropriate glHelpers (as Surfaces may have != formats) TO DO: - Fix picking - Fix windows exposition - Fix shutdown / detection of all windows beging closed Change-Id: I49d070b05f46be4b26cfb57e494feba145d1da9c Reviewed-by: Paul Lemire --- examples/qt3d/examples-common/qt3dquickwindow.cpp | 15 ++++++++------- examples/qt3d/examples-common/qt3dwindow.cpp | 6 ------ 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'examples/qt3d') diff --git a/examples/qt3d/examples-common/qt3dquickwindow.cpp b/examples/qt3d/examples-common/qt3dquickwindow.cpp index 759405541..7b0f4a70f 100644 --- a/examples/qt3d/examples-common/qt3dquickwindow.cpp +++ b/examples/qt3d/examples-common/qt3dquickwindow.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -123,12 +124,6 @@ void Qt3DQuickWindow::showEvent(QShowEvent *e) { if (!m_initialized) { - // TODO: Get rid of this - QVariantMap data; - data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast(this))); - data.insert(QStringLiteral("eventSource"), QVariant::fromValue(this)); - m_engine->aspectEngine()->setData(data); - // Connect to the QQmlAspectEngine's statusChanged signal so that when the QML is loaded // and th eobjects hav ebeen instantiated, but before we set them on the QAspectEngine we // can swoop in and set the window surface and camera on the framegraph and ensure the camera @@ -165,7 +160,13 @@ void Qt3DQuickWindow::onSceneCreated(QObject *rootObject) } } - // TODO: Set ourselves up as a source of input events for the input aspect + // Set ourselves up as a source of input events for the input aspect + Qt3DInput::QInputSettings *inputSettings = rootObject->findChild(); + if (inputSettings) { + inputSettings->setEventSource(this); + } else { + qWarning() << "No Input Settings found, keyboard and mouse events won't be handled"; + } } void Qt3DQuickWindow::setWindowSurface(QObject *rootObject) diff --git a/examples/qt3d/examples-common/qt3dwindow.cpp b/examples/qt3d/examples-common/qt3dwindow.cpp index a7728771e..805d92efb 100644 --- a/examples/qt3d/examples-common/qt3dwindow.cpp +++ b/examples/qt3d/examples-common/qt3dwindow.cpp @@ -171,12 +171,6 @@ void Qt3DWindow::showEvent(QShowEvent *e) if (m_userRoot != nullptr) m_userRoot->setParent(m_root); - // TODO: Get rid of this - QVariantMap data; - data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast(this))); - data.insert(QStringLiteral("eventSource"), QVariant::fromValue(this)); - m_aspectEngine->setData(data); - m_root->addComponent(m_frameGraph); m_aspectEngine->setRootEntity(m_root); -- cgit v1.2.3