paysages : Fixed holes in curve rendering.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@343 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
f541c081db
commit
19fb234a28
4 changed files with 12 additions and 4 deletions
1
TODO
1
TODO
|
@ -16,7 +16,6 @@ Technology Preview 2 :
|
|||
- Fix the distorted sun appearance.
|
||||
- Improve curve editor.
|
||||
=> Add curve modes
|
||||
=> Improve curve rendering
|
||||
=> Add axis labels and grid
|
||||
=> Add logarithmic mode
|
||||
- Improve 3d explorer
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
QPainter painter(this);
|
||||
int width = this->width();
|
||||
int height = this->height();
|
||||
double position, value;
|
||||
double position, value, prev_value, next_value;
|
||||
|
||||
painter.fillRect(rect(), QColor(255, 255, 255));
|
||||
for (int x = 0; x < width; x++)
|
||||
|
@ -35,6 +35,10 @@ public:
|
|||
painter.setPen(QColor(0, 0, 0));
|
||||
position = _xmin + (_xmax - _xmin) * (double)x / (double)(width - 1);
|
||||
value = (curveGetValue(_curve, position) - _ymin) * (_ymax - _ymin);
|
||||
prev_value = curveGetValue(_curve, position - 1.0 / (double)(width - 1));
|
||||
next_value = curveGetValue(_curve, position + 1.0 / (double)(width - 1));
|
||||
|
||||
painter.drawLine(x, height - 1 - (int)((value + (prev_value - value) / 2.0) * (double)(height - 1)), x, height - 1 - (int)((value + (next_value - value) / 2.0) * (double)(height - 1)));
|
||||
painter.drawPoint(x, height - 1 - (int)(value * (double)(height - 1)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ void WidgetCurveEditor::paintEvent(QPaintEvent* event)
|
|||
int width, height;
|
||||
double dwidth, dheight;
|
||||
CurvePoint point;
|
||||
double position, value;
|
||||
double position, value, prev_value, next_value;
|
||||
|
||||
width = this->width();
|
||||
height = this->height();
|
||||
|
@ -55,7 +55,12 @@ void WidgetCurveEditor::paintEvent(QPaintEvent* event)
|
|||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
position = ((double)x) / dwidth;
|
||||
|
||||
value = curveGetValue(_curve, position);
|
||||
prev_value = curveGetValue(_curve, position - 1.0 / dwidth);
|
||||
next_value = curveGetValue(_curve, position + 1.0 / dwidth);
|
||||
|
||||
painter.drawLine(x, height - 1 - (int)((value + (prev_value - value) / 2.0) * dheight), x, height - 1 - (int)((value + (next_value - value) / 2.0) * dheight));
|
||||
painter.drawPoint(x, height - 1 - (int)(value * dheight));
|
||||
}
|
||||
|
||||
|
|
|
@ -850,7 +850,7 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<context>
|
||||
<name>InputCurve</name>
|
||||
<message>
|
||||
<location filename="../gui_qt/inputcurve.cpp" line="58"/>
|
||||
<location filename="../gui_qt/inputcurve.cpp" line="62"/>
|
||||
<source>Edit</source>
|
||||
<translation type="unfinished">Editer</translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in a new issue