doesn't work

This reverts commit 7a398b0392.
pull/27391/head
Shane Smiskol 3 years ago
parent 7a398b0392
commit c3cbfcb6c7
  1. 23
      selfdrive/ui/qt/onroad.cc

@ -521,8 +521,8 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
} }
// paint path // paint path
QLinearGradient bg(0, height(), 0, height() / 4); // QLinearGradient bg(0, height(), 0, height() / 4);
// QLinearGradient bg(0, height(), 0, 0); QLinearGradient bg(0, height(), 0, 0);
float start_hue, end_hue; float start_hue, end_hue;
if (sm["controlsState"].getControlsState().getExperimentalMode()) { if (sm["controlsState"].getControlsState().getExperimentalMode()) {
@ -533,11 +533,6 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
// float gradient_height = bg.finalStop().y(); // float gradient_height = bg.finalStop().y();
for (int i = 0; i < right_points.length(); i++) { for (int i = 0; i < right_points.length(); i++) {
qDebug() << "point y:" << right_points[i].y();
if (right_points[i].y() > height() || right_points[i].y() < (height() / 4-100)) {
continue;
}
const auto &acceleration = sm["uiPlan"].getUiPlan().getAccel(); const auto &acceleration = sm["uiPlan"].getUiPlan().getAccel();
float acceleration_future = 0; float acceleration_future = 0;
if (i >= acceleration.size()) { if (i >= acceleration.size()) {
@ -547,15 +542,13 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
qDebug() << "Using acceleration:" << acceleration_future; qDebug() << "Using acceleration:" << acceleration_future;
// need to flip so 0 is bottom of frame (not really, can also flip linear gradient above) // need to flip so 0 is bottom of frame (not really, can also flip linear gradient above)
// float lin_grad_point = (height() - right_points[i].y()) / height(); float lin_grad_point = (height() - right_points[i].y()) / height();
// float lin_grad_point = (height() - right_points[i].y()) / height();
float lin_grad_point = 1. - (right_points[i].y() - height() / 4) / (height() * 3/4);
qDebug() << right_points[i] << right_points[i].y() << lin_grad_point; qDebug() << right_points[i] << right_points[i].y() << lin_grad_point;
// Some points are out of frame // Some points are out of frame
// // TODO: tho maybe it makes sense to clip instead, so gradient is correct. or no clip/skip at all // TODO: tho maybe it makes sense to clip instead, so gradient is correct. or no clip/skip at all
// if (lin_grad_point < 0) { if (lin_grad_point < 0) {
// continue; continue;
// } }
start_hue = 60; start_hue = 60;
// speed up: 120, slow down: 0 // speed up: 120, slow down: 0
@ -567,7 +560,7 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
// lightness = lerp(0.56, 0.88, lin_grad_point); // lightness = lerp(0.56, 0.88, lin_grad_point);
// float alpha_lerp = (lin_grad_point - 0.5) * 2; // ramp alpha down from 0.4 when point reached 0.5 // float alpha_lerp = (lin_grad_point - 0.5) * 2; // ramp alpha down from 0.4 when point reached 0.5
// float alpha = lerp(0.4, 0, alpha_lerp > 0 ? alpha_lerp : 0); // float alpha = lerp(0.4, 0, alpha_lerp > 0 ? alpha_lerp : 0);
float alpha = interp1d(lin_grad_point, 0.5, 1.0, 0.4, 0.0); // matches behavior before for alpha fade float alpha = interp1d(lin_grad_point, 0.375, 0.625, 0.4, 0.0); // matches behavior before for alpha fade
qDebug() << "saturation:" << saturation << "lightness:" << lightness << "alpha:" << alpha; qDebug() << "saturation:" << saturation << "lightness:" << lightness << "alpha:" << alpha;
// FIXME: painter.drawPolygon can be slow if hue is not rounded // FIXME: painter.drawPolygon can be slow if hue is not rounded

Loading…
Cancel
Save