summaryrefslogtreecommitdiffstats
path: root/tests/auto/render/commons/testrenderer.h
diff options
context:
space:
mode:
authorWieland Hagen <wieland.hagen@kdab.com>2016-02-18 16:56:22 +0100
committerWieland Hagen <wieland.hagen@kdab.com>2016-02-24 13:51:13 +0000
commit143b1c9a0993c371941919acbe52c76f7636502e (patch)
treee2a410d21856c524def9fa0a4a6d513f506d7349 /tests/auto/render/commons/testrenderer.h
parent192f278cf1eb3b3074b0c6f0b0f18bf1dea463c3 (diff)
Propagate backend node changes to Renderer; render-on-demand
Each sceneChangeEvent marks a dirty bit in the AbstractRenderer. If no changes were accumulated during one frame, the renderer decides not to render the frame, by returning false from shouldRender(). We still need to go through each backend node and see what flags to set exactly, and to make sure we also react on backend-initiated changes. Change-Id: I80588bc5c4ebeb5d57b45ddfbd4d79ec268968b1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/auto/render/commons/testrenderer.h')
-rw-r--r--tests/auto/render/commons/testrenderer.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/auto/render/commons/testrenderer.h b/tests/auto/render/commons/testrenderer.h
new file mode 100644
index 000000000..d237b6051
--- /dev/null
+++ b/tests/auto/render/commons/testrenderer.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTRENDERER_H
+#define TESTRENDERER_H
+
+#include <Qt3DRender/private/abstractrenderer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class TestRenderer : public Qt3DRender::Render::AbstractRenderer
+{
+public:
+ TestRenderer();
+ ~TestRenderer();
+
+ API api() const Q_DECL_OVERRIDE { return AbstractRenderer::OpenGL; }
+ qint64 time() const Q_DECL_OVERRIDE { return 0; }
+ void setTime(qint64 time) Q_DECL_OVERRIDE { Q_UNUSED(time); }
+ void setNodeManagers(Qt3DRender::Render::NodeManagers *managers) Q_DECL_OVERRIDE { Q_UNUSED(managers); }
+ void setServices(Qt3DCore::QServiceLocator *services) Q_DECL_OVERRIDE { Q_UNUSED(services); }
+ void setSurfaceExposed(bool exposed) Q_DECL_OVERRIDE { Q_UNUSED(exposed); }
+ Qt3DRender::Render::NodeManagers *nodeManagers() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
+ Qt3DCore::QServiceLocator *services() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
+ void initialize() Q_DECL_OVERRIDE {}
+ void shutdown() Q_DECL_OVERRIDE {}
+ void createAllocators(Qt3DCore::QAbstractAspectJobManager *jobManager) Q_DECL_OVERRIDE { Q_UNUSED(jobManager); }
+ void destroyAllocators(Qt3DCore::QAbstractAspectJobManager *jobManager) Q_DECL_OVERRIDE { Q_UNUSED(jobManager); }
+ void render() Q_DECL_OVERRIDE {}
+ void doRender() Q_DECL_OVERRIDE {}
+ bool isRunning() const Q_DECL_OVERRIDE { return true; }
+ bool shouldRender() Q_DECL_OVERRIDE { return true; }
+ void skipNextFrame() Q_DECL_OVERRIDE {}
+ QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() Q_DECL_OVERRIDE { return QVector<Qt3DCore::QAspectJobPtr>(); }
+ Qt3DCore::QAspectJobPtr pickBoundingVolumeJob() Q_DECL_OVERRIDE { return Qt3DCore::QAspectJobPtr(); }
+ void setFrameGraphRoot(const Qt3DCore::QNodeId fgRootId) Q_DECL_OVERRIDE { Q_UNUSED(fgRootId); }
+ void setSceneRoot(Qt3DCore::QBackendNodeFactory *factory, Qt3DRender::Render::Entity *root) Q_DECL_OVERRIDE { Q_UNUSED(factory); Q_UNUSED(root); }
+ Qt3DRender::Render::Entity *sceneRoot() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
+ Qt3DRender::Render::FrameGraphNode *frameGraphRoot() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
+ Qt3DCore::QAbstractFrameAdvanceService *frameAdvanceService() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
+ void registerEventFilter(Qt3DCore::QEventFilterService *service) Q_DECL_OVERRIDE { Q_UNUSED(service); }
+ void setSettings(Qt3DRender::Render::RendererSettings *settings) Q_DECL_OVERRIDE { Q_UNUSED(settings); }
+ Qt3DRender::Render::RendererSettings *settings() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
+
+ void markDirty(Qt3DRender::Render::BackendNodeDirtySet changes, Qt3DRender::Render::BackendNode *node) Q_DECL_OVERRIDE;
+ Qt3DRender::Render::BackendNodeDirtySet dirtyBits() Q_DECL_OVERRIDE;
+
+ void resetDirty();
+
+protected:
+ Qt3DRender::Render::BackendNodeDirtySet m_changes;
+};
+
+QT_END_NAMESPACE
+
+#endif // TESTRENDERER_H