mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 23:16:22 +01:00
Merge remote-tracking branch 'jano211/siec-radio' into feat/renderers-cleanup
This commit is contained in:
@@ -44,6 +44,7 @@ using geometry::plan_of;
|
||||
float const kHoverPixels{12.0f};
|
||||
float const kFarHoverPixels{16.0f};
|
||||
double const kLinesFrom{0.5};
|
||||
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)};
|
||||
@@ -130,7 +131,9 @@ editor_mode::track_hover editor_mode::track_under_cursor(TTrack const *Only, flo
|
||||
for (int i = 0; i < static_cast<int>(track->m_paths.size()); ++i)
|
||||
{
|
||||
bezier const curve{track->m_paths[i]};
|
||||
if (cull && false == plan_near(curve, plan_of(origin), reach))
|
||||
// the catenary works close to the camera: the paths far away aren't looked at (in a big scenery they cost a lot)
|
||||
if ((cull && false == plan_near(curve, plan_of(origin), reach)) ||
|
||||
(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)};
|
||||
@@ -238,7 +241,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_dragging || 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 || m_switch.slide.active || ImGuizmo::IsUsing();
|
||||
m_point_drag.active || m_handle_drag.active || m_sweep.dragging || m_turntable.placing || m_signal.placing || m_signal.moving || m_switch.slide.active || catenary_dragging() || ImGuizmo::IsUsing();
|
||||
}
|
||||
|
||||
editor_mode::track_intent editor_mode::track_intent_at(int const Mods)
|
||||
@@ -286,6 +289,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)
|
||||
@@ -583,6 +591,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::switch_slide:
|
||||
if (Intent.track != nullptr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user