+ // TODO Make profile width configurable
+ Profile profile;
+ if(i==0)
+ {
+ float rail_w = (rail_max.x-rail_min.x)*2;
+ profile.append_vertex(Vector(rail_w*-0.5, 0, 0), false);
+ profile.append_vertex(Vector(rail_w*0.5, 0, 0), false);
+ }
+ else
+ {
+ profile.append_vertex(Vector(i*(gauge*0.5+rail_min.x*2), 0, 0), false);
+ profile.append_vertex(Vector(i*(gauge*0.5+rail_max.x*2), 0, 0), false);
+ }
+
+ // TODO Avoid generating redundant meshes for single-path tracks
+ for(int j=-1; j<=4; ++j)