wip
This commit is contained in:
@@ -878,17 +878,17 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
|
||||
float lin_grad_point = (height() - scene.track_vertices[i].y()) / height();
|
||||
|
||||
QColor base_color = QColor::fromRgb(base_red, base_green, base_blue);
|
||||
float _h, _s, _l;
|
||||
double _h, _s, _l; // Use double for compatibility with QColor::getHslF()
|
||||
base_color.getHslF(&_h, &_s, &_l); // Extracting HSL values from the base color
|
||||
|
||||
// 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, _l, 0.95f); // Using base lightness as a starting point
|
||||
float adjusted_lightness = util::map_val(adjusted_saturation, 0.f, 1.f, static_cast<float>(_l), 0.95f); // Using base lightness as a starting point
|
||||
|
||||
// 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);
|
||||
QColor final_color = QColor::fromHslF(static_cast<float>(_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
|
||||
|
||||
Reference in New Issue
Block a user