MeshGeometry.copy constructor

MeshGeometry.copy(MeshGeometry mesh)

Implementation

MeshGeometry.copy(MeshGeometry mesh)
    : stride = mesh.stride,
      length = mesh.length,
      attribs = mesh.attribs {
  // Copy the buffer
  buffer = new Float32List(mesh.buffer.length);
  buffer.setAll(0, mesh.buffer);

  // Copy the indices
  if (mesh.indices != null) {
    indices = new Uint16List(mesh.indices.length);
    indices.setAll(0, mesh.indices);
  }
}