Initializes a submesh by copying or converting another submesh.


init?(mdlSubmesh submesh: MDLSubmesh, indexType: MDLIndexBitDepth, geometryType: MDLGeometryType)



The submesh to copy or convert from.


The data type of each index for the new submesh’s index buffer.


The type of geometric primitives for the new submesh’s index buffer.

Return Value

A new submesh object.


If the indexType or geometryType parameter does not match the corresponding property of the object in the submesh parameter, this method creates a new index buffer by converting the submesh’s index buffer to the described format while preserving shape and topology. For example, you can use this method to convert a quad mesh to a triangle mesh for rendering using GPUs that do not support quad primitives, or to convert a triangle mesh to triangle strips to create a smaller index buffer.

If the indexType and geometryType parameters match the corresponding properties of the input submesh, this method simply copies that submesh’s index buffer to create the new submesh.