Fixed explorer and renderer

This commit is contained in:
Michaël Lemaire 2013-12-10 23:06:57 +01:00
parent 19ac6936b0
commit 09c6ce6e58
7 changed files with 15 additions and 9 deletions

View file

@ -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;
}

View file

@ -5,9 +5,10 @@
#include <QVBoxLayout>
#include <QLabel>
#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);

View file

@ -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:

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -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;
}