17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-08 23:07:38 +01:00

fix(editor): the track shown while it's laid over the ground no longer holds up the frames: its grade line is fitted on a thread of its own, the line fitted a moment ago stretched over the track meanwhile, and the click takes the line fitted for the same ground instead of fitting it again; the terrain follows the tracks once the laying ends, not after each click of a chain

Fitting the grade line took 3 ms for 250 m of track, 30 ms for 1 km, 65 ms for 2 km and 200 ms for 4 km, and the preview of the lay tool and of the drag from a free end fitted it every frame, twice for the drag; on the terrain model the preview of some 800 m took 10 to 17 ms a frame, the cursor standing or not. Now the frame waits under 1.5 ms for 4 km. The formations of the tracks led into the terrain went through every chunk under them 0.3 s after each click, some 50 ms, while the cursor went on to the next point; they wait for the laying to end. The tracks laid and the terrain are the same as before.

Selftests: perf logs the longest frame and those over 33 ms, fittime the time of the fit by length, terrainhash a hash of the chunks in memory.
This commit is contained in:
maj00r
2026-10-24 18:00:21 +02:00
parent e35487f767
commit e322947300
12 changed files with 354 additions and 43 deletions

View File

@@ -151,7 +151,11 @@ editor_mode::selftest_result editor_mode::selftest_dispatch(std::string const &c
// screenshot
// save
// log <text>
// perf <label> the frames drawn since the last perf and the time per frame logged, with the timings and counts of the renderer
// perf <label> the frames drawn since the last perf and the time per frame logged, the longest frame and those over 33 ms,
// with the timings and counts of the renderer
// fittime <metres>... the grade line of a straight over rolling ground of each length fitted, as at a click, and the time the
// frame waits for it while the track is laid, the line fitted on the thread of the fitter
// terrainhash a hash of the heights of the terrain chunks in memory, to compare the ground two builds made
// rebuildall the geometry of every path in the sections made already laid anew, the time it took logged,
// and the 3d sleepers of all the tracks laid anew, timed apart
// sleepercheck the 3d sleepers of all the tracks checked for beams over each other and rails without enough under them
@@ -177,6 +181,16 @@ void editor_mode::selftest_step()
set_norms_free(true);
}
++editor_selftest::frames();
// how long each frame took, for the longest one perf tells
{
static auto last{std::chrono::steady_clock::now()};
auto const now{std::chrono::steady_clock::now()};
auto const frame{std::chrono::duration<double, std::milli>(now - last).count()};
last = now;
editor_selftest::frame_longest() = std::max(editor_selftest::frame_longest(), frame);
if (frame > 33.0)
++editor_selftest::frames_slow();
}
if (test.wait > 0)
{
--test.wait;