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 QT3DEXTRAS_QFORWARDRENDERER_H
5#define QT3DEXTRAS_QFORWARDRENDERER_H
6
7#include <Qt3DExtras/qt3dextras_global.h>
8#include <Qt3DRender/qtechniquefilter.h>
9#include <Qt3DCore/qentity.h>
10#include <QtCore/QRectF>
11#include <QtGui/QColor>
12#include <Qt3DRender/QClearBuffers>
13
14QT_BEGIN_NAMESPACE
15
16class QSurface;
17
18namespace Qt3DExtras {
19
20class QForwardRendererPrivate;
21
22class Q_3DEXTRASSHARED_EXPORT QForwardRenderer : public Qt3DRender::QTechniqueFilter
23{
24 Q_OBJECT
25 Q_PROPERTY(QObject *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
26 Q_PROPERTY(QObject *window READ surface WRITE setSurface NOTIFY surfaceChanged)
27 Q_PROPERTY(QRectF viewportRect READ viewportRect WRITE setViewportRect NOTIFY viewportRectChanged)
28 Q_PROPERTY(QColor clearColor READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
29 Q_PROPERTY(Qt3DRender::QClearBuffers::BufferType buffersToClear READ buffersToClear WRITE setBuffersToClear NOTIFY buffersToClearChanged REVISION 14)
30 Q_PROPERTY(Qt3DCore::QEntity *camera READ camera WRITE setCamera NOTIFY cameraChanged)
31 Q_PROPERTY(QSize externalRenderTargetSize READ externalRenderTargetSize WRITE setExternalRenderTargetSize NOTIFY externalRenderTargetSizeChanged)
32 Q_PROPERTY(bool frustumCulling READ isFrustumCullingEnabled WRITE setFrustumCullingEnabled NOTIFY frustumCullingEnabledChanged)
33 Q_PROPERTY(float gamma READ gamma WRITE setGamma NOTIFY gammaChanged REVISION 9)
34 Q_PROPERTY(bool showDebugOverlay READ showDebugOverlay WRITE setShowDebugOverlay NOTIFY showDebugOverlayChanged REVISION 15)
35public:
36 explicit QForwardRenderer(Qt3DCore::QNode *parent = nullptr);
37 ~QForwardRenderer();
38
39 QRectF viewportRect() const;
40 QColor clearColor() const;
41 Qt3DRender::QClearBuffers::BufferType buffersToClear() const;
42 Qt3DCore::QEntity *camera() const;
43 QObject *surface() const;
44 QSize externalRenderTargetSize() const;
45 bool isFrustumCullingEnabled() const;
46 float gamma() const;
47 bool showDebugOverlay() const;
48
49public Q_SLOTS:
50 void setViewportRect(const QRectF &viewportRect);
51 void setClearColor(const QColor &clearColor);
52 void setBuffersToClear(Qt3DRender::QClearBuffers::BufferType);
53 void setCamera(Qt3DCore::QEntity *camera);
54 void setSurface(QObject * surface);
55 void setExternalRenderTargetSize(const QSize &size);
56 void setFrustumCullingEnabled(bool enabled);
57 void setGamma(float gamma);
58 void setShowDebugOverlay(bool showDebugOverlay);
59
60Q_SIGNALS:
61 void viewportRectChanged(const QRectF &viewportRect);
62 void clearColorChanged(const QColor &clearColor);
63 void buffersToClearChanged(Qt3DRender::QClearBuffers::BufferType);
64 void cameraChanged(Qt3DCore::QEntity *camera);
65 void surfaceChanged(QObject *surface);
66 void externalRenderTargetSizeChanged(const QSize &size);
67 void frustumCullingEnabledChanged(bool enabled);
68 void gammaChanged(float gamma);
69 void showDebugOverlayChanged(bool showDebugOverlay);
70
71private:
72 Q_DECLARE_PRIVATE(QForwardRenderer)
73};
74
75} // namespace Qt3DExtras
76
77QT_END_NAMESPACE
78
79#endif // QT3DEXTRAS_QFORWARDRENDERER_H
80

source code of qt3d/src/extras/defaults/qforwardrenderer.h