1// Copyright (C) 2017 The Qt Company Ltd.
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_QUICK3DRENDER_SCENE2DSHAREDOBJECT_P_H
5#define QT3DRENDER_QUICK3DRENDER_SCENE2DSHAREDOBJECT_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 <Qt3DQuickScene2D/qt3dquickscene2d_global.h>
19#include <Qt3DQuickScene2D/qscene2d.h>
20
21#include <QtQuick/QQuickWindow>
22#include <QtQuick/QQuickRenderControl>
23#include <QtGui/QOffscreenSurface>
24#include <QtCore/QCoreApplication>
25#include <QtCore/QWaitCondition>
26#include <QtCore/QThread>
27
28#include <private/qnode_p.h>
29
30#include <QtCore/qobject.h>
31
32QT_BEGIN_NAMESPACE
33
34namespace Qt3DRender {
35
36namespace Quick {
37
38class Scene2DManager;
39
40class Q_3DQUICKSCENE2DSHARED_EXPORT Scene2DSharedObject
41{
42public:
43 Scene2DSharedObject(Scene2DManager *manager);
44 ~Scene2DSharedObject();
45
46 QQuickRenderControl *m_renderControl;
47 QQuickWindow *m_quickWindow;
48 Scene2DManager *m_renderManager;
49 QOffscreenSurface *m_surface;
50
51 QThread *m_renderThread;
52 QObject *m_renderObject;
53
54 QWaitCondition m_cond;
55 QMutex m_mutex;
56
57 bool isInitialized() const;
58 void setInitialized();
59
60 void requestQuit();
61 bool isQuit() const;
62
63 void requestRender(bool sync);
64
65 bool isSyncRequested() const;
66 void clearSyncRequest();
67
68 void wait();
69 void wake();
70
71 bool isPrepared() const;
72 void setPrepared();
73
74 void disallowRender();
75 bool canRender() const;
76
77 void cleanup();
78
79private:
80
81 bool m_disallowed;
82 bool m_quit;
83 bool m_requestSync;
84 bool m_prepared;
85 bool m_initialized;
86};
87
88typedef QSharedPointer<Scene2DSharedObject> Scene2DSharedObjectPtr;
89
90} // namespace Quick
91} // namespace Qt3DRender
92
93QT_END_NAMESPACE
94
95Q_DECLARE_METATYPE(Qt3DRender::Quick::Scene2DSharedObjectPtr)
96
97#endif // QT3DRENDER_QUICK3DRENDER_SCENE2DSHAREDOBJECT_P_H
98

source code of qt3d/src/quick3d/quick3dscene2d/items/scene2dsharedobject_p.h