Fixed explorer and renderer
This commit is contained in:
parent
19ac6936b0
commit
09c6ce6e58
7 changed files with 15 additions and 9 deletions
|
@ -239,7 +239,7 @@ void FreeFormHelper::processExploreClicked()
|
||||||
CameraDefinition camera;
|
CameraDefinition camera;
|
||||||
DesktopScenery::getCurrent()->getCamera(&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();
|
dialog->exec();
|
||||||
delete dialog;
|
delete dialog;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include "WidgetExplorer.h"
|
#include "WidgetExplorer.h"
|
||||||
|
#include "DesktopScenery.h"
|
||||||
#include "CameraDefinition.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;
|
QWidget* panel;
|
||||||
QPushButton* button;
|
QPushButton* button;
|
||||||
|
@ -16,7 +17,12 @@ DialogExplorer::DialogExplorer(QWidget* parent, CameraDefinition* camera, bool c
|
||||||
setWindowTitle(tr("Paysages 3D - Explore"));
|
setWindowTitle(tr("Paysages 3D - Explore"));
|
||||||
setLayout(new QHBoxLayout());
|
setLayout(new QHBoxLayout());
|
||||||
|
|
||||||
_wanderer = new WidgetExplorer(this, camera, renderer);
|
if (!scenery)
|
||||||
|
{
|
||||||
|
scenery = DesktopScenery::getCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
_wanderer = new WidgetExplorer(this, camera, scenery);
|
||||||
layout()->addWidget(_wanderer);
|
layout()->addWidget(_wanderer);
|
||||||
|
|
||||||
panel = new QWidget(this);
|
panel = new QWidget(this);
|
||||||
|
|
|
@ -9,7 +9,7 @@ class DialogExplorer : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
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();
|
~DialogExplorer();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
|
@ -70,7 +70,7 @@ static AtmosphereResult _applyAerialPerspective(Renderer*, Vector3, Color base)
|
||||||
return result;
|
return result;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
WidgetExplorer::WidgetExplorer(QWidget *parent, CameraDefinition* camera, SoftwareRenderer* renderer) :
|
WidgetExplorer::WidgetExplorer(QWidget *parent, CameraDefinition* camera, Scenery* scenery) :
|
||||||
QGLWidget(parent)
|
QGLWidget(parent)
|
||||||
{
|
{
|
||||||
setMinimumSize(400, 300);
|
setMinimumSize(400, 300);
|
||||||
|
@ -80,7 +80,7 @@ QGLWidget(parent)
|
||||||
_base_camera = camera;
|
_base_camera = camera;
|
||||||
camera->copy(_current_camera);
|
camera->copy(_current_camera);
|
||||||
|
|
||||||
_renderer = renderer;
|
_renderer = new SoftwareRenderer(scenery);
|
||||||
_opengl_renderer = new OpenGLRenderer(NULL);
|
_opengl_renderer = new OpenGLRenderer(NULL);
|
||||||
_renderer->prepare();
|
_renderer->prepare();
|
||||||
_renderer->render_quality = 3;
|
_renderer->render_quality = 3;
|
||||||
|
|
|
@ -14,7 +14,7 @@ class OPENGLSHARED_EXPORT WidgetExplorer : public QGLWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
WidgetExplorer(QWidget* parent, CameraDefinition* camera, SoftwareRenderer* renderer);
|
WidgetExplorer(QWidget* parent, CameraDefinition* camera, Scenery* scenery);
|
||||||
~WidgetExplorer();
|
~WidgetExplorer();
|
||||||
|
|
||||||
void performChunksMaintenance();
|
void performChunksMaintenance();
|
||||||
|
|
|
@ -119,7 +119,7 @@ void RenderArea::setParams(RenderParams params)
|
||||||
width = params.width * params.antialias;
|
width = params.width * params.antialias;
|
||||||
height = params.height * params.antialias;
|
height = params.height * params.antialias;
|
||||||
|
|
||||||
params = params;
|
this->params = params;
|
||||||
delete[] pixels;
|
delete[] pixels;
|
||||||
pixels = new RenderFragment[width * height];
|
pixels = new RenderFragment[width * height];
|
||||||
pixel_count = width * height;
|
pixel_count = width * height;
|
||||||
|
|
|
@ -128,6 +128,7 @@ static void* _renderFirstPass(void* data)
|
||||||
{
|
{
|
||||||
SoftwareRenderer* renderer = (SoftwareRenderer*)data;
|
SoftwareRenderer* renderer = (SoftwareRenderer*)data;
|
||||||
renderer->rasterize();
|
renderer->rasterize();
|
||||||
|
renderer->is_rendering = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +165,6 @@ void SoftwareRenderer::start(RenderArea::RenderParams params)
|
||||||
|
|
||||||
if (++loops >= 10)
|
if (++loops >= 10)
|
||||||
{
|
{
|
||||||
|
|
||||||
render_area->update();
|
render_area->update();
|
||||||
loops = 0;
|
loops = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue