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

feat(editor): the top view of the tracks draws the terrain to the corners of the screen, the ballast optional

- In the top view of the tracks work area, the renderer's reach is the half diagonal of the screen. It used to be three extents, which cut wide windows short.
- Cells far from the camera no longer draw only their tracks: the terrain shapes are drawn too. Models keep their own ranges.
- In that view, the heightmap streamer loads chunks as far as the corners, up to 50 km. The detail comes from the size of a pixel, not from the distance.
- The walk over the chunks around the camera is skipped while it would ask for nothing, so a wide reach costs little.
- A setting, kept in the editor settings, leaves out the ballast of the railway in the top view, so the ground under the tracks shows. It is in the View menu and next to the extent slider.
- Self-test: ortho <extent> [noballast|ballast], orthophoto off.
This commit is contained in:
maj00r
2026-10-19 17:10:27 +02:00
parent 97be54e688
commit d1dbd40566
11 changed files with 128 additions and 11 deletions

View File

@@ -33,6 +33,14 @@ int constexpr EU07_REFLECTIONFIDELITYOFFSET { 250 }; // artificial increase of r
namespace {
// the top view of the editor shows everything this close to the camera, the corners of the screen included
float
editor_ortho_reach()
{
auto const aspect{ Global.window_size.x / std::max( 1.f, static_cast<float>( Global.window_size.y ) ) };
return Global.EditorOrthoExtent * std::sqrt( 1.f + aspect * aspect ) + 500.f;
}
float
editor_track_view_range(float const Range, bool const Apply)
{
@@ -40,14 +48,15 @@ editor_track_view_range(float const Range, bool const Apply)
return Range;
float extra = 50000.0f;
if( Global.EditorOrtho )
extra = Global.EditorOrthoExtent * 3.0f;
extra = editor_ortho_reach();
return Range > extra ? Range : extra;
}
// the top view draws the scenery as far as the tracks; its models keep their own ranges
bool
editor_far_tracks_only(bool const Apply, scene::basic_cell const *Cell, glm::dvec3 const &Camera, double const SceneryLimit)
{
if( false == Apply )
if( false == Apply || Global.EditorOrtho )
return false;
double nearest = glm::length( Cell->m_area.center - Camera ) - static_cast<double>( Cell->m_area.radius );
if( nearest < 0.0 )