Generic Initializer

init(indices:primitiveType:)

Creates a geometry element from the specified array of index values.

Declaration

convenience init<IndexType>(indices: [IndexType], primitiveType: SCNGeometryPrimitiveType) where IndexType : FixedWidthInteger

Parameters

indices

An array of index values, each of which identifies a vertex in a geometry source.

primitiveType

The drawing primitive that connects vertices when rendering the geometry element. For possible values, see SCNGeometryPrimitiveType.

Return Value

A new geometry element object.

Discussion

SceneKit connects the vertices in the order specified by the indices array, arranged according to the primitiveType parameter.This initializer is equivalent to the init(data:primitiveType:primitiveCount:bytesPerIndex:) initializer, but does not require an intermediary Data object; instead, it automatically infers the necessary allocation size and bytesPerIndex values based on the contents of the indices array.

To create a custom SCNGeometry object from the geometry element, use the init(sources:elements:) initializer.

See Also

Creating a Geometry Element

init(mdlSubmesh: MDLSubmesh)

Creates a geometry element from the specified Model I/O submesh object.