VisualRadarTracks toggle

This commit is contained in:
royjr
2025-09-23 01:10:44 -04:00
parent e672a352d3
commit ee9fe5c9ed
3 changed files with 18 additions and 8 deletions

View File

@@ -165,6 +165,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"VisualStyle", {PERSISTENT | BACKUP, INT, "0"}},
{"VisualStyleBlend", {PERSISTENT | BACKUP, BOOL, "0"}},
{"VisualStyleBlendThreshold", {PERSISTENT | BACKUP, INT, "20"}},
{"VisualRadarTracks", {PERSISTENT | BACKUP, BOOL, "0"}},
// MADS params
{"Mads", {PERSISTENT | BACKUP, BOOL, "1"}},

View File

@@ -43,14 +43,16 @@ void ModelRenderer::draw(QPainter &painter, const QRect &surface_rect) {
}
}
if (sm.alive("liveTracks") && sm.rcv_frame("liveTracks") >= s->scene.started_frame) {
const auto &tracks = sm["liveTracks"].getLiveTracks().getPoints();
for (const auto &track : tracks) {
if (!std::isfinite(track.getDRel()) || !std::isfinite(track.getYRel())) continue;
QPointF screen_pt;
if (mapToScreen(track.getDRel(), -track.getYRel(), path_offset_z, &screen_pt)) {
float radius = std::clamp(15.0f / (1.0f + track.getDRel() * 0.1f), 3.0f, 8.0f);
drawRadarPoint(painter, screen_pt, track.getVRel(), radius * 3);
if (QString::fromStdString(Params().get("VisualRadarTracks")).toInt()) {
if (sm.alive("liveTracks") && sm.rcv_frame("liveTracks") >= s->scene.started_frame) {
const auto &tracks = sm["liveTracks"].getLiveTracks().getPoints();
for (const auto &track : tracks) {
if (!std::isfinite(track.getDRel()) || !std::isfinite(track.getYRel())) continue;
QPointF screen_pt;
if (mapToScreen(track.getDRel(), -track.getYRel(), path_offset_z, &screen_pt)) {
float radius = std::clamp(15.0f / (1.0f + track.getDRel() * 0.1f), 3.0f, 8.0f);
drawRadarPoint(painter, screen_pt, track.getVRel(), radius * 3);
}
}
}
}

View File

@@ -49,6 +49,13 @@ VisualsPanel::VisualsPanel(QWidget *parent) : QWidget(parent) {
"",
false,
},
{
"VisualRadarTracks",
tr("Show Radar Tracks"),
tr("Shows what the cars radar sees."),
"../assets/offroad/icon_monitoring.png",
false,
},
{
"VisualStyleBlend",
tr("Blend to Overhead Visual Style"),