17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-28 14:37:29 +01:00

fix(track): at a crossing at a wide angle the floor of the flangeway between a running rail and its guard rail is laid only where real crossings have it, as the cast floor of each corner up to 0.3 m past the rail of the other track and as separate spacer blocks every 0.5 m along the rest of the guard, and the floor takes its texture across its width at the scale of the head instead of one stretched column; the wheels of the other track roll over a guard rail across their whole tread instead of only over the head of their rail; and when the tracks cross at nearly a right angle the treads of the other track are laid as plain spans along the rail instead of lines running almost straight across it, which left fins standing up at every edge of a tread

This commit is contained in:
maj00r
2026-10-14 12:43:36 +02:00
parent c177581d8f
commit 1fa7dee5d6
3 changed files with 86 additions and 21 deletions

View File

@@ -169,15 +169,15 @@ using namespace track_rails;
namespace {
gfx::vertex_array box_profile( float const Bottom, float const Top, float const Texture ) {
gfx::vertex_array box_profile( float const Bottom, float const Top, float const Texture, float const Spread = 0.f ) {
return {
{{ 1.f, Bottom, 0.f }, { 1.f, 0.f, 0.f }, { Texture, 0.f }},
{{ 1.f, Top, 0.f }, { 1.f, 0.f, 0.f }, { Texture, 0.f }},
{{ 1.f, Top, 0.f }, { 0.f, 1.f, 0.f }, { Texture, 0.f }},
{{ -1.f, Top, 0.f }, { 0.f, 1.f, 0.f }, { Texture, 0.f }},
{{ -1.f, Top, 0.f }, { -1.f, 0.f, 0.f }, { Texture, 0.f }},
{{ -1.f, Bottom, 0.f }, { -1.f, 0.f, 0.f }, { Texture, 0.f }} };
{{ 1.f, Bottom, 0.f }, { 1.f, 0.f, 0.f }, { Texture + Spread, 0.f }},
{{ 1.f, Top, 0.f }, { 1.f, 0.f, 0.f }, { Texture + Spread, 0.f }},
{{ 1.f, Top, 0.f }, { 0.f, 1.f, 0.f }, { Texture + Spread, 0.f }},
{{ -1.f, Top, 0.f }, { 0.f, 1.f, 0.f }, { Texture - Spread, 0.f }},
{{ -1.f, Top, 0.f }, { -1.f, 0.f, 0.f }, { Texture - Spread, 0.f }},
{{ -1.f, Bottom, 0.f }, { -1.f, 0.f, 0.f }, { Texture - Spread, 0.f }} };
}
} // namespace
@@ -243,7 +243,16 @@ TTrack::rail_drawing TTrack::make_rail_drawing( gfx::geometrybank_handle const &
break;
}
}
sides( box_profile( bottom, neck, webtexture ), drawing.fillers );
glm::vec2 across { 1e9f, -1e9f };
glm::vec2 band { 1e9f, -1e9f };
for( std::size_t i = 0; i < outline.size() / 2; ++i ) {
if( outline[ i ].position.y > highest - 0.0005f ) {
across = { std::min( across.x, outline[ i ].position.x ), std::max( across.y, outline[ i ].position.x ) };
band = { std::min( band.x, outline[ i ].texture.s ), std::max( band.y, outline[ i ].texture.s ) };
}
}
auto const spread { across.y > across.x ? ( band.y - band.x ) / ( across.y - across.x ) : 0.f };
sides( box_profile( bottom, neck, webtexture, spread ), drawing.fillers );
}
return drawing;
}