trackBuilder/segmentToProceduralMesh - Segment Mesh Generator
Reference for `extensions/util/trackBuilder/segmentToProceduralMesh.lua`. Converts track segments (with computed spline points) into ProceduralMesh objects rendered in the scene.
Reference for extensions/util/trackBuilder/segmentToProceduralMesh.lua. Converts track segments (with computed spline points) into ProceduralMesh objects rendered in the scene.
Exports
| Key | Signature | Description |
|---|---|---|
materialize | (segment) | Generates and applies the procedural mesh for a segment |
calculatePointCoordinateSystem | (segment) | Computes per-point orientation vectors (nx, ny, nz) |
compileMeshInfo | (segment, lod?) | Collects mesh data from all sub-generators |
rotateVectorByQuat | (v, q) → vec3 | Vector rotation helper |
clearShapes | () | Clears cached shape data in basicCenters |
getReferences | () → table | Returns {basicCenters, basicBorders} for use by other modules |
Internals
- Sub-generators imported via
require:basicCenters- center road surface meshbasicBorders- border/edge strip meshborderWall- side wall meshceilingMesh- overhead ceiling mesh
- Coordinate system: For each control point with sufficient quality level, computes three orthogonal vectors from
finalRot: nx (right), ny (forward), nz (up). - LOD: Three detail levels are stored, but currently all set to the same mesh (
meshes[1] = meshes[2] = meshes[3]). - ProceduralMesh creation: If the segment has no existing mesh object, one is created and registered in
MissionGroup. Otherwise, the existing object is updated viacreateMesh.
Internal State
| Field | Type | Description |
|---|---|---|
M.settings | varies | Assigned as settings |
How It Works
materialize(segment)is called after spline points and interpolation values are computed.calculatePointCoordinateSystemderives orientation vectors for each point.compileMeshInfogathers meshes from all four sub-generators (centers, borders, walls, ceiling).- The combined mesh array is passed to
ProceduralMesh:createMesh()for rendering. - Submesh indexes are tracked in
segment.submeshIndexesfor per-submesh material assignment.
-- After spline computation and interpolation:
mesher.materialize(segment)
-- segment.mesh now holds a ProceduralMesh scene object
-- Access sub-generator references for intersection merging:
local refs = mesher.getReferences()
-- refs.basicCenters, refs.basicBordersAdditional Exports
M.calculatePointCoordinateSystem- (undocumented)M.clearShapes- (undocumented)M.compileMeshInfo- (undocumented)M.getReferences- (undocumented)M.materialize- (undocumented)M.rotateVectorByQuat- (undocumented)
trackBuilder/quickraceSetup - Quick Race Track Loader
Reference for `extensions/util/trackBuilder/quickraceSetup.lua`. Loads a saved track and sets up checkpoints/vehicle positioning when a quick race scenario starts.
trackBuilder/splineTrack - Main Track Builder Engine
Reference for `extensions/util/trackBuilder/splineTrack.lua`. The central module of the track editor - manages track pieces, converts them to spline geometry, handles markers, materials, checkpoints,