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_CLEARBUFFERS_P_H
5#define QT3DRENDER_RENDER_CLEARBUFFERS_P_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/framegraphnode_p.h>
19#include <Qt3DRender/qclearbuffers.h>
20
21QT_BEGIN_NAMESPACE
22
23namespace Qt3DRender {
24
25namespace Render {
26
27class FrameGraphManager;
28
29class Q_3DRENDERSHARED_PRIVATE_EXPORT ClearBuffers : public FrameGraphNode
30{
31public:
32 ClearBuffers();
33
34 QClearBuffers::BufferType type() const;
35 float clearDepthValue() const;
36 int clearStencilValue() const;
37 Qt3DCore::QNodeId bufferId() const;
38
39 // in the backend we store this as a QVector4D, as the clearBuffer
40 // functions do support all float values (also those not clamped to [0,1])
41 // (for non-clamped float or int buffer types)
42 // we don't support this in the frontend yet, but let's keep our options for now
43 // and avoid QColor->QVector4D conversion every frame.
44 QVector4D clearColor() const;
45
46 // some clear operations only accept clamped values
47 QColor clearColorAsColor() const;
48
49 bool clearsAllColorBuffers() const;
50 void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
51
52private:
53 QClearBuffers::BufferType m_type;
54 QColor m_clearColorAsColor;
55 QVector4D m_clearColor;
56 float m_clearDepthValue;
57 int m_clearStencilValue;
58 Qt3DCore::QNodeId m_colorBufferId;
59};
60
61} // namespace Render
62
63} // namespace Qt3DRender
64
65QT_END_NAMESPACE
66
67#endif // QT3DRENDER_RENDER_CLEARBUFFERS_P_H
68

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