From 09c6ce6e58c1d34c073d2d3be44f4ed784b431d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Tue, 10 Dec 2013 23:06:57 +0100 Subject: [PATCH] Fixed explorer and renderer --- src/interface/desktop/common/freeformhelper.cpp | 2 +- src/interface/desktop/dialogexplorer.cpp | 10 ++++++++-- src/interface/desktop/dialogexplorer.h | 2 +- src/render/opengl/WidgetExplorer.cpp | 4 ++-- src/render/opengl/WidgetExplorer.h | 2 +- src/render/software/RenderArea.cpp | 2 +- src/render/software/SoftwareRenderer.cpp | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/interface/desktop/common/freeformhelper.cpp b/src/interface/desktop/common/freeformhelper.cpp index 0a78f7c..7a927f8 100644 --- a/src/interface/desktop/common/freeformhelper.cpp +++ b/src/interface/desktop/common/freeformhelper.cpp @@ -239,7 +239,7 @@ void FreeFormHelper::processExploreClicked() CameraDefinition camera; DesktopScenery::getCurrent()->getCamera(&camera); - DialogExplorer* dialog = new DialogExplorer(_form_widget, &camera, false, &renderer); + DialogExplorer* dialog = new DialogExplorer(_form_widget, &camera, false, renderer.getScenery()); dialog->exec(); delete dialog; } diff --git a/src/interface/desktop/dialogexplorer.cpp b/src/interface/desktop/dialogexplorer.cpp index 50b59fd..870d588 100644 --- a/src/interface/desktop/dialogexplorer.cpp +++ b/src/interface/desktop/dialogexplorer.cpp @@ -5,9 +5,10 @@ #include #include #include "WidgetExplorer.h" +#include "DesktopScenery.h" #include "CameraDefinition.h" -DialogExplorer::DialogExplorer(QWidget* parent, CameraDefinition* camera, bool camera_validable, SoftwareRenderer* renderer) : QDialog(parent) +DialogExplorer::DialogExplorer(QWidget* parent, CameraDefinition* camera, bool camera_validable, Scenery* scenery) : QDialog(parent) { QWidget* panel; QPushButton* button; @@ -16,7 +17,12 @@ DialogExplorer::DialogExplorer(QWidget* parent, CameraDefinition* camera, bool c setWindowTitle(tr("Paysages 3D - Explore")); setLayout(new QHBoxLayout()); - _wanderer = new WidgetExplorer(this, camera, renderer); + if (!scenery) + { + scenery = DesktopScenery::getCurrent(); + } + + _wanderer = new WidgetExplorer(this, camera, scenery); layout()->addWidget(_wanderer); panel = new QWidget(this); diff --git a/src/interface/desktop/dialogexplorer.h b/src/interface/desktop/dialogexplorer.h index dbc43fc..420b4ec 100644 --- a/src/interface/desktop/dialogexplorer.h +++ b/src/interface/desktop/dialogexplorer.h @@ -9,7 +9,7 @@ class DialogExplorer : public QDialog { Q_OBJECT public: - explicit DialogExplorer(QWidget *parent, CameraDefinition* camera, bool camera_validable=false, SoftwareRenderer* renderer=0); + explicit DialogExplorer(QWidget *parent, CameraDefinition* camera, bool camera_validable=false, Scenery* scenery=0); ~DialogExplorer(); protected slots: diff --git a/src/render/opengl/WidgetExplorer.cpp b/src/render/opengl/WidgetExplorer.cpp index 775f6ea..4ff4c47 100644 --- a/src/render/opengl/WidgetExplorer.cpp +++ b/src/render/opengl/WidgetExplorer.cpp @@ -70,7 +70,7 @@ static AtmosphereResult _applyAerialPerspective(Renderer*, Vector3, Color base) return result; }*/ -WidgetExplorer::WidgetExplorer(QWidget *parent, CameraDefinition* camera, SoftwareRenderer* renderer) : +WidgetExplorer::WidgetExplorer(QWidget *parent, CameraDefinition* camera, Scenery* scenery) : QGLWidget(parent) { setMinimumSize(400, 300); @@ -80,7 +80,7 @@ QGLWidget(parent) _base_camera = camera; camera->copy(_current_camera); - _renderer = renderer; + _renderer = new SoftwareRenderer(scenery); _opengl_renderer = new OpenGLRenderer(NULL); _renderer->prepare(); _renderer->render_quality = 3; diff --git a/src/render/opengl/WidgetExplorer.h b/src/render/opengl/WidgetExplorer.h index dc697a4..283a295 100644 --- a/src/render/opengl/WidgetExplorer.h +++ b/src/render/opengl/WidgetExplorer.h @@ -14,7 +14,7 @@ class OPENGLSHARED_EXPORT WidgetExplorer : public QGLWidget { Q_OBJECT public: - WidgetExplorer(QWidget* parent, CameraDefinition* camera, SoftwareRenderer* renderer); + WidgetExplorer(QWidget* parent, CameraDefinition* camera, Scenery* scenery); ~WidgetExplorer(); void performChunksMaintenance(); diff --git a/src/render/software/RenderArea.cpp b/src/render/software/RenderArea.cpp index 764be2f..1393bd8 100644 --- a/src/render/software/RenderArea.cpp +++ b/src/render/software/RenderArea.cpp @@ -119,7 +119,7 @@ void RenderArea::setParams(RenderParams params) width = params.width * params.antialias; height = params.height * params.antialias; - params = params; + this->params = params; delete[] pixels; pixels = new RenderFragment[width * height]; pixel_count = width * height; diff --git a/src/render/software/SoftwareRenderer.cpp b/src/render/software/SoftwareRenderer.cpp index 664a4ea..f70d66f 100644 --- a/src/render/software/SoftwareRenderer.cpp +++ b/src/render/software/SoftwareRenderer.cpp @@ -128,6 +128,7 @@ static void* _renderFirstPass(void* data) { SoftwareRenderer* renderer = (SoftwareRenderer*)data; renderer->rasterize(); + renderer->is_rendering = 0; return NULL; } @@ -164,7 +165,6 @@ void SoftwareRenderer::start(RenderArea::RenderParams params) if (++loops >= 10) { - render_area->update(); loops = 0; }