paysages : Small change in render dialog.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@517 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
47ebc90552
commit
63fe56c733
2 changed files with 23 additions and 3 deletions
|
@ -42,16 +42,19 @@ static void _renderUpdate(double progress)
|
||||||
class RenderThread:public QThread
|
class RenderThread:public QThread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RenderThread(Renderer* renderer, RenderParams params):QThread()
|
RenderThread(DialogRender* dialog, Renderer* renderer, RenderParams params):QThread()
|
||||||
{
|
{
|
||||||
|
_dialog = dialog;
|
||||||
_renderer = renderer;
|
_renderer = renderer;
|
||||||
_params = params;
|
_params = params;
|
||||||
}
|
}
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
rendererStart(_renderer, _params);
|
rendererStart(_renderer, _params);
|
||||||
|
_dialog->tellRenderEnded();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
DialogRender* _dialog;
|
||||||
Renderer* _renderer;
|
Renderer* _renderer;
|
||||||
RenderParams _params;
|
RenderParams _params;
|
||||||
};
|
};
|
||||||
|
@ -119,7 +122,9 @@ DialogRender::DialogRender(QWidget *parent, Renderer* renderer):
|
||||||
_actions->layout()->addWidget(_tonemapping_control);
|
_actions->layout()->addWidget(_tonemapping_control);
|
||||||
|
|
||||||
_actions->layout()->addWidget(new QLabel(tr("Exposure: "), _actions));
|
_actions->layout()->addWidget(new QLabel(tr("Exposure: "), _actions));
|
||||||
|
_actions->hide();
|
||||||
_exposure_control = new QSlider(Qt::Horizontal, _actions);
|
_exposure_control = new QSlider(Qt::Horizontal, _actions);
|
||||||
|
_exposure_control->setMinimumWidth(200);
|
||||||
_exposure_control->setRange(0, 1000);
|
_exposure_control->setRange(0, 1000);
|
||||||
_exposure_control->setValue(200);
|
_exposure_control->setValue(200);
|
||||||
_actions->layout()->addWidget(_exposure_control);
|
_actions->layout()->addWidget(_exposure_control);
|
||||||
|
@ -130,6 +135,7 @@ DialogRender::DialogRender(QWidget *parent, Renderer* renderer):
|
||||||
// Connections
|
// Connections
|
||||||
connect(this, SIGNAL(renderSizeChanged(int, int)), this, SLOT(applyRenderSize(int, int)));
|
connect(this, SIGNAL(renderSizeChanged(int, int)), this, SLOT(applyRenderSize(int, int)));
|
||||||
connect(this, SIGNAL(progressChanged(double)), this, SLOT(applyProgress(double)));
|
connect(this, SIGNAL(progressChanged(double)), this, SLOT(applyProgress(double)));
|
||||||
|
connect(this, SIGNAL(renderEnded()), this, SLOT(applyRenderEnded()));
|
||||||
connect(_save_button, SIGNAL(clicked()), this, SLOT(saveRender()));
|
connect(_save_button, SIGNAL(clicked()), this, SLOT(saveRender()));
|
||||||
connect(_tonemapping_control, SIGNAL(currentIndexChanged(int)), this, SLOT(toneMappingChanged()));
|
connect(_tonemapping_control, SIGNAL(currentIndexChanged(int)), this, SLOT(toneMappingChanged()));
|
||||||
connect(_exposure_control, SIGNAL(valueChanged(int)), this, SLOT(toneMappingChanged()));
|
connect(_exposure_control, SIGNAL(valueChanged(int)), this, SLOT(toneMappingChanged()));
|
||||||
|
@ -158,6 +164,11 @@ void DialogRender::tellProgressChange(double value)
|
||||||
emit progressChanged(value);
|
emit progressChanged(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogRender::tellRenderEnded()
|
||||||
|
{
|
||||||
|
emit renderEnded();
|
||||||
|
}
|
||||||
|
|
||||||
void DialogRender::startRender(RenderParams params)
|
void DialogRender::startRender(RenderParams params)
|
||||||
{
|
{
|
||||||
_started = time(NULL);
|
_started = time(NULL);
|
||||||
|
@ -165,12 +176,18 @@ void DialogRender::startRender(RenderParams params)
|
||||||
//applyRenderSize(params.width, params.height);
|
//applyRenderSize(params.width, params.height);
|
||||||
rendererSetPreviewCallbacks(_renderer, _renderStart, _renderDraw, _renderUpdate);
|
rendererSetPreviewCallbacks(_renderer, _renderStart, _renderDraw, _renderUpdate);
|
||||||
|
|
||||||
_render_thread = new RenderThread(_renderer, params);
|
_render_thread = new RenderThread(this, _renderer, params);
|
||||||
_render_thread->start();
|
_render_thread->start();
|
||||||
|
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogRender::applyRenderEnded()
|
||||||
|
{
|
||||||
|
_info->hide();
|
||||||
|
_actions->show();
|
||||||
|
}
|
||||||
|
|
||||||
void DialogRender::saveRender()
|
void DialogRender::saveRender()
|
||||||
{
|
{
|
||||||
QString filepath;
|
QString filepath;
|
||||||
|
@ -201,8 +218,8 @@ void DialogRender::toneMappingChanged()
|
||||||
void DialogRender::loadLastRender()
|
void DialogRender::loadLastRender()
|
||||||
{
|
{
|
||||||
//applyRenderSize(_renderer->render_width, _renderer->render_height);
|
//applyRenderSize(_renderer->render_width, _renderer->render_height);
|
||||||
_info->hide();
|
|
||||||
rendererSetPreviewCallbacks(_renderer, _renderStart, _renderDraw, _renderUpdate);
|
rendererSetPreviewCallbacks(_renderer, _renderStart, _renderDraw, _renderUpdate);
|
||||||
|
renderEnded();
|
||||||
|
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
|
|
||||||
void tellRenderSize(int width, int height);
|
void tellRenderSize(int width, int height);
|
||||||
void tellProgressChange(double value);
|
void tellProgressChange(double value);
|
||||||
|
void tellRenderEnded();
|
||||||
void startRender(RenderParams params);
|
void startRender(RenderParams params);
|
||||||
void loadLastRender();
|
void loadLastRender();
|
||||||
|
|
||||||
|
@ -33,11 +34,13 @@ private slots:
|
||||||
void applyRenderSize(int width, int height);
|
void applyRenderSize(int width, int height);
|
||||||
void applyProgress(double value);
|
void applyProgress(double value);
|
||||||
void saveRender();
|
void saveRender();
|
||||||
|
void applyRenderEnded();
|
||||||
void toneMappingChanged();
|
void toneMappingChanged();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void renderSizeChanged(int width, int height);
|
void renderSizeChanged(int width, int height);
|
||||||
void progressChanged(double value);
|
void progressChanged(double value);
|
||||||
|
void renderEnded();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScrollArea* _scroll;
|
QScrollArea* _scroll;
|
||||||
|
|
Loading…
Reference in a new issue