wip
This commit is contained in:
@@ -874,27 +874,26 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
|
||||
acceleration.push_back(acceleration_const[i]);
|
||||
}
|
||||
|
||||
try {
|
||||
for (int i = 0; i < max_len; ++i) {
|
||||
if (scene.track_vertices[i].y() < 0 || scene.track_vertices[i].y() > height()) continue;
|
||||
try {
|
||||
for (int i = 0; i < max_len; ++i) {
|
||||
if (scene.track_vertices[i].y() < 0 || scene.track_vertices[i].y() > height()) continue;
|
||||
|
||||
float lin_grad_point = (height() - scene.track_vertices[i].y()) / height();
|
||||
float lin_grad_point = (height() - scene.track_vertices[i].y()) / height();
|
||||
|
||||
double _h, _s, _l; // Use double for compatibility with QColor::getHslF()
|
||||
center_lane_color.getHslF(&_h, &_s, &_l);
|
||||
double _h, _s, _l; // Use double for compatibility with QColor::getHslF()
|
||||
center_lane_color.getHslF(&_h, &_s, &_l);
|
||||
|
||||
// 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, static_cast<float>(_l), 0.95f); // Using base lightness as a starting point
|
||||
// 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, 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, path_alpha, 0.f);
|
||||
// Calculate dynamic alpha based on lin_grad_point
|
||||
float dynamic_alpha = util::map_val(lin_grad_point, 0.75f / 2.f, 0.75f, path_alpha, 0.f);
|
||||
|
||||
QColor final_color = QColor::fromHslF(static_cast<float>(_h / 360.f), adjusted_saturation, adjusted_lightness, dynamic_alpha);
|
||||
bg.setColorAt(lin_grad_point, final_color);
|
||||
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
|
||||
}
|
||||
i += (i + 2) < max_len ? 1 : 0; // Skipping a point to optimize rendering
|
||||
}
|
||||
} catch () {
|
||||
// Default shading if for some reason the above code fails
|
||||
|
||||
Reference in New Issue
Block a user