diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-03-03 22:43:22 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2020-03-19 10:06:17 +0100 |
commit | cdc9efb609894298d8d854a0ec75f9cb8e89f195 (patch) | |
tree | 50617c6e80c813cafafd42e2b2367e310fa2b77a /src/quick3d/imports/scene3d/scene3ditem_p.h | |
parent | 5007e6e09db2262d28567ad276771e8fb823b069 (diff) |
Allow for when a Scene3D item switches screens
When a Scene3D item switches screens then it will need to be
reinitalized so that the supporting contexts, offscreen surfaces are
set to use the same screen and not the original one. This ensures that
the item is still rendered correctly on the new screen.
This includes a manual test using QQuickWidget in separate windows that
enables it going from one screen to the other.
This is a fresh version after the previous version was found to have a
bug shown in the scene3d-loader test which has now been resolved.
Change-Id: I3c711e894018db52ec00a8a5d2e0fb0128743ab1
Done-with: Antti Kokko <antti.kokko@qt.io>
Fixes: QTBUG-79192
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Mike Krus <mike.krus@kdab.com>
(cherry picked from commit 4eef300be70509a208527bf164f7746fa1bf07a1)
Diffstat (limited to 'src/quick3d/imports/scene3d/scene3ditem_p.h')
-rw-r--r-- | src/quick3d/imports/scene3d/scene3ditem_p.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/quick3d/imports/scene3d/scene3ditem_p.h b/src/quick3d/imports/scene3d/scene3ditem_p.h index 4106ff459..ddb462011 100644 --- a/src/quick3d/imports/scene3d/scene3ditem_p.h +++ b/src/quick3d/imports/scene3d/scene3ditem_p.h @@ -68,7 +68,7 @@ namespace Qt3DRender { class QCamera; class QRenderAspect; class Scene3DRenderer; -class Scene3DCleaner; +class QRenderSurfaceSelector; class Scene3DItem : public QQuickItem { @@ -120,14 +120,18 @@ private: void setCameraAspectModeHelper(); void updateCameraAspectRatio(); void mousePressEvent(QMouseEvent *event) override; + void updateWindowSurface(); + void createDummySurface(QWindow *window, QRenderSurfaceSelector *surfaceSelector); + void applyAspects(); QStringList m_aspects; - Qt3DCore::QEntity *m_entity; + // Store as shared pointer so that aspect engine doesn't delete it. + QSharedPointer<Qt3DCore::QEntity> m_entity; Qt3DCore::QAspectEngine *m_aspectEngine; + Qt3DCore::QAspectEngine *m_aspectToDelete; QRenderAspect *m_renderAspect; Scene3DRenderer *m_renderer; - Scene3DCleaner *m_rendererCleaner; bool m_multisample; |