Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cylindergeometry_p.h
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
6
#
ifndef
CYLINDERGEOMETRY_P_H
7
#
define
CYLINDERGEOMETRY_P_H
8
9
//
10
// W A R N I N G
11
// -------------
12
//
13
// This file is not part of the Qt API. It exists purely as an
14
// implementation detail. This header file may change from version to
15
// version without notice, or even be removed.
16
//
17
// We mean it.
18
//
19
20
#
include
<
QtQuick3DHelpers
/
qtquick3dhelpersexports
.
h
>
21
#
include
<
QQuick3DGeometry
>
22
#
include
<
QQmlEngine
>
23
#
include
<
QVector3D
>
24
25
#
if
QT_CONFIG
(
concurrent
)
26
#
include
<
QFuture
>
27
#
include
<
QFutureWatcher
>
28
#
endif
29
30
QT_BEGIN_NAMESPACE
31
32
class
Q_QUICK3DHELPERS_EXPORT
CylinderGeometry
:
public
QQuick3DGeometry
33
{
34
Q_OBJECT
35
Q_PROPERTY(
float
radius READ radius WRITE setRadius NOTIFY radiusChanged FINAL)
36
Q_PROPERTY(
float
length READ length WRITE setLength NOTIFY lengthChanged FINAL)
37
Q_PROPERTY(
int
rings READ rings WRITE setRings NOTIFY ringsChanged FINAL)
38
Q_PROPERTY(
int
segments READ segments WRITE setSegments NOTIFY segmentsChanged FINAL)
39
Q_PROPERTY(
bool
asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
40
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
41
QML_ELEMENT
42
QML_ADDED_IN_VERSION(6, 9)
43
public
:
44
enum
Status { Null, Ready, Loading, Error };
45
Q_ENUM(Status)
46
47
explicit
CylinderGeometry(QQuick3DObject *parent =
nullptr
);
48
~CylinderGeometry() override;
49
float
radius()
const
;
50
void
setRadius(
float
newRadius);
51
float
length()
const
;
52
void
setLength(
float
newLength);
53
54
int
rings()
const
;
55
void
setRings(
int
newRings);
56
57
int
segments()
const
;
58
void
setSegments(
int
newSegments);
59
60
bool
asynchronous()
const
;
61
void
setAsynchronous(
bool
newAsynchronous);
62
63
Status status()
const
;
64
65
private
Q_SLOTS:
66
void
doUpdateGeometry();
67
void
requestFinished();
68
69
Q_SIGNALS:
70
void
radiusChanged();
71
void
lengthChanged();
72
void
ringsChanged();
73
void
segmentsChanged();
74
void
asynchronousChanged();
75
void
statusChanged();
76
77
private
:
78
struct
GeometryData {
79
QByteArray vertexData;
80
QByteArray indexData;
81
QVector3D boundsMin;
82
QVector3D boundsMax;
83
};
84
85
void
scheduleGeometryUpdate();
86
void
updateGeometry(
const
GeometryData &geometryData);
87
88
static
CylinderGeometry::GeometryData generateCylinderGeometry(
float
radius,
89
float
length,
90
int
rings,
91
int
slices);
92
#
if
QT_CONFIG
(
concurrent
)
93
static
void
generateCylinderGeometryAsync(QPromise<CylinderGeometry::GeometryData> &promise,
94
float
radius,
95
float
length,
96
int
rings,
97
int
segments);
98
#
endif
99
100
float
m_radius = 50.0f;
101
float
m_length = 100.0f;
102
int
m_rings = 0;
103
int
m_segments = 20;
104
bool
m_asynchronous =
true
;
105
Status m_status = Null;
106
#
if
QT_CONFIG
(
concurrent
)
107
QFuture<GeometryData> m_geometryDataFuture;
108
QFutureWatcher<GeometryData> m_geometryDataWatcher;
109
#
endif
110
bool
m_geometryUpdateRequested =
false
;
111
bool
m_pendingAsyncUpdate =
false
;
112
};
113
114
QT_END_NAMESPACE
115
116
#
endif
// CYLINDERGEOMETRY_P_H
CylinderGeometry
Definition
cylindergeometry_p.h:33
QT_BEGIN_NAMESPACE::createCylinderSidesIndices
void createCylinderSidesIndices(quint16 *&indicesPtr, int rings, int slices)
Definition
cylindergeometry.cpp:62
QT_BEGIN_NAMESPACE::createCylinderDiscVertices
void createCylinderDiscVertices(float *&verticesPtr, int slices, double topRadius, double bottomRadius, double length, double yPosition)
Definition
cylindergeometry.cpp:84
QT_BEGIN_NAMESPACE::createCylinderSidesVertices
void createCylinderSidesVertices(float *&verticesPtr, int rings, int slices, double topRadius, double bottomRadius, double length)
Definition
cylindergeometry.cpp:20
QT_BEGIN_NAMESPACE::createCylinderDiscIndices
void createCylinderDiscIndices(quint16 *&indicesPtr, int discCenterIndex, int slices, bool isTopCap)
Definition
cylindergeometry.cpp:146
qtquick3d
src
helpers
cylindergeometry_p.h
Generated on
for Qt by
1.18.0