wip
This commit is contained in:
@@ -825,10 +825,11 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
|
||||
|
||||
// CLEARPILOT: color channel code rewriten to allow custom colors
|
||||
// Define base RGB color and alpha
|
||||
int base_red = 255; // Example red color
|
||||
int base_green = 200; // Example green color
|
||||
int base_blue = 150; // Example blue color
|
||||
float base_alpha = 0.75; // Example base alpha
|
||||
int base_red = 139; // Dark red component
|
||||
int base_green = 0; // Minimal green component
|
||||
int base_blue = 0; // Minimal blue component
|
||||
float base_alpha = 0.6; // 60% opacity
|
||||
|
||||
QColor baseColor(base_red, base_green, base_blue);
|
||||
|
||||
SubMaster &sm = *(s->sm);
|
||||
@@ -876,22 +877,21 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
|
||||
|
||||
float lin_grad_point = (height() - scene.track_vertices[i].y()) / height();
|
||||
|
||||
float path_hue = std::max(std::min(60 + acceleration[i] * 35, 120.f), 0.f);
|
||||
path_hue = static_cast<int>(path_hue * 100 + 0.5) / 100; // Ensuring hue is rounded to reduce processing
|
||||
|
||||
float saturation = std::min(std::abs(acceleration[i] * 1.5f), 1.f);
|
||||
float lightness = util::map_val(saturation, 0.5f, 0.0f, 0.95f, 0.62f); // lighter when grey
|
||||
|
||||
float dynamic_alpha = util::map_val(lin_grad_point, 0.75f / 2.f, 0.75f, base_alpha, 0.0f);
|
||||
|
||||
QColor base_color = QColor::fromRgb(base_red, base_green, base_blue);
|
||||
float h, s, l;
|
||||
base_color.getHslF(&h, &s, &l);
|
||||
QColor final_color = QColor::fromHslF(path_hue / 360., saturation, lightness, dynamic_alpha);
|
||||
|
||||
// Calculate saturation and lightness based on acceleration
|
||||
float adjusted_saturation = std::min(std::abs(acceleration[i] * 1.5f), 1.f);
|
||||
float adjusted_lightness = util::map_val(adjusted_saturation, 0.f, 1.f, 0.62f, 0.95f);
|
||||
|
||||
// Calculate dynamic alpha based on lin_grad_point
|
||||
float dynamic_alpha = util::map_val(lin_grad_point, 0.75f / 2.f, 0.75f, base_alpha, 0.f);
|
||||
|
||||
QColor final_color = QColor::fromHslF(h / 360.f, adjusted_saturation, adjusted_lightness, dynamic_alpha);
|
||||
bg.setColorAt(lin_grad_point, final_color);
|
||||
|
||||
i += (i + 2) < max_len ? 1 : 0; // skipping a point to optimize rendering
|
||||
i += (i + 2) < max_len ? 1 : 0; // Skipping a point to optimize rendering
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user