Debian Codegraph @

tests/manual/rhi/triquadcube/quadrenderer.h

raw
1 // Copyright (C) 2018 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #ifndef QUADRENDERER_H
5 #define QUADRENDERER_H
6
7 #include <rhi/qrhi.h>
8
9 class QuadRenderer
10 {
11 public:
12 void setRhi(QRhi *r) { m_r = r; }
13 void setSampleCount(int samples) { m_sampleCount = samples; }
14 int sampleCount() const { return m_sampleCount; }
15 void setTranslation(const QVector3D &v) { m_translation = v; }
16 void initResources(QRhiRenderPassDescriptor *rp);
17 void releaseResources();
18 void setPipeline(QRhiGraphicsPipeline *ps);
19 void resize(const QSize &pixelSize);
20 void queueResourceUpdates(QRhiResourceUpdateBatch *resourceUpdates);
21 void queueDraw(QRhiCommandBuffer *cb, const QSize &outputSizeInPixels);
22
23 private:
24 QRhi *m_r;
25
26 QRhiBuffer *m_vbuf = nullptr;
27 bool m_vbufReady = false;
28 QRhiBuffer *m_ibuf = nullptr;
29 bool m_opacityReady = false;
30 QRhiBuffer *m_ubuf = nullptr;
31 QRhiGraphicsPipeline *m_ps = nullptr;
32 QRhiShaderResourceBindings *m_srb = nullptr;
33
34 QVector3D m_translation;
35 QMatrix4x4 m_proj;
36 float m_rotation = 0;
37 int m_sampleCount = 1; // no MSAA by default
38 };
39
40 #endif