vertices
The vertices of the mesh.
Declaration
var vertices: ARGeometrySource { get }Discussion
The count equals the total number of vertices. Since each vertex is the type SIMD3<Float>, componentsPerVector is three.
The following code demonstrates retrieving a vertex at a particular index.
extension ARMeshGeometry {
func vertex(at index: UInt32) -> SIMD3<Float> {
assert(vertices.format == MTLVertexFormat.float3, "Expected three floats (twelve bytes) per vertex.")
let vertexPointer = vertices.buffer.contents().advanced(by: vertices.offset + (vertices.stride * Int(index)))
let vertex = vertexPointer.assumingMemoryBound(to: SIMD3<Float>.self).pointee
return vertex
}
}