bridge library

The visual half of the genre: a circuit turned into something to draw, and the lap and position readouts a game lays out over it.

This is the one file here allowed to see a renderer, and the isolation test names it. The readouts it exports are widgets rather than a renderer, and they are here because the simulation's barrel names no Flutter either. Everything else in this package is a simulation and stays testable without a device; the road, however, has to become triangles somewhere, and the rule this repository keeps is that the somewhere is a file that says so.

The road is built rather than authored, which follows from the road not being collision geometry either — see TrackSpline. One curve, a width and a camber describe the surface a car drives on, and the same three describe the surface a player sees. A mesh drawn from a different description than the one being driven on is a mesh whose edges are in the wrong place, and that is the bug this avoids by construction.

Classes

LapReadout
Which lap this is, out of how many.
PositionReadout
Where this car is in the field.
ReadoutStyle
How a game wants its readouts drawn.
RoadMeshSettings
How finely the road is cut into rings.

Functions

buildBarrierMeshes(TrackSpline track, {required int side, RoadMeshSettings settings = const RoadMeshSettings(), VertexLayout? layout}) → List<MeshData>
The walls, where the track says there are walls.
buildRoadMesh(TrackSpline track, {RoadMeshSettings settings = const RoadMeshSettings(), VertexLayout? layout}) → MeshData
The road surface itself, kerb to kerb.
buildVergeMesh(TrackSpline track, {required int side, RoadMeshSettings settings = const RoadMeshSettings(), VertexLayout? layout}) → MeshData
The ground either side of the road, out to where the level takes over.
trackOutline(TrackSpline track, {double step = 12.0}) → List<Vector2>
The lap as a flat outline, for a map in the corner of the screen.