mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 06:59:13 +01:00
Merge remote-tracking branch 'origin/feat/switch-fastenings' into feat/renderers-cleanup
This commit is contained in:
@@ -1633,6 +1633,16 @@ void TTrack::create_geometry( gfx::geometrybank_handle const &Bank ) {
|
||||
auto const layout { plan_rails( Bank != 0 ) };
|
||||
if( Bank != 0 ) {
|
||||
m_crossings = layout.crossed;
|
||||
for( int path = 0; path < 2; ++path ) {
|
||||
for( int side = 0; side < 2; ++side ) {
|
||||
m_railplans[ path ][ side ] = layout.plans[ path ][ side ];
|
||||
m_railguards[ path ][ side ].clear();
|
||||
for( auto const &guard : layout.guards[ path ][ side ] ) {
|
||||
m_railguards[ path ][ side ].emplace_back( guard.from, guard.to );
|
||||
}
|
||||
}
|
||||
}
|
||||
track_sleepers::forget_rails( *this );
|
||||
}
|
||||
auto const lay_rail = [&]( int const Path, gfx::vertex_array const &Profile, int const Side, float const Texturelength, double const From, bool const Openstart, bool const Openend, geometryhandle_sequence &Geometry, geometryhandle_sequence &Cuts ) {
|
||||
return this->lay_rail( layout, drawing, Path, Profile, Side, Texturelength, From, Openstart, Openend, Geometry, Cuts ); };
|
||||
@@ -2356,8 +2366,9 @@ void TTrack::loft_blade( int const Path, gfx::vertex_array const &Rail, gfx::ver
|
||||
offsets.emplace_back( bend.x, -thrown * bend.y );
|
||||
}
|
||||
auto const size { rail_dimensions() };
|
||||
auto const rise { track_sleepers::blade_rise( *this ) };
|
||||
auto const length { SwitchExtension->Segments[ Path ]->GetLength() };
|
||||
SwitchExtension->Segments[ Path ]->RenderLoftSpan( Vertices, m_origin, Rail, { .side = blade_side( Path ), .halfwidth = 0.5f * std::abs( fTrackWidth ), .texturelength = Texturelength, .from = shape.tip, .to = std::min( shape.heel, length ), .offsets = offsets, .extents = shape.extents, .walls = true, .drops = shape.drops, .head = { size.neck, size.crest } } );
|
||||
SwitchExtension->Segments[ Path ]->RenderLoftSpan( Vertices, m_origin, Rail, { .side = blade_side( Path ), .halfwidth = 0.5f * std::abs( fTrackWidth ), .texturelength = Texturelength, .from = shape.tip, .to = std::min( shape.heel, length ), .offsets = offsets, .extents = shape.extents, .walls = true, .drops = shape.drops, .head = { size.neck, size.crest }, .rise = rise } );
|
||||
// the blade running on past the end of the path goes on along the plain track joined there, whose rail starts behind the heel
|
||||
if( auto const *next { track_rails::runon_track( *this, Path ) }; next != nullptr && shape.heel > length + 1e-3 ) {
|
||||
auto const along = [&]( std::vector<glm::dvec2> const &Knots ) {
|
||||
@@ -2366,7 +2377,7 @@ void TTrack::loft_blade( int const Path, gfx::vertex_array const &Rail, gfx::ver
|
||||
result.emplace_back( knot.x - length, knot.y );
|
||||
}
|
||||
return result; };
|
||||
next->Segment->RenderLoftSpan( Vertices, m_origin, Rail, { .side = blade_side( Path ), .halfwidth = 0.5f * std::abs( fTrackWidth ), .texturelength = Texturelength, .from = 0.0, .to = shape.heel - length, .offsets = along( offsets ), .extents = along( shape.extents ), .walls = true, .drops = along( shape.drops ), .head = { size.neck, size.crest } } );
|
||||
next->Segment->RenderLoftSpan( Vertices, m_origin, Rail, { .side = blade_side( Path ), .halfwidth = 0.5f * std::abs( fTrackWidth ), .texturelength = Texturelength, .from = 0.0, .to = shape.heel - length, .offsets = along( offsets ), .extents = along( shape.extents ), .walls = true, .drops = along( shape.drops ), .head = { size.neck, size.crest }, .rise = rise } );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user