| 1 |
// Copyright (C) 2023 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause |
| 3 |
|
| 4 |
#ifndef EXAMPLEWIDGET_H |
| 5 |
#define EXAMPLEWIDGET_H |
| 6 |
|
| 7 |
//![0] |
| 8 |
#include <QRhiWidget> |
| 9 |
#include <rhi/qrhi.h> |
| 10 |
|
| 11 |
class ExampleRhiWidget : public QRhiWidget |
| 12 |
{ |
| 13 |
public: |
| 14 |
ExampleRhiWidget(QWidget *parent = nullptr) : QRhiWidget(parent) { } |
| 15 |
|
| 16 |
void initialize(QRhiCommandBuffer *cb) override; |
| 17 |
void render(QRhiCommandBuffer *cb) override; |
| 18 |
|
| 19 |
private: |
| 20 |
QRhi *m_rhi = nullptr; |
| 21 |
std::unique_ptr<QRhiBuffer> m_vbuf; |
| 22 |
std::unique_ptr<QRhiBuffer> m_ubuf; |
| 23 |
std::unique_ptr<QRhiShaderResourceBindings> m_srb; |
| 24 |
std::unique_ptr<QRhiGraphicsPipeline> m_pipeline; |
| 25 |
QMatrix4x4 m_viewProjection; |
| 26 |
float m_rotation = 0.0f; |
| 27 |
}; |
| 28 |
//![0] |
| 29 |
|
| 30 |
#endif |