paysages : Waiting message when explorer loads the scene.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@513 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
e1514fae78
commit
cc46102f9f
4 changed files with 44 additions and 29 deletions
1
TODO
1
TODO
|
@ -24,7 +24,6 @@ Technology Preview 2 :
|
||||||
- Fix rendering when inside a cloud layer, with other upper or lower layers.
|
- Fix rendering when inside a cloud layer, with other upper or lower layers.
|
||||||
- Improve cloud rendering precision (and beware of precision discontinuity when rendering clouds in front of ground (shorter distance)).
|
- Improve cloud rendering precision (and beware of precision discontinuity when rendering clouds in front of ground (shorter distance)).
|
||||||
- Top-down previews and explorer renderings should be camera independant.
|
- Top-down previews and explorer renderings should be camera independant.
|
||||||
- Explorer should have a waiting message while init.
|
|
||||||
- Sun radius is too small.
|
- Sun radius is too small.
|
||||||
|
|
||||||
Technlogy Preview 3 :
|
Technlogy Preview 3 :
|
||||||
|
|
|
@ -73,8 +73,31 @@ WidgetExplorer::WidgetExplorer(QWidget *parent, CameraDefinition* camera):
|
||||||
_renderer->customData[3] = &_water;
|
_renderer->customData[3] = &_water;
|
||||||
_renderer->applyTextures = _applyTextures;
|
_renderer->applyTextures = _applyTextures;
|
||||||
|
|
||||||
|
_inited = false;
|
||||||
_updated = false;
|
_updated = false;
|
||||||
|
|
||||||
|
_average_frame_time = 0.05;
|
||||||
|
_quality = 3;
|
||||||
|
_last_mouse_x = 0;
|
||||||
|
_last_mouse_y = 0;
|
||||||
|
|
||||||
|
startTimer(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
WidgetExplorer::~WidgetExplorer()
|
||||||
|
{
|
||||||
|
stopRendering();
|
||||||
|
|
||||||
|
for (int i = 0; i < _chunks.count(); i++)
|
||||||
|
{
|
||||||
|
delete _chunks[i];
|
||||||
|
}
|
||||||
|
waterDeleteDefinition(&_water);
|
||||||
|
rendererDelete(_renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WidgetExplorer::startRendering()
|
||||||
|
{
|
||||||
// Add terrain
|
// Add terrain
|
||||||
int chunks = 20;
|
int chunks = 20;
|
||||||
double size = 200.0;
|
double size = 200.0;
|
||||||
|
@ -98,31 +121,8 @@ WidgetExplorer::WidgetExplorer(QWidget *parent, CameraDefinition* camera):
|
||||||
_updateQueue.append(chunk);
|
_updateQueue.append(chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
startThreads();
|
// Start rendering workers
|
||||||
startTimer(500);
|
|
||||||
|
|
||||||
_average_frame_time = 0.05;
|
|
||||||
_quality = 3;
|
|
||||||
_last_mouse_x = 0;
|
|
||||||
_last_mouse_y = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
WidgetExplorer::~WidgetExplorer()
|
|
||||||
{
|
|
||||||
stopThreads();
|
|
||||||
|
|
||||||
for (int i = 0; i < _chunks.count(); i++)
|
|
||||||
{
|
|
||||||
delete _chunks[i];
|
|
||||||
}
|
|
||||||
waterDeleteDefinition(&_water);
|
|
||||||
rendererDelete(_renderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WidgetExplorer::startThreads()
|
|
||||||
{
|
|
||||||
int nbcore;
|
int nbcore;
|
||||||
|
|
||||||
_alive = true;
|
_alive = true;
|
||||||
|
|
||||||
nbcore = QThread::idealThreadCount();
|
nbcore = QThread::idealThreadCount();
|
||||||
|
@ -141,7 +141,7 @@ void WidgetExplorer::startThreads()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetExplorer::stopThreads()
|
void WidgetExplorer::stopRendering()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _threads.count(); i++)
|
for (int i = 0; i < _threads.count(); i++)
|
||||||
{
|
{
|
||||||
|
@ -333,6 +333,12 @@ void WidgetExplorer::wheelEvent(QWheelEvent* event)
|
||||||
|
|
||||||
void WidgetExplorer::timerEvent(QTimerEvent*)
|
void WidgetExplorer::timerEvent(QTimerEvent*)
|
||||||
{
|
{
|
||||||
|
if (!_inited)
|
||||||
|
{
|
||||||
|
_inited = true;
|
||||||
|
startRendering();
|
||||||
|
}
|
||||||
|
|
||||||
if (_updated)
|
if (_updated)
|
||||||
{
|
{
|
||||||
_updated = false;
|
_updated = false;
|
||||||
|
@ -435,6 +441,15 @@ void WidgetExplorer::paintGL()
|
||||||
_quality++;
|
_quality++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Messages
|
||||||
|
if (!_inited)
|
||||||
|
{
|
||||||
|
glColor3f(0.0, 0.0, 0.0);
|
||||||
|
renderText(6, height() - 10, tr("Please wait while loading scene..."));
|
||||||
|
glColor3f(1.0, 1.0, 1.0);
|
||||||
|
renderText(5, height() - 9, tr("Please wait while loading scene..."));
|
||||||
|
}
|
||||||
|
|
||||||
while ((error_code = glGetError()) != GL_NO_ERROR)
|
while ((error_code = glGetError()) != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
logDebug(QString("[OpenGL] ERROR : ") + (const char*)gluErrorString(error_code));
|
logDebug(QString("[OpenGL] ERROR : ") + (const char*)gluErrorString(error_code));
|
||||||
|
|
|
@ -33,13 +33,14 @@ protected:
|
||||||
void paintGL();
|
void paintGL();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void startThreads();
|
void startRendering();
|
||||||
void stopThreads();
|
void stopRendering();
|
||||||
|
|
||||||
CameraDefinition _current_camera;
|
CameraDefinition _current_camera;
|
||||||
CameraDefinition* _base_camera;
|
CameraDefinition* _base_camera;
|
||||||
|
|
||||||
Renderer* _renderer;
|
Renderer* _renderer;
|
||||||
|
bool _inited;
|
||||||
bool _updated;
|
bool _updated;
|
||||||
|
|
||||||
QVector<BaseExplorerChunk*> _chunks;
|
QVector<BaseExplorerChunk*> _chunks;
|
||||||
|
|
Loading…
Reference in a new issue