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
conegeometry_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
CONEGEOMETRY_P_H
7
#
define
CONEGEOMETRY_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
ConeGeometry
:
public
QQuick3DGeometry
33
{
34
Q_OBJECT
35
Q_PROPERTY(
float
topRadius READ topRadius WRITE setTopRadius NOTIFY topRadiusChanged FINAL)
36
Q_PROPERTY(
float
bottomRadius READ bottomRadius WRITE setBottomRadius NOTIFY bottomRadiusChanged FINAL)
37
Q_PROPERTY(
float
length READ length WRITE setLength NOTIFY lengthChanged FINAL)
38
Q_PROPERTY(
int
rings READ rings WRITE setRings NOTIFY ringsChanged FINAL)
39
Q_PROPERTY(
int
segments READ segments WRITE setSegments NOTIFY segmentsChanged FINAL)
40
Q_PROPERTY(
bool
asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
41
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
42
QML_ELEMENT
43
QML_ADDED_IN_VERSION(6, 9)
44
public
:
45
enum
Status { Null, Ready, Loading, Error };
46
Q_ENUM(Status)
47
48
explicit
ConeGeometry(QQuick3DObject *parent =
nullptr
);
49
~ConeGeometry() override;
50
float
topRadius()
const
;
51
void
setTopRadius(
float
newTopRadius);
52
float
bottomRadius()
const
;
53
void
setBottomRadius(
float
newBottomRadius);
54
55
float
length()
const
;
56
void
setLength(
float
newLength);
57
58
int
rings()
const
;
59
void
setRings(
int
newRings);
60
61
int
segments()
const
;
62
void
setSegments(
int
newSegments);
63
64
bool
asynchronous()
const
;
65
void
setAsynchronous(
bool
newAsynchronous);
66
67
Status status()
const
;
68
69
private
Q_SLOTS:
70
void
doUpdateGeometry();
71
void
requestFinished();
72
73
Q_SIGNALS:
74
void
topRadiusChanged();
75
void
bottomRadiusChanged();
76
void
lengthChanged();
77
void
ringsChanged();
78
void
segmentsChanged();
79
void
asynchronousChanged();
80
void
statusChanged();
81
82
private
:
83
struct
GeometryData {
84
QByteArray vertexData;
85
QByteArray indexData;
86
QVector3D boundsMin;
87
QVector3D boundsMax;
88
};
89
90
void
scheduleGeometryUpdate();
91
void
updateGeometry(
const
GeometryData &geometryData);
92
93
static
ConeGeometry::GeometryData generateConeGeometry(
float
topRadius,
94
float
bottomRadius,
95
float
length,
96
int
rings,
97
int
slices);
98
#
if
QT_CONFIG
(
concurrent
)
99
static
void
generateConeGeometryAsync(QPromise<ConeGeometry::GeometryData> &promise,
100
float
topRadius,
101
float
bottomRadius,
102
float
length,
103
int
rings,
104
int
segments);
105
#
endif
106
107
float
m_topRadius = 0.0f;
108
float
m_bottomRadius = 50.0f;
109
float
m_length = 100.0f;
110
int
m_rings = 0;
111
int
m_segments = 20;
112
bool
m_asynchronous =
true
;
113
Status m_status = Null;
114
#
if
QT_CONFIG
(
concurrent
)
115
QFuture<GeometryData> m_geometryDataFuture;
116
QFutureWatcher<GeometryData> m_geometryDataWatcher;
117
#
endif
118
bool
m_geometryUpdateRequested =
false
;
119
bool
m_pendingAsyncUpdate =
false
;
120
};
121
122
QT_END_NAMESPACE
123
124
#
endif
// CONEGEOMETRY_P_H
ConeGeometry
Definition
conegeometry_p.h:33
QT_BEGIN_NAMESPACE::createConeSidesVertices
void createConeSidesVertices(float *&verticesPtr, int rings, int slices, double topRadius, double bottomRadius, double length)
Definition
conegeometry.cpp:18
QT_BEGIN_NAMESPACE::createConeSidesIndices
void createConeSidesIndices(quint16 *&indicesPtr, int rings, int slices)
Definition
conegeometry.cpp:89
QT_BEGIN_NAMESPACE::createConeDiscVertices
void createConeDiscVertices(float *&verticesPtr, int slices, double topRadius, double bottomRadius, double length, double yPosition)
Definition
conegeometry.cpp:111
QT_BEGIN_NAMESPACE::createDiscIndices
void createDiscIndices(quint16 *&indicesPtr, int discCenterIndex, int slices, bool isTopCap)
Definition
conegeometry.cpp:173
qtquick3d
src
helpers
conegeometry_p.h
Generated on
for Qt by
1.18.0