summaryrefslogtreecommitdiffstats
path: root/examples/widgets/rhi/simplerhiwidget/examplewidget.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/rhi/simplerhiwidget/examplewidget.h')
-rw-r--r--examples/widgets/rhi/simplerhiwidget/examplewidget.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/widgets/rhi/simplerhiwidget/examplewidget.h b/examples/widgets/rhi/simplerhiwidget/examplewidget.h
new file mode 100644
index 0000000000..efd3b90d91
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/examplewidget.h
@@ -0,0 +1,30 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef EXAMPLEWIDGET_H
+#define EXAMPLEWIDGET_H
+
+//![0]
+#include <QRhiWidget>
+#include <rhi/qrhi.h>
+
+class ExampleRhiWidget : public QRhiWidget
+{
+public:
+ ExampleRhiWidget(QWidget *parent = nullptr) : QRhiWidget(parent) { }
+
+ void initialize(QRhiCommandBuffer *cb) override;
+ void render(QRhiCommandBuffer *cb) override;
+
+private:
+ QRhi *m_rhi = nullptr;
+ std::unique_ptr<QRhiBuffer> m_vbuf;
+ std::unique_ptr<QRhiBuffer> m_ubuf;
+ std::unique_ptr<QRhiShaderResourceBindings> m_srb;
+ std::unique_ptr<QRhiGraphicsPipeline> m_pipeline;
+ QMatrix4x4 m_viewProjection;
+ float m_rotation = 0.0f;
+};
+//![0]
+
+#endif