18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 22:44:59 +01:00

Merge pull request #310 from miloszunio/pr/road-points-under-terrain

feat(editor): the points of the roads picked on the screen, also under the terrain; Alt+drag their height
This commit is contained in:
maj00r
2026-11-11 14:35:28 +01:00
committed by GitHub
5 changed files with 160 additions and 9 deletions

View File

@@ -1621,6 +1621,17 @@ bool editor_road::nearest_joint(glm::dvec3 const &Point, double const Radius, gl
return found;
}
void editor_road::each_joint(std::function<void(glm::dvec3 const &)> const &Visit)
{
for (auto const *road : simulation::Roads.sequence())
{
if (road == nullptr || road->m_editorremoved)
continue;
Visit(axis_end(road->definition(), false));
Visit(axis_end(road->definition(), true));
}
}
std::vector<editor_road::piece_end> editor_road::ends_at(glm::dvec3 const &Point)
{
std::vector<piece_end> result;

View File

@@ -128,6 +128,8 @@ class editor_road
static junction_node *nearest_junction(glm::dvec3 const &Point);
// the point where pieces meet or end which is nearest to specified one, within specified distance from it. returns: false if there's none
static bool nearest_joint(glm::dvec3 const &Point, double const Radius, glm::dvec3 &Joint);
// Visit called for the ends of every piece, a point where several meet as many times (no search for the repeated ones)
static void each_joint(std::function<void(glm::dvec3 const &)> const &Visit);
// ends of the pieces which meet at specified point
static std::vector<piece_end> ends_at(glm::dvec3 const &Point);
// junctions with an arm at specified point, each with the number of that arm