1// Copyright (C) 2015 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 "qnodraw.h"
5
6QT_BEGIN_NAMESPACE
7
8namespace Qt3DRender {
9
10/*!
11 \class Qt3DRender::QNoDraw
12 \inmodule Qt3DRender
13
14 \brief When a Qt3DRender::QNoDraw node is present in a FrameGraph branch, this
15 prevents the renderer from rendering any primitive.
16
17 Qt3DRender::QNoDraw should be used when the FrameGraph needs to set up some render
18 states or clear some buffers without requiring any mesh to be drawn. It has
19 the same effect as having a Qt3DRender::QRenderPassFilter that matches none of
20 available Qt3DRender::QRenderPass instances of the scene without the overhead cost
21 of actually performing the filtering.
22
23 When disabled, a Qt3DRender::QNoDraw node won't prevent the scene from
24 being rendered. Toggling the enabled property is therefore a way to make a
25 Qt3DRender::QNoDraw active or inactive.
26
27 Qt3DRender::QNoDraw is usually used as a child of a
28 Qt3DRendeR::QClearBuffers node to prevent from drawing the scene when there
29 are multiple render passes.
30
31 \code
32 Qt3DRender::QViewport *viewport = new Qt3DRender::QViewport();
33 Qt3DRender::QCameraSelector *cameraSelector = new Qt3DRender::QCameraSelector(viewport);
34
35 Qt3DRender::QClearBuffers *clearBuffers = new Qt3DRender::QClearBuffers(cameraSelector);
36 clearBuffers->setBuffers(Qt3DRender::QClearBuffers::ColorDepthBuffer);
37
38 Qt3DRender::QNoDraw *noDraw = new Qt3DRender::QNoDraw(clearBuffers);
39
40 Qt3DRender::QRenderPassFilter *mainPass = new Qt3DRender::QRenderPassFilter(cameraSelector);
41 ....
42 Qt3DRender::QRenderPassFilter *previewPass = new Qt3DRender::QRenderPassFilter(cameraSelector);
43 ....
44 \endcode
45
46 \since 5.5
47 */
48
49/*!
50 \qmltype NoDraw
51 \instantiates Qt3DRender::QNoDraw
52 \inherits FrameGraphNode
53 \inqmlmodule Qt3D.Render
54 \since 5.5
55 \brief When a NoDraw node is present in a FrameGraph branch, this
56 prevents the renderer from rendering any primitive.
57
58 NoDraw should be used when the FrameGraph needs to set up some render
59 states or clear some buffers without requiring any mesh to be drawn. It has
60 the same effect as having a Qt3DRender::QRenderPassFilter that matches none
61 of available Qt3DRender::QRenderPass instances of the scene without the
62 overhead cost of actually performing the filtering.
63
64 When disabled, a NoDraw node won't prevent the scene from being rendered.
65 Toggling the enabled property is therefore a way to make a NoDraw active or
66 inactive.
67
68 NoDraw is usually used as a child of a ClearBuffers node to prevent from
69 drawing the scene when there are multiple render passes.
70
71 \code
72
73 Viewport {
74 CameraSelector {
75 ClearBuffers {
76 buffers: ClearBuffers.ColorDepthBuffer
77 NoDraw { } // Prevents from drawing anything
78 }
79 RenderPassFilter {
80 ...
81 }
82 RenderPassFilter {
83 ...
84 }
85 }
86 }
87
88 \endcode
89*/
90
91/*!
92 The constructor creates an instance with the specified \a parent.
93 */
94QNoDraw::QNoDraw(QNode *parent)
95 : QFrameGraphNode(parent)
96{
97}
98
99/*! \internal */
100QNoDraw::~QNoDraw()
101{
102}
103
104} // namespace Qt3DRender
105
106QT_END_NAMESPACE
107
108#include "moc_qnodraw.cpp"
109

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