buildMesh method

  1. @override
Shape3DMesh buildMesh([
  1. Shape3DUv uv = Shape3DUv.natural
])
override

Its triangles, textured by uv.

Implementation

@override
Shape3DMesh buildMesh([Shape3DUv uv = Shape3DUv.natural]) {
  final r = Primitive3DComponent.size(radius);
  final n = Primitive3DComponent.count(rings, 2, 64);
  final b = MeshBuilder(uv)
    ..lathe(
      [
        for (var j = 0; j <= n; j++)
          (
            r * math.sin(math.pi * j / n),
            -r * math.cos(math.pi * j / n),
            math.sin(math.pi * j / n),
            -math.cos(math.pi * j / n),
            uv.anyway(r * math.pi * j / n),
          ),
      ],
      Primitive3DComponent.count(segments, 3, 128),
      aroundLength: uv.around(r),
      profileLength: uv.anyway(r * math.pi),
    );
  final mesh = b.build();
  return smooth ? mesh : mesh.faceted();
}