CylinderMeshThe CylinderMesh item represents a simple cylinder in 3D space. More... Inherits Mesh CylinderMesh instantiates the C++ class CylinderMesh This type was introduced in Qt 4.8. Detailed DescriptionThe CylinderMesh element in QML provides a way to create a simple cylinder object, usually for testing material effects. Cylinder's center is its barycenter. For example, the following QML code displays a green cylinder with a uniform diameter of 0.5, and a length of 3.0: Item3D { mesh: CylinderMesh { radius: 0.5 length: 3.0 } effect: Effect { color: "#aaca00" } } The CylinderMesh element is part of the Qt3D.Shapes namespace, so the following must appear at the top of any QML file that references it: import Qt3D.Shapes 1.0 The cylinder shape can have differing levels of detail, allowing for additional slices and layers to be drawn if more detailed meshes are required. To display the cylinder mesh you can create your own Item3D as shown above, or use the convenience Cylinder QML Component. Cylinder { radius: 0.5 length: 3.0 effect: Effect { color: "#aaca00" } } Performance Hints for Larger ScenesThe convenience Cylinder QML component will create a new mesh each time is instantiated. If you have a scene with a number of similar capsules use your own Item3D elements to all refer to the same mesh. See the Performance Hints section of the SphereMesh documentation for more details on this important technique. Performance Hints for AnimationSome support for animation of the CylinderMesh properties is provided by utilizing a QGraphicsScale3D to implement the length & radius properties, and by caching levels of detail. So within limits animation of these items should provide reasonable results. Be aware that on constrained devices animation of the level of detail for many cylinders could cause problems with memory usage due to the caching. See also Item3D and SphereMesh. |