1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QT3DRENDER_RENDER_SCENEMANAGER_P_H
5#define QT3DRENDER_RENDER_SCENEMANAGER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <Qt3DCore/private/qresourcemanager_p.h>
19#include <Qt3DCore/private/qdownloadhelperservice_p.h>
20#include <Qt3DRender/private/scene_p.h>
21#include <Qt3DCore/qnodeid.h>
22#include <Qt3DRender/private/loadscenejob_p.h>
23
24QT_BEGIN_NAMESPACE
25
26namespace Qt3DCore {
27class QEntity;
28}
29
30namespace Qt3DRender {
31namespace Render {
32
33class SceneManager;
34
35class SceneDownloader : public Qt3DCore::QDownloadRequest {
36public:
37 SceneDownloader(const QUrl &source, Qt3DCore::QNodeId sceneComponent, SceneManager* manager);
38
39 void onCompleted() override;
40
41private:
42 Qt3DCore::QNodeId m_sceneComponent;
43 SceneManager* m_manager;
44};
45
46typedef QSharedPointer<SceneDownloader> SceneDownloaderPtr;
47
48
49class Q_3DRENDERSHARED_PRIVATE_EXPORT SceneManager : public Qt3DCore::QResourceManager<
50 Scene,
51 Qt3DCore::QNodeId,
52 Qt3DCore::ObjectLevelLockingPolicy>
53{
54public:
55 SceneManager();
56 ~SceneManager();
57
58 void setDownloadService(Qt3DCore::QDownloadHelperService *service);
59
60 void addSceneData(const QUrl &source, Qt3DCore::QNodeId sceneUuid,
61 const QByteArray &data = QByteArray());
62 std::vector<LoadSceneJobPtr> takePendingSceneLoaderJobs();
63
64 void startSceneDownload(const QUrl &source, Qt3DCore::QNodeId sceneUuid);
65 void clearSceneDownload(SceneDownloader *downloader);
66
67private:
68 Qt3DCore::QDownloadHelperService *m_service;
69 std::vector<LoadSceneJobPtr> m_pendingJobs;
70 std::vector<SceneDownloaderPtr> m_pendingDownloads;
71};
72
73} // namespace Render
74} // namespace Qt3DRender
75
76Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Scene, Q_REQUIRES_CLEANUP)
77
78QT_END_NAMESPACE
79
80#endif // SCENEMANAGER_P_H
81

source code of qt3d/src/render/io/scenemanager_p.h