MeshGeometry constructor

MeshGeometry(
  1. int length,
  2. List<VertexAttrib> attributes
)

Implementation

factory MeshGeometry(int length, List<VertexAttrib> attributes) {
  var stride = 0;
  for (var a in attributes) {
    stride += a.elementSize * a.size;
  }
  var offset = 0;
  final attribs = <VertexAttrib>[];
  for (var a in attributes) {
    attribs.add(VertexAttrib._resetStrideOffset(a, stride, offset));
    offset += a.elementSize * a.size;
  }

  return MeshGeometry._internal(length, stride, attribs);
}