Type Method


Creates a mesh in the shape of an ellipsoid or sphere.


+ (instancetype)newEllipsoidWithRadii:(vector_float3)radii radialSegments:(NSUInteger)radialSegments verticalSegments:(NSUInteger)verticalSegments geometryType:(MDLGeometryType)geometryType inwardNormals:(BOOL)inwardNormals hemisphere:(BOOL)hemisphere allocator:(id<MDLMeshBufferAllocator>)allocator;



A vector containing the width (x-component), height (y-component), and depth (z-component) of the bounding box of the ellipsoid to generate. If all components are equal, this method generates a sphere.


The number of points to generate around the horizontal circumference of the ellipsoid (that is, its cross-section in the xz-plane). A larger number of points increases rendering fidelity but decreases rendering performance.


The number of points to generate along the height of the ellipsoid. A larger number of points increases rendering fidelity but decreases rendering performance.


The type of geometric primitive from which to construct the mesh; must be either MDLGeometryKindTriangles or MDLGeometryKindQuads.


YES to generate normal vectors pointing toward the center of the ellipsoid; NO to generate normal vectors pointing outward.


YES to generate only the upper half of the ellipsoid or sphere (a dome); NO to generate a complete ellipsoid or sphere.


An object responsible for allocating mesh vertex data. If nil, Model I/O uses an internal allocator object.

Return Value

A new mesh object.


This method generates vertex data for an ellipsoid centered at the origin of its local coordinate system.

The inwardNormals parameter determines the direction of generated vertex normal vectors for the mesh. Specify YES if the mesh will be viewed from inside (for example, for use in a sky effect), or NO if the mesh will be viewed from outside.

The allocator parameter controls vertex data allocation for the mesh. For example, to use the MetalKit framework for loading vertex data into GPU buffers for rendering using Metal, pass a MTKMeshBufferAllocator object. By specifying an allocator, you can ensure that mesh data is copied a minimal number of times between being read from a file and being loaded into GPU memory for rendering.

See Also

Creating Parametric Meshes

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software