1/****************************************************************************
2**
3** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt3D module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qstenciloperationarguments.h"
41#include "qstenciloperationarguments_p.h"
42
43QT_BEGIN_NAMESPACE
44
45namespace Qt3DRender {
46
47/*!
48 \class Qt3DRender::QStencilOperationArguments
49 \brief The QStencilOperationArguments class sets the actions to be taken
50 when stencil and depth tests fail.
51 \since 5.7
52 \ingroup renderstates
53 \inmodule Qt3DRender
54
55 The Qt3DRender::QStencilOperationArguments class specifies the arguments for
56 the stencil operations.
57
58 \sa Qt3DRender::QStencilOperation
59 */
60
61/*!
62 \qmltype StencilOperationArguments
63 \brief The StencilOperationArguments type sets the actions to be taken
64 when stencil and depth tests fail.
65 \since 5.7
66 \ingroup renderstates
67 \inqmlmodule Qt3D.Render
68 \instantiates Qt3DRender::QStencilOperationArguments
69 \inherits QtObject
70
71 The StencilOperationArguments type specifies the arguments for the stencil operations.
72
73 \sa StencilOperation
74 */
75
76/*!
77 \enum Qt3DRender::QStencilOperationArguments::FaceMode
78 This enumeration holds the values for stencil operation argument face modes
79 \value Front Arguments are applied to front-facing polygons.
80 \value Back Arguments are applied to back-facing polygons.
81 \value FrontAndBack Arguments are applied to both front- and back-facing polygons.
82*/
83
84/*!
85 \enum Qt3DRender::QStencilOperationArguments::Operation
86 This enumeration holds the values for stencil operation.
87 \value Zero Set stencil value to zero.
88 \value Keep Keep current stencil value.
89 \value Replace Replace with the masked fragment stencil value.
90 \value Increment Increment current value with saturation.
91 \value Decrement Decrement current value with saturation.
92 \value IncrementWrap Increment current value with wrap.
93 \value DecrementWrap Decrement current value with wrap.
94 \value Invert Invert the current value.
95*/
96
97/*!
98 \qmlproperty enumeration StencilOperationArguments::faceMode
99 Holds the faces the arguments are applied to.
100 \list
101 \li StencilOperationArguments.Front
102 \li StencilOperationArguments.Back
103 \li StencilOperationArguments.FrontAndBack
104 \endlist
105 \sa Qt3DRender::QStencilOperationArguments::FaceMode
106 \readonly
107*/
108
109/*!
110 \qmlproperty enumeration StencilOperationArguments::stencilTestFailureOperation
111 Holds the stencil test operation for when the stencil test fails.
112 Default is StencilOperationArguments.Keep.
113 \list
114 \li StencilOperationArguments.Zero
115 \li StencilOperationArguments.Keep
116 \li StencilOperationArguments.Replace
117 \li StencilOperationArguments.Increment
118 \li StencilOperationArguments.Decrement
119 \li StencilOperationArguments.IncrementWrap
120 \li StencilOperationArguments.DecrementWrap
121 \li StencilOperationArguments.Inverter
122 \endlist
123 \sa Qt3DRender::QStencilOperationArguments::Operation
124*/
125
126/*!
127 \qmlproperty enumeration StencilOperationArguments::depthTestFailureOperation
128 Holds the stencil test operation for when the stencil test passes, but
129 depth test fails. Default is StencilOperationArguments.Keep.
130 \sa StencilOperationArguments::stencilTestFailureOperation, Qt3DRender::QStencilOperationArguments::Operation
131*/
132
133/*!
134 \qmlproperty enumeration StencilOperationArguments::allTestsPassOperation
135 Holds the stencil test operation for when depth and stencil test pass. Default is StencilOperationArguments.Keep.
136 \sa StencilOperationArguments::stencilTestFailureOperation, Qt3DRender::QStencilOperationArguments::Operation
137*/
138
139/*!
140 \property QStencilOperationArguments::faceMode
141 Holds the faces the arguments are applied to.
142 \readonly
143*/
144
145/*!
146 \property QStencilOperationArguments::stencilTestFailureOperation
147 Holds the stencil test operation for when the stencil test fails.
148 Default is StencilOperationArguments.Keep.
149*/
150
151/*!
152 \property QStencilOperationArguments::depthTestFailureOperation
153 Holds the stencil test operation for when the stencil test passes, but
154 depth test fails. Default is StencilOperationArguments.Keep.
155*/
156
157/*!
158 \property QStencilOperationArguments::allTestsPassOperation
159 Holds the stencil test operation for when depth and stencil test pass. Default is StencilOperationArguments.Keep.
160*/
161
162/*!
163 The constructor creates a new QStencilOperationArguments::QStencilOperationArguments
164 instance with the specified \a mode and \a parent.
165 */
166QStencilOperationArguments::QStencilOperationArguments(FaceMode mode, QObject *parent)
167 : QObject(*new QStencilOperationArgumentsPrivate(mode), parent)
168{
169}
170
171/*! \internal */
172QStencilOperationArguments::~QStencilOperationArguments()
173{
174}
175
176QStencilOperationArguments::FaceMode QStencilOperationArguments::faceMode() const
177{
178 Q_D(const QStencilOperationArguments);
179 return d->m_face;
180}
181
182void QStencilOperationArguments::setStencilTestFailureOperation(QStencilOperationArguments::Operation operation)
183{
184 Q_D(QStencilOperationArguments);
185 if (d->m_stencilTestFailureOperation != operation) {
186 d->m_stencilTestFailureOperation = operation;
187 Q_EMIT stencilTestFailureOperationChanged(stencilFail: operation);
188 }
189}
190
191QStencilOperationArguments::Operation QStencilOperationArguments::stencilTestFailureOperation() const
192{
193 Q_D(const QStencilOperationArguments);
194 return d->m_stencilTestFailureOperation;
195}
196
197void QStencilOperationArguments::setDepthTestFailureOperation(QStencilOperationArguments::Operation operation)
198{
199 Q_D(QStencilOperationArguments);
200 if (d->m_depthTestFailureOperation != operation) {
201 d->m_depthTestFailureOperation = operation;
202 Q_EMIT depthTestFailureOperationChanged(depthFail: operation);
203 }
204}
205
206QStencilOperationArguments::Operation QStencilOperationArguments::depthTestFailureOperation() const
207{
208 Q_D(const QStencilOperationArguments);
209 return d->m_depthTestFailureOperation;
210}
211
212void QStencilOperationArguments::setAllTestsPassOperation(QStencilOperationArguments::Operation operation)
213{
214 Q_D(QStencilOperationArguments);
215 if (d->m_allTestsPassOperation != operation) {
216 d->m_allTestsPassOperation = operation;
217 Q_EMIT allTestsPassOperationChanged(stencilDepthPass: operation);
218 }
219}
220
221QStencilOperationArguments::Operation QStencilOperationArguments::allTestsPassOperation() const
222{
223 Q_D(const QStencilOperationArguments);
224 return d->m_allTestsPassOperation;
225}
226
227} // namespace Qt3DRender
228
229QT_END_NAMESPACE
230

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