Don't copy scenery in the renderer

This commit is contained in:
Michaël Lemaire 2015-08-18 22:29:18 +02:00
parent db0be5204f
commit 56dae1e38e
10 changed files with 20 additions and 41 deletions

View file

@ -203,9 +203,8 @@ int main(int argc, char** argv)
Vector3 step = {conf_camera_step_x, conf_camera_step_y, conf_camera_step_z};
camera->setLocation(camera->getLocation().add(step));
renderer = new SoftwareCanvasRenderer();
renderer = new SoftwareCanvasRenderer(scenery);
renderer->setConfig(conf_render_params);
renderer->setScenery(scenery);
if (outputcount >= conf_first_picture)
{

View file

@ -17,12 +17,12 @@
MainModelerWindow::MainModelerWindow()
{
Scenery scenery;
scenery.autoPreset();
scenery = new Scenery();
scenery->autoPreset();
Logs::debug() << "Initialized scenery:\n" << scenery.toString() << std::endl;
Logs::debug() << "Initialized scenery:\n" << scenery->toString() << std::endl;
renderer = new OpenGLRenderer(&scenery);
renderer = new OpenGLRenderer(scenery);
render_preview_provider = new RenderPreviewProvider();
@ -77,11 +77,6 @@ void MainModelerWindow::setState(const QString &stateName)
rootObject()->setProperty("state", stateName);
}
Scenery *MainModelerWindow::getScenery() const
{
return renderer->getScenery();
}
void MainModelerWindow::keyReleaseEvent(QKeyEvent *event)
{
if (getState() == "Render Dialog")

View file

@ -21,7 +21,7 @@ public:
QString getState() const;
void setState(const QString &stateName);
Scenery *getScenery() const;
inline Scenery *getScenery() const {return scenery;}
inline OpenGLRenderer *getRenderer() const {return renderer;}
inline ModelerCameras *getCamera() const {return cameras;}
@ -29,6 +29,7 @@ protected:
virtual void keyReleaseEvent(QKeyEvent *event) override;
private:
Scenery *scenery;
OpenGLRenderer *renderer;
AtmosphereModeler *atmosphere;

View file

@ -76,8 +76,7 @@ void RenderProcess::startRender(Scenery *scenery, const RenderConfig &config)
delete renderer;
}
renderer = new SoftwareCanvasRenderer();
renderer->setScenery(scenery);
renderer = new SoftwareCanvasRenderer(scenery);
renderer->setConfig(config);
destination->setCanvas(renderer->getCanvas());

View file

@ -14,7 +14,7 @@ namespace opengl {
class OPENGLSHARED_EXPORT OpenGLRenderer: public SoftwareRenderer
{
public:
OpenGLRenderer(Scenery* scenery=0);
OpenGLRenderer(Scenery* scenery);
virtual ~OpenGLRenderer();
inline OpenGLSkybox *getSkybox() const {return skybox;}

View file

@ -14,7 +14,8 @@
#include "ColorProfile.h"
#include "CanvasPreview.h"
SoftwareCanvasRenderer::SoftwareCanvasRenderer()
SoftwareCanvasRenderer::SoftwareCanvasRenderer(Scenery *scenery):
SoftwareRenderer(scenery)
{
started = false;
finished = false;

View file

@ -19,7 +19,7 @@ namespace software {
class SOFTWARESHARED_EXPORT SoftwareCanvasRenderer: public SoftwareRenderer
{
public:
SoftwareCanvasRenderer();
SoftwareCanvasRenderer(Scenery *scenery);
virtual ~SoftwareCanvasRenderer();
inline const Canvas *getCanvas() const {return canvas;}

View file

@ -20,14 +20,9 @@
#include "System.h"
#include "Thread.h"
SoftwareRenderer::SoftwareRenderer(Scenery* scenery)
SoftwareRenderer::SoftwareRenderer(Scenery* scenery):
scenery(scenery)
{
this->scenery = new Scenery;
if (scenery)
{
scenery->copy(this->scenery);
}
render_quality = 5;
render_camera = new CameraDefinition;
@ -61,13 +56,6 @@ SoftwareRenderer::~SoftwareRenderer()
delete terrain_renderer;
delete textures_renderer;
delete water_renderer;
delete scenery;
}
void SoftwareRenderer::setScenery(Scenery* scenery)
{
scenery->copy(this->scenery);
}
void SoftwareRenderer::prepare()

View file

@ -15,7 +15,7 @@ class SOFTWARESHARED_EXPORT SoftwareRenderer
{
public:
SoftwareRenderer(Scenery* scenery=0);
SoftwareRenderer(Scenery* scenery);
virtual ~SoftwareRenderer();
/* Render base configuration */
@ -30,13 +30,6 @@ public:
virtual Vector3 projectPoint(const Vector3 &point);
virtual Vector3 unprojectPoint(const Vector3 &point);
/*!
* \brief Set the scenery to render.
*
* Don't call this after rendering has already started.
*/
virtual void setScenery(Scenery* scenery);
/*!
* \brief Prepare the renderer sub-systems.
*

View file

@ -11,14 +11,17 @@ class FluidMediumManager_Test:public BaseTestCase
protected:
virtual void setUp()
{
renderer = new SoftwareRenderer();
scenery = new Scenery();
renderer = new SoftwareRenderer(scenery);
}
virtual void tearDown()
{
delete renderer;
delete scenery;
}
Scenery *scenery;
SoftwareRenderer *renderer;
};