diff --git a/TODO b/TODO index 9351d8f..da1b1c1 100644 --- a/TODO +++ b/TODO @@ -24,7 +24,6 @@ Technology Preview 2 : - 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)). - Top-down previews and explorer renderings should be camera independant. -- Explorer should have a waiting message while init. - Sun radius is too small. Technlogy Preview 3 : diff --git a/gui_qt/dialogexplorer.cpp b/gui_qt/dialogexplorer.cpp index 4a211d0..f636570 100644 --- a/gui_qt/dialogexplorer.cpp +++ b/gui_qt/dialogexplorer.cpp @@ -20,7 +20,7 @@ DialogExplorer::DialogExplorer(QWidget* parent, CameraDefinition* camera, bool c panel = new QWidget(this); panel->setLayout(new QVBoxLayout()); panel->setMaximumWidth(230); - + panel->layout()->addWidget(new QLabel(tr("COMMANDS\n\nLeft click : Look around\nRight click : Pan (adjust framing)\nWheel : Move forward/backward\nHold SHIFT : Faster\nHold CTRL : Slower"), panel)); button = new QPushButton(tr("Reset camera"), panel); diff --git a/gui_qt/widgetexplorer.cpp b/gui_qt/widgetexplorer.cpp index 056addc..e71161d 100644 --- a/gui_qt/widgetexplorer.cpp +++ b/gui_qt/widgetexplorer.cpp @@ -73,8 +73,31 @@ WidgetExplorer::WidgetExplorer(QWidget *parent, CameraDefinition* camera): _renderer->customData[3] = &_water; _renderer->applyTextures = _applyTextures; + _inited = 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 int chunks = 20; double size = 200.0; @@ -98,31 +121,8 @@ WidgetExplorer::WidgetExplorer(QWidget *parent, CameraDefinition* camera): _updateQueue.append(chunk); } - startThreads(); - 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() -{ + // Start rendering workers int nbcore; - _alive = true; nbcore = QThread::idealThreadCount(); @@ -141,7 +141,7 @@ void WidgetExplorer::startThreads() } } -void WidgetExplorer::stopThreads() +void WidgetExplorer::stopRendering() { for (int i = 0; i < _threads.count(); i++) { @@ -333,6 +333,12 @@ void WidgetExplorer::wheelEvent(QWheelEvent* event) void WidgetExplorer::timerEvent(QTimerEvent*) { + if (!_inited) + { + _inited = true; + startRendering(); + } + if (_updated) { _updated = false; @@ -435,6 +441,15 @@ void WidgetExplorer::paintGL() _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) { logDebug(QString("[OpenGL] ERROR : ") + (const char*)gluErrorString(error_code)); diff --git a/gui_qt/widgetexplorer.h b/gui_qt/widgetexplorer.h index dcc67a5..9133048 100644 --- a/gui_qt/widgetexplorer.h +++ b/gui_qt/widgetexplorer.h @@ -33,13 +33,14 @@ protected: void paintGL(); private: - void startThreads(); - void stopThreads(); + void startRendering(); + void stopRendering(); CameraDefinition _current_camera; CameraDefinition* _base_camera; Renderer* _renderer; + bool _inited; bool _updated; QVector _chunks;