buildVergeMesh function
MeshData
buildVergeMesh(
- TrackSpline track, {
- required int side,
- RoadMeshSettings settings = const RoadMeshSettings(),
- VertexLayout? layout,
The ground either side of the road, out to where the level takes over.
side is -1 for the left of the track and 1 for the right — the same
sign as lateral everywhere else.
Implementation
MeshData buildVergeMesh(
TrackSpline track, {
required int side,
RoadMeshSettings settings = const RoadMeshSettings(),
VertexLayout? layout,
}) {
final sign = side < 0 ? -1.0 : 1.0;
return _ribbon(
track,
settings,
layout,
inner: (double s) => sign * track.widthAt(s) / 2.0,
outer: (double s) => sign * (track.widthAt(s) / 2.0 + track.shoulder),
// A verge that tiles at the road's rate looks like more road. This is
// ground, and ground is bigger.
tileScale: 2.5,
);
}