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 "qstenciloperationarguments.h"
5#include "qstenciloperationarguments_p.h"
6
7QT_BEGIN_NAMESPACE
8
9namespace Qt3DRender {
10
11QStencilOperationArgumentsPrivate::~QStencilOperationArgumentsPrivate() = default;
12
13/*!
14 \class Qt3DRender::QStencilOperationArguments
15 \brief The QStencilOperationArguments class sets the actions to be taken
16 when stencil and depth tests fail.
17 \since 5.7
18 \ingroup renderstates
19 \inmodule Qt3DRender
20
21 The Qt3DRender::QStencilOperationArguments class specifies the arguments for
22 the stencil operations.
23
24 \sa Qt3DRender::QStencilOperation
25 */
26
27/*!
28 \qmltype StencilOperationArguments
29 \brief The StencilOperationArguments type sets the actions to be taken
30 when stencil and depth tests fail.
31 \since 5.7
32 \ingroup renderstates
33 \inqmlmodule Qt3D.Render
34 \instantiates Qt3DRender::QStencilOperationArguments
35 \inherits QtObject
36
37 The StencilOperationArguments type specifies the arguments for the stencil operations.
38
39 \sa StencilOperation
40 */
41
42/*!
43 \enum Qt3DRender::QStencilOperationArguments::FaceMode
44 This enumeration holds the values for stencil operation argument face modes
45 \value Front Arguments are applied to front-facing polygons.
46 \value Back Arguments are applied to back-facing polygons.
47 \value FrontAndBack Arguments are applied to both front- and back-facing polygons.
48*/
49
50/*!
51 \enum Qt3DRender::QStencilOperationArguments::Operation
52 This enumeration holds the values for stencil operation.
53 \value Zero Set stencil value to zero.
54 \value Keep Keep current stencil value.
55 \value Replace Replace with the masked fragment stencil value.
56 \value Increment Increment current value with saturation.
57 \value Decrement Decrement current value with saturation.
58 \value IncrementWrap Increment current value with wrap.
59 \value DecrementWrap Decrement current value with wrap.
60 \value Invert Invert the current value.
61*/
62
63/*!
64 \qmlproperty enumeration StencilOperationArguments::faceMode
65 Holds the faces the arguments are applied to.
66 \list
67 \li StencilOperationArguments.Front
68 \li StencilOperationArguments.Back
69 \li StencilOperationArguments.FrontAndBack
70 \endlist
71 \sa Qt3DRender::QStencilOperationArguments::FaceMode
72 \readonly
73*/
74
75/*!
76 \qmlproperty enumeration StencilOperationArguments::stencilTestFailureOperation
77 Holds the stencil test operation for when the stencil test fails.
78 Default is StencilOperationArguments.Keep.
79 \list
80 \li StencilOperationArguments.Zero
81 \li StencilOperationArguments.Keep
82 \li StencilOperationArguments.Replace
83 \li StencilOperationArguments.Increment
84 \li StencilOperationArguments.Decrement
85 \li StencilOperationArguments.IncrementWrap
86 \li StencilOperationArguments.DecrementWrap
87 \li StencilOperationArguments.Inverter
88 \endlist
89 \sa Qt3DRender::QStencilOperationArguments::Operation
90*/
91
92/*!
93 \qmlproperty enumeration StencilOperationArguments::depthTestFailureOperation
94 Holds the stencil test operation for when the stencil test passes, but
95 depth test fails. Default is StencilOperationArguments.Keep.
96 \sa StencilOperationArguments::stencilTestFailureOperation, Qt3DRender::QStencilOperationArguments::Operation
97*/
98
99/*!
100 \qmlproperty enumeration StencilOperationArguments::allTestsPassOperation
101 Holds the stencil test operation for when depth and stencil test pass. Default is StencilOperationArguments.Keep.
102 \sa StencilOperationArguments::stencilTestFailureOperation, Qt3DRender::QStencilOperationArguments::Operation
103*/
104
105/*!
106 \property QStencilOperationArguments::faceMode
107 Holds the faces the arguments are applied to.
108 \readonly
109*/
110
111/*!
112 \property QStencilOperationArguments::stencilTestFailureOperation
113 Holds the stencil test operation for when the stencil test fails.
114 Default is StencilOperationArguments.Keep.
115*/
116
117/*!
118 \property QStencilOperationArguments::depthTestFailureOperation
119 Holds the stencil test operation for when the stencil test passes, but
120 depth test fails. Default is StencilOperationArguments.Keep.
121*/
122
123/*!
124 \property QStencilOperationArguments::allTestsPassOperation
125 Holds the stencil test operation for when depth and stencil test pass. Default is StencilOperationArguments.Keep.
126*/
127
128/*!
129 The constructor creates a new QStencilOperationArguments::QStencilOperationArguments
130 instance with the specified \a mode and \a parent.
131 */
132QStencilOperationArguments::QStencilOperationArguments(FaceMode mode, QObject *parent)
133 : QObject(*new QStencilOperationArgumentsPrivate(mode), parent)
134{
135}
136
137/*! \internal */
138QStencilOperationArguments::~QStencilOperationArguments()
139{
140}
141
142QStencilOperationArguments::FaceMode QStencilOperationArguments::faceMode() const
143{
144 Q_D(const QStencilOperationArguments);
145 return d->m_face;
146}
147
148void QStencilOperationArguments::setStencilTestFailureOperation(QStencilOperationArguments::Operation operation)
149{
150 Q_D(QStencilOperationArguments);
151 if (d->m_stencilTestFailureOperation != operation) {
152 d->m_stencilTestFailureOperation = operation;
153 Q_EMIT stencilTestFailureOperationChanged(stencilFail: operation);
154 }
155}
156
157QStencilOperationArguments::Operation QStencilOperationArguments::stencilTestFailureOperation() const
158{
159 Q_D(const QStencilOperationArguments);
160 return d->m_stencilTestFailureOperation;
161}
162
163void QStencilOperationArguments::setDepthTestFailureOperation(QStencilOperationArguments::Operation operation)
164{
165 Q_D(QStencilOperationArguments);
166 if (d->m_depthTestFailureOperation != operation) {
167 d->m_depthTestFailureOperation = operation;
168 Q_EMIT depthTestFailureOperationChanged(depthFail: operation);
169 }
170}
171
172QStencilOperationArguments::Operation QStencilOperationArguments::depthTestFailureOperation() const
173{
174 Q_D(const QStencilOperationArguments);
175 return d->m_depthTestFailureOperation;
176}
177
178void QStencilOperationArguments::setAllTestsPassOperation(QStencilOperationArguments::Operation operation)
179{
180 Q_D(QStencilOperationArguments);
181 if (d->m_allTestsPassOperation != operation) {
182 d->m_allTestsPassOperation = operation;
183 Q_EMIT allTestsPassOperationChanged(stencilDepthPass: operation);
184 }
185}
186
187QStencilOperationArguments::Operation QStencilOperationArguments::allTestsPassOperation() const
188{
189 Q_D(const QStencilOperationArguments);
190 return d->m_allTestsPassOperation;
191}
192
193} // namespace Qt3DRender
194
195QT_END_NAMESPACE
196
197#include "moc_qstenciloperationarguments.cpp"
198

source code of qt3d/src/render/renderstates/qstenciloperationarguments.cpp