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 "qpointsize.h"
5#include "qpointsize_p.h"
6
7QT_BEGIN_NAMESPACE
8
9namespace Qt3DRender {
10
11/*!
12 \class Qt3DRender::QPointSize
13 \inmodule Qt3DRender
14 \since 5.7
15 \brief Specifies the size of rasterized points. May either be set statically
16 or by shader programs.
17
18 When the sizeMode property is set to SizeMode::Fixed, the value is set
19 using glPointSize(), if available. When using SizeMode::Programmable,
20 gl_PointSize must be set within shader programs, the value provided to this
21 RenderState is ignored in that case.
22 */
23
24/*!
25 \qmltype PointSize
26 \since 5.7
27 \inherits RenderState
28 \instantiates Qt3DRender::QPointSize
29 \inqmlmodule Qt3D.Render
30
31 \brief Specifies the size of rasterized points. May either be set statically
32 or by shader programs.
33
34 When the sizeMode property is set to SizeMode::Fixed, the value is set
35 using glPointSize(), if available. When using SizeMode::Programmable,
36 gl_PointSize must be set within shader programs, the value provided to this
37 RenderState is ignored in that case.
38 */
39
40/*!
41 \enum Qt3DRender::QPointSize::SizeMode
42
43 This enumeration specifies values for the size mode.
44 \value Fixed The point size is by the QPointSize::value.
45 \value Programmable The point size value must be set in shader
46*/
47/*!
48 \qmlproperty real PointSize::value
49 Specifies the point size value to be used.
50*/
51
52/*!
53 \qmlproperty enumeration PointSize::sizeMode
54 Specifies the sizeMode to be used.
55*/
56
57/*!
58 \property QPointSize::value
59 Specifies the point size value to be used.
60*/
61
62/*!
63 \property QPointSize::sizeMode
64 Specifies the sizeMode to be used.
65*/
66
67QPointSize::QPointSize(Qt3DCore::QNode *parent)
68 : QRenderState(*new QPointSizePrivate(SizeMode::Programmable, 0.f), parent)
69{
70}
71
72/*! \internal */
73QPointSize::~QPointSize()
74{
75}
76
77QPointSize::SizeMode QPointSize::sizeMode() const
78{
79 Q_D(const QPointSize);
80 return d->m_sizeMode;
81}
82
83float QPointSize::value() const
84{
85 Q_D(const QPointSize);
86 return d->m_value;
87}
88
89void QPointSize::setSizeMode(SizeMode sizeMode)
90{
91 Q_D(QPointSize);
92 d->m_sizeMode = sizeMode;
93 emit sizeModeChanged(sizeMode);
94}
95
96void QPointSize::setValue(float size)
97{
98 Q_D(QPointSize);
99 d->m_value = size;
100 emit valueChanged(value: size);
101}
102
103} // namespace Qt3DRender
104
105QT_END_NAMESPACE
106
107#include "moc_qpointsize.cpp"
108
109

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