aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-04-06 13:43:18 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-04-07 11:37:32 +0200
commit07d1dbcf7f1de03ae700894eaf1c63a33afc739a (patch)
treef6432d0b7506396e107b348f647a81a02cfdcf1b /src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
parent494063ccc8f8619d11e3a4e85168d04c1211bf44 (diff)
Remove QSGEngine and move QSGAbstractRenderer back to private
QSGEngine goes away. Same for the associated example, which is the only place this is used anywhere in Qt. As a consequence, the renderer base class can be moved back to private: there is no use for it to be public anymore, since that made sense only in combination with QSGEngine. With the RHI-based rendering path driving a renderer directly is more complicated than before so it is not reasonable to allow the QSGEngine-style access anymore. Instead, one has QQuickRenderControl, which allows redirecting and manually driving the rendering of a QQuickWindow, thus providing an alternative to the legacy QSGEngine approach. Task-number: QTBUG-78596 Change-Id: If57c6b657b2053da1c4e545e517026382a71d998 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h')
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h79
1 files changed, 60 insertions, 19 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h b/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
index bbc4289b2c..5d48f18310 100644
--- a/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
@@ -51,37 +51,78 @@
// We mean it.
//
-#include "qsgabstractrenderer.h"
-
-#include "qsgnode.h"
-#include <qcolor.h>
-
-#include <QtCore/private/qobject_p.h>
#include <QtQuick/private/qtquickglobal_p.h>
+#include <QtQuick/qsgnode.h>
+
+#ifndef GLuint
+#define GLuint uint
+#endif
QT_BEGIN_NAMESPACE
-class Q_QUICK_PRIVATE_EXPORT QSGAbstractRendererPrivate : public QObjectPrivate
+class QSGAbstractRendererPrivate;
+
+class Q_QUICK_PRIVATE_EXPORT QSGAbstractRenderer : public QObject
{
- Q_DECLARE_PUBLIC(QSGAbstractRenderer)
+ Q_OBJECT
public:
- static const QSGAbstractRendererPrivate *get(const QSGAbstractRenderer *q) { return q->d_func(); }
+ enum ClearModeBit
+ {
+ ClearColorBuffer = 0x0001,
+ ClearDepthBuffer = 0x0002,
+ ClearStencilBuffer = 0x0004
+ };
+ Q_DECLARE_FLAGS(ClearMode, ClearModeBit)
+ Q_FLAG(ClearMode)
+
+ enum MatrixTransformFlag
+ {
+ MatrixTransformFlipY = 0x01
+ };
+ Q_DECLARE_FLAGS(MatrixTransformFlags, MatrixTransformFlag)
+ Q_FLAG(MatrixTransformFlags)
+
+ ~QSGAbstractRenderer() override;
- QSGAbstractRendererPrivate();
- void updateProjectionMatrix();
+ void setRootNode(QSGRootNode *node);
+ QSGRootNode *rootNode() const;
+ void setDeviceRect(const QRect &rect);
+ inline void setDeviceRect(const QSize &size) { setDeviceRect(QRect(QPoint(), size)); }
+ QRect deviceRect() const;
- QSGRootNode *m_root_node;
- QColor m_clear_color;
- QSGAbstractRenderer::ClearMode m_clear_mode;
+ void setViewportRect(const QRect &rect);
+ inline void setViewportRect(const QSize &size) { setViewportRect(QRect(QPoint(), size)); }
+ QRect viewportRect() const;
- QRect m_device_rect;
- QRect m_viewport_rect;
+ void setProjectionMatrixToRect(const QRectF &rect);
+ void setProjectionMatrixToRect(const QRectF &rect, MatrixTransformFlags flags);
+ void setProjectionMatrix(const QMatrix4x4 &matrix);
+ void setProjectionMatrixWithNativeNDC(const QMatrix4x4 &matrix);
+ QMatrix4x4 projectionMatrix() const;
+ QMatrix4x4 projectionMatrixWithNativeNDC() const;
- QMatrix4x4 m_projection_matrix;
- QMatrix4x4 m_projection_matrix_native_ndc;
- uint m_mirrored : 1;
+ void setClearColor(const QColor &color);
+ QColor clearColor() const;
+
+ void setClearMode(ClearMode mode);
+ ClearMode clearMode() const;
+
+ virtual void renderScene(GLuint fboId = 0) = 0;
+
+Q_SIGNALS:
+ void sceneGraphChanged();
+
+protected:
+ explicit QSGAbstractRenderer(QObject *parent = nullptr);
+ virtual void nodeChanged(QSGNode *node, QSGNode::DirtyState state) = 0;
+
+private:
+ Q_DECLARE_PRIVATE(QSGAbstractRenderer)
+ friend class QSGRootNode;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSGAbstractRenderer::ClearMode)
+
QT_END_NAMESPACE
#endif