buildMesh method
Its triangles, textured by uv.
Implementation
@override
Shape3DMesh buildMesh([Shape3DUv uv = Shape3DUv.natural]) {
final big = Primitive3DComponent.size(radius),
r = Primitive3DComponent.size(tubeRadius);
final t = Primitive3DComponent.count(sides, 3, 64);
final b = MeshBuilder(uv)
..lathe(
[
for (var k = 0; k <= t; k++)
(
big + r * math.cos(2 * math.pi * k / t),
-r * math.sin(2 * math.pi * k / t),
math.cos(2 * math.pi * k / t),
-math.sin(2 * math.pi * k / t),
uv.anyway(r * 2 * math.pi * k / t),
),
],
Primitive3DComponent.count(segments, 3, 128),
aroundLength: uv.around(big),
profileLength: uv.anyway(r * 2 * math.pi),
);
final mesh = b.build();
return smooth ? mesh : mesh.faceted();
}