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

feat(editor): the free ends of the tracks are marked red in the track mode

Each end of a rail track joined to nothing, where a train would run off, gets a red dot next to the white dots of the joints,
in the 3D view near the camera and from above over the whole view. The ends are looked for again after an edit or once the
camera leaves the place they were found for, not every frame.
This commit is contained in:
maj00r
2026-10-21 17:34:36 +02:00
parent a154fce67b
commit 4db3dd70d3
4 changed files with 36 additions and 0 deletions

View File

@@ -1593,6 +1593,16 @@ class editor_mode : public application_mode, private editor_track::observer, pri
void draw_track_intent() const;
editor_track::snap_target snap_free_end(glm::dvec3 const &Near, glm::vec2 const &Screen, TTrack const *Self, int const Category, std::vector<TTrack const *> const &Exclude) const;
void draw_free_ends(TTrack const *Self, int const Category, std::vector<TTrack const *> const &Exclude) const;
// the free ends of the rail tracks around the camera, looked for again after an edit or once the camera leaves the place
struct free_end_cache
{
int edits{-1};
glm::dvec3 centre{0.0};
double reach{0.0};
std::vector<glm::dvec3> points;
};
mutable free_end_cache m_free_end_cache;
std::vector<glm::dvec3> const &free_end_points(glm::dvec3 const &Centre, double const Reach) const;
struct point_drag
{
bool active{false};