| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). | 
| 4 | ** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). | 
| 5 | ** Contact: https://www.qt.io/licensing/ | 
| 6 | ** | 
| 7 | ** This file is part of the Qt3D module of the Qt Toolkit. | 
| 8 | ** | 
| 9 | ** $QT_BEGIN_LICENSE:LGPL$ | 
| 10 | ** Commercial License Usage | 
| 11 | ** Licensees holding valid commercial Qt licenses may use this file in | 
| 12 | ** accordance with the commercial license agreement provided with the | 
| 13 | ** Software or, alternatively, in accordance with the terms contained in | 
| 14 | ** a written agreement between you and The Qt Company. For licensing terms | 
| 15 | ** and conditions see https://www.qt.io/terms-conditions. For further | 
| 16 | ** information use the contact form at https://www.qt.io/contact-us. | 
| 17 | ** | 
| 18 | ** GNU Lesser General Public License Usage | 
| 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
| 20 | ** General Public License version 3 as published by the Free Software | 
| 21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | 
| 22 | ** packaging of this file. Please review the following information to | 
| 23 | ** ensure the GNU Lesser General Public License version 3 requirements | 
| 24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | 
| 25 | ** | 
| 26 | ** GNU General Public License Usage | 
| 27 | ** Alternatively, this file may be used under the terms of the GNU | 
| 28 | ** General Public License version 2.0 or (at your option) the GNU General | 
| 29 | ** Public license version 3 or any later version approved by the KDE Free | 
| 30 | ** Qt Foundation. The licenses are as published by the Free Software | 
| 31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | 
| 32 | ** included in the packaging of this file. Please review the following | 
| 33 | ** information to ensure the GNU General Public License requirements will | 
| 34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | 
| 35 | ** https://www.gnu.org/licenses/gpl-3.0.html. | 
| 36 | ** | 
| 37 | ** $QT_END_LICENSE$ | 
| 38 | ** | 
| 39 | ****************************************************************************/ | 
| 40 |  | 
| 41 | #ifndef _USE_MATH_DEFINES | 
| 42 | # define _USE_MATH_DEFINES // For MSVC | 
| 43 | #endif | 
| 44 |  | 
| 45 | #include "qtorusmesh.h" | 
| 46 |  | 
| 47 | #include <Qt3DExtras/qtorusgeometry.h> | 
| 48 |  | 
| 49 | QT_BEGIN_NAMESPACE | 
| 50 |  | 
| 51 | namespace  Qt3DExtras { | 
| 52 |  | 
| 53 | /*! | 
| 54 |  * \qmltype TorusMesh | 
| 55 |  * \instantiates Qt3DExtras::QTorusMesh | 
| 56 |  * \inqmlmodule Qt3D.Extras | 
| 57 |  * \brief A toroidal mesh. | 
| 58 |  */ | 
| 59 |  | 
| 60 | /*! | 
| 61 |  * \qmlproperty int TorusMesh::rings | 
| 62 |  * | 
| 63 |  * Holds the number of rings in the mesh. | 
| 64 |  */ | 
| 65 |  | 
| 66 | /*! | 
| 67 |  * \qmlproperty int TorusMesh::slices | 
| 68 |  * | 
| 69 |  * Holds the number of slices in the mesh. | 
| 70 |  */ | 
| 71 |  | 
| 72 | /*! | 
| 73 |  * \qmlproperty real TorusMesh::radius | 
| 74 |  * | 
| 75 |  * Holds the outer radius of the torus. | 
| 76 |  */ | 
| 77 |  | 
| 78 | /*! | 
| 79 |  * \qmlproperty real TorusMesh::minorRadius | 
| 80 |  * | 
| 81 |  * Holds the inner radius of the torus. | 
| 82 |  */ | 
| 83 |  | 
| 84 | /*! | 
| 85 |  * \class Qt3DExtras::QTorusMesh | 
| 86 |    \ingroup qt3d-extras-geometries | 
| 87 |  * \inheaderfile Qt3DExtras/QTorusMesh | 
| 88 |  * \inmodule Qt3DExtras | 
| 89 |  * | 
| 90 |  * \inherits Qt3DRender::QGeometryRenderer | 
| 91 |  * | 
| 92 |  * \brief A toroidal mesh. | 
| 93 |  */ | 
| 94 |  | 
| 95 | /*! | 
| 96 |  * Constructs a new QTorusMesh with \a parent. | 
| 97 |  */ | 
| 98 | QTorusMesh::(QNode *parent) | 
| 99 |     : QGeometryRenderer(parent) | 
| 100 | { | 
| 101 |     QTorusGeometry *geometry = new QTorusGeometry(this); | 
| 102 |     QObject::connect(sender: geometry, signal: &QTorusGeometry::radiusChanged, receiver: this, slot: &QTorusMesh::radiusChanged); | 
| 103 |     QObject::connect(sender: geometry, signal: &QTorusGeometry::ringsChanged, receiver: this, slot: &QTorusMesh::ringsChanged); | 
| 104 |     QObject::connect(sender: geometry, signal: &QTorusGeometry::slicesChanged, receiver: this, slot: &QTorusMesh::slicesChanged); | 
| 105 |     QObject::connect(sender: geometry, signal: &QTorusGeometry::minorRadiusChanged, receiver: this, slot: &QTorusMesh::minorRadiusChanged); | 
| 106 |  | 
| 107 |     QGeometryRenderer::setGeometry(geometry); | 
| 108 | } | 
| 109 |  | 
| 110 | /*! \internal */ | 
| 111 | QTorusMesh::() | 
| 112 | { | 
| 113 | } | 
| 114 |  | 
| 115 | void QTorusMesh::(int rings) | 
| 116 | { | 
| 117 |     static_cast<QTorusGeometry *>(geometry())->setRings(rings); | 
| 118 | } | 
| 119 |  | 
| 120 | void QTorusMesh::(int slices) | 
| 121 | { | 
| 122 |     static_cast<QTorusGeometry *>(geometry())->setSlices(slices); | 
| 123 | } | 
| 124 |  | 
| 125 | void QTorusMesh::(float radius) | 
| 126 | { | 
| 127 |     static_cast<QTorusGeometry *>(geometry())->setRadius(radius); | 
| 128 | } | 
| 129 |  | 
| 130 | void QTorusMesh::(float minorRadius) | 
| 131 | { | 
| 132 |     static_cast<QTorusGeometry *>(geometry())->setMinorRadius(minorRadius); | 
| 133 | } | 
| 134 |  | 
| 135 | /*! | 
| 136 |  * \property QTorusMesh::rings | 
| 137 |  * | 
| 138 |  * Holds the number of rings in the mesh. | 
| 139 |  */ | 
| 140 | int QTorusMesh::() const | 
| 141 | { | 
| 142 |     return static_cast<QTorusGeometry *>(geometry())->rings(); | 
| 143 | } | 
| 144 |  | 
| 145 | /*! | 
| 146 |  * \property QTorusMesh::slices | 
| 147 |  * | 
| 148 |  * Holds the number of slices in the mesh. | 
| 149 |  */ | 
| 150 | int QTorusMesh::() const | 
| 151 | { | 
| 152 |     return static_cast<QTorusGeometry *>(geometry())->slices(); | 
| 153 | } | 
| 154 |  | 
| 155 | /*! | 
| 156 |  * \property QTorusMesh::radius | 
| 157 |  * | 
| 158 |  * Holds the outer radius of the torus. | 
| 159 |  */ | 
| 160 | float QTorusMesh::() const | 
| 161 | { | 
| 162 |     return static_cast<QTorusGeometry *>(geometry())->radius(); | 
| 163 | } | 
| 164 |  | 
| 165 | /*! | 
| 166 |  * \property QTorusMesh::minorRadius | 
| 167 |  * | 
| 168 |  * Holds the inner radius of the torus. | 
| 169 |  */ | 
| 170 | float QTorusMesh::() const | 
| 171 | { | 
| 172 |     return static_cast<QTorusGeometry *>(geometry())->minorRadius(); | 
| 173 | } | 
| 174 |  | 
| 175 | } // namespace  Qt3DExtras | 
| 176 |  | 
| 177 | QT_END_NAMESPACE | 
| 178 |  |