Initializes a vertex attribute object with the specified property values.
SDKs
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- Model I/O
Declaration
init(name: String, format: MDLVertex Format, offset: Int, bufferIndex: Int)
Parameters
name
An identifier for the semantic use of the vertex attribute.
format
The format of per-vertex data for the attribute.
offset
The offset, in bytes, of vertex data for the attribute in a vertex buffer, relative to the start of data for each vertex.
bufferIndex
The index of the vertex buffer containing data for this attribute in a mesh’s
vertex
array.Buffers
Return Value
A new vertex attribute object.
Discussion
Use this initializer when constructing a new mesh from custom data, or when building a new MDLVertex
object to change the vertex buffer formatting of an existing mesh. When you load a mesh from a MDLAsset
object, Model I/O automatically creates vertex descriptor and vertex attribute objects describing the mesh’s vertex data.