mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-03 22:22:04 +01:00
fix(track): 3D sleepers of a track's own sleeper model at the height it was fitted to
This commit is contained in:
@@ -3388,8 +3388,9 @@ TTrack::create_track_bed_profile( gfx::vertex_array &Output, TTrack const *Previ
|
||||
{0.5f + map12, 0.f} }; // prawy skos
|
||||
}
|
||||
}
|
||||
if( m_sleepers3d.active ) {
|
||||
// the ballast lowered under the sleepers laid on it, so they stick out of it
|
||||
if( m_sleepers3d.active && false == ( m_sleeper_enabled && false == m_sleeper_model_name.empty() ) ) {
|
||||
// the ballast lowered under the sleepers laid on it, so they stick out of it; the ballast under the sleepers of
|
||||
// the model of the track itself is moved by its own trackbed shift, as without the 3D sleepers
|
||||
for( auto &point : Output ) {
|
||||
point.position.y -= static_cast<float>( track_sleepers::bed_drop );
|
||||
}
|
||||
|
||||
@@ -118,6 +118,10 @@ void lay( TTrack &Track ) {
|
||||
if( false == laid.active || laid.timbers == nullptr ) {
|
||||
return;
|
||||
}
|
||||
// the sleepers of the model of the track itself (sleepermodel) at the height they're drawn at without the 3D sleepers: the
|
||||
// origin of the model at the top of the rails, moved up by the sleeper shift, which the model was fitted to
|
||||
auto const ownplains { laid.plains != nullptr && Track.m_sleeper_enabled && laid.plains != plain_model() };
|
||||
auto const plainlift { ownplains ? Track.rail_height() + Track.m_sleeper_offset.z : 0.f };
|
||||
auto const &parts { *laid.timbers };
|
||||
if( auto const panel { panel_off_plane( Track ) }; panel.first > coplanar_tolerance ) {
|
||||
WriteLog(
|
||||
@@ -202,7 +206,7 @@ void lay( TTrack &Track ) {
|
||||
// the whole sleeper at its own length, its middle under the middle of the track
|
||||
auto const &plain { *laid.plains };
|
||||
laid.plain.emplace_back(
|
||||
glm::translate( frame, glm::vec3 { -0.5f * ( plain.span.x + plain.span.y ), -plain.seat, 0.f } ) );
|
||||
glm::translate( frame, glm::vec3 { -0.5f * ( plain.span.x + plain.span.y ), ( ownplains ? plainlift : -plain.seat ), 0.f } ) );
|
||||
}
|
||||
else if( false == parts.stretchable ) {
|
||||
// a timber of a model which can't be put together, the whole of it stretched to the length
|
||||
|
||||
Reference in New Issue
Block a user