1/****************************************************************************
2**
3** Copyright (C) 2015 Paul Lemire
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 "qstenciltestarguments.h"
41#include "qstenciltestarguments_p.h"
42
43QT_BEGIN_NAMESPACE
44
45namespace Qt3DRender {
46
47/*!
48 \class Qt3DRender::QStencilTestArguments
49 \brief The QStencilTestArguments class specifies arguments for stencil test.
50 \since 5.7
51 \ingroup renderstates
52 \inmodule Qt3DRender
53
54 The Qt3DRender::QStencilTestArguments class specifies the arguments for
55 the stencil test.
56 */
57
58/*!
59 \qmltype StencilTestArguments
60 \brief The StencilTestArguments type specifies arguments for stencil test.
61 \since 5.7
62 \ingroup renderstates
63 \inqmlmodule Qt3D.Render
64 \instantiates Qt3DRender::QStencilTestArguments
65 \inherits QtObject
66
67 The StencilTestArguments type specifies the arguments for
68 the stencil test.
69 */
70
71/*!
72 \enum Qt3DRender::QStencilTestArguments::StencilFaceMode
73 This enumeration holds the values for stencil test arguments face modes
74 \value Front Arguments are applied to front-facing polygons.
75 \value Back Arguments are applied to back-facing polygons.
76 \value FrontAndBack Arguments are applied to both front- and back-facing polygons.
77*/
78
79/*!
80 \enum Qt3DRender::QStencilTestArguments::StencilFunction
81
82 Enumeration for the stencil function values
83 \value Never Never pass stencil test
84 \value Always Always pass stencil test
85 \value Less Pass stencil test if fragment stencil is less than reference value
86 \value LessOrEqual Pass stencil test if fragment stencil is less than or equal to reference value
87 \value Equal Pass stencil test if fragment stencil is equal to reference value
88 \value GreaterOrEqual Pass stencil test if fragment stencil is greater than or equal to reference value
89 \value Greater Pass stencil test if fragment stencil is greater than reference value
90 \value NotEqual Pass stencil test if fragment stencil is not equal to reference value
91*/
92
93/*!
94 \qmlproperty enumeration StencilTestArguments::faceMode
95 Holds the faces the arguments are applied to.
96 \list
97 \li StencilTestArguments.Front
98 \li StencilTestArguments.Back
99 \li StencilTestArguments.FrontAndBack
100 \endlist
101 \sa Qt3DRender::QStencilTestArguments::StencilFaceMode
102 \readonly
103*/
104
105/*!
106 \qmlproperty int StencilTestArguments::comparisonMask
107 Holds the stencil test comparison mask. Default is all zeroes.
108*/
109
110/*!
111 \qmlproperty int StencilTestArguments::referenceValue
112 Holds the stencil test reference value. Default is zero.
113*/
114
115/*!
116 \qmlproperty enumeration StencilTestArguments::stencilFunction
117 Holds the stencil test function. Default is StencilTestArguments.Never.
118 \list
119 \li StencilTestArguments.Never
120 \li StencilTestArguments.Always
121 \li StencilTestArguments.Less
122 \li StencilTestArguments.LessOrEqual
123 \li StencilTestArguments.Equal
124 \li StencilTestArguments.GreaterOrEqual
125 \li StencilTestArguments.Greater
126 \li StencilTestArguments.NotEqual
127 \endlist
128*/
129
130/*!
131 \property QStencilTestArguments::faceMode
132 Holds the faces the arguments are applied to.
133 \readonly
134*/
135
136/*!
137 \property QStencilTestArguments::comparisonMask
138 Holds the stencil test comparison mask. Default is all zeroes.
139*/
140
141/*!
142 \property QStencilTestArguments::referenceValue
143 Holds the stencil test reference value. Default is zero.
144*/
145
146/*!
147 \property QStencilTestArguments::stencilFunction
148 Holds the stencil test function. Default is Never.
149 \sa Qt3DRender::QStencilTestArguments::StencilFunction
150*/
151
152/*!
153 The constructor creates a new QStencilTestArguments::QStencilTestArguments
154 instance with the specified \a face and \a parent.
155 */
156QStencilTestArguments::QStencilTestArguments(QStencilTestArguments::StencilFaceMode face, QObject *parent)
157 : QObject(*new QStencilTestArgumentsPrivate(face), parent)
158{
159}
160
161/*! \internal */
162QStencilTestArguments::~QStencilTestArguments()
163{
164}
165
166uint QStencilTestArguments::comparisonMask() const
167{
168 Q_D(const QStencilTestArguments);
169 return d->m_comparisonMask;
170}
171
172void QStencilTestArguments::setComparisonMask(uint comparisonMask)
173{
174 Q_D(QStencilTestArguments);
175 if (d->m_comparisonMask != comparisonMask) {
176 d->m_comparisonMask = comparisonMask;
177 emit comparisonMaskChanged(comparisonMask);
178 }
179}
180
181int QStencilTestArguments::referenceValue() const
182{
183 Q_D(const QStencilTestArguments);
184 return d->m_referenceValue;
185}
186
187void QStencilTestArguments::setReferenceValue(int referenceValue)
188{
189 Q_D(QStencilTestArguments);
190 if (d->m_referenceValue != referenceValue) {
191 d->m_referenceValue = referenceValue;
192 emit referenceValueChanged(referenceValue);
193 }
194}
195
196QStencilTestArguments::StencilFunction QStencilTestArguments::stencilFunction() const
197{
198 Q_D(const QStencilTestArguments);
199 return d->m_stencilFunction;
200}
201
202void QStencilTestArguments::setStencilFunction(QStencilTestArguments::StencilFunction stencilFunction)
203{
204 Q_D(QStencilTestArguments);
205 if (d->m_stencilFunction != stencilFunction) {
206 d->m_stencilFunction = stencilFunction;
207 emit stencilFunctionChanged(stencilFunction);
208 }
209}
210
211QStencilTestArguments::StencilFaceMode QStencilTestArguments::faceMode() const
212{
213 Q_D(const QStencilTestArguments);
214 return d->m_face;
215}
216
217} // namespace Qt3DRender
218
219QT_END_NAMESPACE
220

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