buildMesh method

  1. @override
ShapeMesh buildMesh([
  1. ShapeUv uv = ShapeUv.natural
])
override

Its triangles, textured by uv.

Implementation

@override
ShapeMesh buildMesh([ShapeUv uv = ShapeUv.natural]) {
  final r = Primitive3D.size(radius), hy = Primitive3D.size(height) / 2;
  final s = Primitive3D.count(segments, 3, 128);
  final side = uv.alongY(hy * 2);
  final b = MeshBuilder(uv)
    ..lathe(
      [(r, -hy, 1, 0, 0), (r, hy, 1, 0, side)],
      s,
      aroundLength: uv.around(r),
      profileLength: side,
    )
    ..disc(r, -hy, s, up: true)
    ..disc(r, hy, s, up: false);
  final mesh = b.build();
  return smooth ? mesh : mesh.faceted();
}