1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#include "qspheregeometryview.h"
6
7#include <Qt3DExtras/qspheregeometry.h>
8
9QT_BEGIN_NAMESPACE
10
11namespace Qt3DExtras {
12
13/*!
14 * \qmltype SphereGeometryView
15 * \instantiates Qt3DExtras::QSphereGeometryView
16 * \inqmlmodule Qt3D.Extras
17 * \brief A spherical mesh.
18 */
19
20/*!
21 * \qmlproperty int SphereGeometryView::rings
22 *
23 * Holds the number of rings in the mesh.
24 */
25
26/*!
27 * \qmlproperty int SphereGeometryView::slices
28 *
29 * Holds the number of slices in the mesh.
30 */
31
32/*!
33 * \qmlproperty real SphereGeometryView::radius
34 *
35 * Holds the radius of the sphere.
36 */
37
38/*!
39 * \qmlproperty bool SphereGeometryView::generateTangents
40 *
41 * Holds the value of the automatic tangent vectors generation flag.
42 * Tangent vectors are orthogonal to normal vectors.
43 */
44
45/*!
46 * \class Qt3DExtras::QSphereGeometryView
47 \ingroup qt3d-extras-geometries
48 * \inheaderfile Qt3DExtras/QSphereGeometryView
49 * \inmodule Qt3DExtras
50 *
51 * \inherits Qt3DCore::QGeometryView
52 *
53 * \brief A spherical mesh.
54 */
55
56/*!
57 * Constructs a new QSphereGeometryView with \a parent.
58 */
59QSphereGeometryView::QSphereGeometryView(QNode *parent)
60 : Qt3DCore::QGeometryView(parent)
61{
62 QSphereGeometry *geometry = new QSphereGeometry(this);
63 QObject::connect(sender: geometry, signal: &QSphereGeometry::radiusChanged, context: this, slot: &QSphereGeometryView::radiusChanged);
64 QObject::connect(sender: geometry, signal: &QSphereGeometry::ringsChanged, context: this, slot: &QSphereGeometryView::ringsChanged);
65 QObject::connect(sender: geometry, signal: &QSphereGeometry::slicesChanged, context: this, slot: &QSphereGeometryView::slicesChanged);
66 QObject::connect(sender: geometry, signal: &QSphereGeometry::generateTangentsChanged, context: this, slot: &QSphereGeometryView::generateTangentsChanged);
67 QGeometryView::setGeometry(geometry);
68}
69
70/*! \internal */
71QSphereGeometryView::~QSphereGeometryView()
72{
73}
74
75void QSphereGeometryView::setRings(int rings)
76{
77 static_cast<QSphereGeometry *>(geometry())->setRings(rings);
78}
79
80void QSphereGeometryView::setSlices(int slices)
81{
82 static_cast<QSphereGeometry *>(geometry())->setSlices(slices);
83}
84
85void QSphereGeometryView::setRadius(float radius)
86{
87 static_cast<QSphereGeometry *>(geometry())->setRadius(radius);
88}
89
90void QSphereGeometryView::setGenerateTangents(bool gen)
91{
92 static_cast<QSphereGeometry *>(geometry())->setGenerateTangents(gen);
93}
94
95/*!
96 * \property QSphereGeometryView::generateTangents
97 *
98 * Holds the value of the automatic tangent vectors generation flag.
99 * Tangent vectors are orthogonal to normal vectors.
100 */
101bool QSphereGeometryView::generateTangents() const
102{
103 return static_cast<QSphereGeometry *>(geometry())->generateTangents();
104}
105
106/*!
107 * \property QSphereGeometryView::rings
108 *
109 * Holds the number of rings in the mesh.
110 */
111int QSphereGeometryView::rings() const
112{
113 return static_cast<QSphereGeometry *>(geometry())->rings();
114}
115
116/*!
117 * \property QSphereGeometryView::slices
118 *
119 * Holds the number of slices in the mesh.
120 */
121int QSphereGeometryView::slices() const
122{
123 return static_cast<QSphereGeometry *>(geometry())->slices();
124}
125
126/*!
127 * \property QSphereGeometryView::radius
128 *
129 * Holds the radius of the sphere.
130 */
131float QSphereGeometryView::radius() const
132{
133 return static_cast<QSphereGeometry *>(geometry())->radius();
134}
135
136} // Qt3DExtras
137
138QT_END_NAMESPACE
139
140#include "moc_qspheregeometryview.cpp"
141

source code of qt3d/src/extras/geometries/qspheregeometryview.cpp