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_RENDERTARGET_H |
5 | #define QT3DRENDER_RENDER_RENDERTARGET_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 <Qt3DRender/private/backendnode_p.h> |
19 | #include <QList> |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | namespace Qt3DRender { |
24 | |
25 | class QRenderTarget; |
26 | class QRenderTargetOutput; |
27 | |
28 | namespace Render { |
29 | |
30 | class RenderTargetManager; |
31 | |
32 | class Q_3DRENDERSHARED_PRIVATE_EXPORT RenderTarget : public BackendNode |
33 | { |
34 | public: |
35 | RenderTarget(); |
36 | void cleanup(); |
37 | |
38 | void appendRenderOutput(Qt3DCore::QNodeId outputId); |
39 | void removeRenderOutput(Qt3DCore::QNodeId outputId); |
40 | |
41 | QList<Qt3DCore::QNodeId> renderOutputs() const; |
42 | |
43 | bool isDirty() const; |
44 | void unsetDirty(); |
45 | |
46 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override; |
47 | |
48 | private: |
49 | QList<Qt3DCore::QNodeId> m_renderOutputs; |
50 | bool m_dirty; |
51 | }; |
52 | |
53 | class Q_AUTOTEST_EXPORT RenderTargetFunctor : public Qt3DCore::QBackendNodeMapper |
54 | { |
55 | public: |
56 | explicit RenderTargetFunctor(AbstractRenderer *renderer, |
57 | RenderTargetManager *manager); |
58 | Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; |
59 | Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; |
60 | void destroy(Qt3DCore::QNodeId id) const final; |
61 | |
62 | private: |
63 | AbstractRenderer *m_renderer; |
64 | RenderTargetManager *m_renderTargetManager; |
65 | }; |
66 | |
67 | |
68 | } // namespace Render |
69 | |
70 | } // namespace Qt3DRender |
71 | |
72 | QT_END_NAMESPACE |
73 | |
74 | #endif // QT3DRENDER_RENDER_RENDERTARGET_H |
75 | |