2013-11-17 21:36:18 +00:00
|
|
|
#ifndef TERRAINDEFINITION_H
|
|
|
|
#define TERRAINDEFINITION_H
|
|
|
|
|
|
|
|
#include "definition_global.h"
|
|
|
|
|
2015-08-12 20:21:10 +00:00
|
|
|
#include "DefinitionNode.h"
|
2013-11-17 21:36:18 +00:00
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace definition {
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double min_height;
|
|
|
|
double max_height;
|
|
|
|
double base_height;
|
|
|
|
} HeightInfo;
|
|
|
|
|
2015-08-12 20:21:10 +00:00
|
|
|
class DEFINITIONSHARED_EXPORT TerrainDefinition : public DefinitionNode
|
2013-11-17 21:36:18 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-08-12 20:21:10 +00:00
|
|
|
TerrainDefinition(DefinitionNode* parent);
|
2013-11-17 21:36:18 +00:00
|
|
|
virtual ~TerrainDefinition();
|
|
|
|
|
|
|
|
virtual void save(PackStream* stream) const override;
|
|
|
|
virtual void load(PackStream* stream) override;
|
|
|
|
|
2015-08-12 20:21:10 +00:00
|
|
|
virtual void copy(DefinitionNode* destination) const override;
|
2013-11-17 21:36:18 +00:00
|
|
|
virtual void validate() override;
|
|
|
|
|
2015-08-17 20:55:30 +00:00
|
|
|
inline FloatNode *propWaterHeight() const {return water_height;}
|
|
|
|
|
2014-11-21 08:45:19 +00:00
|
|
|
double getGridHeight(int x, int z, bool with_painting);
|
2015-08-17 20:55:30 +00:00
|
|
|
double getInterpolatedHeight(double x, double z, bool scaled, bool with_painting, bool water_offset=true);
|
|
|
|
double getWaterOffset() const;
|
2013-11-17 21:36:18 +00:00
|
|
|
unsigned long getMemoryStats();
|
|
|
|
HeightInfo getHeightInfo();
|
|
|
|
|
|
|
|
public:
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
TERRAIN_PRESET_STANDARD
|
|
|
|
} TerrainPreset;
|
|
|
|
void applyPreset(TerrainPreset preset);
|
|
|
|
|
|
|
|
public:
|
|
|
|
double height;
|
|
|
|
double shadow_smoothing;
|
|
|
|
|
|
|
|
TerrainHeightMap* height_map;
|
2015-09-20 23:36:03 +00:00
|
|
|
bool has_painting;
|
2013-11-17 21:36:18 +00:00
|
|
|
|
|
|
|
double _detail;
|
|
|
|
NoiseGenerator* _height_noise;
|
|
|
|
double _min_height;
|
|
|
|
double _max_height;
|
2015-08-13 21:46:50 +00:00
|
|
|
|
|
|
|
private:
|
2015-08-17 20:55:30 +00:00
|
|
|
FloatNode *water_height;
|
2013-11-17 21:36:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TERRAINDEFINITION_H
|