diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2020-08-25 16:58:08 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2020-08-26 16:39:22 +0200 |
commit | 4dc69e150356c95a41f16f45538d27d1a6e024fc (patch) | |
tree | 2de256e94a892aaf110904a2f28e666eb6774340 | |
parent | 54c8d77ef2f4590c4d125274844665f2ea2c4f65 (diff) |
Remove Scene3DViews support
As making them work is currently not possible due to RHI limitations about
not clearing when beginning a new render pass.
We might be able to revert that patch later on.
[ChangeLog] Remove Scene3DView support due to incompatibility with RHI
Change-Id: I209a3c23033ea1997868d488ef89071eff3ec6ac
Reviewed-by: Mike Krus <mike.krus@kdab.com>
-rw-r--r-- | src/quick3d/imports/scene3d/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/quick3d/imports/scene3d/importsscene3d.pro | 6 | ||||
-rw-r--r-- | src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp | 2 | ||||
-rw-r--r-- | src/quick3d/imports/scene3d/scene3ditem.cpp | 86 | ||||
-rw-r--r-- | src/quick3d/imports/scene3d/scene3ditem_p.h | 7 | ||||
-rw-r--r-- | src/quick3d/imports/scene3d/scene3drenderer.cpp | 28 | ||||
-rw-r--r-- | src/quick3d/imports/scene3d/scene3drenderer_p.h | 2 | ||||
-rw-r--r-- | src/quick3d/imports/scene3d/scene3dview.cpp | 320 | ||||
-rw-r--r-- | src/quick3d/imports/scene3d/scene3dview_p.h | 134 |
9 files changed, 4 insertions, 582 deletions
diff --git a/src/quick3d/imports/scene3d/CMakeLists.txt b/src/quick3d/imports/scene3d/CMakeLists.txt index a658714a2..0c31d662c 100644 --- a/src/quick3d/imports/scene3d/CMakeLists.txt +++ b/src/quick3d/imports/scene3d/CMakeLists.txt @@ -17,7 +17,6 @@ qt_add_qml_module(qtquickscene3dplugin scene3dsgmaterial.cpp scene3dsgmaterial_p.h scene3dsgmaterialshader.cpp scene3dsgmaterialshader_p.h scene3dsgnode.cpp scene3dsgnode_p.h - scene3dview.cpp scene3dview_p.h PUBLIC_LIBRARIES Qt::3DCore Qt::3DRender diff --git a/src/quick3d/imports/scene3d/importsscene3d.pro b/src/quick3d/imports/scene3d/importsscene3d.pro index 3b8244f19..f8f3320b9 100644 --- a/src/quick3d/imports/scene3d/importsscene3d.pro +++ b/src/quick3d/imports/scene3d/importsscene3d.pro @@ -16,8 +16,7 @@ HEADERS += \ scene3drenderer_p.h \ scene3dsgnode_p.h \ scene3dsgmaterialshader_p.h \ - scene3dsgmaterial_p.h \ - scene3dview_p.h + scene3dsgmaterial_p.h SOURCES += \ qtquickscene3dplugin.cpp \ @@ -26,8 +25,7 @@ SOURCES += \ scene3drenderer.cpp \ scene3dsgnode.cpp \ scene3dsgmaterialshader.cpp \ - scene3dsgmaterial.cpp \ - scene3dview.cpp + scene3dsgmaterial.cpp OTHER_FILES += qmldir shaders/* diff --git a/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp b/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp index 3da9a54fc..fa79af1cd 100644 --- a/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp +++ b/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp @@ -42,7 +42,6 @@ #include <QtQml> #include <scene3ditem_p.h> -#include <scene3dview_p.h> QT_BEGIN_NAMESPACE @@ -50,7 +49,6 @@ void QtQuickScene3DPlugin::registerTypes(const char *uri) { qmlRegisterType<Qt3DRender::Scene3DItem>(uri, 2, 0, "Scene3D"); qmlRegisterType<Qt3DRender::Scene3DItem, 14>(uri, 2, 14, "Scene3D"); - qmlRegisterType<Qt3DRender::Scene3DView>(uri, 2, 14, "Scene3DView"); // The minor version used to be the current Qt 5 minor. For compatibility it is the last // Qt 5 release. diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp index 2ca7c2327..f086ab2ae 100644 --- a/src/quick3d/imports/scene3d/scene3ditem.cpp +++ b/src/quick3d/imports/scene3d/scene3ditem.cpp @@ -71,7 +71,6 @@ #include <scene3dlogging_p.h> #include <scene3drenderer_p.h> #include <scene3dsgnode_p.h> -#include <scene3dview_p.h> #include <Qt3DCore/private/qaspectengine_p.h> #include <Qt3DCore/private/qaspectmanager_p.h> @@ -184,15 +183,12 @@ private: Scene3DItem::Scene3DItem(QQuickItem *parent) : QQuickItem(parent) , m_entity(nullptr) - , m_viewHolderEntity(nullptr) - , m_viewHolderFG(nullptr) , m_aspectEngine(nullptr) , m_aspectToDelete(nullptr) , m_lastManagerNode(nullptr) , m_aspectEngineDestroyer() , m_multisample(true) , m_dirty(true) - , m_dirtyViews(false) , m_wasFrameProcessed(false) , m_wasSGUpdated(false) , m_cameraAspectRatioMode(AutomaticAspectRatio) @@ -388,66 +384,6 @@ Scene3DItem::CompositingMode Scene3DItem::compositingMode() const return m_compositingMode; } -// MainThread called by Scene3DView -void Scene3DItem::addView(Scene3DView *view) -{ - if (m_views.contains(view)) - return; - - Qt3DRender::QFrameGraphNode *viewFG = view->viewFrameGraph(); - Qt3DCore::QEntity *subtreeRoot = view->viewSubtree(); - - if (m_viewHolderEntity == nullptr) { - m_viewHolderEntity = new Qt3DCore::QEntity; - - if (m_entity != nullptr) { - qCWarning(Scene3D) << "Scene3DView is not supported if the Scene3D entity property has been set"; - } - - Qt3DRender::QRenderSettings *settings = new Qt3DRender::QRenderSettings(); - Qt3DRender::QRenderSurfaceSelector *surfaceSelector = new Qt3DRender::QRenderSurfaceSelector(); - m_viewHolderFG = surfaceSelector; - surfaceSelector->setSurface(window()); - - // Copy setting properties from first View - const QList<Qt3DRender::QRenderSettings *> viewRenderSettings = subtreeRoot->componentsOfType<Qt3DRender::QRenderSettings>(); - if (viewRenderSettings.size() > 0) { - Qt3DRender::QRenderSettings *viewRenderSetting = viewRenderSettings.first(); - settings->setRenderPolicy(viewRenderSetting->renderPolicy()); - settings->pickingSettings()->setPickMethod(viewRenderSetting->pickingSettings()->pickMethod()); - settings->pickingSettings()->setPickResultMode(viewRenderSetting->pickingSettings()->pickResultMode()); - } - settings->setActiveFrameGraph(m_viewHolderFG); - m_viewHolderEntity->addComponent(settings); - - setEntity(m_viewHolderEntity); - } - - // Parent FG and Subtree - viewFG->setParent(m_viewHolderFG); - subtreeRoot->setParent(m_viewHolderEntity); - - m_views.push_back(view); - m_dirtyViews |= true; -} - -// MainThread called by Scene3DView -void Scene3DItem::removeView(Scene3DView *view) -{ - if (!m_views.contains(view)) - return; - - Qt3DRender::QFrameGraphNode *viewFG = view->viewFrameGraph(); - Qt3DCore::QEntity *subtreeRoot = view->viewSubtree(); - - // Unparent FG and Subtree - viewFG->setParent(Q_NODE_NULLPTR); - subtreeRoot->setParent(Q_NODE_NULLPTR); - - m_views.removeOne(view); - m_dirtyViews |= true; -} - void Scene3DItem::applyRootEntityChange() { if (m_aspectEngine->rootEntity().data() != m_entity) { @@ -586,8 +522,6 @@ void Scene3DItem::requestUpdate() const bool usesFBO = m_compositingMode == FBO; if (usesFBO) { QQuickItem::update(); - for (Scene3DView *view : m_views) - view->update(); } else { window()->update(); } @@ -901,12 +835,11 @@ QSGNode *Scene3DItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNode } const bool usesFBO = m_compositingMode == FBO; - const bool hasScene3DViews = !m_views.empty(); Scene3DSGNode *fboNode = static_cast<Scene3DSGNode *>(managerNode->firstChild()); - // When using Scene3DViews or Scene3D in Underlay mode + // When using Scene3D in Underlay mode // we shouldn't be managing a Scene3DSGNode - if (!usesFBO || hasScene3DViews) { + if (!usesFBO) { if (fboNode != nullptr) { managerNode->removeChildNode(fboNode); delete fboNode; @@ -923,21 +856,6 @@ QSGNode *Scene3DItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNode } } - // Make renderer aware of any Scene3DView we are dealing with - if (m_dirtyViews) { - const bool usesFBO = m_compositingMode == FBO; - // Scene3DViews checks - if (entity() != m_viewHolderEntity) { - qCWarning(Scene3D) << "Scene3DView is not supported if the Scene3D entity property has been set"; - } - if (!usesFBO) { - qCWarning(Scene3D) << "Scene3DView is only supported when Scene3D compositingMode is set to FBO"; - } - // The Scene3DRender will take care of providing the texture containing the 3D scene - renderer->setScene3DViews(m_views); - m_dirtyViews = false; - } - // Let the renderer prepare anything it needs to prior to the rendering if (m_wasFrameProcessed) renderer->beforeSynchronize(); diff --git a/src/quick3d/imports/scene3d/scene3ditem_p.h b/src/quick3d/imports/scene3d/scene3ditem_p.h index eb38149fb..b5a832d12 100644 --- a/src/quick3d/imports/scene3d/scene3ditem_p.h +++ b/src/quick3d/imports/scene3d/scene3ditem_p.h @@ -111,9 +111,6 @@ public: Q_ENUM(CompositingMode) // LCOV_EXCL_LINE CompositingMode compositingMode() const; - void addView(Scene3DView *view); - void removeView(Scene3DView *view); - public Q_SLOTS: void setAspects(const QStringList &aspects); void setEntity(Qt3DCore::QEntity *entity); @@ -148,8 +145,6 @@ private: QStringList m_aspects; Qt3DCore::QEntity *m_entity; - Qt3DCore::QEntity *m_viewHolderEntity; - Qt3DRender::QFrameGraphNode *m_viewHolderFG; Qt3DCore::QAspectEngine *m_aspectEngine; Qt3DCore::QAspectEngine *m_aspectToDelete; @@ -158,7 +153,6 @@ private: bool m_multisample; bool m_dirty; - bool m_dirtyViews; bool m_wasFrameProcessed; bool m_wasSGUpdated; @@ -166,7 +160,6 @@ private: CameraAspectRatioMode m_cameraAspectRatioMode; CompositingMode m_compositingMode; QOffscreenSurface *m_dummySurface; - QList<Scene3DView *> m_views; QMetaObject::Connection m_windowConnection; }; diff --git a/src/quick3d/imports/scene3d/scene3drenderer.cpp b/src/quick3d/imports/scene3d/scene3drenderer.cpp index 6cdef96c3..6dd7a0971 100644 --- a/src/quick3d/imports/scene3d/scene3drenderer.cpp +++ b/src/quick3d/imports/scene3d/scene3drenderer.cpp @@ -57,7 +57,6 @@ #include <scene3ditem_p.h> #include <scene3dlogging_p.h> #include <scene3dsgnode_p.h> -#include <scene3dview_p.h> #include <QtQuick/private/qquickwindow_p.h> @@ -242,13 +241,6 @@ void Scene3DRenderer::setBoundingSize(const QSize &size) m_boundingRectSize = size; } -// Main Thread, Render Thread locked -void Scene3DRenderer::setScene3DViews(const QList<Scene3DView *> &views) -{ - m_views = views; - m_dirtyViews = true; -} - QOpenGLFramebufferObject *Scene3DRenderer::GLRenderer::createMultisampledFramebufferObject(const QSize &size) { QOpenGLFramebufferObjectFormat format; @@ -343,34 +335,14 @@ void Scene3DRenderer::GLRenderer::beforeSynchronize(Scene3DRenderer *scene3DRend m_texture.reset(QPlatformInterface::QSGOpenGLTexture::fromNative(m_textureId, window, m_finalFBO->size(), QQuickWindow::TextureHasAlphaChannel)); } - // We can render either the Scene3D or the Scene3DView but not both - // at the same time - const auto &views = scene3DRenderer->m_views; - Q_ASSERT((node == nullptr || views.empty()) || - (node != nullptr && views.empty()) || - (node == nullptr && !views.empty())); - - - // Set texture on node if (!node->texture() || generateNewTexture) node->setTexture(m_texture.data()); - - // Set textures on Scene3DView - if (scene3DRenderer->m_dirtyViews || generateNewTexture) { - for (Scene3DView *view : qAsConst(views)) - if (!view->texture() || generateNewTexture) - view->setTexture(m_texture.data()); - scene3DRenderer->m_dirtyViews = false; - } } // Mark SGNodes as dirty so that QQuick will trigger some rendering if (node) node->markDirty(QSGNode::DirtyMaterial); - - for (Scene3DView *view : qAsConst(scene3DRenderer->m_views)) - view->markSGNodeDirty(); } void Scene3DRenderer::GLRenderer::beforeRendering(Scene3DRenderer *scene3DRenderer) diff --git a/src/quick3d/imports/scene3d/scene3drenderer_p.h b/src/quick3d/imports/scene3d/scene3drenderer_p.h index f42167981..f448909fa 100644 --- a/src/quick3d/imports/scene3d/scene3drenderer_p.h +++ b/src/quick3d/imports/scene3d/scene3drenderer_p.h @@ -103,7 +103,6 @@ public: bool multisample() const { return m_multisample; } QSize boundingSize() const { return m_boundingRectSize; } - void setScene3DViews(const QList<Scene3DView *> &views); void init(Qt3DCore::QAspectEngine *aspectEngine, QRenderAspect *renderAspect); void beforeSynchronize(); @@ -197,7 +196,6 @@ private: bool m_skipFrame; QSemaphore m_allowRendering; Scene3DItem::CompositingMode m_compositingMode; - QList<Scene3DView *> m_views; bool m_resetRequested = false; QuickRenderer *m_quickRenderer = nullptr; diff --git a/src/quick3d/imports/scene3d/scene3dview.cpp b/src/quick3d/imports/scene3d/scene3dview.cpp deleted file mode 100644 index f38d135f0..000000000 --- a/src/quick3d/imports/scene3d/scene3dview.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "scene3dview_p.h" -#include <Qt3DCore/QEntity> -#include <Qt3DRender/QRenderSettings> -#include <Qt3DRender/QFrameGraphNode> -#include <Qt3DRender/QLayer> -#include <Qt3DRender/QLayerFilter> -#include <Qt3DRender/QViewport> -#include <scene3dsgnode_p.h> -#include <scene3ditem_p.h> -#include <QQuickWindow> - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -/*! - \qmltype Scene3DView - \inherits Item - \inqmlmodule QtQuick.Scene3D - \since 5.14 - - \preliminary - - \brief The Scene3DView type is used to integrate a Qt 3D sub scene into a - QtQuick 2 scene using Scene3D. Whereas you should only use a single Scene3D - instance per application, you can have multiple Scene3DView instances. - - Essentially, if you need to render multiple scenes each in a separate view, - you should use a single Scene3D instance and as many Scene3DView items as - you have scenes to render. - - Typical usage looks like: - \qml - Scene3D { - id: mainScene3D - anchors.fill: parent - } - - Scene3DView { - id: view1 - scene3D: mainScene3D - width: 200 - height: 200 - Entity { - ... - } - } - - Scene3DView { - id: view2 - scene3D: mainScene3D - width: 200 - height: 200 - x: 200 - Entity { - ... - } - } - \endqml - - There are a few limitations when using Scene3DView: - \list - \li The Scene3D compositingMode has to be set to FBO - \li The Scene3D is sized to occupy the full window size (at the very least - it must be sized as wide as the area occupied by all Scene3DViews) - \li The Scene3D instance is instantiated prior to any Scene3DView - \li The Scene3D entity property is left unset - \endlist - - Scene3D behaves likes a texture atlas from which all Scene3DView instances. - For this reason, care should be taken that only the first Scene3DView - declared in the scene clears the color/depth. Additionally overlapping - Scene3DView instances is discouraged as this might not produce the expected - output. - - It is expected that a Scene3DView's Entity provide a RenderSettings with a - valid SceneGraph. Please note that only the RenderSettings of the first - Scene3DView instantiated will be taken into account. - - There are no restriction on the sharing of elements between different scenes - in different Scene3DView instances. - */ - -namespace { - -Qt3DRender::QFrameGraphNode *frameGraphFromEntity(Qt3DCore::QEntity *entity) -{ - const auto renderSettingsComponents = entity->componentsOfType<Qt3DRender::QRenderSettings>(); - - if (renderSettingsComponents.size() > 0) { - Qt3DRender::QRenderSettings *renderSettings = renderSettingsComponents.first(); - return renderSettings->activeFrameGraph(); - } - return nullptr; -} - -} - -Scene3DView::Scene3DView(QQuickItem *parent) - : QQuickItem(parent) - , m_scene3D(nullptr) - , m_entity(nullptr) - , m_previousFGParent(nullptr) - , m_holderEntity(new Qt3DCore::QEntity()) - , m_holderLayer(new Qt3DRender::QLayer()) - , m_holderLayerFilter(new Qt3DRender::QLayerFilter()) - , m_holderViewport(new Qt3DRender::QViewport()) - , m_dirtyFlags(DirtyNode|DirtyTexture) - , m_texture(nullptr) -{ - setFlag(QQuickItem::ItemHasContents, true);\ - - m_holderLayer->setRecursive(true); - m_holderEntity->addComponent(m_holderLayer); - m_holderLayerFilter->setParent(m_holderViewport); - m_holderLayerFilter->addLayer(m_holderLayer); -} - -Scene3DView::~Scene3DView() -{ - if (m_entity) - abandonSubtree(m_entity); - - if (m_scene3D) - m_scene3D->removeView(this); -} - -Qt3DCore::QEntity *Scene3DView::entity() const -{ - return m_entity; -} - -Scene3DItem *Scene3DView::scene3D() const -{ - return m_scene3D; -} - -Qt3DCore::QEntity *Scene3DView::viewSubtree() const -{ - return m_holderEntity; -} - -QFrameGraphNode *Scene3DView::viewFrameGraph() const -{ - return m_holderViewport; -} - -// Called by Scene3DRender::beforeSynchronizing in RenderThread -void Scene3DView::setTexture(QSGTexture *texture) -{ - m_dirtyFlags |= DirtyTexture; - m_texture = texture; - QQuickItem::update(); -} - -QSGTexture *Scene3DView::texture() const -{ - return m_texture; -} - -// Called by Scene3DRender::beforeSynchronizing in RenderThread -void Scene3DView::markSGNodeDirty() -{ - m_dirtyFlags |= DirtyNode; - QQuickItem::update(); -} - -// Main Thread -void Scene3DView::setEntity(Qt3DCore::QEntity *entity) -{ - if (m_entity == entity) - return; - - if (m_entity) - abandonSubtree(m_entity); - - m_entity = entity; - emit entityChanged(); - - if (m_entity) - adoptSubtree(m_entity); -} - -// Main Thread -void Scene3DView::setScene3D(Scene3DItem *scene3D) -{ - if (m_scene3D == scene3D) - return; - - if (m_scene3D) { - m_scene3D->removeView(this); - QObject::disconnect(m_scene3DDestroyedConnection); - } - - setTexture(nullptr); - m_scene3D = scene3D; - emit scene3DChanged(); - - - if (m_scene3D) { - m_scene3DDestroyedConnection = QObject::connect(m_scene3D, - &Scene3DItem::destroyed, - this, - [this] { - m_scene3D = nullptr; - }); - m_scene3D->addView(this); - } -} - -// Render Thread -QSGNode *Scene3DView::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *) -{ - Scene3DSGNode *fboNode = static_cast<Scene3DSGNode *>(node); - if (fboNode == nullptr) - fboNode = new Scene3DSGNode(); - - // We only need to draw a sub part of the texture based - // on our size, Scene3D essentially acts as a TextureAtlas - const QRectF itemRect(mapRectToScene(boundingRect())); - const QSize winSize = window() ? window()->size() : QSize(); - const QRectF normalizedViewportRect(itemRect.x() / winSize.width(), - itemRect.y() / winSize.height(), - itemRect.width() / winSize.width(), - itemRect.height() / winSize.height()); - // Swap Y axis to match GL coordinates - const QRectF textureRect(itemRect.x() / winSize.width(), - 1.0f - (itemRect.y() / winSize.height()), - itemRect.width() / winSize.width(), - -(itemRect.height() / winSize.height())); - - // TO DO: Should be done from main thread - // updateViewport - m_holderViewport->setNormalizedRect(normalizedViewportRect); - - // update node rect and texture coordinates - fboNode->setRect(boundingRect(), textureRect); - - if (m_dirtyFlags & DirtyTexture) { - fboNode->setTexture(m_texture); - m_dirtyFlags.setFlag(DirtyTexture, false); - // Show FBO Node at this point - fboNode->show(); - } - if (m_dirtyFlags & DirtyNode) { - fboNode->markDirty(QSGNode::DirtyMaterial); - m_dirtyFlags.setFlag(DirtyNode, false); - } - - return fboNode; -} - -// Main Thread -void Scene3DView::adoptSubtree(Qt3DCore::QEntity *subtree) -{ - // Reparent FrameGraph - Qt3DRender::QFrameGraphNode *fgNode = frameGraphFromEntity(subtree); - if (fgNode) { - m_previousFGParent = fgNode->parentNode(); - fgNode->setParent(m_holderLayerFilter); - } - - // Insert Entity Subtree - subtree->setParent(m_holderEntity); -} - -// Main Thread -void Scene3DView::abandonSubtree(Qt3DCore::QEntity *subtree) -{ - // Remove FrameGraph part - Qt3DRender::QFrameGraphNode *fgNode = frameGraphFromEntity(subtree); - if (fgNode) - fgNode->setParent(m_previousFGParent); - - // Remove Entity Subtree - subtree->setParent(Q_NODE_NULLPTR); -} - -} // Qt3DRender - -QT_END_NAMESPACE diff --git a/src/quick3d/imports/scene3d/scene3dview_p.h b/src/quick3d/imports/scene3d/scene3dview_p.h deleted file mode 100644 index c39c81dd8..000000000 --- a/src/quick3d/imports/scene3d/scene3dview_p.h +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SCENE3DVIEW_P_H -#define SCENE3DVIEW_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtQuick/QQuickItem> -#include <QtCore/QFlags> -#include <Qt3DCore/qentity.h> -#include "scene3ditem_p.h" - -QT_BEGIN_NAMESPACE - -class QSGTexture; - -namespace Qt3DRender { - -class QLayer; -class QLayerFilter; -class Scene3DItem; -class QFrameGraphNode; -class QViewport; - -class Scene3DView : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(Qt3DCore::QEntity* entity READ entity WRITE setEntity NOTIFY entityChanged) - Q_PROPERTY(Qt3DRender::Scene3DItem *scene3D READ scene3D WRITE setScene3D NOTIFY scene3DChanged) - Q_CLASSINFO("DefaultProperty", "entity") - -public: - enum DirtyFlag { - DirtyNode = 1 << 0, - DirtyTexture = 1 << 1 - }; - Q_DECLARE_FLAGS(DirtyFlags, DirtyFlag) - - explicit Scene3DView(QQuickItem *parent = nullptr); - ~Scene3DView(); - - Qt3DCore::QEntity *entity() const; - Scene3DItem *scene3D() const; - - Qt3DCore::QEntity *viewSubtree() const; - Qt3DRender::QFrameGraphNode *viewFrameGraph() const; - - void setTexture(QSGTexture *texture); - QSGTexture *texture() const; - - void markSGNodeDirty(); - -public Q_SLOTS: - void setEntity(Qt3DCore::QEntity *entity); - void setScene3D(Scene3DItem *scene3D); - -Q_SIGNALS: - void entityChanged(); - void scene3DChanged(); - -private: - QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *nodeData) override; - void adoptSubtree(Qt3DCore::QEntity *subtree); - void abandonSubtree(Qt3DCore::QEntity *subtree); - - Scene3DItem *m_scene3D; - Qt3DCore::QEntity *m_entity; - Qt3DCore::QNode *m_previousFGParent; - - Qt3DCore::QEntity *m_holderEntity; - Qt3DRender::QLayer *m_holderLayer; - Qt3DRender::QLayerFilter *m_holderLayerFilter; - Qt3DRender::QViewport *m_holderViewport; - - QMetaObject::Connection m_scene3DDestroyedConnection; - - DirtyFlags m_dirtyFlags; - QSGTexture *m_texture; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(Scene3DView::DirtyFlags) - - -} // Qt3DRender - -QT_END_NAMESPACE - -#endif // SCENE3DVIEW_P_H |