Instance Method

addAttribute(withName:format:)

Adds a vertex attribute to the mesh and creates a new, empty corresponding vertex buffer.

Declaration

func addAttribute(withName name: String, format: MDLVertexFormat)

Parameters

name

A name for the new attribute. See Vertex Attributes for standard attribute names.

format

The data format for the new attribute.

Discussion

Calling this method updates the mesh’s vertexDescriptor object to reflect the new attribute, and then uses the same MDLMeshBufferAllocator object shared by the mesh’s existing vertex buffers to allocate new, empty storage for the new attribute’s vertex data. This method has no effect if the mesh already contains an attribute with the specified name; to overwrite or rearrange existing attribute data, use the vertexDescriptor property.