mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 21:00:03 +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:
@@ -134,6 +134,16 @@ void editor_mode::follow_ground(std::vector<segment_data> &Pieces, double const
|
||||
ground_follow::follow(Pieces, {Height0, Grade0, Height1, Grade1}, [](std::vector<glm::dvec3> const &Points, std::vector<glm::dvec2> const &) { return std::vector<double>(Points.size(), std::numeric_limits<double>::quiet_NaN()); });
|
||||
return;
|
||||
}
|
||||
auto const grading{laying_grading(Style)};
|
||||
auto const bed = [&](std::vector<glm::dvec3> const &Points, std::vector<glm::dvec2> const &Directions) { return bed_heights(Points, Directions, Style); };
|
||||
if (m_follow_preview)
|
||||
ground_follow::follow_meanwhile(Pieces, {Height0, Grade0, Height1, Grade1}, bed, grading, m_fitter);
|
||||
else
|
||||
ground_follow::follow(Pieces, {Height0, Grade0, Height1, Grade1}, bed, grading, &m_fitter);
|
||||
}
|
||||
|
||||
ground_follow::grading editor_mode::laying_grading(TTrack const *Style) const
|
||||
{
|
||||
// the line goes over the ground as the tracks go onto the terrain: the vertical curves of the norms, the grades as steep as the
|
||||
// ground has them, a rise or a hollow longer than a structure followed closely, the bumps and what parts from it gone past
|
||||
ground_follow::grading grading;
|
||||
@@ -148,7 +158,7 @@ void editor_mode::follow_ground(std::vector<segment_data> &Pieces, double const
|
||||
grading.fit.follow_steepest = 100.0;
|
||||
grading.fit.follow_tolerance = 0.05;
|
||||
grading.reach = kModel;
|
||||
ground_follow::follow(Pieces, {Height0, Grade0, Height1, Grade1}, [&](std::vector<glm::dvec3> const &Points, std::vector<glm::dvec2> const &Directions) { return bed_heights(Points, Directions, Style); }, grading);
|
||||
return grading;
|
||||
}
|
||||
|
||||
glm::dvec3 editor_mode::lay_bed(glm::dvec3 const &Point)
|
||||
|
||||
Reference in New Issue
Block a user