mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 23:16:22 +01:00
Sieć trakcyjna: przęsła wg typów sieci, wysięgniki z katalogu, bramki, kotwienia i edytor sieci
Sam kod exe z gałęzi siec-trakcyjna (bez testów, notatek i danych z tests/catenary). Dane (data/traction_*.txt) leżą poza repozytorium. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Tqn7T8D1Gx3ptKtZgNtX5
This commit is contained in:
@@ -40,6 +40,7 @@ namespace
|
||||
using geometry::bezier;
|
||||
|
||||
float const kHoverPixels{12.0f};
|
||||
double const kCatenaryHoverRange{1500.0}; // m from the camera: the paths the catenary looks at under the cursor
|
||||
double const kHoverLabelDelay{0.35}; // s the cursor rests on a path before its data shows up
|
||||
double const kFocusDistance{25.0};
|
||||
auto const kContextClick{std::chrono::milliseconds(350)};
|
||||
@@ -106,6 +107,9 @@ editor_mode::track_hover editor_mode::track_under_cursor() const
|
||||
for (int i = 0; i < static_cast<int>(track->m_paths.size()); ++i)
|
||||
{
|
||||
bezier const curve{track->m_paths[i]};
|
||||
// the catenary works close to the camera: the paths far away aren't looked at (in a big scenery they cost a lot)
|
||||
if (m_track_tab == track_tab::catenary && glm::distance(curve.point(0.5), glm::dvec3{Global.pCamera.Pos}) > curve.plan_length() * 0.5 + kCatenaryHoverRange)
|
||||
continue;
|
||||
auto const count{std::clamp(static_cast<int>(curve.plan_length() / 3.0), 6, 64)};
|
||||
auto previous{curve.point(0.0)};
|
||||
ImVec2 from;
|
||||
@@ -181,7 +185,7 @@ void editor_mode::draw_track_hover() const
|
||||
bool editor_mode::track_gesture_on() const
|
||||
{
|
||||
return mouseHold || m_track_set_using || m_track_box.active || m_input.mouse.button(GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS || m_track_gizmo_using || m_route_gizmo_using || m_extend.active || m_switch.placing || m_straights.dragging || m_straights.tool_mouse ||
|
||||
m_point_drag.active || m_handle_drag.active || m_sweep.dragging || m_turntable.placing || m_signal.placing || m_signal.moving || ImGuizmo::IsUsing();
|
||||
m_point_drag.active || m_handle_drag.active || m_sweep.dragging || m_turntable.placing || m_signal.placing || m_signal.moving || catenary_dragging() || ImGuizmo::IsUsing();
|
||||
}
|
||||
|
||||
editor_mode::track_intent editor_mode::track_intent_at(int const Mods)
|
||||
@@ -220,6 +224,11 @@ editor_mode::track_intent editor_mode::track_intent_at(int const Mods)
|
||||
}
|
||||
if (m_track_tab == track_tab::turntable)
|
||||
return turntable_intent(ground, shift);
|
||||
if (m_track_tab == track_tab::catenary)
|
||||
{
|
||||
catenary_intent(intent);
|
||||
return intent;
|
||||
}
|
||||
if (m_track_tab == track_tab::signals)
|
||||
{
|
||||
if (auto const hit{signal_hit()}; hit >= 0)
|
||||
@@ -453,6 +462,7 @@ void editor_mode::track_press(track_intent const &Intent)
|
||||
case kind::turntable_fit: turntable_press(Intent); return;
|
||||
case kind::signal_place:
|
||||
case kind::signal_move: signal_press(Intent); return;
|
||||
case kind::catenary: catenary_press(Intent); return;
|
||||
case kind::select:
|
||||
case kind::none:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user