paysages: Restored "show last render" feature.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@282 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-04-02 19:10:34 +00:00 committed by ThunderK
parent decaf96036
commit df7041a82b
4 changed files with 30 additions and 12 deletions

1
TODO
View file

@ -1,5 +1,4 @@
- Implement scaling and scrolling on previews. - Implement scaling and scrolling on previews.
- Improve color gradation dialog (with curve editor ?).
- Replace FILE* by a custom type for Save and Load. - Replace FILE* by a custom type for Save and Load.
- Water and terrain LOD moves with the camera, fix it like in the wanderer. - Water and terrain LOD moves with the camera, fix it like in the wanderer.
- Restore render progress. - Restore render progress.

View file

@ -10,6 +10,8 @@
#include "../lib_paysages/auto.h" #include "../lib_paysages/auto.h"
static DialogRender* _current_dialog; static DialogRender* _current_dialog;
static Renderer _renderer;
static bool _renderer_inited = false;
static void _renderStart(int width, int height, Color background) static void _renderStart(int width, int height, Color background)
{ {
@ -72,7 +74,6 @@ DialogRender::DialogRender(QWidget *parent):
pixbuf = new QImage(1, 1, QImage::Format_ARGB32); pixbuf = new QImage(1, 1, QImage::Format_ARGB32);
_current_dialog = this; _current_dialog = this;
render_thread = NULL; render_thread = NULL;
renderer = sceneryCreateStandardRenderer();
setModal(true); setModal(true);
setWindowTitle(tr("Paysages 3D - Render")); setWindowTitle(tr("Paysages 3D - Render"));
@ -96,14 +97,11 @@ DialogRender::~DialogRender()
{ {
if (render_thread) if (render_thread)
{ {
rendererInterrupt(&renderer); rendererInterrupt(&_renderer);
render_thread->wait(); render_thread->wait();
rendererSetPreviewCallbacks(&renderer, NULL, NULL, NULL);
delete render_thread; delete render_thread;
} }
rendererDelete(&renderer);
delete pixbuf; delete pixbuf;
} }
@ -115,10 +113,17 @@ void DialogRender::startRender(int quality, int width, int height)
area->setMaximumSize(width, height); area->setMaximumSize(width, height);
area->resize(width, height); area->resize(width, height);
scroll->setMinimumSize(width > 800 ? 850 : width + 50, height > 600 ? 650 : height + 50); scroll->setMinimumSize(width > 800 ? 850 : width + 50, height > 600 ? 650 : height + 50);
rendererSetPreviewCallbacks(&renderer, _renderStart, _renderDraw, _renderUpdate);
render_thread = new RenderThread(&renderer, width, height, quality); if (_renderer_inited)
{
rendererDelete(&_renderer);
}
_renderer = sceneryCreateStandardRenderer();
_renderer_inited = true;
rendererSetPreviewCallbacks(&_renderer, _renderStart, _renderDraw, _renderUpdate);
render_thread = new RenderThread(&_renderer, width, height, quality);
render_thread->start(); render_thread->start();
exec(); exec();
@ -126,8 +131,23 @@ void DialogRender::startRender(int quality, int width, int height)
void DialogRender::loadLastRender() void DialogRender::loadLastRender()
{ {
int width, height;
progress->hide(); progress->hide();
//renderSetPreviewCallbacks(_renderStart, _renderDraw, _renderUpdate); if (_renderer_inited)
{
width = _renderer.render_width;
height = _renderer.render_height;
delete pixbuf;
pixbuf = new QImage(width, height, QImage::Format_ARGB32);
area->setMinimumSize(width, height);
area->setMaximumSize(width, height);
area->resize(width, height);
scroll->setMinimumSize(width > 800 ? 850 : width + 50, height > 600 ? 650 : height + 50);
rendererSetPreviewCallbacks(&_renderer, _renderStart, _renderDraw, _renderUpdate);
}
exec(); exec();
} }

View file

@ -25,7 +25,6 @@ public:
private: private:
QThread* render_thread; QThread* render_thread;
Renderer renderer;
}; };
#endif // _PAYSAGES_QT_DIALOGRENDER_H_ #endif // _PAYSAGES_QT_DIALOGRENDER_H_

View file

@ -156,7 +156,7 @@ Cliquez avec le bouton droit sur un point pour le supprimer.</translation>
<context> <context>
<name>DialogRender</name> <name>DialogRender</name>
<message> <message>
<location filename="../gui_qt/dialogrender.cpp" line="78"/> <location filename="../gui_qt/dialogrender.cpp" line="79"/>
<source>Paysages 3D - Render</source> <source>Paysages 3D - Render</source>
<translation>Paysages 3D - Rendu</translation> <translation>Paysages 3D - Rendu</translation>
</message> </message>