UI: remove struct track_vertices_data (#20018)
* remove struct track_vertices_data * space * rebase master
This commit is contained in:
parent
2a935a2010
commit
c2aefab553
|
@ -125,12 +125,13 @@ static void draw_lead(UIState *s, int idx){
|
||||||
draw_chevron(s, x, y, sz, nvgRGBA(201, 34, 49, fillAlpha), COLOR_YELLOW);
|
draw_chevron(s, x, y, sz, nvgRGBA(201, 34, 49, fillAlpha), COLOR_YELLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_draw_line(UIState *s, const vertex_data *v, const int cnt, NVGcolor *color, NVGpaint *paint) {
|
static void ui_draw_line(UIState *s, const line_vertices_data &vd, NVGcolor *color, NVGpaint *paint) {
|
||||||
if (cnt == 0) return;
|
if (vd.cnt == 0) return;
|
||||||
|
|
||||||
|
const vertex_data *v = &vd.v[0];
|
||||||
nvgBeginPath(s->vg);
|
nvgBeginPath(s->vg);
|
||||||
nvgMoveTo(s->vg, v[0].x, v[0].y);
|
nvgMoveTo(s->vg, v[0].x, v[0].y);
|
||||||
for (int i = 1; i < cnt; i++) {
|
for (int i = 1; i < vd.cnt; i++) {
|
||||||
nvgLineTo(s->vg, v[i].x, v[i].y);
|
nvgLineTo(s->vg, v[i].x, v[i].y);
|
||||||
}
|
}
|
||||||
nvgClosePath(s->vg);
|
nvgClosePath(s->vg);
|
||||||
|
@ -178,19 +179,19 @@ static void ui_draw_vision_lane_lines(UIState *s) {
|
||||||
// paint lanelines
|
// paint lanelines
|
||||||
for (int i = 0; i < std::size(scene.lane_line_vertices); i++) {
|
for (int i = 0; i < std::size(scene.lane_line_vertices); i++) {
|
||||||
NVGcolor color = nvgRGBAf(1.0, 1.0, 1.0, scene.lane_line_probs[i]);
|
NVGcolor color = nvgRGBAf(1.0, 1.0, 1.0, scene.lane_line_probs[i]);
|
||||||
ui_draw_line(s, scene.lane_line_vertices[i].v, scene.lane_line_vertices[i].cnt, &color, nullptr);
|
ui_draw_line(s, scene.lane_line_vertices[i], &color, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// paint road edges
|
// paint road edges
|
||||||
for (int i = 0; i < std::size(scene.road_edge_vertices); i++) {
|
for (int i = 0; i < std::size(scene.road_edge_vertices); i++) {
|
||||||
NVGcolor color = nvgRGBAf(1.0, 0.0, 0.0, std::clamp<float>(1.0 - scene.road_edge_stds[i], 0.0, 1.0));
|
NVGcolor color = nvgRGBAf(1.0, 0.0, 0.0, std::clamp<float>(1.0 - scene.road_edge_stds[i], 0.0, 1.0));
|
||||||
ui_draw_line(s, scene.road_edge_vertices[i].v, scene.road_edge_vertices[i].cnt, &color, nullptr);
|
ui_draw_line(s, scene.road_edge_vertices[i], &color, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// paint path
|
// paint path
|
||||||
NVGpaint track_bg = nvgLinearGradient(s->vg, s->fb_w, s->fb_h, s->fb_w, s->fb_h * .4,
|
NVGpaint track_bg = nvgLinearGradient(s->vg, s->fb_w, s->fb_h, s->fb_w, s->fb_h * .4,
|
||||||
COLOR_WHITE, COLOR_WHITE_ALPHA(0));
|
COLOR_WHITE, COLOR_WHITE_ALPHA(0));
|
||||||
ui_draw_line(s, scene.track_vertices.v, scene.track_vertices.cnt, nullptr, &track_bg);
|
ui_draw_line(s, scene.track_vertices, nullptr, &track_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw all world space objects.
|
// Draw all world space objects.
|
||||||
|
|
|
@ -75,9 +75,8 @@ static void update_lead(UIState *s, const cereal::RadarState::Reader &radar_stat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
|
||||||
static void update_line_data(const UIState *s, const cereal::ModelDataV2::XYZTData::Reader &line,
|
static void update_line_data(const UIState *s, const cereal::ModelDataV2::XYZTData::Reader &line,
|
||||||
float y_off, float z_off, T *pvd, float max_distance) {
|
float y_off, float z_off, line_vertices_data *pvd, float max_distance) {
|
||||||
const auto line_x = line.getX(), line_y = line.getY(), line_z = line.getZ();
|
const auto line_x = line.getX(), line_y = line.getY(), line_z = line.getZ();
|
||||||
int max_idx = -1;
|
int max_idx = -1;
|
||||||
vertex_data *v = &pvd->v[0];
|
vertex_data *v = &pvd->v[0];
|
||||||
|
|
|
@ -58,9 +58,6 @@ const Rect home_btn = {60, 1080 - 180 - 40, 180, 180};
|
||||||
|
|
||||||
const int UI_FREQ = 20; // Hz
|
const int UI_FREQ = 20; // Hz
|
||||||
|
|
||||||
const int MODEL_PATH_MAX_VERTICES_CNT = TRAJECTORY_SIZE*2;
|
|
||||||
const int TRACK_POINTS_MAX_CNT = TRAJECTORY_SIZE*4;
|
|
||||||
|
|
||||||
typedef enum NetStatus {
|
typedef enum NetStatus {
|
||||||
NET_CONNECTED,
|
NET_CONNECTED,
|
||||||
NET_DISCONNECTED,
|
NET_DISCONNECTED,
|
||||||
|
@ -92,15 +89,10 @@ typedef struct {
|
||||||
} vertex_data;
|
} vertex_data;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
vertex_data v[MODEL_PATH_MAX_VERTICES_CNT];
|
vertex_data v[TRAJECTORY_SIZE * 2];
|
||||||
int cnt;
|
int cnt;
|
||||||
} line_vertices_data;
|
} line_vertices_data;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
vertex_data v[TRACK_POINTS_MAX_CNT];
|
|
||||||
int cnt;
|
|
||||||
} track_vertices_data;
|
|
||||||
|
|
||||||
typedef struct UIScene {
|
typedef struct UIScene {
|
||||||
|
|
||||||
mat4 extrinsic_matrix; // Last row is 0 so we can use mat4.
|
mat4 extrinsic_matrix; // Last row is 0 so we can use mat4.
|
||||||
|
@ -132,7 +124,7 @@ typedef struct UIScene {
|
||||||
// modelV2
|
// modelV2
|
||||||
float lane_line_probs[4];
|
float lane_line_probs[4];
|
||||||
float road_edge_stds[2];
|
float road_edge_stds[2];
|
||||||
track_vertices_data track_vertices;
|
line_vertices_data track_vertices;
|
||||||
line_vertices_data lane_line_vertices[4];
|
line_vertices_data lane_line_vertices[4];
|
||||||
line_vertices_data road_edge_vertices[2];
|
line_vertices_data road_edge_vertices[2];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue