buildRoadMesh function

MeshData buildRoadMesh(
  1. TrackSpline track, {
  2. RoadMeshSettings settings = const RoadMeshSettings(),
  3. VertexLayout? layout,
})

The road surface itself, kerb to kerb.

The texture runs along the road rather than across it: v is the distance travelled, in tiles, so a repeating surface repeats down the straight and nothing has to line up between one segment and the next. u runs from nought at one edge to one at the other, whatever the road is doing — a corner that narrows keeps its markings at its edges rather than sliding them inwards.

Implementation

MeshData buildRoadMesh(
  TrackSpline track, {
  RoadMeshSettings settings = const RoadMeshSettings(),
  VertexLayout? layout,
}) => _ribbon(
  track,
  settings,
  layout,
  inner: (double s) => -track.widthAt(s) / 2.0,
  outer: (double s) => track.widthAt(s) / 2.0,
);