1// Copyright (C) 2018 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 "qrastermode.h"
5#include "qrastermode_p.h"
6
7QT_BEGIN_NAMESPACE
8
9namespace Qt3DRender {
10
11/*!
12 \class Qt3DRender::QRasterMode
13 \brief The QRasterMode render state allows to control the type of
14 rasterization to be performed.
15 \since 5.14
16 \inmodule Qt3DRender
17 \ingroup renderstates
18
19 The QRasterMode class is used to control the rasterization step of the
20 primitives at render time. This can be used to choose whether we only
21 want to show points, edges or fill a primitive.
22
23 \note This is not supported when rendering on OpenGL ES 2.0 platforms.
24
25 \sa QAlphaTest, QStencilTest
26 */
27
28/*!
29 \qmltype RasterMode
30 \brief The RasterMode render state allows to control the type of
31 rasterization to be performed.
32 \since 5.14
33 \inqmlmodule Qt3D.Render
34 \inherits RenderState
35 \instantiates Qt3DRender::QRasterMode
36 \ingroup renderstates
37
38 The QRasterMode class is used to control the rasterization step of the
39 primitives at render time. This can be used to choose whether we only
40 want to show points, edges or fill a primitive.
41
42 \note This is not supported when rendering on OpenGL ES 2.0 platforms.
43
44 \sa AlphaTest, StencilTest
45 */
46
47/*!
48 \enum Qt3DRender::QRasterMode::RasterMode
49
50 Enumeration for raster mode values
51 \value Points Vertices at the start of an edge are drawn as points.
52 \value Lines Edges of a polygon are draw as line segments.
53 \value Fill Fills the interior of the primitive.
54*/
55
56/*!
57 \enum Qt3DRender::QRasterMode::FaceMode
58
59 Enumeration for face mode values
60 \value Front Applies to front faces only
61 \value Back Applies to back faces only
62 \value FrontAndBack Applies to front and back faces
63*/
64
65/*!
66 \property QRasterMode::rasterMode
67
68 Holds the raster mode to be used.
69*/
70
71/*!
72 \property QRasterMode::faceMode
73
74 Holds the face mode to be used. Controls on which face the raster mode is
75 to be applied.
76*/
77
78/*!
79 \qmlproperty enumeration RasterMode::rasterMode
80
81 Holds the raster mode to be used.
82
83 \list
84 \li Points Vertices at the start of an edge are drawn as points.
85 \li Lines Edges of a polygon are draw as line segments.
86 \li Fill Fills the interior of the primitive.
87 \endlist
88*/
89
90/*!
91 \qmlproperty enumeration RasterMode::faceMode
92
93 Holds the face mode to be used. Controls on which face the raster mode is
94 to be applied.
95
96 \list
97 \li Front Applies to front faces only
98 \li Back Applies to back faces only
99 \li FrontAndBack Applies to front and back faces
100 \endlist
101*/
102
103
104
105QRasterMode::QRasterMode(QNode *parent)
106 : QRenderState(*new QRasterModePrivate, parent)
107{
108}
109
110/*!
111 \internal
112*/
113QRasterMode::~QRasterMode()
114 = default;
115
116QRasterMode::RasterMode QRasterMode::rasterMode() const
117{
118 Q_D(const QRasterMode);
119 return d->m_rasterMode;
120}
121
122QRasterMode::FaceMode QRasterMode::faceMode() const
123{
124 Q_D(const QRasterMode);
125 return d->m_faceMode;
126}
127
128void QRasterMode::setRasterMode(QRasterMode::RasterMode rasterMode)
129{
130 Q_D(QRasterMode);
131 if (d->m_rasterMode != rasterMode) {
132 d->m_rasterMode = rasterMode;
133 emit rasterModeChanged(rasterMode);
134 }
135}
136
137void QRasterMode::setFaceMode(QRasterMode::FaceMode faceMode)
138{
139 Q_D(QRasterMode);
140 if (d->m_faceMode != faceMode) {
141 d->m_faceMode = faceMode;
142 emit faceModeChanged(faceMode);
143 }
144}
145
146} // namespace Qt3DRender
147
148QT_END_NAMESPACE
149
150#include "moc_qrastermode.cpp"
151

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