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)
42 QML_ADDED_IN_VERSION(6, 9)
44 enum Status { Null, Ready, Loading, Error };
47 explicit CylinderGeometry(QQuick3DObject *parent =
nullptr);
48 ~CylinderGeometry() override;
50 void setRadius(
float newRadius);
52 void setLength(
float newLength);
55 void setRings(
int newRings);
58 void setSegments(
int newSegments);
60 bool asynchronous()
const;
61 void setAsynchronous(
bool newAsynchronous);
63 Status status()
const;
66 void doUpdateGeometry();
67 void requestFinished();
73 void segmentsChanged();
74 void asynchronousChanged();
79 QByteArray vertexData;
85 void scheduleGeometryUpdate();
86 void updateGeometry(
const GeometryData &geometryData);
88 static CylinderGeometry::GeometryData generateCylinderGeometry(
float radius,
92#if QT_CONFIG(concurrent)
93 static void generateCylinderGeometryAsync(QPromise<CylinderGeometry::GeometryData> &promise,
100 float m_radius = 50.0f;
101 float m_length = 100.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;
110 bool m_geometryUpdateRequested =
false;
111 bool m_pendingAsyncUpdate =
false;