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_QCLEARBUFFERS_H
5#define QT3DRENDER_QCLEARBUFFERS_H
6
7#include <Qt3DRender/qframegraphnode.h>
8#include <Qt3DRender/qrendertargetoutput.h>
9#include <QtGui/QColor>
10#include <QtCore/QFlags>
11
12QT_BEGIN_NAMESPACE
13
14namespace Qt3DRender {
15
16class QClearBuffersPrivate;
17
18class Q_3DRENDERSHARED_EXPORT QClearBuffers : public QFrameGraphNode
19{
20 Q_OBJECT
21 Q_PROPERTY(BufferType buffers READ buffers WRITE setBuffers NOTIFY buffersChanged)
22 Q_PROPERTY(QColor clearColor READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
23 Q_PROPERTY(float clearDepthValue READ clearDepthValue WRITE setClearDepthValue NOTIFY clearDepthValueChanged)
24 Q_PROPERTY(int clearStencilValue READ clearStencilValue WRITE setClearStencilValue NOTIFY clearStencilValueChanged)
25 Q_PROPERTY(Qt3DRender::QRenderTargetOutput* colorBuffer READ colorBuffer WRITE setColorBuffer NOTIFY colorBufferChanged)
26
27public:
28 explicit QClearBuffers(Qt3DCore::QNode *parent = nullptr);
29 ~QClearBuffers();
30
31 enum BufferType {
32 None = 0,
33 ColorBuffer = (1 << 0),
34 DepthBuffer = (1 << 1),
35 StencilBuffer = (1 << 2),
36 DepthStencilBuffer = DepthBuffer | StencilBuffer,
37 ColorDepthBuffer = ColorBuffer | DepthBuffer,
38 ColorDepthStencilBuffer = ColorBuffer | DepthStencilBuffer,
39 AllBuffers = 0xFFFFFFFF
40 };
41 Q_ENUM(BufferType) // LCOV_EXCL_LINE
42 Q_DECLARE_FLAGS(BufferTypeFlags, BufferType)
43
44 BufferType buffers() const;
45 QColor clearColor() const;
46 float clearDepthValue() const;
47 int clearStencilValue() const;
48 QRenderTargetOutput *colorBuffer() const;
49
50public Q_SLOTS:
51 void setBuffers(BufferType buffers);
52 void setClearColor(const QColor& color);
53 void setClearDepthValue(float clearDepthValue);
54 void setClearStencilValue(int clearStencilValue);
55 void setColorBuffer(QRenderTargetOutput *buffer);
56
57Q_SIGNALS:
58 void buffersChanged(BufferType buffers);
59 void clearColorChanged(const QColor& color);
60 void clearDepthValueChanged(float clearDepthValue);
61 void clearStencilValueChanged(int clearStencilValue);
62 void colorBufferChanged(QRenderTargetOutput *buffer);
63
64protected:
65 explicit QClearBuffers(QClearBuffersPrivate &dd, Qt3DCore::QNode *parent = nullptr);
66
67private:
68 Q_DECLARE_PRIVATE(QClearBuffers)
69};
70
71} // namespace Qt3DRender
72
73QT_END_NAMESPACE
74
75#endif // QT3DRENDER_QCLEARBUFFERS_H
76

source code of qt3d/src/render/framegraph/qclearbuffers.h