17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-04 04:12:05 +01:00

feat(track): 3D sleepers and switch timbers, blade heel and throw from templates, one rail carving pass

- sleepers3d / sleepers3dplain / sleepers3dbed in eu07.ini: timbers put together from the begin, main and end parts of a model
  and stretched to their length, plain sleepers of their own model; tracks whose plain sleepers would touch are laid as one
  cluster, lines of timbers led by priority and turned to the bisectors of frogs and crossings at a limited rate, whole timbers
  under crossings, split ones between tracks with room to part them, gaps filled per rail and overlaps shortened or dropped;
  clusters worked out in a background thread while driving, on demand in the editor
- the ballast can be left out under the beams (sleepers3dbed no)
- blades get their heel and throw from the switch template or blades <heel> <throw> in the scenery; blades of double switches
  run on into the track linking them to the next switch
- rail cutting at frogs, wing rails, movable noses and switch crossings done by one carving pass (RailCarve)
- tint of the rail treads applied to the colour only, without the matte band at the frog
- a switch trailed through with a movable nose set the other way derails the vehicle
- self-tests: sleepercheck, sharedzones, beamsnear, throw, sleepersbg
This commit is contained in:
maj00r
2026-10-17 23:28:36 +02:00
parent 21eca4d9a6
commit d25f20a56c
49 changed files with 9802 additions and 848 deletions

View File

@@ -15,14 +15,30 @@ http://mozilla.org/MPL/2.0/.
namespace track_rails {
void forget();
// changes with every forget(): what's kept of the rails around holds as long as it doesn't
unsigned int memo_stamp();
rail_size measure_rail( gfx::vertex_array const &Profile );
// the noses, wing rails and point rails at crossings at small angles are carved out of what lies around them, all by the same rules: no rail
// reaches into the flangeway of another one where its wheels run, and two heads lying over each other share the room between them by what
// the wheels of each roll on
void carve_plans( TTrack &Track, rail_layout &Layout );
// the layout of the track designed already to carve the tracks around against, before carving
rail_layout const *designed_layout( TTrack &Track );
// how many parts carving left with nothing of the head somewhere along them, since the start
int carve_faults();
// how far a wing rail reaches past the crossing point of the rails
double wing_reach( double const Slope );
double check_length( double const Slope );
// how far from the tip the nose of a movable frog bends over to the wing rail
double movable_nose_length( double const Slope );
// the rails of the track are cut where they cross other rails: plain tracks, and switches whose frog is made from the rails
bool cut_rails( TTrack const &Track );
int blade_steps( TTrack const &Track, int const Path );
double blade_length( TTrack const &Track, int const Path );
// the plain track a path of a switch goes on into at its end, laid the same way, which the blade of the path may run on into
TTrack const *runon_track( TTrack const &Switch, int const Path );
// how far the blade of the switch the track goes on from runs on into its rail of Side
double blade_runon( TTrack const &Track, int const Side );
material_handle cut_material( material_handle const Material );
float tread_brightness( material_handle const Material, glm::vec2 const &Band );
glm::vec3 tread_colour( material_handle const Material, glm::vec2 const &Band );
@@ -33,6 +49,16 @@ gfx::userdata_array worn_userdata( std::size_t const Count );
// the ends of rails left open: at track ends with nothing joined, blade tips, the gap of a frog
void cut_faces( gfx::vertex_array const &Strip, std::size_t const Ring, bool const Start, bool const End, gfx::geometrybank_handle const &Bank, TTrack::geometryhandle_sequence &Geometry );
// the geometry of a track laid while one is alive goes into the chunks of the pool given, of the same type, before new ones
class reused_chunks {
public:
reused_chunks( chunk_pool *Pool );
~reused_chunks();
private:
chunk_pool *m_previous { nullptr };
};
gfx::geometry_handle insert_chunk( gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Bank, int const Type );
TSegment const &path_segment( TTrack const &Track, int const Path );
int path_count( TTrack const &Track );
TTrack *path_neighbour( TTrack const &Track, int const Path, int const End );