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