| 1 | // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). |
| 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 QT3DRENDER_QBLITFRAMEBUFFER_H |
| 5 | #define QT3DRENDER_QBLITFRAMEBUFFER_H |
| 6 | |
| 7 | #include <Qt3DRender/qframegraphnode.h> |
| 8 | #include <Qt3DRender/qrendertargetoutput.h> |
| 9 | #include <Qt3DRender/qrendertarget.h> |
| 10 | #include <QtCore/QRect> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | namespace Qt3DRender { |
| 15 | |
| 16 | class QBlitFramebufferPrivate; |
| 17 | |
| 18 | class Q_3DRENDERSHARED_EXPORT QBlitFramebuffer : public QFrameGraphNode |
| 19 | { |
| 20 | Q_OBJECT |
| 21 | Q_PROPERTY(Qt3DRender::QRenderTarget *source READ source WRITE setSource NOTIFY sourceChanged) |
| 22 | Q_PROPERTY(Qt3DRender::QRenderTarget *destination READ destination WRITE setDestination NOTIFY destinationChanged) |
| 23 | Q_PROPERTY(QRectF sourceRect READ sourceRect WRITE setSourceRect NOTIFY sourceRectChanged) |
| 24 | Q_PROPERTY(QRectF destinationRect READ destinationRect WRITE setDestinationRect NOTIFY destinationRectChanged) |
| 25 | Q_PROPERTY(Qt3DRender::QRenderTargetOutput::AttachmentPoint sourceAttachmentPoint READ sourceAttachmentPoint WRITE setSourceAttachmentPoint NOTIFY sourceAttachmentPointChanged) |
| 26 | Q_PROPERTY(Qt3DRender::QRenderTargetOutput::AttachmentPoint destinationAttachmentPoint READ destinationAttachmentPoint WRITE setDestinationAttachmentPoint NOTIFY destinationAttachmentPointChanged) |
| 27 | Q_PROPERTY(InterpolationMethod interpolationMethod READ interpolationMethod WRITE setInterpolationMethod NOTIFY interpolationMethodChanged) |
| 28 | public: |
| 29 | enum InterpolationMethod { |
| 30 | Nearest = 0, |
| 31 | Linear, |
| 32 | }; |
| 33 | Q_ENUM(InterpolationMethod) // LCOV_EXCL_LINE |
| 34 | |
| 35 | explicit QBlitFramebuffer(Qt3DCore::QNode *parent = nullptr); |
| 36 | ~QBlitFramebuffer(); |
| 37 | |
| 38 | QRenderTarget *source() const; |
| 39 | QRenderTarget *destination() const; |
| 40 | QRectF sourceRect() const; |
| 41 | QRectF destinationRect() const; |
| 42 | Qt3DRender::QRenderTargetOutput::AttachmentPoint sourceAttachmentPoint() const; |
| 43 | Qt3DRender::QRenderTargetOutput::AttachmentPoint destinationAttachmentPoint() const; |
| 44 | InterpolationMethod interpolationMethod() const; |
| 45 | |
| 46 | void setSource(QRenderTarget *source); |
| 47 | void setDestination(QRenderTarget *destination); |
| 48 | void setSourceRect(const QRectF &sourceRect); |
| 49 | void setDestinationRect(const QRectF &destinationRect); |
| 50 | void setSourceAttachmentPoint(Qt3DRender::QRenderTargetOutput::AttachmentPoint sourceAttachmentPoint); |
| 51 | void setDestinationAttachmentPoint(Qt3DRender::QRenderTargetOutput::AttachmentPoint destinationAttachmentPoint); |
| 52 | void setInterpolationMethod(InterpolationMethod interpolationMethod); |
| 53 | |
| 54 | Q_SIGNALS: |
| 55 | void sourceChanged(); |
| 56 | void destinationChanged(); |
| 57 | void sourceRectChanged(); |
| 58 | void destinationRectChanged(); |
| 59 | void sourceAttachmentPointChanged(); |
| 60 | void destinationAttachmentPointChanged(); |
| 61 | void interpolationMethodChanged(); |
| 62 | |
| 63 | protected: |
| 64 | explicit QBlitFramebuffer(QBlitFramebufferPrivate &dd, Qt3DCore::QNode *parent = nullptr); |
| 65 | |
| 66 | private: |
| 67 | Q_DECLARE_PRIVATE(QBlitFramebuffer) |
| 68 | }; |
| 69 | |
| 70 | } // namespace Qt3DRender |
| 71 | |
| 72 | QT_END_NAMESPACE |
| 73 | |
| 74 | #endif // QT3DRENDER_QBLITFRAMEBUFFER_H |
| 75 | |