face method

void face(
  1. List<(double, double, double)> corners,
  2. double nx,
  3. double ny,
  4. double nz, {
  5. bool stretch = false,
})

A flat face through corners (x, y, z each, in order round a convex outline) facing (nx, ny, nz); its texture spans it once when stretch and the layout is natural, else by planar.

Implementation

void face(
  List<(double, double, double)> corners,
  double nx,
  double ny,
  double nz, {
  bool stretch = false,
}) {
  final first = vertexCount;
  for (final (x, y, z) in corners) {
    final (u, v) = planar(x, y, z, nx, ny, nz);
    vertex(x, y, z, nx, ny, nz, u, v);
  }
  if (stretch && !uv.metres) fitTexture(first, vertexCount);
  for (var k = 1; k + 1 < corners.length; k++) {
    triangle(first, first + k, first + k + 1);
  }
}