Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgabstractrenderer_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
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 QSGABSTRACTRENDERER_P_H
5#define QSGABSTRACTRENDERER_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 purely as an
12// implementation detail. 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 <QtQuick/private/qtquickglobal_p.h>
19#include <QtQuick/qsgnode.h>
20#include <QtCore/qobject.h>
21
22#ifndef GLuint
23#define GLuint uint
24#endif
25
26QT_BEGIN_NAMESPACE
27
28class QSGAbstractRendererPrivate;
29
30class Q_QUICK_EXPORT QSGAbstractRenderer : public QObject
31{
32 Q_OBJECT
33public:
34 enum MatrixTransformFlag
35 {
36 MatrixTransformFlipY = 0x01
37 };
38 Q_DECLARE_FLAGS(MatrixTransformFlags, MatrixTransformFlag)
39 Q_FLAG(MatrixTransformFlags)
40
41 ~QSGAbstractRenderer() override;
42
43 void setRootNode(QSGRootNode *node);
44 QSGRootNode *rootNode() const;
45 void setDeviceRect(const QRect &rect);
46 inline void setDeviceRect(const QSize &size) { setDeviceRect(QRect(QPoint(), size)); }
47 QRect deviceRect() const;
48
49 void setViewportRect(const QRect &rect);
50 inline void setViewportRect(const QSize &size) { setViewportRect(QRect(QPoint(), size)); }
51 QRect viewportRect() const;
52
53 void setProjectionMatrixToRect(const QRectF &rect);
54 void setProjectionMatrixToRect(const QRectF &rect, MatrixTransformFlags flags);
55 void setProjectionMatrixToRect(const QRectF &rect, MatrixTransformFlags flags,
56 bool nativeNDCFlipY);
57 void setProjectionMatrix(const QMatrix4x4 &matrix, int index = 0);
58 void setProjectionMatrixWithNativeNDC(const QMatrix4x4 &matrix, int index = 0);
59 QMatrix4x4 projectionMatrix(int index) const;
60 QMatrix4x4 projectionMatrixWithNativeNDC(int index) const;
61 int projectionMatrixCount() const;
62 int projectionMatrixWithNativeNDCCount() const;
63 void setInvertFrontFace(bool invert);
64 bool invertFrontFace() const;
65
66 void setClearColor(const QColor &color);
67 QColor clearColor() const;
68
69 virtual void renderScene() = 0;
70
71 virtual void prepareSceneInline();
72 virtual void renderSceneInline();
73
74Q_SIGNALS:
75 void sceneGraphChanged();
76
77protected:
78 explicit QSGAbstractRenderer(QObject *parent = nullptr);
79 virtual void nodeChanged(QSGNode *node, QSGNode::DirtyState state) = 0;
80
81private:
82 Q_DECLARE_PRIVATE(QSGAbstractRenderer)
83 friend class QSGRootNode;
84};
85
86QT_END_NAMESPACE
87
88#endif
QSGAbstractRenderer gives access to the scene graph nodes and rendering.