2013-10-29 20:28:59 +00:00
|
|
|
#ifndef SCENERY_H
|
|
|
|
#define SCENERY_H
|
|
|
|
|
2013-11-17 21:36:18 +00:00
|
|
|
#include "definition_global.h"
|
2013-10-29 20:28:59 +00:00
|
|
|
|
2015-08-12 20:21:10 +00:00
|
|
|
#include "DefinitionNode.h"
|
2013-10-30 14:39:56 +00:00
|
|
|
|
2013-11-17 21:36:18 +00:00
|
|
|
namespace paysages {
|
|
|
|
namespace definition {
|
2013-10-29 20:28:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Global scenery management
|
|
|
|
*
|
|
|
|
* This class contains the whole scenery definition.
|
|
|
|
*/
|
2015-11-09 21:30:46 +00:00
|
|
|
class DEFINITIONSHARED_EXPORT Scenery : public DefinitionNode {
|
|
|
|
public:
|
2013-12-10 21:32:58 +00:00
|
|
|
typedef enum {
|
|
|
|
FILE_OPERATION_OK,
|
|
|
|
FILE_OPERATION_IOERROR,
|
|
|
|
FILE_OPERATION_APP_MISMATCH,
|
|
|
|
FILE_OPERATION_VERSION_MISMATCH
|
|
|
|
} FileOperationResult;
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
typedef void (*SceneryCustomDataCallback)(PackStream *stream, void *data);
|
2013-12-10 21:32:58 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
public:
|
2013-10-29 20:28:59 +00:00
|
|
|
Scenery();
|
2013-11-13 22:03:02 +00:00
|
|
|
|
2013-11-14 17:47:03 +00:00
|
|
|
virtual void validate() override;
|
2013-11-17 22:33:46 +00:00
|
|
|
|
2015-12-10 23:36:50 +00:00
|
|
|
FileOperationResult saveGlobal(const string &filepath) const;
|
|
|
|
FileOperationResult loadGlobal(const string &filepath);
|
2013-12-10 21:32:58 +00:00
|
|
|
|
2015-12-13 18:56:00 +00:00
|
|
|
/**
|
|
|
|
* Undo the last scenery change.
|
|
|
|
*/
|
|
|
|
void undo();
|
|
|
|
/**
|
|
|
|
* Redo the last scenery change.
|
|
|
|
*/
|
|
|
|
void redo();
|
|
|
|
|
|
|
|
void set(const string &path, const int &value);
|
|
|
|
void set(const string &path, const double &value);
|
|
|
|
|
2015-11-09 21:38:00 +00:00
|
|
|
virtual const Scenery *getScenery() const override;
|
2015-11-09 21:30:46 +00:00
|
|
|
|
2015-12-10 18:40:39 +00:00
|
|
|
void autoPreset(RandomGenerator &random = RandomGeneratorDefault);
|
|
|
|
void autoPreset(unsigned int seed);
|
2015-11-09 21:30:46 +00:00
|
|
|
|
|
|
|
void setAtmosphere(AtmosphereDefinition *atmosphere);
|
|
|
|
inline AtmosphereDefinition *getAtmosphere() const {
|
|
|
|
return atmosphere;
|
|
|
|
}
|
|
|
|
void getAtmosphere(AtmosphereDefinition *atmosphere);
|
|
|
|
|
|
|
|
void setCamera(CameraDefinition *camera);
|
|
|
|
inline CameraDefinition *getCamera() const {
|
|
|
|
return camera;
|
|
|
|
}
|
|
|
|
void getCamera(CameraDefinition *camera);
|
|
|
|
|
|
|
|
void setClouds(CloudsDefinition *clouds);
|
|
|
|
inline CloudsDefinition *getClouds() const {
|
|
|
|
return clouds;
|
|
|
|
}
|
|
|
|
void getClouds(CloudsDefinition *clouds);
|
|
|
|
|
|
|
|
void setTerrain(TerrainDefinition *terrain);
|
|
|
|
inline TerrainDefinition *getTerrain() const {
|
|
|
|
return terrain;
|
|
|
|
}
|
|
|
|
void getTerrain(TerrainDefinition *terrain);
|
|
|
|
|
|
|
|
void setTextures(TexturesDefinition *textures);
|
|
|
|
inline TexturesDefinition *getTextures() const {
|
|
|
|
return textures;
|
|
|
|
}
|
|
|
|
void getTextures(TexturesDefinition *textures);
|
|
|
|
|
2015-11-09 21:38:00 +00:00
|
|
|
void setVegetation(VegetationDefinition *Vegetation);
|
|
|
|
inline VegetationDefinition *getVegetation() const {
|
|
|
|
return vegetation;
|
|
|
|
}
|
|
|
|
void getVegetation(VegetationDefinition *Vegetation);
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
void setWater(WaterDefinition *water);
|
|
|
|
inline WaterDefinition *getWater() const {
|
|
|
|
return water;
|
|
|
|
}
|
|
|
|
void getWater(WaterDefinition *water);
|
|
|
|
|
|
|
|
void keepCameraAboveGround(CameraDefinition *camera);
|
|
|
|
|
|
|
|
private:
|
|
|
|
AtmosphereDefinition *atmosphere;
|
|
|
|
CameraDefinition *camera;
|
|
|
|
CloudsDefinition *clouds;
|
|
|
|
TerrainDefinition *terrain;
|
|
|
|
TexturesDefinition *textures;
|
2015-11-09 21:38:00 +00:00
|
|
|
VegetationDefinition *vegetation;
|
2015-11-09 21:30:46 +00:00
|
|
|
WaterDefinition *water;
|
2013-10-29 20:28:59 +00:00
|
|
|
};
|
2013-11-17 21:36:18 +00:00
|
|
|
}
|
|
|
|
}
|
2013-10-29 20:28:59 +00:00
|
|
|
|
|
|
|
#endif // SCENERY_H
|