Vertices.fromFloat32List constructor
Vertices.fromFloat32List(
- Float32List vertices
Creates a new collection of triangle vertices from the specified Float32List, interpreted as x,y pairs.
Implementation
factory Vertices.fromFloat32List(Float32List vertices) {
if (vertices.length.isOdd) {
throw ArgumentError(
'must be an even number of vertex points',
'vertices',
);
}
final List<Point> vertexPoints = <Point>[];
for (int index = 0; index < vertices.length; index += 2) {
vertexPoints.add(Point(vertices[index], vertices[index + 1]));
}
return Vertices(vertexPoints);
}