Type Method

submeshWithSCNGeometryElement:bufferAllocator:

Creates a submesh from the specified SceneKit geometry element, using the specified allocator.

Declaration

+ (instancetype)submeshWithSCNGeometryElement:(SCNGeometryElement *)scnGeometryElement bufferAllocator:(id<MDLMeshBufferAllocator>)bufferAllocator;

Parameters

scnGeometryElement

A SceneKit geometry element.

bufferAllocator

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

Return Value

A new submesh object.

Discussion

SceneKit is a high-level framework for modeling, animating, and displaying 3D scenes. (For details, see SceneKit.) The SCNGeometryElement objects describes only the index data for a 3D object; geometry elements are contained in SCNGeometry objects that manage both the vertex data that a geometry element refers to and the material assignments for rendering each geometry element.

Importing a SceneKit geometry element creates only a MDLSubmesh object. To import geometry elements together with vertex data and material assignments, use the MDLMeshmeshWithSCNGeometry: method.

The allocator parameter controls vertex data allocation for the submesh. 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

Importing Submesh Objects from SceneKit

+ submeshWithSCNGeometryElement:

Creates a submesh from the specified SceneKit geometry element.