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

fix(track): 3D sleepers let go of the beams of the tracks far away

This commit is contained in:
2026-10-21 18:19:21 +02:00
parent 83c8c23c80
commit 9c2520ea52
7 changed files with 65 additions and 5 deletions

View File

@@ -5889,6 +5889,11 @@ void opengl46_renderer::Render_Timbers( scene::basic_cell::path_sequence::const_
// the distance is taken from the camera of the view, the shadow pass culling against its own frustum
auto const camera = ( shadows ? m_renderpass.viewport_camera.position() : m_renderpass.pass_camera.position() );
auto const range = static_cast<double>( shadows ? std::min( Global.SleeperDistance, 50.f ) : Global.SleeperDistance );
if( m_renderpass.draw_mode == rendermode::color && m_timbersweepframe != m_framestamp ) {
// once a frame the beams of the tracks well past where they're laid and worked out ahead are let go
m_timbersweepframe = m_framestamp;
track_sleepers::release_far( camera, range + 600.0 );
}
glm::mat4 const originmodelview = OpenGLMatrices.data( GL_MODELVIEW );
for( auto &bucket : m_timberbuckets ) {
bucket.instances.clear();

View File

@@ -598,6 +598,7 @@ class opengl46_renderer : public gfx_renderer {
bool m_particlesoft{false}; // the depth for the soft particles is bound in the colour pass being drawn
unsigned int m_framestamp; // id of currently rendered gfx frame
unsigned int m_timbersweepframe { 0 }; // the frame the beams of the tracks far away were last let go in
float m_framerate;
double m_updateaccumulator{0.0};
std::string m_debugtimestext;