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

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