9#include <QtQuick/QQuickWindow>
11#include <QtQuick3DRuntimeRender/private/qssgrenderlayer_p.h>
12#include <QtQuick3DRuntimeRender/private/qssgrendercontextcore_p.h>
13#include <QtQuick3DRuntimeRender/private/qssgrendermodel_p.h>
15#include <QtQuick3DUtils/private/qssgassert_p.h>
81 po->spatialNode =
nullptr;
107 for (
auto object : dirtyList) {
126 ret |= updateResources(
it);
144 updateExtensions(
it);
158 bool beforeSourceItemValid =
false;
161 beforeSourceItemValid =
image &&
image->m_qsgTexture !=
nullptr;
167 if (itemPriv->
spatialNode->
type == QSSGRenderGraphObject::Type::ResourceLoader) {
169 }
else if (itemPriv->
spatialNode->
type == QSSGRenderGraphObject::Type::Image2D) {
171 bool afterSouceItemValid =
image &&
image->m_qsgTexture !=
nullptr;
172 if (beforeSourceItemValid != afterSouceItemValid)
192 if (itemPriv->
type == QQuick3DObjectPrivate::Type::Item2D && itemPriv->
spatialNode != oldNode)
199 QQuick3DNode *nodeParent = qobject_cast<QQuick3DNode *>(spatialNode->parentItem());
203 if (parentGraphNode) {
205 parentGraphNode->
addChild(*graphNode);
210 if (graphNode && graphNode->
parent ==
nullptr) {
211 QQuick3DNode *nodeParent = qobject_cast<QQuick3DNode *>(spatialNode->parentItem());
214 if (!parentGraphNode) {
217 parentNode->spatialNode = nodeParent->
updateSpatialNode(parentNode->spatialNode);
218 if (parentNode->spatialNode)
220 parentGraphNode =
static_cast<QSSGRenderNode *
>(parentNode->spatialNode);
223 parentGraphNode->
addChild(*graphNode);
228 if (!sceneRoot->spatialNode)
230 if (sceneRoot->spatialNode) {
232 static_cast<QSSGRenderNode *
>(sceneRoot->spatialNode)->addChild(*graphNode);
273 if (node->type == QQuick3DObjectPrivate::Type::Item2D) {
275 }
else if (node->type == QQuick3DObjectPrivate::Type::Image2D) {
277 if (
image &&
image->m_qsgTexture !=
nullptr ) {
291 if (node->type == QSSGRenderGraphObject::Type::ResourceLoader)
304bool QQuick3DSceneManager::updateResources(
QQuick3DObject **listHead)
322 ret |= po->sharedResource;
323 po->removeFromDirtyList();
351void QQuick3DSceneManager::updateExtensions(
QQuick3DObject **listHead)
375 updateDirtyExtensionNode(
item);
423 if (
QSSG_GUARD_X(rc,
"QQuickWindow has no QSGRenderContext, this should not happen")) {
440 for (
auto manager: sceneManagerCleanupQueue) {
449 QSSG_CHECK_X(!m_rci || m_rci.use_count() == 1,
"RCI has unexpected reference count!");
454 for (
auto &sceneManager : std::as_const(sceneManagers))
455 sceneManager->preSync();
474 if (resourceCleanupQueue.
size() != 0)
475 m_rci->cleanupResources(resourceCleanupQueue);
479void QQuick3DWindowAttachment::onReleaseCachedResources()
482 m_rci->releaseCachedResources();
486void QQuick3DWindowAttachment::onInvalidated()
491 if (m_rci.use_count() == 1) {
492 onReleaseCachedResources();
501 for (
auto manager: sceneManagerCleanupQueue) {
506 sceneManagerCleanupQueue = {};
508 bool sharedUpdateNeeded =
false;
511 for (
auto &sceneManager : std::as_const(sceneManagers))
512 sharedUpdateNeeded |= sceneManager->cleanupNodes();
515 for (
auto &sceneManager : std::as_const(sceneManagers))
516 sharedUpdateNeeded |= sceneManager->updateDirtyResourceNodes();
518 for (
auto &sceneManager : std::as_const(sceneManagers))
519 sceneManager->updateDirtySpatialNodes();
520 for (
auto &sceneManager : std::as_const(sceneManagers))
521 sceneManager->updateDiryExtensions();
523 for (
auto &sceneManager : std::as_const(sceneManagers))
524 sceneManager->updateBoundingBoxes(*m_rci->bufferManager());
526 for (
auto &sceneManager : std::as_const(sceneManagers))
527 resourceLoaders.
unite(sceneManager->resourceLoaders);
529 if (sharedUpdateNeeded) {
532 for (
auto &sceneManager : std::as_const(sceneManagers))
533 sceneManager->requestUpdate();
537 for (
const auto &pr : std::as_const(pendingResourceCleanupQueue))
538 resourceCleanupQueue.
insert(pr);
539 pendingResourceCleanupQueue.
clear();
541 return sharedUpdateNeeded;
546 for (
const auto &sm : std::as_const(sceneManagers))
554 QSSG_CHECK_X(m_rci ==
nullptr || m_rci.use_count() == 1,
"Old render context was not released!");
bool remove(const Key &key)
Removes the item that has the key from the hash.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
bool removeOne(const AT &t)
void push_back(parameter_type t)
void append(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QVariant property(const char *name) const
Returns the value of the object's name property.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
void deleteLater()
\threadsafe
QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node) override
QPointer< QQuick3DSceneManager > sceneManager
QQuick3DObject ** prevDirtyItem
void removeFromDirtyList()
QQuick3DObject * nextDirtyItem
static QQuick3DObjectPrivate * get(QQuick3DObject *item)
QSSGRenderGraphObject * spatialNode
\qmltype Object3D \inqmlmodule QtQuick3D \instantiates QQuick3DObject \inherits QtObject
QQuick3DObject * parent
\qmlproperty Object3D QtQuick3D::Object3D::parent This property holds the parent of the Object3D in a...
virtual QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node)
void setWindow(QQuickWindow *window)
void updateDirtyResource(QQuick3DObject *resourceObject)
bool sharedResourceRemoved
QSet< QSSGRenderGraphObject * > resourceLoaders
QQuick3DSceneManager(QObject *parent=nullptr)
QPointer< QQuick3DWindowAttachment > wattached
QList< QQuick3DObject * > dirtyBoundingBoxList
QQuick3DObject * dirtyNodes[size_t(NodePriority::Count)]
bool updateDirtyResourceNodes()
static QQuick3DWindowAttachment * getOrSetWindowAttachment(QQuickWindow &window)
QQuick3DObject * lookUpNode(const QSSGRenderGraphObject *node) const
void updateDiryExtensions()
QQuick3DObject * dirtyExtensions[size_t(ExtensionPriority::Count)]
void dirtyItem(QQuick3DObject *item)
QQuick3DObject * dirtyResources[size_t(ResourcePriority::Count)]
void updateDirtySpatialNodes()
QList< QSSGRenderGraphObject * > cleanupNodeList
~QQuick3DSceneManager() override
void updateBoundingBoxes(QSSGBufferManager &mgr)
QHash< const QSSGRenderGraphObject *, QQuick3DObject * > m_nodeMap
void updateDirtySpatialNode(QQuick3DNode *spatialNode)
void cleanup(QSSGRenderGraphObject *item)
Q_INVOKABLE void requestUpdate()
void releaseCachedResources()
Q_INVOKABLE void cleanupResources()
void unregisterSceneManager(QQuick3DSceneManager &manager)
Q_INVOKABLE bool synchronize(QSet< QSSGRenderGraphObject * > &resourceLoaders)
void renderContextInterfaceChanged()
void registerSceneManager(QQuick3DSceneManager &manager)
~QQuick3DWindowAttachment() override
QQuickWindow * window() const
void queueForCleanup(QSSGRenderGraphObject *obj)
QQuick3DWindowAttachment(QQuickWindow *window)
QQuick3DWindowAttachment.
void setRci(const std::shared_ptr< QSSGRenderContextInterface > &rciptr)
Q_INVOKABLE void preSync()
static QQuickWindowPrivate * get(QQuickWindow *c)
QSGRenderContext * context
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
void releaseCachedResourcesRequested()
Class representing 3D range or axis aligned bounding box.
QSSGBounds3 getModelBounds(const QSSGRenderModel *model) const
bool remove(const T &value)
QSet< T > & unite(const QSet< T > &other)
iterator insert(const T &value)
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE constexpr char qtQQ3DWAPropName[]
#define QSSG_GUARD_X(cond, msg)
#define QSSG_CHECK_X(cond, msg)
QSqlQueryModel * model
[16]
QNetworkAccessManager manager
bool contains(const AT &t) const noexcept
static Q_REQUIRED_RESULT constexpr bool isNodeType(Type type) Q_DECL_NOTHROW
static constexpr bool isExtension(Type type) noexcept
static Q_REQUIRED_RESULT constexpr bool hasGraphicsResources(Type type) Q_DECL_NOTHROW
void addChild(QSSGRenderNode &inChild)
void removeChild(QSSGRenderNode &inChild)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent