Refactored RenderingScenery and STL containers usage
This commit is contained in:
parent
2aed1f07ae
commit
19ac6936b0
37 changed files with 261 additions and 289 deletions
5
Makefile
5
Makefile
|
@ -1,6 +1,7 @@
|
||||||
BUILDMODE=release
|
BUILDMODE=release
|
||||||
BUILDPATH=./build/${BUILDMODE}
|
BUILDPATH=./build/${BUILDMODE}
|
||||||
LIBRARY_PATH=${BUILDPATH}/rendering:${BUILDPATH}/exploring:${BUILDPATH}/system:${BUILDPATH}/basics:${BUILDPATH}/definition:${BUILDPATH}/render/opengl:${BUILDPATH}/render/software:${BUILDPATH}/tests/googletest
|
LIBRARY_PATH=${BUILDPATH}/rendering:${BUILDPATH}/exploring:${BUILDPATH}/system:${BUILDPATH}/basics:${BUILDPATH}/definition:${BUILDPATH}/render/opengl:${BUILDPATH}/render/software:${BUILDPATH}/tests/googletest
|
||||||
|
BUILD_SPEC=linux-g++
|
||||||
|
|
||||||
all:build
|
all:build
|
||||||
|
|
||||||
|
@ -9,9 +10,9 @@ dirs:
|
||||||
|
|
||||||
makefiles:dirs
|
makefiles:dirs
|
||||||
ifeq (${BUILDMODE}, release)
|
ifeq (${BUILDMODE}, release)
|
||||||
@+cd ${BUILDPATH} && qmake ../../src/paysages.pro -r -spec linux-clang
|
@+cd ${BUILDPATH} && qmake ../../src/paysages.pro -r -spec $(BUILD_SPEC)
|
||||||
else
|
else
|
||||||
@+cd ${BUILDPATH} && qmake ../../src/paysages.pro -r -spec linux-clang CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
|
@+cd ${BUILDPATH} && qmake ../../src/paysages.pro -r -spec $(BUILD_SPEC) CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build:makefiles
|
build:makefiles
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#include "Curve.h"
|
#include "Curve.h"
|
||||||
|
|
||||||
const int MAX_NB_POINTS = 30;
|
#include <cstring>
|
||||||
|
|
||||||
#include "PackStream.h"
|
#include "PackStream.h"
|
||||||
|
|
||||||
|
const int MAX_NB_POINTS = 30;
|
||||||
|
|
||||||
Curve::Curve()
|
Curve::Curve()
|
||||||
{
|
{
|
||||||
nbpoints = 0;
|
nbpoints = 0;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "RandomGenerator.h"
|
#include "RandomGenerator.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#define MAX_LEVEL_COUNT 30
|
#define MAX_LEVEL_COUNT 30
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,13 @@ BaseDefinition::BaseDefinition(BaseDefinition* parent):
|
||||||
|
|
||||||
BaseDefinition::~BaseDefinition()
|
BaseDefinition::~BaseDefinition()
|
||||||
{
|
{
|
||||||
QListIterator<BaseDefinition*> it(children);
|
for (auto child:children)
|
||||||
while (it.hasNext())
|
|
||||||
{
|
{
|
||||||
delete it.next();
|
delete child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDefinition::setName(const QString &name)
|
void BaseDefinition::setName(const std::string &name)
|
||||||
{
|
{
|
||||||
this->name = name;
|
this->name = name;
|
||||||
}
|
}
|
||||||
|
@ -44,20 +43,18 @@ Scenery* BaseDefinition::getScenery()
|
||||||
void BaseDefinition::save(PackStream* stream) const
|
void BaseDefinition::save(PackStream* stream) const
|
||||||
{
|
{
|
||||||
stream->write(name);
|
stream->write(name);
|
||||||
QListIterator<BaseDefinition*> it(children);
|
for (auto child: children)
|
||||||
while (it.hasNext())
|
|
||||||
{
|
{
|
||||||
it.next()->save(stream);
|
child->save(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDefinition::load(PackStream* stream)
|
void BaseDefinition::load(PackStream* stream)
|
||||||
{
|
{
|
||||||
name = stream->readString();
|
name = stream->readString();
|
||||||
QListIterator<BaseDefinition*> it(children);
|
for (auto child: children)
|
||||||
while (it.hasNext())
|
|
||||||
{
|
{
|
||||||
it.next()->load(stream);
|
child->load(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,18 +66,17 @@ void BaseDefinition::copy(BaseDefinition* destination) const
|
||||||
|
|
||||||
void BaseDefinition::validate()
|
void BaseDefinition::validate()
|
||||||
{
|
{
|
||||||
QListIterator<BaseDefinition*> it(children);
|
for (auto child: children)
|
||||||
while (it.hasNext())
|
|
||||||
{
|
{
|
||||||
it.next()->validate();
|
child->validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseDefinition::addChild(BaseDefinition* child)
|
void BaseDefinition::addChild(BaseDefinition* child)
|
||||||
{
|
{
|
||||||
if (not children.contains(child))
|
if (std::find(children.begin(), children.end(), child) != children.end())
|
||||||
{
|
{
|
||||||
children.append(child);
|
children.push_back(child);
|
||||||
child->parent = this;
|
child->parent = this;
|
||||||
child->root = this->root;
|
child->root = this->root;
|
||||||
}
|
}
|
||||||
|
@ -88,5 +84,13 @@ void BaseDefinition::addChild(BaseDefinition* child)
|
||||||
|
|
||||||
void BaseDefinition::removeChild(BaseDefinition* child)
|
void BaseDefinition::removeChild(BaseDefinition* child)
|
||||||
{
|
{
|
||||||
children.removeOne(child);
|
std::vector<BaseDefinition*>::iterator it = std::find(children.begin(), children.end(), child);
|
||||||
|
if (it != children.end())
|
||||||
|
{
|
||||||
|
children.erase(it);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("Trying to remove not found child from '%s'", name.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,7 @@
|
||||||
|
|
||||||
#include "definition_global.h"
|
#include "definition_global.h"
|
||||||
|
|
||||||
#include <QList>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
namespace paysages {
|
namespace paysages {
|
||||||
namespace system {class PackStream;}
|
|
||||||
namespace definition {
|
namespace definition {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,8 +21,8 @@ public:
|
||||||
virtual void copy(BaseDefinition* destination) const;
|
virtual void copy(BaseDefinition* destination) const;
|
||||||
virtual void validate();
|
virtual void validate();
|
||||||
|
|
||||||
inline const QString& getName() const {return name;}
|
inline const std::string &getName() const {return name;}
|
||||||
virtual void setName(const QString &name);
|
virtual void setName(const std::string &name);
|
||||||
|
|
||||||
virtual Scenery* getScenery();
|
virtual Scenery* getScenery();
|
||||||
|
|
||||||
|
@ -40,8 +36,8 @@ protected:
|
||||||
private:
|
private:
|
||||||
BaseDefinition* parent;
|
BaseDefinition* parent;
|
||||||
BaseDefinition* root;
|
BaseDefinition* root;
|
||||||
QString name;
|
std::string name;
|
||||||
QList<BaseDefinition*> children;
|
std::vector<BaseDefinition*> children;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,11 @@ void Layers::copy(BaseDefinition* destination_) const
|
||||||
|
|
||||||
null_layer->copy(destination->null_layer);
|
null_layer->copy(destination->null_layer);
|
||||||
|
|
||||||
QListIterator<BaseDefinition*> it(layers);
|
for (auto layer: layers)
|
||||||
while (it.hasNext())
|
|
||||||
{
|
{
|
||||||
int position = destination->addLayer();
|
int position = destination->addLayer();
|
||||||
BaseDefinition* new_layer = destination->getLayer(position);
|
BaseDefinition* new_layer = destination->getLayer(position);
|
||||||
it.next()->copy(new_layer);
|
layer->copy(new_layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,12 +48,12 @@ void Layers::setMaxLayerCount(int max_layer_count)
|
||||||
|
|
||||||
int Layers::count() const
|
int Layers::count() const
|
||||||
{
|
{
|
||||||
return layers.count();
|
return layers.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseDefinition* Layers::getLayer(int position) const
|
BaseDefinition* Layers::getLayer(int position) const
|
||||||
{
|
{
|
||||||
if (position >= 0 and position < layers.size())
|
if (position >= 0 and position < (int)layers.size())
|
||||||
{
|
{
|
||||||
return layers[position];
|
return layers[position];
|
||||||
}
|
}
|
||||||
|
@ -67,19 +66,24 @@ BaseDefinition* Layers::getLayer(int position) const
|
||||||
|
|
||||||
int Layers::findLayer(BaseDefinition* layer) const
|
int Layers::findLayer(BaseDefinition* layer) const
|
||||||
{
|
{
|
||||||
int result = layers.indexOf(layer);
|
int i = 0;
|
||||||
if (result < 0)
|
for (auto it:layers)
|
||||||
{
|
{
|
||||||
qWarning("Layer %p not found, on a total of %d, returning %d", layer, layers.size(), result);
|
if (it == layer)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
return result;
|
i++;
|
||||||
|
}
|
||||||
|
qWarning("Layer %p not found, on a total of %d, returning %d", layer, layers.size(), -1);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Layers::addLayer(BaseDefinition* layer)
|
int Layers::addLayer(BaseDefinition* layer)
|
||||||
{
|
{
|
||||||
if (layers.size() < max_layer_count)
|
if ((int)layers.size() < max_layer_count)
|
||||||
{
|
{
|
||||||
layers.append(layer);
|
layers.push_back(layer);
|
||||||
addChild(layer);
|
addChild(layer);
|
||||||
return layers.size() - 1;
|
return layers.size() - 1;
|
||||||
}
|
}
|
||||||
|
@ -97,10 +101,11 @@ int Layers::addLayer()
|
||||||
|
|
||||||
void Layers::removeLayer(int position)
|
void Layers::removeLayer(int position)
|
||||||
{
|
{
|
||||||
if (position >= 0 and position < layers.size())
|
if (position >= 0 and position < (int)layers.size())
|
||||||
{
|
{
|
||||||
BaseDefinition* removed = layers.takeAt(position);
|
BaseDefinition* removed = layers[position];
|
||||||
removeChild(removed);
|
removeChild(removed);
|
||||||
|
layers.erase(layers.begin() + position);
|
||||||
delete removed;
|
delete removed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,9 +117,11 @@ void Layers::removeLayer(BaseDefinition* layer)
|
||||||
|
|
||||||
void Layers::moveLayer(int old_position, int new_position)
|
void Layers::moveLayer(int old_position, int new_position)
|
||||||
{
|
{
|
||||||
if (old_position >= 0 and old_position < layers.size() and new_position >= 0 and new_position < layers.size())
|
if (old_position >= 0 and old_position < (int)layers.size() and new_position >= 0 and new_position < (int)layers.size())
|
||||||
{
|
{
|
||||||
layers.move(old_position, new_position);
|
BaseDefinition* layer = layers[old_position];
|
||||||
|
layers.erase(layers.begin() + old_position);
|
||||||
|
layers.insert(layers.begin() + new_position, layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
public:
|
public:
|
||||||
LayerConstructor layer_constructor;
|
LayerConstructor layer_constructor;
|
||||||
int max_layer_count;
|
int max_layer_count;
|
||||||
QList<BaseDefinition*> layers;
|
std::vector<BaseDefinition*> layers;
|
||||||
BaseDefinition* null_layer;
|
BaseDefinition* null_layer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "Scenery.h"
|
#include "Scenery.h"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "NoiseGenerator.h"
|
#include "NoiseGenerator.h"
|
||||||
#include "PackStream.h"
|
#include "PackStream.h"
|
||||||
|
@ -11,6 +12,9 @@
|
||||||
#include "TexturesDefinition.h"
|
#include "TexturesDefinition.h"
|
||||||
#include "WaterDefinition.h"
|
#include "WaterDefinition.h"
|
||||||
|
|
||||||
|
static const double APP_HEADER = 19866544632.125;
|
||||||
|
static const int DATA_VERSION = 1;
|
||||||
|
|
||||||
Scenery::Scenery():
|
Scenery::Scenery():
|
||||||
BaseDefinition(NULL)
|
BaseDefinition(NULL)
|
||||||
{
|
{
|
||||||
|
@ -59,6 +63,53 @@ void Scenery::validate()
|
||||||
checkCameraAboveGround();
|
checkCameraAboveGround();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Scenery::FileOperationResult Scenery::saveGlobal(const std::string &filepath) const
|
||||||
|
{
|
||||||
|
PackStream stream;
|
||||||
|
double app_header, version_header;
|
||||||
|
|
||||||
|
if (not stream.bindToFile(filepath, true))
|
||||||
|
{
|
||||||
|
return FILE_OPERATION_IOERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
app_header = (double)APP_HEADER;
|
||||||
|
stream.write(&app_header);
|
||||||
|
version_header = (double)DATA_VERSION;
|
||||||
|
stream.write(&version_header);
|
||||||
|
|
||||||
|
save(&stream);
|
||||||
|
|
||||||
|
return FILE_OPERATION_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Scenery::FileOperationResult Scenery::loadGlobal(const std::string &filepath)
|
||||||
|
{
|
||||||
|
PackStream stream;
|
||||||
|
double app_header, version_header;
|
||||||
|
|
||||||
|
if (not stream.bindToFile(filepath, false))
|
||||||
|
{
|
||||||
|
return FILE_OPERATION_IOERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
stream.read(&app_header);
|
||||||
|
if (app_header != APP_HEADER)
|
||||||
|
{
|
||||||
|
return FILE_OPERATION_APP_MISMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
stream.read(&version_header);
|
||||||
|
if ((int)version_header != DATA_VERSION)
|
||||||
|
{
|
||||||
|
return FILE_OPERATION_VERSION_MISMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
load(&stream);
|
||||||
|
|
||||||
|
return FILE_OPERATION_OK;
|
||||||
|
}
|
||||||
|
|
||||||
Scenery* Scenery::getScenery()
|
Scenery* Scenery::getScenery()
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -15,6 +15,16 @@ namespace definition {
|
||||||
*/
|
*/
|
||||||
class DEFINITIONSHARED_EXPORT Scenery: public BaseDefinition
|
class DEFINITIONSHARED_EXPORT Scenery: public BaseDefinition
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
typedef enum {
|
||||||
|
FILE_OPERATION_OK,
|
||||||
|
FILE_OPERATION_IOERROR,
|
||||||
|
FILE_OPERATION_APP_MISMATCH,
|
||||||
|
FILE_OPERATION_VERSION_MISMATCH
|
||||||
|
} FileOperationResult;
|
||||||
|
|
||||||
|
typedef void (*SceneryCustomDataCallback)(PackStream* stream, void* data);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scenery();
|
Scenery();
|
||||||
|
|
||||||
|
@ -24,9 +34,12 @@ public:
|
||||||
virtual void validate() override;
|
virtual void validate() override;
|
||||||
virtual void copy(BaseDefinition *destination) const override;
|
virtual void copy(BaseDefinition *destination) const override;
|
||||||
|
|
||||||
|
FileOperationResult saveGlobal(const std::string &filepath) const;
|
||||||
|
FileOperationResult loadGlobal(const std::string &filepath);
|
||||||
|
|
||||||
virtual Scenery* getScenery() override;
|
virtual Scenery* getScenery() override;
|
||||||
|
|
||||||
void autoPreset(int seed);
|
void autoPreset(int seed=0);
|
||||||
|
|
||||||
void setAtmosphere(AtmosphereDefinition* atmosphere);
|
void setAtmosphere(AtmosphereDefinition* atmosphere);
|
||||||
inline AtmosphereDefinition* getAtmosphere() const {return atmosphere;}
|
inline AtmosphereDefinition* getAtmosphere() const {return atmosphere;}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#include "TerrainHeightMap.h"
|
#include "TerrainHeightMap.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring>
|
||||||
#include "PackStream.h"
|
#include "PackStream.h"
|
||||||
#include "Memory.h"
|
#include "Memory.h"
|
||||||
#include "TerrainDefinition.h"
|
#include "TerrainDefinition.h"
|
||||||
#include "TerrainHeightMapBrush.h"
|
#include "TerrainHeightMapBrush.h"
|
||||||
#include "Interpolation.h"
|
#include "Interpolation.h"
|
||||||
#include "NoiseGenerator.h"
|
#include "NoiseGenerator.h"
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "Zone.h"
|
#include "Zone.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include "Curve.h"
|
#include "Curve.h"
|
||||||
#include "PackStream.h"
|
#include "PackStream.h"
|
||||||
#include "Vector3.h"
|
#include "Vector3.h"
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "main.h"
|
|
||||||
#include "CameraDefinition.h"
|
#include "CameraDefinition.h"
|
||||||
#include "AtmosphereDefinition.h"
|
#include "AtmosphereDefinition.h"
|
||||||
#include "SoftwareRenderer.h"
|
#include "SoftwareRenderer.h"
|
||||||
#include "RenderingScenery.h"
|
#include "Scenery.h"
|
||||||
|
|
||||||
void startRender(SoftwareRenderer* renderer, char* outputpath, RenderArea::RenderParams params)
|
void startRender(SoftwareRenderer* renderer, char* outputpath, RenderArea::RenderParams params)
|
||||||
{
|
{
|
||||||
|
@ -156,25 +155,29 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Initializing ...\n");
|
printf("Initializing ...\n");
|
||||||
paysagesInit();
|
Scenery* scenery = new Scenery();
|
||||||
|
|
||||||
if (conf_file_path)
|
if (conf_file_path)
|
||||||
{
|
{
|
||||||
paysagesLoad(conf_file_path);
|
scenery->loadGlobal(conf_file_path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scenery->autoPreset();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (outputcount = 0; outputcount < conf_first_picture + conf_nb_pictures; outputcount++)
|
for (outputcount = 0; outputcount < conf_first_picture + conf_nb_pictures; outputcount++)
|
||||||
{
|
{
|
||||||
AtmosphereDefinition* atmo = RenderingScenery::getCurrent()->getAtmosphere();
|
AtmosphereDefinition* atmo = scenery->getAtmosphere();
|
||||||
atmo->hour = (int)floor(conf_daytime_start * 24.0);
|
atmo->hour = (int)floor(conf_daytime_start * 24.0);
|
||||||
atmo->minute = (int)floor(fmod(conf_daytime_start, 1.0 / 24.0) * 24.0 * 60.0);
|
atmo->minute = (int)floor(fmod(conf_daytime_start, 1.0 / 24.0) * 24.0 * 60.0);
|
||||||
atmo->validate();
|
atmo->validate();
|
||||||
|
|
||||||
CameraDefinition* camera = RenderingScenery::getCurrent()->getCamera();
|
CameraDefinition* camera = scenery->getCamera();
|
||||||
Vector3 step = {conf_camera_step_x, conf_camera_step_y, conf_camera_step_z};
|
Vector3 step = {conf_camera_step_x, conf_camera_step_y, conf_camera_step_z};
|
||||||
camera->setLocation(camera->getLocation().add(step));
|
camera->setLocation(camera->getLocation().add(step));
|
||||||
|
|
||||||
renderer = new SoftwareRenderer(RenderingScenery::getCurrent());
|
renderer = new SoftwareRenderer(scenery);
|
||||||
renderer->setPreviewCallbacks(NULL, NULL, _previewUpdate);
|
renderer->setPreviewCallbacks(NULL, NULL, _previewUpdate);
|
||||||
|
|
||||||
if (outputcount >= conf_first_picture)
|
if (outputcount >= conf_first_picture)
|
||||||
|
@ -189,7 +192,7 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Cleaning up ...\n");
|
printf("Cleaning up ...\n");
|
||||||
paysagesQuit();
|
delete scenery;
|
||||||
|
|
||||||
printf("\rDone. \n");
|
printf("\rDone. \n");
|
||||||
|
|
||||||
|
|
24
src/interface/desktop/DesktopScenery.cpp
Normal file
24
src/interface/desktop/DesktopScenery.cpp
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#include "DesktopScenery.h"
|
||||||
|
|
||||||
|
#include "common/mainwindow.h"
|
||||||
|
|
||||||
|
static DesktopScenery _main_scenery;
|
||||||
|
|
||||||
|
void DesktopScenery::save(PackStream *stream) const
|
||||||
|
{
|
||||||
|
Scenery::save(stream);
|
||||||
|
|
||||||
|
MainWindow::instance()->guiSave(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DesktopScenery::load(PackStream *stream)
|
||||||
|
{
|
||||||
|
Scenery::load(stream);
|
||||||
|
|
||||||
|
MainWindow::instance()->guiLoad(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
DesktopScenery* DesktopScenery::getCurrent()
|
||||||
|
{
|
||||||
|
return &_main_scenery;
|
||||||
|
}
|
17
src/interface/desktop/DesktopScenery.h
Normal file
17
src/interface/desktop/DesktopScenery.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef DESKTOPSCENERY_H
|
||||||
|
#define DESKTOPSCENERY_H
|
||||||
|
|
||||||
|
#include "desktop_global.h"
|
||||||
|
|
||||||
|
#include "Scenery.h"
|
||||||
|
|
||||||
|
class DesktopScenery: public Scenery
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void save(PackStream* stream) const override;
|
||||||
|
virtual void load(PackStream* stream) override;
|
||||||
|
|
||||||
|
static DesktopScenery* getCurrent();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DESKTOPSCENERY_H
|
|
@ -1,42 +0,0 @@
|
||||||
#include "RenderingScenery.h"
|
|
||||||
|
|
||||||
static RenderingScenery _main_scenery;
|
|
||||||
|
|
||||||
RenderingScenery::RenderingScenery()
|
|
||||||
{
|
|
||||||
_custom_load = NULL;
|
|
||||||
_custom_save = NULL;
|
|
||||||
_custom_data = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderingScenery* RenderingScenery::getCurrent()
|
|
||||||
{
|
|
||||||
return &_main_scenery;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderingScenery::setCustomSaveCallbacks(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data)
|
|
||||||
{
|
|
||||||
_custom_save = callback_save;
|
|
||||||
_custom_load = callback_load;
|
|
||||||
_custom_data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderingScenery::save(PackStream* stream) const
|
|
||||||
{
|
|
||||||
Scenery::save(stream);
|
|
||||||
|
|
||||||
if (_custom_save)
|
|
||||||
{
|
|
||||||
_custom_save(stream, _custom_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenderingScenery::load(PackStream* stream)
|
|
||||||
{
|
|
||||||
Scenery::load(stream);
|
|
||||||
|
|
||||||
if (_custom_load)
|
|
||||||
{
|
|
||||||
_custom_load(stream, _custom_data);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
#ifndef RENDERINGSCENERY_H
|
|
||||||
#define RENDERINGSCENERY_H
|
|
||||||
|
|
||||||
#include "desktop_global.h"
|
|
||||||
|
|
||||||
#include "Scenery.h"
|
|
||||||
|
|
||||||
typedef void (*SceneryCustomDataCallback)(PackStream* stream, void* data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Global scenery management
|
|
||||||
*
|
|
||||||
* This class contains the whole scenery definition.
|
|
||||||
*/
|
|
||||||
class RenderingScenery: public Scenery
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RenderingScenery();
|
|
||||||
|
|
||||||
static RenderingScenery* getCurrent();
|
|
||||||
|
|
||||||
void setCustomSaveCallbacks(SceneryCustomDataCallback callback_save, SceneryCustomDataCallback callback_load, void* data);
|
|
||||||
|
|
||||||
virtual void save(PackStream* stream) const override;
|
|
||||||
virtual void load(PackStream* stream) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
SceneryCustomDataCallback _custom_save;
|
|
||||||
SceneryCustomDataCallback _custom_load;
|
|
||||||
void* _custom_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // RENDERINGSCENERY_H
|
|
|
@ -77,7 +77,7 @@ QStringList BaseFormLayer::getLayers()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _layers_modified->count(); i++)
|
for (int i = 0; i < _layers_modified->count(); i++)
|
||||||
{
|
{
|
||||||
result << _layers_modified->getLayer(i)->getName();
|
result << QString::fromStdString(_layers_modified->getLayer(i)->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void BaseFormLayer::layerAddedEvent()
|
||||||
int layer = _layers_modified->addLayer();
|
int layer = _layers_modified->addLayer();
|
||||||
if (layer >= 0)
|
if (layer >= 0)
|
||||||
{
|
{
|
||||||
_layers_modified->getLayer(layer)->setName(layer_name);
|
_layers_modified->getLayer(layer)->setName(layer_name.toStdString());
|
||||||
|
|
||||||
BaseForm::layerAddedEvent();
|
BaseForm::layerAddedEvent();
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ void BaseFormLayer::layerRenamedEvent(int layer, QString new_name)
|
||||||
{
|
{
|
||||||
if (_layers_modified)
|
if (_layers_modified)
|
||||||
{
|
{
|
||||||
_layers_modified->getLayer(layer)->setName(new_name);
|
_layers_modified->getLayer(layer)->setName(new_name.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseForm::layerRenamedEvent(layer, new_name);
|
BaseForm::layerRenamedEvent(layer, new_name);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "dialogrender.h"
|
#include "dialogrender.h"
|
||||||
#include "dialogexplorer.h"
|
#include "dialogexplorer.h"
|
||||||
#include "RenderingScenery.h"
|
#include "DesktopScenery.h"
|
||||||
#include "BasePreview.h"
|
#include "BasePreview.h"
|
||||||
#include "SoftwareRenderer.h"
|
#include "SoftwareRenderer.h"
|
||||||
#include "CameraDefinition.h"
|
#include "CameraDefinition.h"
|
||||||
|
@ -77,7 +77,7 @@ void FreeFormHelper::startManaging()
|
||||||
connect(this, SIGNAL(needGlobalRefreshing()), _form_widget, SLOT(refreshFromFellowData()));
|
connect(this, SIGNAL(needGlobalRefreshing()), _form_widget, SLOT(refreshFromFellowData()));
|
||||||
connect(this, SIGNAL(needReverting()), _form_widget, SLOT(updateLocalDataFromScenery()));
|
connect(this, SIGNAL(needReverting()), _form_widget, SLOT(updateLocalDataFromScenery()));
|
||||||
connect(this, SIGNAL(needCommitting()), _form_widget, SLOT(commitLocalDataToScenery()));
|
connect(this, SIGNAL(needCommitting()), _form_widget, SLOT(commitLocalDataToScenery()));
|
||||||
connect(this, SIGNAL(needAlterRenderer(Renderer*)), _form_widget, SLOT(alterRenderer(Renderer*)));
|
connect(this, SIGNAL(needAlterRenderer(SoftwareRenderer*)), _form_widget, SLOT(alterRenderer(SoftwareRenderer*)));
|
||||||
|
|
||||||
processGlobalRefresh();
|
processGlobalRefresh();
|
||||||
}
|
}
|
||||||
|
@ -232,12 +232,12 @@ void FreeFormHelper::processApplyClicked()
|
||||||
|
|
||||||
void FreeFormHelper::processExploreClicked()
|
void FreeFormHelper::processExploreClicked()
|
||||||
{
|
{
|
||||||
SoftwareRenderer renderer(RenderingScenery::getCurrent());
|
SoftwareRenderer renderer(DesktopScenery::getCurrent());
|
||||||
|
|
||||||
emit needAlterRenderer(&renderer);
|
emit needAlterRenderer(&renderer);
|
||||||
|
|
||||||
CameraDefinition camera;
|
CameraDefinition camera;
|
||||||
RenderingScenery::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);
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
|
@ -246,7 +246,7 @@ void FreeFormHelper::processExploreClicked()
|
||||||
|
|
||||||
void FreeFormHelper::processRenderClicked()
|
void FreeFormHelper::processRenderClicked()
|
||||||
{
|
{
|
||||||
SoftwareRenderer renderer(RenderingScenery::getCurrent());
|
SoftwareRenderer renderer(DesktopScenery::getCurrent());
|
||||||
|
|
||||||
emit needAlterRenderer(&renderer);
|
emit needAlterRenderer(&renderer);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "dialogexplorer.h"
|
#include "dialogexplorer.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "RenderingScenery.h"
|
#include "DesktopScenery.h"
|
||||||
#include "PackStream.h"
|
#include "PackStream.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
|
@ -127,11 +127,9 @@ MainWindow::MainWindow() :
|
||||||
ui->tool_panel->hide();
|
ui->tool_panel->hide();
|
||||||
//ui->menuBar->hide();
|
//ui->menuBar->hide();
|
||||||
|
|
||||||
RenderingScenery::getCurrent()->setCustomSaveCallbacks(MainWindow::guiSaveCallback, MainWindow::guiLoadCallback, this);
|
|
||||||
|
|
||||||
// FIXME AutoPreset has already been called by paysagesInit but we need to redo it here because
|
// FIXME AutoPreset has already been called by paysagesInit but we need to redo it here because
|
||||||
// the auto apply on FormRender overwrites the camera. Delete this when the render form is no longer a BaseForm.
|
// the auto apply on FormRender overwrites the camera. Delete this when the render form is no longer a BaseForm.
|
||||||
RenderingScenery::getCurrent()->autoPreset(0);
|
DesktopScenery::getCurrent()->autoPreset(0);
|
||||||
refreshAll();
|
refreshAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +162,7 @@ void MainWindow::refreshAll()
|
||||||
PreviewOsd* osd = PreviewOsd::getInstance(QString("geolocation"));
|
PreviewOsd* osd = PreviewOsd::getInstance(QString("geolocation"));
|
||||||
osd->clearItems();
|
osd->clearItems();
|
||||||
PreviewOsdItem* item = osd->newItem(50, 50);
|
PreviewOsdItem* item = osd->newItem(50, 50);
|
||||||
item->drawCamera(RenderingScenery::getCurrent()->getCamera());
|
item->drawCamera(DesktopScenery::getCurrent()->getCamera());
|
||||||
item->setToolTip(QString(tr("Camera")));
|
item->setToolTip(QString(tr("Camera")));
|
||||||
|
|
||||||
emit refreshed();
|
emit refreshed();
|
||||||
|
@ -179,7 +177,7 @@ void MainWindow::fileNew()
|
||||||
{
|
{
|
||||||
if (QMessageBox::question(this, tr("Paysages 3D - New scenery"), tr("Do you want to start a new scenery ? Any unsaved changes will be lost."), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)
|
if (QMessageBox::question(this, tr("Paysages 3D - New scenery"), tr("Do you want to start a new scenery ? Any unsaved changes will be lost."), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->autoPreset(0);
|
DesktopScenery::getCurrent()->autoPreset(0);
|
||||||
refreshAll();
|
refreshAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,12 +192,12 @@ void MainWindow::fileSave()
|
||||||
filepath = filepath.append(".p3d");
|
filepath = filepath.append(".p3d");
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOperationResult result = paysagesSave((char*) filepath.toStdString().c_str());
|
Scenery::FileOperationResult result = DesktopScenery::getCurrent()->saveGlobal(filepath.toStdString());
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case FILE_OPERATION_OK:
|
case Scenery::FILE_OPERATION_OK:
|
||||||
break;
|
break;
|
||||||
case FILE_OPERATION_IOERROR:
|
case Scenery::FILE_OPERATION_IOERROR:
|
||||||
QMessageBox::critical(this, tr("Paysages 3D - File saving error"), tr("Can't write specified file : %1").arg(filepath));
|
QMessageBox::critical(this, tr("Paysages 3D - File saving error"), tr("Can't write specified file : %1").arg(filepath));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -215,19 +213,19 @@ void MainWindow::fileLoad()
|
||||||
QString filepath = QFileDialog::getOpenFileName(this, tr("Paysages 3D - Choose a scenery file to load"), QString(), tr("Paysages 3D Scenery (*.p3d)"));
|
QString filepath = QFileDialog::getOpenFileName(this, tr("Paysages 3D - Choose a scenery file to load"), QString(), tr("Paysages 3D Scenery (*.p3d)"));
|
||||||
if (!filepath.isNull())
|
if (!filepath.isNull())
|
||||||
{
|
{
|
||||||
FileOperationResult result = paysagesLoad((char*) filepath.toStdString().c_str());
|
Scenery::FileOperationResult result = DesktopScenery::getCurrent()->loadGlobal(filepath.toStdString());
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case FILE_OPERATION_OK:
|
case Scenery::FILE_OPERATION_OK:
|
||||||
refreshAll();
|
refreshAll();
|
||||||
break;
|
break;
|
||||||
case FILE_OPERATION_IOERROR:
|
case Scenery::FILE_OPERATION_IOERROR:
|
||||||
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("Can't read specified file : %1").arg(filepath));
|
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("Can't read specified file : %1").arg(filepath));
|
||||||
break;
|
break;
|
||||||
case FILE_OPERATION_APP_MISMATCH:
|
case Scenery::FILE_OPERATION_APP_MISMATCH:
|
||||||
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("This file doesn't look like a Paysages 3D file : %1").arg(filepath));
|
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("This file doesn't look like a Paysages 3D file : %1").arg(filepath));
|
||||||
break;
|
break;
|
||||||
case FILE_OPERATION_VERSION_MISMATCH:
|
case Scenery::FILE_OPERATION_VERSION_MISMATCH:
|
||||||
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("This file was created with an incompatible Paysages 3D version : %1").arg(filepath));
|
QMessageBox::critical(this, tr("Paysages 3D - File loading error"), tr("This file was created with an incompatible Paysages 3D version : %1").arg(filepath));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -262,7 +260,7 @@ void MainWindow::explore3D()
|
||||||
CameraDefinition* camera = new CameraDefinition;
|
CameraDefinition* camera = new CameraDefinition;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
RenderingScenery::getCurrent()->getCamera(camera);
|
DesktopScenery::getCurrent()->getCamera(camera);
|
||||||
|
|
||||||
DialogExplorer* dialog = new DialogExplorer(this, camera, true);
|
DialogExplorer* dialog = new DialogExplorer(this, camera, true);
|
||||||
result = dialog->exec();
|
result = dialog->exec();
|
||||||
|
@ -271,23 +269,13 @@ void MainWindow::explore3D()
|
||||||
|
|
||||||
if (result == QDialog::Accepted)
|
if (result == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->setCamera(camera);
|
DesktopScenery::getCurrent()->setCamera(camera);
|
||||||
refreshAll();
|
refreshAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete camera;
|
delete camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::guiSaveCallback(PackStream* stream, void* data)
|
|
||||||
{
|
|
||||||
((MainWindow*) data)->guiSave(stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::guiLoadCallback(PackStream* stream, void* data)
|
|
||||||
{
|
|
||||||
((MainWindow*) data)->guiLoad(stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::guiSave(PackStream* stream)
|
void MainWindow::guiSave(PackStream* stream)
|
||||||
{
|
{
|
||||||
// Save all tabs status
|
// Save all tabs status
|
||||||
|
|
|
@ -24,12 +24,13 @@ public:
|
||||||
|
|
||||||
virtual bool event(QEvent* event);
|
virtual bool event(QEvent* event);
|
||||||
|
|
||||||
|
void guiSave(PackStream* stream);
|
||||||
|
void guiLoad(PackStream* stream);
|
||||||
|
|
||||||
static inline MainWindow* instance()
|
static inline MainWindow* instance()
|
||||||
{
|
{
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
static void guiSaveCallback(PackStream* stream, void* data);
|
|
||||||
static void guiLoadCallback(PackStream* stream, void* data);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -57,9 +58,6 @@ private:
|
||||||
static MainWindow* _instance;
|
static MainWindow* _instance;
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
||||||
void guiSave(PackStream* stream);
|
|
||||||
void guiLoad(PackStream* stream);
|
|
||||||
|
|
||||||
QVector<BaseForm*> _forms;
|
QVector<BaseForm*> _forms;
|
||||||
FormRender* _form_render;
|
FormRender* _form_render;
|
||||||
};
|
};
|
||||||
|
|
|
@ -56,7 +56,7 @@ HEADERS += \
|
||||||
textures/PreviewCumul.h \
|
textures/PreviewCumul.h \
|
||||||
textures/DialogTexturesLayer.h \
|
textures/DialogTexturesLayer.h \
|
||||||
desktop_global.h \
|
desktop_global.h \
|
||||||
RenderingScenery.h
|
DesktopScenery.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
terrain/widgetheightmap.cpp \
|
terrain/widgetheightmap.cpp \
|
||||||
|
@ -104,7 +104,7 @@ SOURCES += \
|
||||||
textures/PreviewLayerLook.cpp \
|
textures/PreviewLayerLook.cpp \
|
||||||
textures/PreviewCumul.cpp \
|
textures/PreviewCumul.cpp \
|
||||||
textures/DialogTexturesLayer.cpp \
|
textures/DialogTexturesLayer.cpp \
|
||||||
RenderingScenery.cpp
|
DesktopScenery.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
terrain/dialogterrainpainting.ui \
|
terrain/dialogterrainpainting.ui \
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "AtmosphereColorPreviewRenderer.h"
|
#include "AtmosphereColorPreviewRenderer.h"
|
||||||
#include "RenderingScenery.h"
|
#include "DesktopScenery.h"
|
||||||
#include "BasePreview.h"
|
#include "BasePreview.h"
|
||||||
#include "AtmosphereDefinition.h"
|
#include "AtmosphereDefinition.h"
|
||||||
|
|
||||||
|
@ -56,13 +56,13 @@ FormAtmosphere::~FormAtmosphere()
|
||||||
|
|
||||||
void FormAtmosphere::revertConfig()
|
void FormAtmosphere::revertConfig()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->getAtmosphere(_definition);
|
DesktopScenery::getCurrent()->getAtmosphere(_definition);
|
||||||
BaseForm::revertConfig();
|
BaseForm::revertConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormAtmosphere::applyConfig()
|
void FormAtmosphere::applyConfig()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->setAtmosphere(_definition);
|
DesktopScenery::getCurrent()->setAtmosphere(_definition);
|
||||||
BaseForm::applyConfig();
|
BaseForm::applyConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "formclouds.h"
|
#include "formclouds.h"
|
||||||
|
|
||||||
#include "RenderingScenery.h"
|
#include "DesktopScenery.h"
|
||||||
#include "BasePreview.h"
|
#include "BasePreview.h"
|
||||||
#include "CloudsDefinition.h"
|
#include "CloudsDefinition.h"
|
||||||
#include "CloudLayerDefinition.h"
|
#include "CloudLayerDefinition.h"
|
||||||
|
@ -60,14 +60,14 @@ FormClouds::~FormClouds()
|
||||||
|
|
||||||
void FormClouds::revertConfig()
|
void FormClouds::revertConfig()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->getClouds(_definition);
|
DesktopScenery::getCurrent()->getClouds(_definition);
|
||||||
BaseFormLayer::revertConfig();
|
BaseFormLayer::revertConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClouds::applyConfig()
|
void FormClouds::applyConfig()
|
||||||
{
|
{
|
||||||
BaseFormLayer::applyConfig();
|
BaseFormLayer::applyConfig();
|
||||||
RenderingScenery::getCurrent()->setClouds(_definition);
|
DesktopScenery::getCurrent()->setClouds(_definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormClouds::layerReadCurrentFrom(void* layer_definition)
|
void FormClouds::layerReadCurrentFrom(void* layer_definition)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "dialogrender.h"
|
#include "dialogrender.h"
|
||||||
#include "inputcamera.h"
|
#include "inputcamera.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "RenderingScenery.h"
|
#include "DesktopScenery.h"
|
||||||
#include "PackStream.h"
|
#include "PackStream.h"
|
||||||
#include "SoftwareRenderer.h"
|
#include "SoftwareRenderer.h"
|
||||||
#include "BasePreview.h"
|
#include "BasePreview.h"
|
||||||
|
@ -30,7 +30,7 @@ BaseForm(parent, true)
|
||||||
disablePreviewsUpdate();
|
disablePreviewsUpdate();
|
||||||
|
|
||||||
_preview_landscape = new BasePreview(this);
|
_preview_landscape = new BasePreview(this);
|
||||||
_preview_landscape_renderer = new SceneryTopDownPreviewRenderer(RenderingScenery::getCurrent());
|
_preview_landscape_renderer = new SceneryTopDownPreviewRenderer(DesktopScenery::getCurrent());
|
||||||
addPreview(_preview_landscape, QString(tr("Top-down preview")));
|
addPreview(_preview_landscape, QString(tr("Top-down preview")));
|
||||||
_preview_landscape->setRenderer(_preview_landscape_renderer);
|
_preview_landscape->setRenderer(_preview_landscape_renderer);
|
||||||
|
|
||||||
|
@ -81,13 +81,13 @@ void FormRender::loadPack(PackStream* stream)
|
||||||
|
|
||||||
void FormRender::revertConfig()
|
void FormRender::revertConfig()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->getCamera(_camera);
|
DesktopScenery::getCurrent()->getCamera(_camera);
|
||||||
BaseForm::revertConfig();
|
BaseForm::revertConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormRender::applyConfig()
|
void FormRender::applyConfig()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->setCamera(_camera);
|
DesktopScenery::getCurrent()->setCamera(_camera);
|
||||||
BaseForm::applyConfig();
|
BaseForm::applyConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ void FormRender::startQuickRender()
|
||||||
{
|
{
|
||||||
delete _renderer;
|
delete _renderer;
|
||||||
}
|
}
|
||||||
_renderer = new SoftwareRenderer(RenderingScenery::getCurrent());
|
_renderer = new SoftwareRenderer(DesktopScenery::getCurrent());
|
||||||
_renderer_inited = true;
|
_renderer_inited = true;
|
||||||
|
|
||||||
DialogRender* dialog = new DialogRender(this, _renderer);
|
DialogRender* dialog = new DialogRender(this, _renderer);
|
||||||
|
@ -119,7 +119,7 @@ void FormRender::startRender()
|
||||||
{
|
{
|
||||||
delete _renderer;
|
delete _renderer;
|
||||||
}
|
}
|
||||||
_renderer = new SoftwareRenderer(RenderingScenery::getCurrent());
|
_renderer = new SoftwareRenderer(DesktopScenery::getCurrent());
|
||||||
_renderer_inited = true;
|
_renderer_inited = true;
|
||||||
|
|
||||||
DialogRender* dialog = new DialogRender(this, _renderer);
|
DialogRender* dialog = new DialogRender(this, _renderer);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "formtextures.h"
|
#include "formtextures.h"
|
||||||
|
|
||||||
#include "RenderingScenery.h"
|
#include "DesktopScenery.h"
|
||||||
#include "BasePreview.h"
|
#include "BasePreview.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "CameraDefinition.h"
|
#include "CameraDefinition.h"
|
||||||
|
@ -144,14 +144,14 @@ FormTextures::~FormTextures()
|
||||||
|
|
||||||
void FormTextures::revertConfig()
|
void FormTextures::revertConfig()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->getTextures(_definition);
|
DesktopScenery::getCurrent()->getTextures(_definition);
|
||||||
BaseFormLayer::revertConfig();
|
BaseFormLayer::revertConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormTextures::applyConfig()
|
void FormTextures::applyConfig()
|
||||||
{
|
{
|
||||||
BaseFormLayer::applyConfig();
|
BaseFormLayer::applyConfig();
|
||||||
RenderingScenery::getCurrent()->setTextures(_definition);
|
DesktopScenery::getCurrent()->setTextures(_definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormTextures::layerReadCurrentFrom(void* layer_definition)
|
void FormTextures::layerReadCurrentFrom(void* layer_definition)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "RenderingScenery.h"
|
#include "DesktopScenery.h"
|
||||||
#include "BasePreview.h"
|
#include "BasePreview.h"
|
||||||
#include "CameraDefinition.h"
|
#include "CameraDefinition.h"
|
||||||
#include "WaterDefinition.h"
|
#include "WaterDefinition.h"
|
||||||
|
@ -63,13 +63,13 @@ FormWater::~FormWater()
|
||||||
|
|
||||||
void FormWater::revertConfig()
|
void FormWater::revertConfig()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->getWater(_definition);
|
DesktopScenery::getCurrent()->getWater(_definition);
|
||||||
BaseForm::revertConfig();
|
BaseForm::revertConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormWater::applyConfig()
|
void FormWater::applyConfig()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->setWater(_definition);
|
DesktopScenery::getCurrent()->setWater(_definition);
|
||||||
BaseForm::applyConfig();
|
BaseForm::applyConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
|
#include "Color.h"
|
||||||
|
|
||||||
#include "lighting/SmallPreviewColor.h"
|
#include "lighting/SmallPreviewColor.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
@ -12,7 +13,9 @@ InputColor::InputColor(QWidget* form, QString label, Color* value):
|
||||||
BaseInput(form, label),
|
BaseInput(form, label),
|
||||||
_original(value)
|
_original(value)
|
||||||
{
|
{
|
||||||
_preview = new SmallPreviewColor(form, &_edited);
|
_edited = new Color();
|
||||||
|
|
||||||
|
_preview = new SmallPreviewColor(form, _edited);
|
||||||
_preview->setMinimumSize(50, 20);
|
_preview->setMinimumSize(50, 20);
|
||||||
_control = new QPushButton(tr("Edit"), form);
|
_control = new QPushButton(tr("Edit"), form);
|
||||||
_control->setMaximumWidth(150);
|
_control->setMaximumWidth(150);
|
||||||
|
@ -28,24 +31,24 @@ void InputColor::updatePreview()
|
||||||
|
|
||||||
void InputColor::applyValue()
|
void InputColor::applyValue()
|
||||||
{
|
{
|
||||||
*_original = _edited;
|
*_original = *_edited;
|
||||||
BaseInput::applyValue();
|
BaseInput::applyValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputColor::revert()
|
void InputColor::revert()
|
||||||
{
|
{
|
||||||
_edited = *_original;
|
*_edited = *_original;
|
||||||
BaseInput::revert();
|
BaseInput::revert();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputColor::chooseColor()
|
void InputColor::chooseColor()
|
||||||
{
|
{
|
||||||
QColor col = QColorDialog::getColor(colorToQColor(_edited), _control);
|
QColor col = QColorDialog::getColor(colorToQColor(*_edited), _control);
|
||||||
if (col.isValid())
|
if (col.isValid())
|
||||||
{
|
{
|
||||||
_edited.r = col.redF();
|
_edited->r = col.redF();
|
||||||
_edited.g = col.greenF();
|
_edited->g = col.greenF();
|
||||||
_edited.b = col.blueF();
|
_edited->b = col.blueF();
|
||||||
applyValue();
|
applyValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "baseinput.h"
|
#include "baseinput.h"
|
||||||
|
|
||||||
#include "shared/types.h"
|
|
||||||
|
|
||||||
class InputColor:public BaseInput
|
class InputColor:public BaseInput
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -23,7 +21,7 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Color* _original;
|
Color* _original;
|
||||||
Color _edited;
|
Color* _edited;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "TerrainShapePreviewRenderer.h"
|
#include "TerrainShapePreviewRenderer.h"
|
||||||
#include "common/freeformhelper.h"
|
#include "common/freeformhelper.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "RenderingScenery.h"
|
#include "DesktopScenery.h"
|
||||||
#include "TerrainDefinition.h"
|
#include "TerrainDefinition.h"
|
||||||
#include "TerrainHeightMap.h"
|
#include "TerrainHeightMap.h"
|
||||||
|
|
||||||
|
@ -85,12 +85,12 @@ void MainTerrainForm::refreshFromFellowData()
|
||||||
|
|
||||||
void MainTerrainForm::updateLocalDataFromScenery()
|
void MainTerrainForm::updateLocalDataFromScenery()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->getTerrain(_terrain);
|
DesktopScenery::getCurrent()->getTerrain(_terrain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTerrainForm::commitLocalDataToScenery()
|
void MainTerrainForm::commitLocalDataToScenery()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->setTerrain(_terrain);
|
DesktopScenery::getCurrent()->setTerrain(_terrain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTerrainForm::alterRenderer(SoftwareRenderer* renderer)
|
void MainTerrainForm::alterRenderer(SoftwareRenderer* renderer)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "../common/freeformhelper.h"
|
#include "../common/freeformhelper.h"
|
||||||
#include "../common/freelayerhelper.h"
|
#include "../common/freelayerhelper.h"
|
||||||
#include "RenderingScenery.h"
|
#include "DesktopScenery.h"
|
||||||
#include "TexturesDefinition.h"
|
#include "TexturesDefinition.h"
|
||||||
#include "TextureLayerDefinition.h"
|
#include "TextureLayerDefinition.h"
|
||||||
#include "previewmaterial.h"
|
#include "previewmaterial.h"
|
||||||
|
@ -83,7 +83,7 @@ void MainTexturesForm::updateLayers()
|
||||||
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
ui->layersGrid->setItem(n - 1 - i, 0, item);
|
ui->layersGrid->setItem(n - 1 - i, 0, item);
|
||||||
|
|
||||||
item = new QTableWidgetItem(layer->getName());
|
item = new QTableWidgetItem(QString::fromStdString(layer->getName()));
|
||||||
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||||
ui->layersGrid->setItem(n - 1 - i, 1, item);
|
ui->layersGrid->setItem(n - 1 - i, 1, item);
|
||||||
|
|
||||||
|
@ -132,12 +132,12 @@ void MainTexturesForm::selectPreset(int preset)
|
||||||
|
|
||||||
void MainTexturesForm::updateLocalDataFromScenery()
|
void MainTexturesForm::updateLocalDataFromScenery()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->getTextures(textures);
|
DesktopScenery::getCurrent()->getTextures(textures);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTexturesForm::commitLocalDataToScenery()
|
void MainTexturesForm::commitLocalDataToScenery()
|
||||||
{
|
{
|
||||||
RenderingScenery::getCurrent()->setTextures(textures);
|
DesktopScenery::getCurrent()->setTextures(textures);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTexturesForm::refreshFromLocalData()
|
void MainTexturesForm::refreshFromLocalData()
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#include "shared/types.h"
|
|
||||||
#include "Color.h"
|
#include "Color.h"
|
||||||
|
|
||||||
static inline QColor colorToQColor(Color color)
|
static inline QColor colorToQColor(Color color)
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "tools/data.h"
|
#include "tools/data.h"
|
||||||
#include "RenderingScenery.h"
|
|
||||||
#include "Scenery.h"
|
|
||||||
#include "PackStream.h"
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
#define APP_HEADER 198632.125
|
|
||||||
|
|
||||||
void paysagesInit()
|
void paysagesInit()
|
||||||
{
|
{
|
||||||
|
@ -22,50 +18,3 @@ void paysagesInit()
|
||||||
void paysagesQuit()
|
void paysagesQuit()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOperationResult paysagesSave(char* filepath)
|
|
||||||
{
|
|
||||||
PackStream stream;
|
|
||||||
double app_header, version_header;
|
|
||||||
|
|
||||||
if (!stream.bindToFile(filepath, true))
|
|
||||||
{
|
|
||||||
return FILE_OPERATION_IOERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
app_header = (double)APP_HEADER;
|
|
||||||
stream.write(&app_header);
|
|
||||||
version_header = (double)PAYSAGES_CURRENT_DATA_VERSION;
|
|
||||||
stream.write(&version_header);
|
|
||||||
|
|
||||||
RenderingScenery::getCurrent()->save(&stream);
|
|
||||||
|
|
||||||
return FILE_OPERATION_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileOperationResult paysagesLoad(char* filepath)
|
|
||||||
{
|
|
||||||
PackStream stream;
|
|
||||||
double app_header, version_header;
|
|
||||||
|
|
||||||
if (!stream.bindToFile(filepath, false))
|
|
||||||
{
|
|
||||||
return FILE_OPERATION_IOERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.read(&app_header);
|
|
||||||
if (app_header != APP_HEADER)
|
|
||||||
{
|
|
||||||
return FILE_OPERATION_APP_MISMATCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.read(&version_header);
|
|
||||||
if ((int)version_header != PAYSAGES_CURRENT_DATA_VERSION)
|
|
||||||
{
|
|
||||||
return FILE_OPERATION_VERSION_MISMATCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderingScenery::getCurrent()->load(&stream);
|
|
||||||
|
|
||||||
return FILE_OPERATION_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,20 +1,9 @@
|
||||||
#ifndef _PAYSAGES_MAIN_H_
|
#ifndef _PAYSAGES_MAIN_H_
|
||||||
#define _PAYSAGES_MAIN_H_
|
#define _PAYSAGES_MAIN_H_
|
||||||
|
|
||||||
#define PAYSAGES_CURRENT_DATA_VERSION 1
|
|
||||||
|
|
||||||
#include "rendering_global.h"
|
#include "rendering_global.h"
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
FILE_OPERATION_OK,
|
|
||||||
FILE_OPERATION_IOERROR,
|
|
||||||
FILE_OPERATION_APP_MISMATCH,
|
|
||||||
FILE_OPERATION_VERSION_MISMATCH
|
|
||||||
} FileOperationResult;
|
|
||||||
|
|
||||||
RENDERINGSHARED_EXPORT void paysagesInit();
|
RENDERINGSHARED_EXPORT void paysagesInit();
|
||||||
RENDERINGSHARED_EXPORT void paysagesQuit();
|
RENDERINGSHARED_EXPORT void paysagesQuit();
|
||||||
RENDERINGSHARED_EXPORT FileOperationResult paysagesSave(char* filepath);
|
|
||||||
RENDERINGSHARED_EXPORT FileOperationResult paysagesLoad(char* filepath);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,11 +22,11 @@ PackStream::~PackStream()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PackStream::bindToFile(const char* filepath, bool write)
|
bool PackStream::bindToFile(const std::string &filepath, bool write)
|
||||||
{
|
{
|
||||||
if (not file and not stream)
|
if (not file and not stream)
|
||||||
{
|
{
|
||||||
file = new QFile(filepath);
|
file = new QFile(QString::fromStdString(filepath));
|
||||||
if (not file->open(write ? QIODevice::WriteOnly : QIODevice::ReadOnly))
|
if (not file->open(write ? QIODevice::WriteOnly : QIODevice::ReadOnly))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -62,11 +62,11 @@ void PackStream::write(const char *value, int max_length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackStream::write(const QString &value)
|
void PackStream::write(const std::string &value)
|
||||||
{
|
{
|
||||||
if (stream)
|
if (stream)
|
||||||
{
|
{
|
||||||
*stream << value;
|
*stream << QString::fromStdString(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,16 +101,16 @@ void PackStream::read(char* value, int max_length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PackStream::readString()
|
std::string PackStream::readString()
|
||||||
{
|
{
|
||||||
if (stream and not stream->atEnd())
|
if (stream and not stream->atEnd())
|
||||||
{
|
{
|
||||||
QString output;
|
QString output;
|
||||||
*stream >> output;
|
*stream >> output;
|
||||||
return output;
|
return output.toStdString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QString();
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define PACKSTREAM_H
|
#define PACKSTREAM_H
|
||||||
|
|
||||||
#include "system_global.h"
|
#include "system_global.h"
|
||||||
#include <QString>
|
|
||||||
class QFile;
|
class QFile;
|
||||||
class QDataStream;
|
class QDataStream;
|
||||||
|
|
||||||
|
@ -20,17 +20,17 @@ public:
|
||||||
PackStream();
|
PackStream();
|
||||||
~PackStream();
|
~PackStream();
|
||||||
|
|
||||||
bool bindToFile(const char* filepath, bool write=false);
|
bool bindToFile(const std::string &filepath, bool write=false);
|
||||||
|
|
||||||
void write(const int *value);
|
void write(const int *value);
|
||||||
void write(const double *value);
|
void write(const double *value);
|
||||||
void write(const char *value, const int max_length);
|
void write(const char *value, const int max_length);
|
||||||
void write(const QString &value);
|
void write(const std::string &value);
|
||||||
|
|
||||||
void read(int* value);
|
void read(int* value);
|
||||||
void read(double* value);
|
void read(double* value);
|
||||||
void read(char* value, int max_length);
|
void read(char* value, int max_length);
|
||||||
QString readString();
|
std::string readString();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFile* file;
|
QFile* file;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "AtmosphereDefinition.h"
|
#include "AtmosphereDefinition.h"
|
||||||
#include "AtmosphereRenderer.h"
|
#include "AtmosphereRenderer.h"
|
||||||
#include "AtmosphereResult.h"
|
#include "AtmosphereResult.h"
|
||||||
#include "RenderingScenery.h"
|
#include "Scenery.h"
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
|
|
||||||
#define OUTPUT_WIDTH 400
|
#define OUTPUT_WIDTH 400
|
||||||
|
@ -18,7 +18,8 @@ static Color _postProcessFragment(SoftwareRenderer* renderer, Vector3 location,
|
||||||
|
|
||||||
TEST(Bruneton, AerialPerspective1)
|
TEST(Bruneton, AerialPerspective1)
|
||||||
{
|
{
|
||||||
SoftwareRenderer renderer;
|
Scenery scenery;
|
||||||
|
SoftwareRenderer renderer(&scenery);
|
||||||
renderer.render_width = 800;
|
renderer.render_width = 800;
|
||||||
renderer.render_height = 600;
|
renderer.render_height = 600;
|
||||||
renderer.render_quality = 1;
|
renderer.render_quality = 1;
|
||||||
|
@ -44,12 +45,14 @@ TEST(Bruneton, AerialPerspective1)
|
||||||
|
|
||||||
TEST(Bruneton, AerialPerspective2)
|
TEST(Bruneton, AerialPerspective2)
|
||||||
{
|
{
|
||||||
AtmosphereDefinition* atmo = RenderingScenery::getCurrent()->getAtmosphere();
|
Scenery scenery;
|
||||||
|
|
||||||
|
AtmosphereDefinition* atmo = scenery.getAtmosphere();
|
||||||
atmo->hour = 6;
|
atmo->hour = 6;
|
||||||
atmo->minute = 30;
|
atmo->minute = 30;
|
||||||
atmo->validate();
|
atmo->validate();
|
||||||
|
|
||||||
SoftwareRenderer renderer;
|
SoftwareRenderer renderer(&scenery);
|
||||||
renderer.render_width = 800;
|
renderer.render_width = 800;
|
||||||
renderer.render_height = 600;
|
renderer.render_height = 600;
|
||||||
renderer.render_quality = 1;
|
renderer.render_quality = 1;
|
||||||
|
|
|
@ -33,7 +33,7 @@ TEST(Layers, NullLayer)
|
||||||
EXPECT_EQ(NULL, layer->getParent());
|
EXPECT_EQ(NULL, layer->getParent());
|
||||||
EXPECT_EQ(layer, layer->getRoot());
|
EXPECT_EQ(layer, layer->getRoot());
|
||||||
|
|
||||||
EXPECT_EQ(QString(), layer->getName());
|
EXPECT_EQ("", layer->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ(0, layers1.count());
|
EXPECT_EQ(0, layers1.count());
|
||||||
|
@ -50,9 +50,9 @@ TEST(Layers, copy)
|
||||||
EXPECT_EQ(0, layers2.count());
|
EXPECT_EQ(0, layers2.count());
|
||||||
layers1.copy(&layers2);
|
layers1.copy(&layers2);
|
||||||
EXPECT_EQ(1, layers2.count());
|
EXPECT_EQ(1, layers2.count());
|
||||||
EXPECT_EQ(QString("test"), layers1.getLayer(0)->getName());
|
EXPECT_EQ("test", layers1.getLayer(0)->getName());
|
||||||
EXPECT_EQ(&layers1, layers1.getLayer(0)->getParent());
|
EXPECT_EQ(&layers1, layers1.getLayer(0)->getParent());
|
||||||
EXPECT_EQ(QString("test"), layers2.getLayer(0)->getName());
|
EXPECT_EQ("test", layers2.getLayer(0)->getName());
|
||||||
EXPECT_EQ(&layers2, layers2.getLayer(0)->getParent());
|
EXPECT_EQ(&layers2, layers2.getLayer(0)->getParent());
|
||||||
EXPECT_NE(layers1.getLayer(0), layers2.getLayer(0));
|
EXPECT_NE(layers1.getLayer(0), layers2.getLayer(0));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue