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_ATTACHMENTPACK_P_H
5#define QT3DRENDER_RENDER_ATTACHMENTPACK_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/qrendertargetoutput.h>
19#include <Qt3DRender/private/qt3drender_global_p.h>
20#include <QList>
21
22QT_BEGIN_NAMESPACE
23
24namespace Qt3DRender {
25namespace Render {
26
27struct Q_3DRENDERSHARED_PRIVATE_EXPORT Attachment
28{
29 Attachment()
30 : m_mipLevel(0)
31 , m_layer(0)
32 , m_point(QRenderTargetOutput::Color0)
33 , m_face(QAbstractTexture::CubeMapNegativeX)
34 {}
35
36 QString m_name;
37 int m_mipLevel;
38 int m_layer;
39 Qt3DCore::QNodeId m_textureUuid;
40 QRenderTargetOutput::AttachmentPoint m_point;
41 QAbstractTexture::CubeMapFace m_face;
42};
43
44class RenderTarget;
45class RenderTargetSelector;
46class AttachmentManager;
47
48class Q_3DRENDERSHARED_PRIVATE_EXPORT AttachmentPack
49{
50public:
51 AttachmentPack();
52 AttachmentPack(const RenderTarget *target,
53 AttachmentManager *attachmentManager,
54 const QList<QRenderTargetOutput::AttachmentPoint> &drawBuffers = {});
55
56 const std::vector<Attachment> &attachments() const { return m_attachments; }
57 const std::vector<int> &getGlDrawBuffers() const { return m_drawBuffers; }
58
59 // return index of given attachment within actual draw buffers list
60 int getDrawBufferIndex(QRenderTargetOutput::AttachmentPoint attachmentPoint) const;
61
62private:
63 std::vector<Attachment> m_attachments;
64 std::vector<int> m_drawBuffers;
65};
66
67Q_3DRENDERSHARED_PRIVATE_EXPORT bool operator ==(const Attachment &a, const Attachment &b);
68Q_3DRENDERSHARED_PRIVATE_EXPORT bool operator !=(const Attachment &a, const Attachment &b);
69
70Q_3DRENDERSHARED_PRIVATE_EXPORT bool operator ==(const AttachmentPack &packA, const AttachmentPack &packB);
71Q_3DRENDERSHARED_PRIVATE_EXPORT bool operator !=(const AttachmentPack &packA, const AttachmentPack &packB);
72
73} // namespace Render
74} // namespace Qt3DRender
75
76QT_END_NAMESPACE
77
78#endif // QT3DRENDER_RENDER_ATTACHMENTPACK_P_H
79

source code of qt3d/src/render/backend/attachmentpack_p.h