33 Q_PROPERTY(
float radius READ radius WRITE setRadius NOTIFY radiusChanged FINAL)
34 Q_PROPERTY(
float length READ length WRITE setLength NOTIFY lengthChanged FINAL)
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(
bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
38 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
40 QML_ADDED_IN_VERSION(6, 9)
42 enum Status { Null, Ready, Loading, Error };
45 explicit CylinderGeometry(QQuick3DObject *parent =
nullptr);
46 ~CylinderGeometry() override;
48 void setRadius(
float newRadius);
50 void setLength(
float newLength);
53 void setRings(
int newRings);
56 void setSegments(
int newSegments);
58 bool asynchronous()
const;
59 void setAsynchronous(
bool newAsynchronous);
61 Status status()
const;
64 void doUpdateGeometry();
65 void requestFinished();
71 void segmentsChanged();
72 void asynchronousChanged();
77 QByteArray vertexData;
83 void scheduleGeometryUpdate();
84 void updateGeometry(
const GeometryData &geometryData);
86 static CylinderGeometry::GeometryData generateCylinderGeometry(
float radius,
90#if QT_CONFIG(concurrent)
91 static void generateCylinderGeometryAsync(QPromise<CylinderGeometry::GeometryData> &promise,
98 float m_radius = 50.0f;
99 float m_length = 100.0f;
102 bool m_asynchronous =
true;
103 Status m_status = Null;
104#if QT_CONFIG(concurrent)
105 QFuture<GeometryData> m_geometryDataFuture;
106 QFutureWatcher<GeometryData> m_geometryDataWatcher;
108 bool m_geometryUpdateRequested =
false;
109 bool m_pendingAsyncUpdate =
false;