1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt3D module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef TESTRENDERER_H |
30 | #define TESTRENDERER_H |
31 | |
32 | #include <Qt3DRender/private/abstractrenderer_p.h> |
33 | #include <Qt3DRender/private/resourceaccessor_p.h> |
34 | |
35 | QT_BEGIN_NAMESPACE |
36 | |
37 | class TestRenderer : public Qt3DRender::Render::AbstractRenderer |
38 | { |
39 | public: |
40 | TestRenderer(); |
41 | ~TestRenderer(); |
42 | |
43 | void dumpInfo() const override {} |
44 | Qt3DRender::API api() const override { return Qt3DRender::API::OpenGL; } |
45 | qint64 time() const override { return 0; } |
46 | void setTime(qint64 time) override { Q_UNUSED(time) } |
47 | void setAspect(Qt3DRender::QRenderAspect *aspect) override { m_aspect = aspect; } |
48 | void setNodeManagers(Qt3DRender::Render::NodeManagers *m) override |
49 | { |
50 | m_managers = m; |
51 | m_resourceAccessor.reset(t: new Qt3DRender::Render::ResourceAccessor(this, m_managers)); |
52 | } |
53 | void setServices(Qt3DCore::QServiceLocator *services) override { Q_UNUSED(services) } |
54 | void setSurfaceExposed(bool exposed) override { Q_UNUSED(exposed) } |
55 | void setJobsInLastFrame(int jobsInLastFrame) override { Q_UNUSED(jobsInLastFrame) } |
56 | Qt3DRender::QRenderAspect *aspect() const override { return m_aspect; } |
57 | Qt3DRender::Render::NodeManagers *nodeManagers() const override { return m_managers; } |
58 | Qt3DCore::QServiceLocator *services() const override { return nullptr; } |
59 | void initialize() override {} |
60 | void shutdown() override {} |
61 | void releaseGraphicsResources() override {} |
62 | void render() override {} |
63 | void doRender(bool swapBuffers) override { Q_UNUSED(swapBuffers) } |
64 | void cleanGraphicsResources() override {} |
65 | bool isRunning() const override { return true; } |
66 | bool shouldRender() const override { return true; } |
67 | void skipNextFrame() override {} |
68 | void jobsDone(Qt3DCore::QAspectManager *manager) override { Q_UNUSED(manager) } |
69 | QVector<Qt3DCore::QAspectJobPtr> preRenderingJobs() override { return QVector<Qt3DCore::QAspectJobPtr>(); } |
70 | QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() override { return QVector<Qt3DCore::QAspectJobPtr>(); } |
71 | void setSceneRoot(Qt3DRender::Render::Entity *root) override { Q_UNUSED(root) } |
72 | Qt3DRender::Render::Entity *sceneRoot() const override { return nullptr; } |
73 | Qt3DRender::Render::FrameGraphNode *frameGraphRoot() const override { return nullptr; } |
74 | Qt3DCore::QAbstractFrameAdvanceService *frameAdvanceService() const override { return nullptr; } |
75 | void setSettings(Qt3DRender::Render::RenderSettings *settings) override { m_settings = settings; } |
76 | Qt3DRender::Render::RenderSettings *settings() const override { return m_settings; } |
77 | void setPendingEvents(const QList<QPair<QObject *, QMouseEvent> > &, const QList<QKeyEvent> &) override { } |
78 | |
79 | void markDirty(Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet changes, Qt3DRender::Render::BackendNode *node) override; |
80 | Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet dirtyBits() override; |
81 | #if defined(QT_BUILD_INTERNAL) |
82 | void clearDirtyBits(Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet changes) override; |
83 | #endif |
84 | |
85 | void resetDirty(); |
86 | QVariant executeCommand(const QStringList &args) override; |
87 | QOpenGLContext *shareContext() const override; |
88 | const Qt3DRender::GraphicsApiFilterData *contextInfo() const override { return nullptr; } |
89 | |
90 | void setOffscreenSurfaceHelper(Qt3DRender::Render::OffscreenSurfaceHelper *helper) override; |
91 | QSurfaceFormat format() override; |
92 | |
93 | void setOpenGLContext(QOpenGLContext *) override {} |
94 | bool accessOpenGLTexture(Qt3DCore::QNodeId, QOpenGLTexture **, QMutex **, bool) override { return false; } |
95 | QSharedPointer<Qt3DRender::Render::RenderBackendResourceAccessor> resourceAccessor() const override { return m_resourceAccessor; } |
96 | |
97 | void loadShader(Qt3DRender::Render::Shader *, Qt3DRender::Render::HShader) override {} |
98 | |
99 | protected: |
100 | Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet m_changes; |
101 | Qt3DRender::QRenderAspect *m_aspect = nullptr; |
102 | Qt3DRender::Render::NodeManagers *m_managers = nullptr; |
103 | QSharedPointer<Qt3DRender::Render::ResourceAccessor> m_resourceAccessor; |
104 | Qt3DRender::Render::RenderSettings *m_settings = nullptr; |
105 | }; |
106 | |
107 | QT_END_NAMESPACE |
108 | |
109 | #endif // TESTRENDERER_H |
110 | |