1// Copyright (C) 2014 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 "renderpassfilternode_p.h"
5#include "qfilterkey.h"
6#include "qrenderpassfilter.h"
7#include <Qt3DRender/private/qrenderpassfilter_p.h>
8#include <Qt3DRender/qparameter.h>
9
10QT_BEGIN_NAMESPACE
11
12using namespace Qt3DCore;
13
14namespace Qt3DRender {
15namespace Render {
16
17RenderPassFilter::RenderPassFilter()
18 : FrameGraphNode(FrameGraphNode::RenderPassFilter)
19{
20}
21
22void RenderPassFilter::syncFromFrontEnd(const QNode *frontEnd, bool firstTime)
23{
24 const QRenderPassFilter *node = qobject_cast<const QRenderPassFilter *>(object: frontEnd);
25 if (!node)
26 return;
27
28 FrameGraphNode::syncFromFrontEnd(frontEnd, firstTime);
29
30 if (firstTime)
31 m_parameterPack.clear();
32
33 auto parameters = qIdsForNodes(nodes: node->parameters());
34 std::sort(first: std::begin(cont&: parameters), last: std::end(cont&: parameters));
35 if (m_parameterPack.parameters() != parameters) {
36 m_parameterPack.setParameters(parameters);
37 markDirty(changes: AbstractRenderer::FrameGraphDirty);
38 }
39
40 auto filterIds = qIdsForNodes(nodes: node->matchAny());
41 std::sort(first: std::begin(cont&: filterIds), last: std::end(cont&: filterIds));
42 if (m_filters != filterIds) {
43 m_filters = filterIds;
44 markDirty(changes: AbstractRenderer::FrameGraphDirty);
45 }
46}
47
48
49QList<Qt3DCore::QNodeId> RenderPassFilter::filters() const
50{
51 return m_filters;
52}
53
54void RenderPassFilter::appendFilter(Qt3DCore::QNodeId criterionId)
55{
56 if (!m_filters.contains(t: criterionId))
57 m_filters.append(t: criterionId);
58}
59
60void RenderPassFilter::removeFilter(Qt3DCore::QNodeId criterionId)
61{
62 m_filters.removeOne(t: criterionId);
63}
64
65QList<Qt3DCore::QNodeId> RenderPassFilter::parameters() const
66{
67 return m_parameterPack.parameters();
68}
69
70} // namespace Render
71} // namespace Qt3DRender
72
73QT_END_NAMESPACE
74

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