18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 23:14:59 +01:00

feat(editor): the points of the roads picked on the screen, also under the terrain; Alt+drag their height

The points where the pieces of a road meet were picked only by the ground clicked: one more than 3 m above or below the
ground under the cursor (a road taken down into a cutting, under an embankment) couldn't be picked again. Now the point
nearest to the cursor on the screen (within 12 px, the one nearer to the camera of those about as near) is picked first,
the ground as before after it.

Alt+LMB on a point and dragging up or down changes the height of the selected points (Ctrl: ten times finer); the change
shows as yellow lines and a label by the cursor while dragging, and is applied, as one step of the history, when the button
is let go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
This commit is contained in:
Claude
2026-11-09 23:16:38 +01:00
parent 823807201c
commit 6684baefc3
5 changed files with 148 additions and 3 deletions

View File

@@ -1621,6 +1621,24 @@ bool editor_road::nearest_joint(glm::dvec3 const &Point, double const Radius, gl
return found;
}
std::vector<glm::dvec3> editor_road::joints()
{
std::vector<glm::dvec3> result;
for (auto const *road : simulation::Roads.sequence())
{
if (road == nullptr || road->m_editorremoved)
continue;
for (auto const atend : {false, true})
{
auto const position{axis_end(road->definition(), atend)};
auto const same = [&position](glm::dvec3 const &Listed) { return glm::distance(Listed, position) < kSamePoint; };
if (std::none_of(result.begin(), result.end(), same))
result.push_back(position);
}
}
return result;
}
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);
// every point where pieces meet or end, each once
static std::vector<glm::dvec3> joints();
// 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