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 c = _corners;
  final h = Primitive3DComponent.size(height),
      d = Primitive3DComponent.size(depth);
  final len = math.sqrt(h * h + d * d);
  final b = MeshBuilder(uv)
    ..face([c[0], c[1], c[2], c[3]], 0, 1, 0) // underneath
    ..face([c[3], c[2], c[4], c[5]], 0, 0, 1) // back
    ..face([c[0], c[1], c[4], c[5]], 0, -d / len, -h / len) // slope
    ..face([c[0], c[3], c[5]], -1, 0, 0)
    ..face([c[1], c[2], c[4]], 1, 0, 0);
  return b.build();
}