mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-31 22:49:05 +01:00
feat(track): the blades of the switches laid in the editor shaped from their templates with the frogs still whole: the blades alone are on (track_features::blades), the rails cut at the frogs, the wing and the check rails stay off. A switch with the key frogs draws its blades from the tip where their planed nose ends to the heel, bent as they're thrown, the rail behind them from the heel on, where they were laid from the start of the switch before; on a switch of the catalogue they start at the cut tip of the tables, 1.248 m from the joint at R 190, 1.5 m at R 300. The plain track a blade of a double switch runs on into starts its rail behind the heel. The switches without the key, laid by other tools, and the ones of a double slip, whose blades end short of crossings found only with the rails cut, keep the blades they had. The paths the vehicles run on don't change
This commit is contained in:
@@ -96,6 +96,19 @@ bool cut_rails( TTrack const &Track ) {
|
|||||||
Track.eType == tt_Switch && Track.SwitchExtension && Track.SwitchExtension->m_frogs && Track.SwitchExtension->Segments[ 0 ] && Track.SwitchExtension->Segments[ 1 ] );
|
Track.eType == tt_Switch && Track.SwitchExtension && Track.SwitchExtension->m_frogs && Track.SwitchExtension->Segments[ 0 ] && Track.SwitchExtension->Segments[ 1 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool shaped_blades( TTrack const &Track ) {
|
||||||
|
|
||||||
|
if( cut_rails( Track ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return track_features::blades
|
||||||
|
&& ( Track.iCategoryFlag & 15 ) == 1
|
||||||
|
&& Track.m_material1 != null_handle
|
||||||
|
&& false == Track.m_editorremoved
|
||||||
|
&& Track.eType == tt_Switch && Track.SwitchExtension && Track.SwitchExtension->m_frogs && Track.SwitchExtension->Segments[ 0 ] && Track.SwitchExtension->Segments[ 1 ]
|
||||||
|
&& false == Track.DoubleSlip();
|
||||||
|
}
|
||||||
|
|
||||||
int blade_steps( TTrack const &Track, int const Path ) {
|
int blade_steps( TTrack const &Track, int const Path ) {
|
||||||
|
|
||||||
return static_cast<int>( std::ceil( Track.SwitchExtension->Segments[ Path ]->RaSegCount() * 0.65 ) );
|
return static_cast<int>( std::ceil( Track.SwitchExtension->Segments[ Path ]->RaSegCount() * 0.65 ) );
|
||||||
@@ -131,7 +144,7 @@ TTrack const *runon_track( TTrack const &Switch, int const Path ) {
|
|||||||
double blade_runon( TTrack const &Track, int const Side ) {
|
double blade_runon( TTrack const &Track, int const Side ) {
|
||||||
|
|
||||||
auto const *owner { Track.trPrev };
|
auto const *owner { Track.trPrev };
|
||||||
if( Track.eType != tt_Normal || Track.Segment == nullptr || owner == nullptr || owner->eType != tt_Switch || false == cut_rails( *owner ) ) {
|
if( Track.eType != tt_Normal || Track.Segment == nullptr || owner == nullptr || owner->eType != tt_Switch || false == shaped_blades( *owner ) ) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
for( int path = 0; path < 2; ++path ) {
|
for( int path = 0; path < 2; ++path ) {
|
||||||
@@ -831,7 +844,7 @@ track_rails::switch_blade const &TTrack::blade( int const Path ) const {
|
|||||||
}
|
}
|
||||||
cached = switch_blade {};
|
cached = switch_blade {};
|
||||||
auto &result { *cached };
|
auto &result { *cached };
|
||||||
if( eType != tt_Switch || false == cut_rails( *this ) || m_profiles.empty() ) {
|
if( eType != tt_Switch || false == shaped_blades( *this ) || m_profiles.empty() ) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
auto const side { blade_side( Path ) };
|
auto const side { blade_side( Path ) };
|
||||||
|
|||||||
@@ -1637,7 +1637,13 @@ void TTrack::create_geometry( gfx::geometrybank_handle const &Bank ) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
vertices.clear(); // reuse the scratchpad
|
vertices.clear(); // reuse the scratchpad
|
||||||
Segment->RenderLoft( vertices, m_origin, profile, iTrapezoid > 0, texturelength );
|
// the rail starts behind the heel of a blade running on into the track from the switch before it
|
||||||
|
if( auto const runon { eType == tt_Normal && iTrapezoid == 0 ? track_rails::blade_runon( *this, side ) : 0.0 }; runon > 0.0 ) {
|
||||||
|
Segment->RenderLoftSpan( vertices, m_origin, profile, { .side = side, .halfwidth = 0.5f * std::abs( fTrackWidth ), .texturelength = texturelength, .from = runon, .to = Segment->GetLength() } );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Segment->RenderLoft( vertices, m_origin, profile, iTrapezoid > 0, texturelength );
|
||||||
|
}
|
||||||
if( open ) {
|
if( open ) {
|
||||||
cut_faces( vertices, nnumPts, trPrev == nullptr, trNext == nullptr, GeometryCut1 );
|
cut_faces( vertices, nnumPts, trPrev == nullptr, trNext == nullptr, GeometryCut1 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,5 +17,8 @@ namespace track_features {
|
|||||||
bool constexpr crossings { false };
|
bool constexpr crossings { false };
|
||||||
// the 3D sleepers and switch timbers of sleepers3d; off, the tracks keep their ballast whatever eu07.ini sets
|
// the 3D sleepers and switch timbers of sleepers3d; off, the tracks keep their ballast whatever eu07.ini sets
|
||||||
bool constexpr sleepers { false };
|
bool constexpr sleepers { false };
|
||||||
|
// the blades of the switches with the key frogs shaped as their templates have them, from the tip their planed nose ends at to the heel,
|
||||||
|
// with the rails left whole where the crossings are off; off with the crossings too, they're laid from the start of the switch as before
|
||||||
|
bool constexpr blades { true };
|
||||||
|
|
||||||
} // namespace track_features
|
} // namespace track_features
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ double check_length( double const Slope );
|
|||||||
double movable_nose_length( double const Slope );
|
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
|
// 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 );
|
bool cut_rails( TTrack const &Track );
|
||||||
|
// the blades of the switch are shaped from the tip to the heel: with the rails cut, or alone where only the blades are on, but for the
|
||||||
|
// switches of a double slip, whose blades end short of crossings found only with the rails cut
|
||||||
|
bool shaped_blades( TTrack const &Track );
|
||||||
int blade_steps( TTrack const &Track, int const Path );
|
int blade_steps( TTrack const &Track, int const Path );
|
||||||
double blade_length( 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
|
// 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
|
||||||
|
|||||||
Reference in New Issue
Block a user