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
torusgeometry_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
TORUSGEOMETRY_P_H
7
#
define
TORUSGEOMETRY_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
TorusGeometry
:
public
QQuick3DGeometry
33
{
34
Q_OBJECT
35
Q_PROPERTY(
int
rings READ rings WRITE setRings NOTIFY ringsChanged FINAL)
36
Q_PROPERTY(
int
segments READ segments WRITE setSegments NOTIFY segmentsChanged FINAL)
37
Q_PROPERTY(
float
radius READ radius WRITE setRadius NOTIFY radiusChanged FINAL)
38
Q_PROPERTY(
float
tubeRadius READ tubeRadius WRITE setTubeRadius NOTIFY tubeRadiusChanged 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
explicit
TorusGeometry(QQuick3DObject *parent =
nullptr
);
47
~TorusGeometry() override;
48
49
int
rings()
const
;
50
void
setRings(
int
newRings);
51
int
segments()
const
;
52
void
setSegments(
int
newSegments);
53
54
float
radius()
const
;
55
void
setRadius(
float
newRadius);
56
57
float
tubeRadius()
const
;
58
void
setTubeRadius(
float
newTubeRadius);
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
ringsChanged();
71
void
segmentsChanged();
72
void
radiusChanged();
73
void
tubeRadiusChanged();
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
TorusGeometry::GeometryData generateTorusGeometry(
int
rings,
89
int
segments,
90
float
radius,
91
float
tubeRadius);
92
#
if
QT_CONFIG
(
concurrent
)
93
static
void
generateTorusGeometryAsync(QPromise<TorusGeometry::GeometryData> &promise,
94
int
rings,
95
int
segments,
96
float
radius,
97
float
tubeRadius);
98
#
endif
99
100
int
m_rings = 50;
101
int
m_segments = 50;
102
float
m_radius = 100.0f;
103
float
m_tubeRadius = 10.0f;
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
// TORUSGEOMETRY_P_H
TorusGeometry
Definition
torusgeometry_p.h:33
UINT_SIZE
const size_t UINT_SIZE
Definition
torusgeometry.cpp:247
VEC3_SIZE
const size_t VEC3_SIZE
Definition
torusgeometry.cpp:245
VEC2_SIZE
const size_t VEC2_SIZE
Definition
torusgeometry.cpp:246
FLOAT_SIZE
const size_t FLOAT_SIZE
Definition
torusgeometry.cpp:244
qtquick3d
src
helpers
torusgeometry_p.h
Generated on
for Qt by
1.18.0