Instance Method

addAttributeWithName:format:

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

Declaration

- (void)addAttributeWithName:(NSString *)name format:(MDLVertexFormat)format;

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.

See Also

Working with Vertex Data

boundingBox

The minimum region entirely enclosing the mesh’s vertex positions, expressed in the model coordinate system of the mesh.

submeshes

The array of submeshes to be used in rendering the mesh.

vertexBuffers

The array of buffers that provide vertex data for the mesh.

vertexCount

The number of vertices in the mesh.

vertexDescriptor

A description of the format and layout of the mesh’s vertex buffers.

- vertexAttributeDataForAttributeNamed:

Returns the vertex data for the specified attribute.

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