18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-04 23:45:17 +01:00

Merge branch 'feat/editor-trace-photo' into feat/editor-level-crossing-surface

# Conflicts:
#	lang/editor_pl.po
This commit is contained in:
maj00r
2026-11-29 23:03:02 +01:00
38 changed files with 528 additions and 96 deletions
+21 -1
View File
@@ -1915,6 +1915,9 @@ void editor_mode::render_settings()
ImGui::SetTooltip("%s", STR_C("A line laid in the straights, or applied by the route design, becomes a line of the model of the track geometry: its tracks are made by the model, "
"its edits checked against the norms and refused with the reasons, the project of the map kept next to it.\n"
"The tracks there were stay as they are, edited the old way. Off, the editor works as it did"));
// taken when a scenery is opened: changed meanwhile, the model and the scene would go out of step
if (model != model_taken())
ImGui::TextDisabled("%s", STR_C("Takes effect with the next scenery opened"));
if (auto const error{model_error()}; model && false == error.empty())
ImGui::TextColored(ImVec4(1.0f, 0.6f, 0.2f, 1.0f), "%s", format(STR_C("The project of the map can't be opened: %s"), error.c_str()).c_str());
}
@@ -2999,6 +3002,9 @@ void editor_mode::area_grow()
auto const now{ImGui::GetTime()};
if (now - m_area_grow_time < 5.0 || m_area_drawing.active || m_orthophoto.area().empty() || (false == m_orthophoto.enabled() && false == m_lay.active))
return;
// every 5 s, whatever comes of it: set only by a growth, an area which didn't grow, or at its limit, was rastered and flood filled
// every frame
m_area_grow_time = now;
auto const &config{m_orthophoto.settings()};
if (config.north == 0.0 && config.east == 0.0)
return;
@@ -3044,13 +3050,27 @@ void editor_mode::draw_orthophoto_failures() const
screen_projection const projection;
auto *drawlist{ImGui::GetBackgroundDrawList(ImGui::GetMainViewport())};
auto const height{static_cast<double>(m_orthophoto.settings().height)};
// in the 3D view on the ground, where the photo draped over it lies: at the height of the layer they stood off the tiles they mark
// where the terrain lies well above or below it. Seen from above the height doesn't matter
auto const grounded{m_orthophoto.settings().drape && false == Global.EditorOrtho};
auto const colour{IM_COL32(240, 70, 60, 210)};
std::size_t drawn{0};
for (auto const &[low, high] : failed)
{
if (++drawn > 400)
break;
glm::dvec3 const corners[]{{low.x, height, low.y}, {high.x, height, low.y}, {high.x, height, high.y}, {low.x, height, high.y}};
std::vector<glm::dvec3> corners{{low.x, height, low.y}, {high.x, height, low.y}, {high.x, height, high.y}, {low.x, height, high.y}};
if (grounded)
{
std::vector<glm::dvec3> above{corners};
for (auto &corner : above)
corner.y = 10000.0;
std::vector<char> found;
auto const ground{ground_heights(above, false, &found)};
for (std::size_t i = 0; i < corners.size(); ++i)
if (found[i] != 0)
corners[i].y = ground[i];
}
for (int i = 0; i < 4; ++i)
projection.line(drawlist, corners[i], corners[(i + 1) % 4], colour, 2.0f);
projection.line(drawlist, corners[0], corners[2], (colour & ~IM_COL32_A_MASK) | IM_COL32(0, 0, 0, 110), 1.5f);