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#include <Qt3DRender/private/qblitframebuffer_p.h>
5#include <Qt3DRender/private/blitframebuffer_p.h>
6
7QT_BEGIN_NAMESPACE
8
9using namespace Qt3DCore;
10
11namespace Qt3DRender {
12namespace Render {
13
14BlitFramebuffer::BlitFramebuffer()
15 : FrameGraphNode(FrameGraphNode::BlitFramebuffer)
16 , m_sourceRenderTargetId(Qt3DCore::QNodeId())
17 , m_destinationRenderTargetId(Qt3DCore::QNodeId())
18 , m_sourceRect(QRect())
19 , m_destinationRect(QRect())
20 , m_sourceAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color0)
21 , m_destinationAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color0)
22 , m_interpolationMethod(Qt3DRender::QBlitFramebuffer::Linear)
23{
24}
25
26void BlitFramebuffer::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
27{
28 const QBlitFramebuffer *node = qobject_cast<const QBlitFramebuffer *>(object: frontEnd);
29 if (!node)
30 return;
31
32 FrameGraphNode::syncFromFrontEnd(frontEnd, firstTime);
33
34 if (node->sourceRect().toRect() != m_sourceRect) {
35 m_sourceRect = node->sourceRect().toRect();
36 markDirty(changes: AbstractRenderer::FrameGraphDirty);
37 }
38 if (node->destinationRect().toRect() != m_destinationRect) {
39 m_destinationRect = node->destinationRect().toRect();
40 markDirty(changes: AbstractRenderer::FrameGraphDirty);
41 }
42 if (node->sourceAttachmentPoint() != m_sourceAttachmentPoint) {
43 m_sourceAttachmentPoint = node->sourceAttachmentPoint();
44 markDirty(changes: AbstractRenderer::FrameGraphDirty);
45 }
46 if (node->destinationAttachmentPoint() != m_destinationAttachmentPoint) {
47 m_destinationAttachmentPoint = node->destinationAttachmentPoint();
48 markDirty(changes: AbstractRenderer::FrameGraphDirty);
49 }
50 if (node->interpolationMethod() != m_interpolationMethod) {
51 m_interpolationMethod = node->interpolationMethod();
52 markDirty(changes: AbstractRenderer::FrameGraphDirty);
53 }
54 const QNodeId destinationNodeId = qIdForNode(node: node->destination());
55 if (destinationNodeId != m_destinationRenderTargetId) {
56 m_destinationRenderTargetId = destinationNodeId;
57 markDirty(changes: AbstractRenderer::FrameGraphDirty);
58 }
59 const QNodeId sourceNodeId = qIdForNode(node: node->source());
60 if (sourceNodeId != m_sourceRenderTargetId) {
61 m_sourceRenderTargetId = sourceNodeId;
62 markDirty(changes: AbstractRenderer::FrameGraphDirty);
63 }
64}
65
66Qt3DRender::QRenderTargetOutput::AttachmentPoint BlitFramebuffer::destinationAttachmentPoint() const
67{
68 return m_destinationAttachmentPoint;
69}
70
71QBlitFramebuffer::InterpolationMethod BlitFramebuffer::interpolationMethod() const
72{
73 return m_interpolationMethod;
74}
75
76Qt3DRender::QRenderTargetOutput::AttachmentPoint BlitFramebuffer::sourceAttachmentPoint() const
77{
78 return m_sourceAttachmentPoint;
79}
80
81QRect BlitFramebuffer::destinationRect() const
82{
83 return m_destinationRect;
84}
85
86QRect BlitFramebuffer::sourceRect() const
87{
88 return m_sourceRect;
89}
90
91Qt3DCore::QNodeId BlitFramebuffer::destinationRenderTargetId() const
92{
93 return m_destinationRenderTargetId;
94}
95
96Qt3DCore::QNodeId BlitFramebuffer::sourceRenderTargetId() const
97{
98 return m_sourceRenderTargetId;
99}
100
101} // namespace Render
102} // namespace Qt3DRender
103
104QT_END_NAMESPACE
105

source code of qt3d/src/render/framegraph/blitframebuffer.cpp